@broxus/js-core
Version:
MobX-based JavaScript Core library
175 lines (174 loc) • 9.05 kB
TypeScript
import { type Address, type FullContractState, type ProviderRpcClient } from 'everscale-inpage-provider';
import { TvmToken } from '../../models/tvm-token';
import { type TvmTokenWallet } from '../../models/tvm-token-wallet';
import { type CallId } from '../../types';
export interface DexStablePoolExchangePayloadAbiParams extends Partial<CallId> {
cancelPayload?: string | null;
deployWalletGrams?: string;
expectedAmount: string;
outcoming: Address | string;
recipient: Address | string;
referrer: Address | string;
successPayload?: string | null;
toNative?: boolean | null;
}
export interface DexStablePoolDepositLiquidityPayloadAbiParams extends Partial<CallId> {
cancelPayload?: string | null;
deployWalletGrams?: string | number;
expectedAmount: string | number;
recipient: Address | string;
referrer: Address | string;
successPayload?: string | null;
}
export interface DexStablePoolWithdrawLiquidityPayloadAbiParams extends Partial<CallId> {
cancelPayload?: string | null;
deployWalletGrams?: string | number;
expectedAmounts: (string | number)[];
recipient: Address | string;
referrer: Address | string;
successPayload?: string | null;
toNative?: boolean | null;
}
export interface DexStablePoolWithdrawLiquidityOneCoinPayloadAbiParams extends Partial<CallId> {
cancelPayload?: string | null;
deployWalletGrams?: string | number;
expectedAmount: string | number;
outcoming: Address | string;
recipient: Address | string;
referrer: Address | string;
successPayload?: string | null;
toNative?: boolean | null;
}
export interface DexStablePoolExpectedDepositLiquidityV2AbiParams {
amounts: (string | number)[];
}
export interface DexStablePoolExpectedDepositSpendAmountAbiParams {
lpAmount: string | number;
spentTokenAddress: Address | string;
}
export interface DexStablePoolExpectedDepositLiquidityOneCoinAbiParams {
amount: string | number;
spentTokenAddress: Address | string;
}
export interface DexStablePoolExpectedExchangeAbiParams {
amount: string | number;
receiveTokenAddress: Address | string;
spentTokenAddress: Address | string;
}
export interface DexStablePoolExpectedWithdrawLiquidityOneCoinAbiParams {
amount: string | number;
outcoming: Address | string;
}
export interface DexStablePoolExpectedOneCoinWithdrawalSpendAmountAbiParams {
receiveAmount: string | number;
receiveTokenAddress: Address | string;
}
export interface DexStablePoolDepositPriceImpactAbiParams {
amount: string | number;
priceAmount: string | number;
spentTokenAddress: Address | string;
}
export interface DexStablePoolWithdrawalPriceImpactAbiParams {
amount: string | number;
priceAmount: string | number;
receiveTokenAddress: Address | string;
}
export interface DexStablePoolExpectedDepositLiquidityV2 {
amounts: string[];
differences: string[];
invariant: string;
lpReward: string;
oldBalances: string[];
poolFees: string[];
resultBalances: string[];
sell: boolean[];
}
export interface DexStablePoolExpectedDepositSpendAmount {
expectedFee: string;
tokensAmount: string;
}
export interface DexStablePoolExpectedDepositLiquidityOneCoin {
amounts: string[];
differences: string[];
invariant: string;
lpReward: string;
oldBalances: string[];
poolFees: string[];
resultBalances: string[];
sell: boolean[];
}
export interface DexStablePoolExpectedOneCoinWithdrawalSpendAmount {
expectedFee: string;
lp: string;
}
export interface DexStablePoolExpectedWithdrawLiquidity {
amounts: string[];
differences: string[];
invariant: string;
lpAmount: string;
oldBalances: string[];
poolFees: string[];
resultBalances: string[];
sell: boolean[];
}
export interface DexStablePoolExpectedExchange {
expectedAmount: string;
expectedFee: string;
}
export interface DexStablePoolFeeParams {
beneficiaryAddress: Address | string;
beneficiaryNumerator: number;
denominator: number;
numerator: number;
threshold: (readonly [Address, string])[];
}
export interface DexStablePoolRoots {
lp: Address;
tokens: Address[];
}
export interface DexStablePoolWallets {
lp: Address;
tokens: Address[];
}
export interface DexStablePoolTokenDetails {
address: Address;
balance?: string;
contractState?: FullContractState;
decimals: number;
pairWalletAddress?: Address;
symbol: string;
}
export interface DexStablePoolFullDetails {
address: Address;
balances: Map<string, string>;
contractState?: FullContractState;
isActive?: boolean;
lpToken: TvmToken;
lpWallet: TvmTokenWallet;
tokens: TvmToken[];
wallets: TvmTokenWallet[];
}
export declare abstract class DexStablePoolUtils {
static getDetails(connection: ProviderRpcClient, poolAddress: Address | string, cachedState?: FullContractState): Promise<DexStablePoolFullDetails>;
static getBalances(connection: ProviderRpcClient, poolAddress: Address | string, cachedState?: FullContractState): Promise<Map<string, string>>;
static getVirtualPrice(connection: ProviderRpcClient, poolAddress: Address | string, cachedState?: FullContractState): Promise<string | null>;
static getDepositPriceImpact(connection: ProviderRpcClient, poolAddress: Address | string, params: DexStablePoolDepositPriceImpactAbiParams, cachedState?: FullContractState): Promise<string | null>;
static getWithdrawalPriceImpact(connection: ProviderRpcClient, poolAddress: Address | string, params: DexStablePoolWithdrawalPriceImpactAbiParams, cachedState?: FullContractState): Promise<string | null>;
static getFeeParams(connection: ProviderRpcClient, poolAddress: Address | string, cachedState?: FullContractState): Promise<DexStablePoolFeeParams>;
static getRoot(connection: ProviderRpcClient, poolAddress: Address | string, cachedState?: FullContractState): Promise<Address>;
static getVault(connection: ProviderRpcClient, poolAddress: Address | string, cachedState?: FullContractState): Promise<Address>;
static isActive(connection: ProviderRpcClient, poolAddress: Address | string, cachedState?: FullContractState): Promise<boolean>;
static getTokenRoots(connection: ProviderRpcClient, poolAddress: Address | string, cachedState?: FullContractState): Promise<DexStablePoolRoots>;
static getTokenWallets(connection: ProviderRpcClient, poolAddress: Address | string, cachedState?: FullContractState): Promise<DexStablePoolWallets>;
static buildExchangePayload(connection: ProviderRpcClient, poolAddress: Address | string, params: DexStablePoolExchangePayloadAbiParams, cachedState?: FullContractState): Promise<string>;
static buildDepositLiquidityPayload(connection: ProviderRpcClient, poolAddress: Address | string, params: DexStablePoolDepositLiquidityPayloadAbiParams, cachedState?: FullContractState): Promise<string>;
static buildWithdrawLiquidityPayload(connection: ProviderRpcClient, poolAddress: Address | string, params: DexStablePoolWithdrawLiquidityPayloadAbiParams, cachedState?: FullContractState): Promise<string>;
static buildWithdrawLiquidityOneCoinPayload(connection: ProviderRpcClient, poolAddress: Address | string, params: DexStablePoolWithdrawLiquidityOneCoinPayloadAbiParams, cachedState?: FullContractState): Promise<string>;
static expectedDepositLiquidityV2(connection: ProviderRpcClient, poolAddress: Address | string, params: DexStablePoolExpectedDepositLiquidityV2AbiParams, cachedState?: FullContractState): Promise<DexStablePoolExpectedDepositLiquidityV2>;
static expectedDepositLiquidityOneCoin(connection: ProviderRpcClient, poolAddress: Address | string, params: DexStablePoolExpectedDepositLiquidityOneCoinAbiParams, cachedState?: FullContractState): Promise<DexStablePoolExpectedDepositLiquidityOneCoin>;
static expectedDepositSpendAmount(connection: ProviderRpcClient, poolAddress: Address | string, params: DexStablePoolExpectedDepositSpendAmountAbiParams, cachedState?: FullContractState): Promise<DexStablePoolExpectedDepositSpendAmount>;
static expectedExchange(connection: ProviderRpcClient, poolAddress: Address | string, params: DexStablePoolExpectedExchangeAbiParams, cachedState?: FullContractState): Promise<DexStablePoolExpectedExchange>;
static expectedOneCoinWithdrawalSpendAmount(connection: ProviderRpcClient, poolAddress: Address | string, params: DexStablePoolExpectedOneCoinWithdrawalSpendAmountAbiParams, cachedState?: FullContractState): Promise<DexStablePoolExpectedOneCoinWithdrawalSpendAmount>;
static expectedWithdrawLiquidity(connection: ProviderRpcClient, poolAddress: Address | string, amount: string | number, cachedState?: FullContractState): Promise<DexStablePoolExpectedWithdrawLiquidity>;
static expectedWithdrawLiquidityOneCoin(connection: ProviderRpcClient, poolAddress: Address | string, params: DexStablePoolExpectedWithdrawLiquidityOneCoinAbiParams, cachedState?: FullContractState): Promise<any>;
}