UNPKG

@broxus/js-core

Version:

MobX-based JavaScript Core library

74 lines (73 loc) 4.06 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 DexStablePoolFeeParams, type DexStablePoolFullDetails, DexStablePoolUtils } from '../../models/dex-stable-pool/DexStablePoolUtils'; import { type DexPoolDeployParams, type DexStablePoolWithdrawParams } from '../../models/dex-stable-pool/types'; import { type Forceable, type Silentable, type Syncable, type Watchable } from '../../types'; export interface DexStablePoolCtorOptions { watchDebounceDelay?: number; } export type DexStablePoolCreateConfig = { dex: Dex; } & ({ address: Address | string; } | { roots: (Address | string)[]; }); export interface DexStablePoolCreateOptions extends DexStablePoolCtorOptions, Syncable, Watchable { watchCallback?: VoidFunction; } export interface DexStablePoolData extends DexStablePoolFullDetails { dexRootAddress: Address; dexVaultAddress: Address; feeParams: DexStablePoolFeeParams; virtualPrice?: string | null; } export declare class DexStablePool extends SmartContractModel<DexStablePoolData> { protected readonly _connection: ProviderRpcClient; protected readonly dex: Dex; protected readonly options?: Readonly<DexStablePoolCtorOptions> | undefined; protected readonly _provider?: ProviderRpcClient | undefined; static Utils: typeof DexStablePoolUtils; /** * @param {ProviderRpcClient} _connection * Standalone RPC client that doesn't require connection to the TVM wallet provider * @param {Address | string} address * DexStablePool root address * @param {Dex} dex * Dex Smart Contract Model instance * @param {Readonly<DexStablePoolCtorOptions>} [options] * (optional) DexStablePool 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<DexStablePoolCtorOptions> | undefined, _provider?: ProviderRpcClient | undefined); /** * @param {ProviderRpcClient} connection * Standalone RPC client that doesn't require connection to the TVM wallet provider * @param {Readonly<DexStablePoolCreateConfig>} config * DexStablePool Smart Contract Model config * @param {Readonly<DexStablePoolCreateOptions>} [options] * (optional) DexStablePool Smart Contract Model options * @param {ProviderRpcClient} [provider] * (optional) RPC provider that require connection to the TVM wallet */ static create(connection: ProviderRpcClient, config: Readonly<DexStablePoolCreateConfig>, options?: Readonly<DexStablePoolCreateOptions>, provider?: ProviderRpcClient): Promise<DexStablePool>; sync(options?: Forceable & Silentable): Promise<void>; watch(callback?: SmartContractWatchCallback<DexStablePoolData>): Promise<Subscriber>; unwatch(): Promise<void>; check(options?: Forceable): Promise<boolean>; syncBalances(options?: Forceable): Promise<Map<string, string>>; deployPool(params: DexPoolDeployParams, args?: Partial<SendInternalParams>): Promise<Transaction | undefined>; withdrawLiquidity(params: DexStablePoolWithdrawParams, args?: Partial<SendInternalParams>): Promise<Transaction | undefined>; get balances(): DexStablePoolData['balances']; get dexRootAddress(): DexStablePoolData['dexRootAddress']; get dexVaultAddress(): DexStablePoolData['dexVaultAddress']; get feeParams(): DexStablePoolData['feeParams']; get isActive(): DexStablePoolData['isActive']; get lpToken(): DexStablePoolData['lpToken']; get lpWallet(): DexStablePoolData['lpWallet']; get tokens(): DexStablePoolData['tokens']; get virtualPrice(): DexStablePoolData['virtualPrice']; get wallets(): DexStablePoolData['wallets']; }