mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-16 16:21:32 +03:00
add estimate withdraw request
This commit is contained in:
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.20.82",
|
||||
"version": "0.20.83-rc0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.20.82",
|
||||
"version": "0.20.83-rc0",
|
||||
"hasInstallScript": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.20.82",
|
||||
"version": "0.20.83-rc0",
|
||||
"description": "Orion Protocol SDK",
|
||||
"main": "./lib/index.cjs",
|
||||
"module": "./lib/index.js",
|
||||
|
||||
@@ -20,6 +20,7 @@ import { makePartial } from '../../utils';
|
||||
import type { networkCodes } from '../../constants/index.js';
|
||||
import { fetchWithValidation } from 'simple-typed-fetch';
|
||||
import type { BasicAuthCredentials } from '../../types.js';
|
||||
import { dueLiabilityEstimateSchema } from './schemas/dueLiabilityEstimateSchema';
|
||||
|
||||
type IAdminAuthHeaders = {
|
||||
auth: string
|
||||
@@ -64,6 +65,10 @@ type PlatformFees = {
|
||||
walletAddress?: string | undefined
|
||||
fromWidget?: string | undefined
|
||||
}
|
||||
type DueLiabilityEstimateProps = {
|
||||
asset: string
|
||||
amount: number
|
||||
}
|
||||
|
||||
class BlockchainService {
|
||||
private readonly apiUrl: string;
|
||||
@@ -115,6 +120,7 @@ class BlockchainService {
|
||||
this.claimOrder = this.claimOrder.bind(this);
|
||||
this.getGasLimits = this.getGasLimits.bind(this);
|
||||
this.getExchangeContractWalletBalance = this.getExchangeContractWalletBalance.bind(this);
|
||||
this.getDueLiabilityEstimate = this.getDueLiabilityEstimate.bind(this);
|
||||
}
|
||||
|
||||
get basicAuthHeaders() {
|
||||
@@ -271,6 +277,12 @@ class BlockchainService {
|
||||
{ headers: this.basicAuthHeaders }
|
||||
);
|
||||
|
||||
getDueLiabilityEstimate = ({ asset, amount }: DueLiabilityEstimateProps) => fetchWithValidation(
|
||||
`${this.apiUrl}/api/due-liability-esstimate/${asset}/${amount}`,
|
||||
dueLiabilityEstimateSchema,
|
||||
{ headers: this.basicAuthHeaders }
|
||||
);
|
||||
|
||||
getGasPriceWei = () => fetchWithValidation(
|
||||
`${this.apiUrl}/api/gasPrice`,
|
||||
z.string(),
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
export const dueLiabilityEstimateSchema = z.object({
|
||||
asset: z.string(),
|
||||
amount: z.number().nonnegative(),
|
||||
});
|
||||
@@ -1,18 +1,19 @@
|
||||
export * from './adminPoolSchema.js';
|
||||
export { default as adminPoolsListSchema } from './adminPoolsListSchema.js';
|
||||
export { default as addPoolSchema } from './addPoolSchema.js';
|
||||
export { default as atomicHistorySchema } from './atomicHistorySchema.js';
|
||||
export { default as checkRedeemOrderSchema } from './checkRedeemOrderSchema.js';
|
||||
export { default as historySchema } from './historySchema.js';
|
||||
export { default as IDOSchema } from './IDOSchema.js';
|
||||
export { default as infoSchema } from './infoSchema.js';
|
||||
export { default as poolsConfigSchema } from './poolsConfigSchema.js';
|
||||
export { default as poolsInfoSchema } from './poolsInfoSchema.js';
|
||||
export { default as atomicSummarySchema } from './atomicSummarySchema.js';
|
||||
export { default as poolsLpAndStakedSchema } from './poolsLpAndStakedSchema.js';
|
||||
export { default as userVotesSchema } from './userVotesSchema.js';
|
||||
export { default as userEarnedSchema } from './userEarnedSchema.js';
|
||||
export { default as poolsV3InfoSchema } from './poolsV3InfoSchema.js';
|
||||
export { default as pmmSchema } from './pmmSchema.js';
|
||||
export { pricesWithQuoteAssetSchema } from './pricesWithQuoteAssetSchema.js';
|
||||
export { referralDataSchema } from './referralDataSchema.js';
|
||||
export * from './adminPoolSchema';
|
||||
export { default as adminPoolsListSchema } from './adminPoolsListSchema';
|
||||
export { default as addPoolSchema } from './addPoolSchema';
|
||||
export { default as atomicHistorySchema } from './atomicHistorySchema';
|
||||
export { default as checkRedeemOrderSchema } from './checkRedeemOrderSchema';
|
||||
export { default as historySchema } from './historySchema';
|
||||
export { default as IDOSchema } from './IDOSchema';
|
||||
export { default as infoSchema } from './infoSchema';
|
||||
export { default as poolsConfigSchema } from './poolsConfigSchema';
|
||||
export { default as poolsInfoSchema } from './poolsInfoSchema';
|
||||
export { default as atomicSummarySchema } from './atomicSummarySchema';
|
||||
export { default as poolsLpAndStakedSchema } from './poolsLpAndStakedSchema';
|
||||
export { default as userVotesSchema } from './userVotesSchema';
|
||||
export { default as userEarnedSchema } from './userEarnedSchema';
|
||||
export { default as poolsV3InfoSchema } from './poolsV3InfoSchema';
|
||||
export { default as pmmSchema } from './pmmSchema';
|
||||
export { pricesWithQuoteAssetSchema } from './pricesWithQuoteAssetSchema';
|
||||
export { referralDataSchema } from './referralDataSchema';
|
||||
export { dueLiabilityEstimateSchema } from './dueLiabilityEstimateSchema';
|
||||
|
||||
Reference in New Issue
Block a user