UNPKG

@broxus/js-core

Version:

MobX-based JavaScript Core library

135 lines (134 loc) 7.95 kB
import { type Address, type DecodedAbiFunctionOutputs, type FullContractState, type ProviderRpcClient } from 'everscale-inpage-provider'; import { type DexPoolType } from '../../models/dex'; import { type DexPairAbi } from '../../models/dex-pair/abi'; import { TvmToken } from '../../models/tvm-token'; import { type TvmTokenWallet } from '../../models/tvm-token-wallet'; import { type CallId } from '../../types'; export interface DexPairCrossExchangePayloadAbiParams extends Partial<CallId> { deployWalletGrams?: string | number; expectedAmount: string | number; steps: { amount: string | number; root: Address | string; }[]; } export interface DexPairCrossExchangePayloadV2AbiParams extends Partial<CallId> { cancelPayload?: string | null; deployWalletGrams?: string | number; expectedAmount: string | number; nextStepIndices: (string | number)[]; outcoming: Address | string; recipient: Address | string; referrer?: Address | string; steps: { amount: string | number; nextStepIndices: (string | number)[]; numerator: string | number; outcoming: Address | string; roots: (Address | string)[]; }[]; successPayload?: string | null; toNative?: boolean | null; } export interface DexPairExchangePayloadAbiParams extends Partial<CallId> { deployWalletGrams?: string | number; expectedAmount: string | number; } export interface DexPairExchangePayloadV2AbiParams extends Partial<CallId> { cancelPayload?: string | null; deployWalletGrams?: string | number; expectedAmount: string | number; recipient: Address | string; referrer?: Address | string; successPayload?: string | null; toNative?: boolean | null; } export interface DexPairDepositLiquidityPayloadAbiParams extends Partial<CallId> { deployWalletGrams?: string | number; } export interface DexPairDepositLiquidityPayloadV2AbiParams extends Partial<CallId> { cancelPayload?: string | null; deployWalletGrams?: string | number; expectedAmount: string | number; recipient: Address | string; referrer?: Address | string; successPayload?: string | null; toNative?: boolean | null; } export interface DexPairWithdrawLiquidityPayloadAbiParams extends Partial<CallId> { deployWalletGrams?: string | number; } export interface DexPairWithdrawLiquidityPayloadV2AbiParams extends Partial<CallId> { cancelPayload?: string | null; deployWalletGrams?: string | number; expectedLeftAmount: string | number; expectedRightAmount: string | number; recipient: Address | string; referrer?: Address | string; successPayload?: string | null; toNative?: boolean | null; } export interface DexPairExpectedExchangeAbiParams { amount: string | number; spentTokenAddress: Address | string; } export interface DexPairExpectedSpendAmountAbiParams { receiveAmount: string | number; receiveTokenAddress: Address | string; } export interface DexPairExpectedDepositLiquidityAbiParams { autoChange: boolean; leftAmount: string | number; referrer?: Address | string; rightAmount: string | number; } export interface DexPairExpectedExchange { expectedAmount: string; expectedFee: string; } export interface DexPairExpectedSpendAmount { expectedAmount: string; expectedFee: string; } export interface DexPairFeeParams { beneficiaryAddress: Address | string; beneficiaryNumerator: number; denominator: number; numerator: number; threshold: (readonly [Address, string])[]; } export interface DexPairFullDetails { address: Address; balances: Map<string, string>; contractState?: FullContractState; isActive?: boolean; lpToken: TvmToken; lpWallet: TvmTokenWallet; tokens: [leftToken: TvmToken, rightToken: TvmToken]; type?: DexPoolType; wallets: [leftTokenWallet: TvmTokenWallet, rightTokenWallet: TvmTokenWallet]; } export declare abstract class DexPairUtils { static getDetails(connection: ProviderRpcClient, pairAddress: Address | string, cachedState?: FullContractState): Promise<DexPairFullDetails>; static getBalances(connection: ProviderRpcClient, pairAddress: Address | string, cachedState?: FullContractState): Promise<Map<string, string>>; static getFeeParams(connection: ProviderRpcClient, pairAddress: Address | string, cachedState?: FullContractState): Promise<DexPairFeeParams>; static isActive(connection: ProviderRpcClient, pairAddress: Address | string, cachedState?: FullContractState): Promise<boolean>; static getTokenRoots(connection: ProviderRpcClient, pairAddress: Address | string, cachedState?: FullContractState): Promise<DecodedAbiFunctionOutputs<typeof DexPairAbi, 'getTokenRoots'>>; static getTokenWallets(connection: ProviderRpcClient, pairAddress: Address | string, cachedState?: FullContractState): Promise<DecodedAbiFunctionOutputs<typeof DexPairAbi, 'getTokenWallets'>>; static getPoolType(connection: ProviderRpcClient, pairAddress: Address | string, cachedState?: FullContractState): Promise<DexPoolType>; static getRoot(connection: ProviderRpcClient, pairAddress: Address | string, cachedState?: FullContractState): Promise<Address>; static getVault(connection: ProviderRpcClient, pairAddress: Address | string, cachedState?: FullContractState): Promise<Address>; static getWeverVaultTokenRoot(connection: ProviderRpcClient, pairAddress: Address | string, cachedState?: FullContractState): Promise<Address>; static getAccumulatedFees(connection: ProviderRpcClient, pairAddress: Address | string, cachedState?: FullContractState): Promise<string[]>; static buildCrossPairExchangePayload(connection: ProviderRpcClient, pairAddress: Address | string, params: DexPairCrossExchangePayloadAbiParams, cachedState?: FullContractState): Promise<string>; static buildCrossPairExchangePayloadV2(connection: ProviderRpcClient, pairAddress: Address | string, params: DexPairCrossExchangePayloadV2AbiParams, cachedState?: FullContractState): Promise<string>; static buildExchangePayload(connection: ProviderRpcClient, pairAddress: Address | string, params: DexPairExchangePayloadAbiParams, cachedState?: FullContractState): Promise<string>; static buildExchangePayloadV2(connection: ProviderRpcClient, pairAddress: Address | string, params: DexPairExchangePayloadV2AbiParams, cachedState?: FullContractState): Promise<string>; static buildDepositLiquidityPayload(connection: ProviderRpcClient, pairAddress: Address | string, params: DexPairDepositLiquidityPayloadAbiParams, cachedState?: FullContractState): Promise<string>; static buildDepositLiquidityPayloadV2(connection: ProviderRpcClient, pairAddress: Address | string, params: DexPairDepositLiquidityPayloadV2AbiParams, cachedState?: FullContractState): Promise<string>; static buildWithdrawLiquidityPayload(connection: ProviderRpcClient, pairAddress: Address | string, params: DexPairWithdrawLiquidityPayloadAbiParams, cachedState?: FullContractState): Promise<string>; static buildWithdrawLiquidityPayloadV2(connection: ProviderRpcClient, pairAddress: Address | string, params: DexPairWithdrawLiquidityPayloadV2AbiParams, cachedState?: FullContractState): Promise<string>; static expectedDepositLiquidity(connection: ProviderRpcClient, pairAddress: Address | string, params: DexPairExpectedDepositLiquidityAbiParams, cachedState?: FullContractState): Promise<DecodedAbiFunctionOutputs<typeof DexPairAbi, 'expectedDepositLiquidity'>['value0']>; static expectedExchange(connection: ProviderRpcClient, pairAddress: Address | string, params: DexPairExpectedExchangeAbiParams, cachedState?: FullContractState): Promise<DexPairExpectedExchange>; static expectedSpendAmount(connection: ProviderRpcClient, pairAddress: Address | string, params: DexPairExpectedSpendAmountAbiParams, cachedState?: FullContractState): Promise<DexPairExpectedSpendAmount>; }