UNPKG

@swapper-finance/sdk

Version:
58 lines (51 loc) 1.44 kB
import { GetPointsResponse, GetReferralCodeResponse, GetTasksResponse, } from "@src/interfaces/Rewards"; import { _sendRequest } from "./api"; export async function getTasks( walletAddress: string, ): Promise<GetTasksResponse> { return await _sendRequest( `/tasks?${new URLSearchParams({ data: JSON.stringify({ walletAddress }), })}`, ); } export async function getPoints( walletAddress: string, ): Promise<GetPointsResponse> { return await _sendRequest( `/points?${new URLSearchParams({ data: JSON.stringify({ walletAddress }), })}`, ); } export async function getReferralCode( walletAddress: string, ): Promise<GetReferralCodeResponse> { return await _sendRequest( `/referral-code?${new URLSearchParams({ data: JSON.stringify({ walletAddress }), })}`, ); } export async function claimTasks(walletAddress: string, taskIds: string[]) { return await _sendRequest(`/tasks/claim`, { method: "POST", body: JSON.stringify({ walletAddress, taskIds }), }); } export async function verifyTasks(walletAddress: string, taskIds: string[]) { return await _sendRequest(`/tasks/verify`, { method: "POST", body: JSON.stringify({ walletAddress, taskIds }), }); } export async function applyReferralCode(walletAddress: string, code: string) { return await _sendRequest(`/referral`, { method: "POST", body: JSON.stringify({ walletAddress, code }), }); }