Merge pull request #226 from orionprotocol/get-referral-data

get referral data
This commit is contained in:
kigastu
2023-12-14 17:18:35 +03:00
committed by GitHub
4 changed files with 15 additions and 1 deletions

View File

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

View File

@@ -11,6 +11,7 @@ import {
type PairStatusEnum,
pairStatusSchema,
pricesWithQuoteAssetSchema,
referralDataSchema,
} from './schemas/index.js';
import type redeemOrderSchema from '../Aggregator/schemas/redeemOrderSchema.js';
import { sourceAtomicHistorySchema, targetAtomicHistorySchema } from './schemas/atomicHistorySchema.js';
@@ -258,6 +259,12 @@ class BlockchainService {
)
};
getReferralData = (walletAddress: string) => fetchWithValidation(
`${this.apiUrl}/api/referral-data/${walletAddress}`,
referralDataSchema,
{ headers: this.basicAuthHeaders }
);
getGasPriceWei = () => fetchWithValidation(
`${this.apiUrl}/api/gasPrice`,
z.string(),

View File

@@ -14,3 +14,4 @@ export { default as userVotesSchema } from './userVotesSchema.js';
export { default as userEarnedSchema } from './userEarnedSchema.js';
export { default as poolsV3InfoSchema } from './poolsV3InfoSchema.js';
export { pricesWithQuoteAssetSchema } from './pricesWithQuoteAssetSchema.js';
export { referralDataSchema } from './referralDataSchema.js';

View File

@@ -0,0 +1,6 @@
import { z } from "zod";
export const referralDataSchema = z.object({
referer: z.string(),
isReferral: z.boolean(),
});