mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-14 06:02:36 +03:00
OP-3735 referrals rating (#87)
This commit is contained in:
93
package-lock.json
generated
93
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.18.3",
|
||||
"version": "0.18.7-rc2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.18.3",
|
||||
"version": "0.18.7-rc2",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.21.0",
|
||||
@@ -3212,23 +3212,6 @@
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/scope-manager": {
|
||||
"version": "5.57.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.57.0.tgz",
|
||||
"integrity": "sha512-NANBNOQvllPlizl9LatX8+MHi7bx7WGIWYjPHDmQe5Si/0YEYfxSljJpoTyTWFTgRy3X8gLYSE4xQ2U+aCozSw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "5.57.0",
|
||||
"@typescript-eslint/visitor-keys": "5.57.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/typescript-eslint"
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/type-utils": {
|
||||
"version": "5.57.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.57.1.tgz",
|
||||
@@ -3328,61 +3311,6 @@
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/types": {
|
||||
"version": "5.57.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.57.0.tgz",
|
||||
"integrity": "sha512-mxsod+aZRSyLT+jiqHw1KK6xrANm19/+VFALVFP5qa/aiJnlP38qpyaTd0fEKhWvQk6YeNZ5LGwI1pDpBRBhtQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/typescript-eslint"
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/typescript-estree": {
|
||||
"version": "5.57.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.57.0.tgz",
|
||||
"integrity": "sha512-LTzQ23TV82KpO8HPnWuxM2V7ieXW8O142I7hQTxWIHDcCEIjtkat6H96PFkYBQqGFLW/G/eVVOB9Z8rcvdY/Vw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "5.57.0",
|
||||
"@typescript-eslint/visitor-keys": "5.57.0",
|
||||
"debug": "^4.3.4",
|
||||
"globby": "^11.1.0",
|
||||
"is-glob": "^4.0.3",
|
||||
"semver": "^7.3.7",
|
||||
"tsutils": "^3.21.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/typescript-eslint"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"typescript": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/typescript-estree/node_modules/semver": {
|
||||
"version": "7.3.8",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
|
||||
"integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"lru-cache": "^6.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/utils": {
|
||||
"version": "5.57.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.57.1.tgz",
|
||||
@@ -3498,23 +3426,6 @@
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/visitor-keys": {
|
||||
"version": "5.57.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.57.0.tgz",
|
||||
"integrity": "sha512-ery2g3k0hv5BLiKpPuwYt9KBkAp2ugT6VvyShXdLOkax895EC55sP0Tx5L0fZaQueiK3fBLvHVvEl3jFS5ia+g==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "5.57.0",
|
||||
"eslint-visitor-keys": "^3.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/typescript-eslint"
|
||||
}
|
||||
},
|
||||
"node_modules/@webassemblyjs/ast": {
|
||||
"version": "1.11.1",
|
||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.18.6",
|
||||
"version": "0.18.7-rc2",
|
||||
"description": "Orion Protocol SDK",
|
||||
"main": "./lib/index.cjs",
|
||||
"module": "./lib/index.js",
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
globalAnalyticsSchema,
|
||||
rewardsClaimedSchema,
|
||||
linkSchema,
|
||||
ratingSchema,
|
||||
} from './schemas/index.js';
|
||||
|
||||
type CreateLinkPayloadType = {
|
||||
@@ -152,6 +153,14 @@ class ReferralSystem {
|
||||
},
|
||||
errorSchema
|
||||
);
|
||||
|
||||
getRating = () =>
|
||||
fetchWithValidation(
|
||||
`${this.apiUrl}/referer/ve/rating-table-leaderboard`,
|
||||
ratingSchema,
|
||||
{},
|
||||
errorSchema
|
||||
);
|
||||
}
|
||||
|
||||
export * as schemas from './schemas/index.js';
|
||||
|
||||
@@ -5,3 +5,4 @@ export { default as miniStatsSchema } from './miniStatsSchema.js';
|
||||
export { default as rewardsMappingSchema } from './rewardsMappingSchema.js';
|
||||
export { default as rewardsClaimedSchema } from './rewardsClaimedSchema.js';
|
||||
export { default as globalAnalyticsSchema } from './globalAnalyticsSchema.js';
|
||||
export { default as ratingSchema } from './ratingSchema.js';
|
||||
|
||||
26
src/services/ReferralSystem/schemas/ratingSchema.ts
Normal file
26
src/services/ReferralSystem/schemas/ratingSchema.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
const ratingSchema = z.object({
|
||||
info: z.object({
|
||||
weekly_boost_budget: z.string(),
|
||||
weekly_boost_budget_fmt: z.number(),
|
||||
time_left_for_the_reward: z.number(),
|
||||
time_left_for_the_reward_local: z.string(),
|
||||
time_left_for_the_reward_utc: z.string(),
|
||||
personal_info: z.any(),
|
||||
}),
|
||||
list: z.array(z.object({
|
||||
rank_id: z.number(),
|
||||
wallet: z.string(),
|
||||
staked_ve_orn: z.string(),
|
||||
staked_ve_orn_fmt: z.number(),
|
||||
weighted_volume: z.string(),
|
||||
weighted_volume_fmt: z.number(),
|
||||
total_weight: z.string(),
|
||||
total_weight_fmt: z.number(),
|
||||
reward: z.string(),
|
||||
reward_fmt: z.number()
|
||||
})),
|
||||
});
|
||||
|
||||
export default ratingSchema;
|
||||
Reference in New Issue
Block a user