mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-22 21:59:44 +03:00
Fix integrator service
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@orionprotocol/sdk",
|
"name": "@orionprotocol/sdk",
|
||||||
"version": "0.20.5",
|
"version": "0.20.6",
|
||||||
"description": "Orion Protocol SDK",
|
"description": "Orion Protocol SDK",
|
||||||
"main": "./lib/index.cjs",
|
"main": "./lib/index.cjs",
|
||||||
"module": "./lib/index.js",
|
"module": "./lib/index.js",
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ class IntegratorService {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
readonly veORNInfo = (address: string) => {
|
readonly veORNInfo = (address?: string) => {
|
||||||
return fetchWithValidation(this.apiUrl, veORNInfoResponseSchema, {
|
return fetchWithValidation(this.apiUrl, veORNInfoResponseSchema, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: this.makeRPCPayload({
|
body: this.makeRPCPayload({
|
||||||
@@ -121,16 +121,16 @@ class IntegratorService {
|
|||||||
readonly getAmountByORN = (amountToken: number, timeLock: number) => {
|
readonly getAmountByORN = (amountToken: number, timeLock: number) => {
|
||||||
const timestamp = Date.now() / 1000;
|
const timestamp = Date.now() / 1000;
|
||||||
|
|
||||||
const deltaDays = BigNumber(timeLock).minus(timestamp).dividedBy(DAY);
|
const deltaDaysBN = BigNumber(timeLock).minus(timestamp).dividedBy(DAY);
|
||||||
|
|
||||||
if (deltaDays.lte(0)) return 0;
|
if (deltaDaysBN.lte(0)) return 0;
|
||||||
|
|
||||||
return BigNumber(amountToken)
|
return BigNumber(amountToken)
|
||||||
.multipliedBy(BigNumber(deltaDays).sqrt())
|
.multipliedBy(deltaDaysBN.sqrt())
|
||||||
.dividedBy(BigNumber(WEEK_DAYS).sqrt());
|
.dividedBy(BigNumber(WEEK_DAYS).sqrt());
|
||||||
};
|
};
|
||||||
|
|
||||||
readonly getVotingInfo = (userAddress: string) => {
|
readonly getVotingInfo = (userAddress?: string) => {
|
||||||
return fetchWithValidation(this.apiUrl, votingInfoResponseSchema, {
|
return fetchWithValidation(this.apiUrl, votingInfoResponseSchema, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: this.makeRPCPayload({
|
body: this.makeRPCPayload({
|
||||||
@@ -178,7 +178,7 @@ class IntegratorService {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
readonly listPool = (address: string) => {
|
readonly listPool = (address?: string) => {
|
||||||
return fetchWithValidation(this.apiUrl, listPoolResponseSchema, {
|
return fetchWithValidation(this.apiUrl, listPoolResponseSchema, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: this.makeRPCPayload({
|
body: this.makeRPCPayload({
|
||||||
|
|||||||
@@ -6,8 +6,14 @@ const poolSchema = z.object({
|
|||||||
name: z.string(),
|
name: z.string(),
|
||||||
poolAddress: z.string(),
|
poolAddress: z.string(),
|
||||||
type: z.string(),
|
type: z.string(),
|
||||||
userVote: z.number()
|
userVote: z.number(),
|
||||||
})
|
token0: z.string(), // deprecated
|
||||||
|
token1: z.string(), // deprecated
|
||||||
|
name0: z.string(),
|
||||||
|
name1: z.string(),
|
||||||
|
poolFee: z.number(),
|
||||||
|
weight: z.number(),
|
||||||
|
});
|
||||||
|
|
||||||
const votingResultSchema = z.object({
|
const votingResultSchema = z.object({
|
||||||
absoluteVeTokenInVoting: z.number(),
|
absoluteVeTokenInVoting: z.number(),
|
||||||
@@ -16,8 +22,8 @@ const votingResultSchema = z.object({
|
|||||||
userVeTokenInVoting: z.number(),
|
userVeTokenInVoting: z.number(),
|
||||||
veTokenAddress: z.string(),
|
veTokenAddress: z.string(),
|
||||||
votingAddress: z.string(),
|
votingAddress: z.string(),
|
||||||
weeklyReward: z.number()
|
weeklyReward: z.number(),
|
||||||
})
|
});
|
||||||
|
|
||||||
const votingInfoSchema = z.object({
|
const votingInfoSchema = z.object({
|
||||||
result: votingResultSchema,
|
result: votingResultSchema,
|
||||||
|
|||||||
@@ -2,3 +2,4 @@ export * as aggregator from './Aggregator/index.js';
|
|||||||
export * as blockchainService from './BlockchainService/index.js';
|
export * as blockchainService from './BlockchainService/index.js';
|
||||||
export * as priceFeed from './PriceFeed/index.js';
|
export * as priceFeed from './PriceFeed/index.js';
|
||||||
export * as referralSystem from './ReferralSystem/index.js';
|
export * as referralSystem from './ReferralSystem/index.js';
|
||||||
|
export * as integrator from './Integrator/index.js';
|
||||||
|
|||||||
Reference in New Issue
Block a user