UNPKG

@broxus/js-core

Version:

MobX-based JavaScript Core library

77 lines (76 loc) 3.99 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 DexPairFeeParams, type DexPairFullDetails, DexPairUtils } from '../../models/dex-pair/DexPairUtils'; import { type DexPairDeployParams, type DexPairWithdrawParams } from '../../models/dex-pair/types'; import { type Forceable, type Silentable, type Syncable, type Watchable } from '../../types'; export interface DexPairCtorOptions { watchDebounceDelay?: number; } export type DexPairCreateConfig = { address: Address | string; dex: Dex; } | { dex: Dex; leftRootAddress: Address | string; rightRootAddress: Address | string; }; export interface DexPairCreateOptions extends DexPairCtorOptions, Syncable, Watchable { watchCallback?: VoidFunction; } export interface DexPairData extends DexPairFullDetails { dexRootAddress: Address; dexVaultAddress: Address; feeParams: DexPairFeeParams; } export declare class DexPair extends SmartContractModel<DexPairData> { protected readonly _connection: ProviderRpcClient; protected readonly dex: Dex; protected readonly options?: Readonly<DexPairCtorOptions> | undefined; protected readonly _provider?: ProviderRpcClient | undefined; static Utils: typeof DexPairUtils; /** * @param {ProviderRpcClient} _connection * Standalone RPC client that doesn't require connection to the TVM wallet provider * @param {Address | string} address * DexPair root address * @param {Dex} dex * Dex Smart Contract Model instance * @param {Readonly<DexPairCtorOptions>} [options] * (optional) DexPair 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<DexPairCtorOptions> | undefined, _provider?: ProviderRpcClient | undefined); /** * @param {ProviderRpcClient} connection * Standalone RPC client that doesn't require connection to the TVM wallet provider * @param {Readonly<DexPairCreateConfig>} config * DexPair Smart Contract Model config * @param {Readonly<DexPairCreateOptions>} [options] * (optional) DexPair Smart Contract Model options * @param {ProviderRpcClient} [provider] * (optional) RPC provider that require connection to the TVM wallet */ static create(connection: ProviderRpcClient, config: Readonly<DexPairCreateConfig>, options?: Readonly<DexPairCreateOptions>, provider?: ProviderRpcClient): Promise<DexPair>; sync(options?: Forceable & Silentable): Promise<void>; watch(callback?: SmartContractWatchCallback<DexPairData>): 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(): DexPairData['balances']; get dexRootAddress(): DexPairData['dexRootAddress']; get dexVaultAddress(): DexPairData['dexVaultAddress']; get feeParams(): DexPairData['feeParams']; get isActive(): DexPairData['isActive']; get leftToken(): DexPairData['tokens'][number]; get leftTokenWallet(): DexPairData['wallets'][number]; get lpToken(): DexPairData['lpToken']; get lpWallet(): DexPairData['lpWallet']; get rightToken(): DexPairData['tokens'][number]; get rightTokenWallet(): DexPairData['wallets'][number]; get tokens(): DexPairData['tokens']; get type(): DexPairData['type']; }