mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-14 06:02:36 +03:00
feat: add pagination support (#57)
Co-authored-by: kuduzow <admin@intocode.ru> Co-authored-by: Aleksandr Kraiz <selfsurfer@gmail.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.17.18",
|
||||
"version": "0.17.19-rc.0",
|
||||
"description": "Orion Protocol SDK",
|
||||
"main": "./lib/esm/index.js",
|
||||
"module": "./lib/esm/index.js",
|
||||
|
||||
@@ -85,15 +85,20 @@ class ReferralSystem {
|
||||
}),
|
||||
);
|
||||
|
||||
getRewardsMapping = (referralAddress: string) => fetchWithValidation(
|
||||
`${this.apiUrl}/referer/view/rewards-mapping`,
|
||||
rewardsMappingSchema,
|
||||
{
|
||||
headers: {
|
||||
referral: referralAddress,
|
||||
getRewardsMapping = (
|
||||
referralAddress: string,
|
||||
page = 1,
|
||||
positionsPerPage = 10
|
||||
) =>
|
||||
fetchWithValidation(
|
||||
`${this.apiUrl}/referer/view/rewards-mapping?n_per_page=${positionsPerPage}&page=${page}`,
|
||||
rewardsMappingSchema,
|
||||
{
|
||||
headers: {
|
||||
referral: referralAddress,
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
);
|
||||
|
||||
createReferralLink = (payload: CreateLinkPayloadType, signature: SignatureType) => fetchWithValidation(
|
||||
`${this.apiUrl}/referer/create`,
|
||||
|
||||
@@ -1,25 +1,31 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
const rewardsMappingSchema = z.array(
|
||||
z.object({
|
||||
distribution: z.object({
|
||||
dist: z.object({
|
||||
orion: z.number(),
|
||||
referers_list: z.array(z.number()),
|
||||
const rewardsMappingSchema = z.object({
|
||||
data: z.array(
|
||||
z.object({
|
||||
distribution: z.object({
|
||||
dist: z.object({
|
||||
orion: z.number(),
|
||||
referers_list: z.array(z.number()),
|
||||
}),
|
||||
address_to_reward_mapping: z.record(z.string(), z.number()),
|
||||
ref_offset_to_rewarded_actors: z.record(z.string(), z.string()),
|
||||
governance_reward_only: z.number(),
|
||||
total_reward: z.number(),
|
||||
trade_initiator: z.string(),
|
||||
}),
|
||||
address_to_reward_mapping: z.record(z.string(), z.number()),
|
||||
ref_offset_to_rewarded_actors: z.record(z.string(), z.string()),
|
||||
governance_reward_only: z.number(),
|
||||
total_reward: z.number(),
|
||||
trade_initiator: z.string(),
|
||||
}),
|
||||
timestamp_ms: z.number(),
|
||||
block_height: z.number(),
|
||||
tx_hash: z.string(),
|
||||
price_feed_meta_info: z
|
||||
.record(z.string(), z.record(z.string(), z.number()))
|
||||
.nullable(),
|
||||
})
|
||||
);
|
||||
timestamp_ms: z.number(),
|
||||
block_height: z.number(),
|
||||
tx_hash: z.string(),
|
||||
price_feed_meta_info: z
|
||||
.record(z.string(), z.record(z.string(), z.number()))
|
||||
.nullable(),
|
||||
})
|
||||
),
|
||||
pagination_info: z.object({
|
||||
c_page: z.number().int().nonnegative(),
|
||||
t_pages: z.number().int().nonnegative(),
|
||||
}),
|
||||
});
|
||||
|
||||
export default rewardsMappingSchema;
|
||||
|
||||
Reference in New Issue
Block a user