UNPKG

@broxus/js-core

Version:

MobX-based JavaScript Core library

77 lines (76 loc) 4.24 kB
import { type Address, type ProviderRpcClient, type SendInternalParams, type Subscriber, type Transaction } from 'everscale-inpage-provider'; import { type SmartContractWatchCallback, SmartContractModel } from '../../core'; import { type Dex } from '../../models/dex'; import { type DexPairDeployParams, type DexPairWithdrawParams } from '../../models/dex-pair/types'; import { type DexStablePairFeeParams, type DexStablePairFullDetails, DexStablePairUtils } from '../../models/dex-stable-pair/DexStablePairUtils'; import { type Forceable, type Silentable, type Syncable, type Watchable } from '../../types'; export interface DexStablePairCtorOptions { watchDebounceDelay?: number; } export type DexStablePairCreateConfig = { address: Address | string; dex: Dex; } | { dex: Dex; leftRootAddress: Address | string; rightRootAddress: Address | string; }; export interface DexStablePairCreateOptions extends DexStablePairCtorOptions, Syncable, Watchable { watchCallback?: VoidFunction; } export interface DexStablePairData extends DexStablePairFullDetails { dexRootAddress: Address; dexVaultAddress: Address; feeParams: DexStablePairFeeParams; } export declare class DexStablePair extends SmartContractModel<DexStablePairData> { protected readonly _connection: ProviderRpcClient; protected readonly dex: Dex; protected readonly options?: Readonly<DexStablePairCtorOptions> | undefined; protected readonly _provider?: ProviderRpcClient | undefined; static Utils: typeof DexStablePairUtils; /** * @param {ProviderRpcClient} _connection * Standalone RPC client that doesn't require connection to the TVM wallet provider * @param {Address | string} address * DexStablePair root address * @param {Dex} dex * Dex Smart Contract Model instance * @param {Readonly<DexStablePairCtorOptions>} [options] * (optional) DexStablePair Smart Contract Model options * @param {ProviderRpcClient} [_provider] * (optional) RPC provider that require connection to the TVM wallet */ constructor(_connection: ProviderRpcClient, address: Address | string, dex: Dex, options?: Readonly<DexStablePairCtorOptions> | undefined, _provider?: ProviderRpcClient | undefined); /** * @param {ProviderRpcClient} connection * Standalone RPC client that doesn't require connection to the TVM wallet provider * @param {Readonly<DexStablePairCreateConfig>} config * DexStablePair Smart Contract Model config * @param {Readonly<DexStablePairCreateOptions>} [options] * (optional) DexStablePair Smart Contract Model options * @param {ProviderRpcClient} [provider] * (optional) RPC provider that require connection to the TVM wallet */ static create(connection: ProviderRpcClient, config: Readonly<DexStablePairCreateConfig>, options?: Readonly<DexStablePairCreateOptions>, provider?: ProviderRpcClient): Promise<DexStablePair>; sync(options?: Forceable & Silentable): Promise<void>; watch(callback?: SmartContractWatchCallback<DexStablePairData>): Promise<Subscriber>; unwatch(): Promise<void>; check(options?: Forceable): Promise<boolean>; syncBalances(options?: Forceable): Promise<Map<string, string>>; deployPair(params: DexPairDeployParams, args?: Partial<SendInternalParams>): Promise<Transaction | undefined>; withdrawLiquidity(params: DexPairWithdrawParams, args?: Partial<SendInternalParams>): Promise<Transaction | undefined>; get balances(): DexStablePairData['balances']; get dexRootAddress(): DexStablePairData['dexRootAddress']; get dexVaultAddress(): DexStablePairData['dexVaultAddress']; get feeParams(): DexStablePairData['feeParams']; get isActive(): DexStablePairData['isActive']; get leftToken(): DexStablePairData['tokens'][number]; get leftTokenWallet(): DexStablePairData['wallets'][number]; get lpToken(): DexStablePairData['lpToken']; get lpWallet(): DexStablePairData['lpWallet']; get rightToken(): DexStablePairData['tokens'][number]; get rightTokenWallet(): DexStablePairData['wallets'][number]; get tokens(): DexStablePairData['tokens']; get type(): DexStablePairData['type']; }