feat: added getMinLockAmountForCCS method

This commit is contained in:
Mikhail Gladchenko
2024-07-18 17:13:27 +01:00
parent 722ca75e18
commit bec2775fab
2 changed files with 15 additions and 2 deletions

View File

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

View File

@@ -19,7 +19,7 @@ import { sourceAtomicHistorySchema, targetAtomicHistorySchema } from './schemas/
import { makePartial } from '../../utils';
import type { networkCodes } from '../../constants/index.js';
import { fetchWithValidation } from 'simple-typed-fetch';
import type { BasicAuthCredentials } from '../../types.js';
import { type BasicAuthCredentials, SupportedChainId } from '../../types.js';
import errorSchema from '../Aggregator/schemas/errorSchema';
type IAdminAuthHeaders = {
@@ -66,6 +66,12 @@ type PlatformFees = {
fromWidget?: string | undefined
}
type MinLockAmount = {
assetIn: string
assetOut: string
targetChainId: SupportedChainId
}
class BlockchainService {
private readonly apiUrl: string;
@@ -117,6 +123,7 @@ class BlockchainService {
this.getGasLimits = this.getGasLimits.bind(this);
this.getExchangeContractWalletBalance = this.getExchangeContractWalletBalance.bind(this);
this.getAtomicSwapFee = this.getAtomicSwapFee.bind(this);
this.getMinLockAmountForCCS = this.getMinLockAmountForCCS.bind(this);
}
get basicAuthHeaders() {
@@ -515,6 +522,12 @@ class BlockchainService {
z.record(z.string()),
{ headers: this.basicAuthHeaders }
);
ф = ({ assetIn, assetOut, targetChainId }: MinLockAmount) => fetchWithValidation(
`${this.apiUrl}/api/atomic/min-lock-amount?assetIn=${assetIn}&assetOut=${assetOut}&targetChainId=${targetChainId}`,
z.number(),
{ headers: this.basicAuthHeaders }
);
}
export * as schemas from './schemas/index.js';