@parcl-finance/product-sdk
Version:
TypeScript SDK for interacting with Parcl's product APIs
206 lines • 6.38 kB
TypeScript
import { Address } from "@project-serum/anchor";
import { PublicKey } from "@solana/web3.js";
import { ContestFiltersSortConfig, ContestLeaderboardWithUserInfo, ContestsFilters, Env, Prizes } from "./types";
import { PaginationParams } from "./types/pagination";
import { ContestLeaderboardResponse } from "./types/responseTypes";
export declare class Contest {
baseUrl: string;
private headers;
private client;
private expressClient;
constructor(baseUrl: string, contest?: ContestId, accessToken?: string, env?: Env);
static defaultContest(): ContestId;
/**
* @deprecated - please use getLeaderboardById instead
*/
getLeaderboard(refresh?: boolean): Promise<ContestLeaderboardResponse>;
/**
* @param contestId - the id of the contest
* @returns top 500 leaderboard for the contest
*/
getLeaderboardById({ contestId }: {
contestId: ContestId;
}): Promise<{
leaderboard: EnrichedLeaderboardPosition[];
count: number;
inTheMoneyCount: number;
}>;
getAllContests(filters?: ContestsFilters | {
user: string;
}): Promise<ContestsConfig>;
getFilteredContests(params: ContestsFilters | PaginationParams | ContestFiltersSortConfig | {
user: string;
}): Promise<ContestsFiltersConfig>;
getAllContestsIds(): Promise<number[]>;
getContestById({ contestId }: {
contestId: ContestId;
}): Promise<ContestConfig>;
/**
* @deprecated - please use getParticipantInfo instead
*/
getLeaderboardWithUserInfo(user: Address, refresh?: boolean): Promise<ContestLeaderboardWithUserInfo>;
/**
* @param userAddress - the publicKey address of the user
* @param contestId - the id of the contest
* @returns - the user's position in the contest leaderboard
*/
getParticipantInfo({ userAddress, contestId, }: {
userAddress: Address;
contestId: ContestId;
}): Promise<ParticipantInfoWithTier>;
/**
* @param contestId - the id of the contest
* @returns - the contest participants count
*/
getParticipantCount({ contestId }: {
contestId: ContestId;
}): Promise<ParticipantsCount>;
/**
* @deprecated - please use `getParticipantInfo` instead
*/
isParticipating(user: Address, refresh?: boolean): Promise<boolean>;
/**
* @deprecated - please use `enterContest` instead
*/
participate(user: Address, accessToken?: string): Promise<boolean>;
enterContest({ userAddress, contestId, }: {
userAddress: PublicKey;
contestId: ContestId;
}): Promise<ParticipantInfoWithTier>;
/**
* @deprecated
*/
getPrizes(refresh?: boolean): Promise<Prizes>;
}
type ContestId = string | number;
/**
* @deprecated - please use `EnrichedLeaderboardPosition` instead
*/
export type LeaderboardPosition = {
rank: number;
id: number;
address: string;
metricValue: string | null;
usdcPayoutSignature: string | null;
prclPayoutSignature: string | null;
rafflePayoutSignature: string | null;
pointsPayout: number | null;
total_count: number;
realized_total_pnl: number;
totalNotionalVolume: number;
totalTrades: number;
rankTrend: number;
};
export type EnrichedLeaderboardPosition = {
address: string;
tier: ContestTier;
prclPayout: number;
pointsPayout: number;
id: number;
totalNotionalVolume: number;
totalTrades: number;
metricValue: number | null;
usdcPayoutSignature: string | null;
prclPayoutSignature: string | null;
rafflePayoutSignature: string | null;
rank: number | null;
yesterdaysRank: number;
rankTrend: number;
totalCount: number;
};
/**
* @deprecated - please use `ParticipantInfoWithTier` instead
*/
export type ParticipantInfo = {
address: string;
id: number;
realized_total_pnl: number | null;
metricValue: string | null;
usdcPayoutSignature: string | null;
prclPayoutSignature: string | null;
rafflePayoutSignature: string | null;
pointsPayout: number | null;
rank: number | null;
totalNotionalVolume: number;
realizedTotalPnl: number;
totalTrades: number;
};
export type ContestTier = "Diamond" | "Emerald" | "Gold" | "Silver" | "Bronze" | null;
export type ParticipantInfoWithTier = {
tier: ContestTier;
prclPayout: number;
pointsPayout: number;
address: string;
id: number;
totalNotionalVolume: number;
totalTrades: number;
metricValue: number | null;
usdcPayoutSignature: string | null;
prclPayoutSignature: string | null;
rafflePayoutSignature: string | null;
rank: number | null;
yesterdaysRank: number;
rankTrend: number;
totalCount: number;
};
export type ParticipantsCount = {
currentCount: number;
countTrend: number;
};
export type ContestConfig = {
id: number;
name: string;
description: string | null;
prizePool: {
first: number;
second: number;
third: number;
prcl: number;
points: number;
};
inTheMoneyConfig: {
threshold: number;
limit: number;
};
metric: "realized_total_pnl" | "realized_price_pnl" | "realized_funding_pnl" | "total_notional_volume" | "total_size_volume";
startDate: string;
endDate: string;
marketsConfig: string[];
participantsCount: number;
participantsCountTrend: number;
totalNotionalVolume: number;
totalTrades: number;
realizedTotalPnl: number;
minRequiredVolume: number;
includeFees: boolean;
};
export type ContestsConfig = ContestConfig[];
export type ContestFilterConfig = {
id: number;
name: string;
prizePool: {
first: number;
second: number;
third: number;
prcl: number;
points: number;
};
inTheMoneyConfig: {
threshold: number;
limit: number;
};
metric: "realized_total_pnl" | "realized_price_pnl" | "realized_funding_pnl" | "total_notional_volume" | "total_size_volume";
startDate: string;
endDate: string;
marketsConfig: string[];
minRequiredVolume: number;
includeFees: boolean;
};
export type ContestsFiltersConfig = {
contests: ContestFilterConfig[];
totalCount: number;
pageSize: number;
pageNumber: number;
};
export {};
//# sourceMappingURL=contest.d.ts.map