all time leaderboard

This commit is contained in:
Kirill Litvinov
2024-02-13 20:18:33 +03:00
parent a2e7e04ad1
commit 81ef6a6aff
5 changed files with 30 additions and 3 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "@orionprotocol/sdk",
"version": "0.20.57",
"version": "0.20.59",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@orionprotocol/sdk",
"version": "0.20.57",
"version": "0.20.59",
"hasInstallScript": true,
"license": "ISC",
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "@orionprotocol/sdk",
"version": "0.20.58",
"version": "0.20.59",
"description": "Orion Protocol SDK",
"main": "./lib/index.cjs",
"module": "./lib/index.js",

View File

@@ -13,6 +13,7 @@ import {
aggregatedHistorySchema,
inviteCodeLinkSchema,
contractsAddressesSchema,
allTimeLeadersSchema,
} from './schemas/index.js';
import type { SupportedChainId } from '../../types.js';
@@ -71,6 +72,7 @@ class ReferralSystem {
this.claimRewards = this.claimRewards.bind(this);
this.getLeaderboard = this.getLeaderboard.bind(this);
this.getLeaderboardSingleChain = this.getLeaderboardSingleChain.bind(this);
this.getAllTimeLeaders = this.getAllTimeLeaders.bind(this);
this.getContractsAddresses = this.getContractsAddresses.bind(this);
this.getClaimInfo = this.getClaimInfo.bind(this);
this.getAggregatedHistory = this.getAggregatedHistory.bind(this);
@@ -231,6 +233,19 @@ class ReferralSystem {
errorSchema
);
getAllTimeLeaders = (refererAddress: string | undefined) =>
fetchWithValidation(
`${this.apiUrl}/referer/ve/leaderboard-lifetime`,
ratingSchema,
{
headers:
refererAddress !== undefined
? { 'referer-address': refererAddress }
: {},
},
allTimeLeadersSchema
);
getContractsAddresses = () =>
fetchWithValidation(
`${this.apiUrl}/referer/view/contracts`,

View File

@@ -0,0 +1,11 @@
import { z } from 'zod';
const allTimeLeadersSchema = z.array(z.object({
wallet: z.string(),
total_earnings_fmt: z.number(),
referrals_count_fmt: z.number(),
total_trades_fmt: z.number(),
weekly_earnings_fmt: z.number(),
}));
export default allTimeLeadersSchema;

View File

@@ -10,3 +10,4 @@ export { default as claimInfoSchema } from './claimInfoSchema.js';
export { default as aggregatedHistorySchema } from './aggregatedHistorySchema.js';
export { default as contractsAddressesSchema } from './contractsAddressesSchema.js';
export { default as inviteCodeLinkSchema } from './inviteCodeLinkSchema.js';
export { default as allTimeLeadersSchema } from './allTimeLeadersSchema.js';