UNPKG

@broxus/js-core

Version:

MobX-based JavaScript Core library

78 lines (77 loc) 4.29 kB
import { type Address, type DecodeEventParams, type DecodeTransactionParams, type ProviderRpcClient, type SendInternalParams, type Subscriber, type Transaction } from 'everscale-inpage-provider'; import { type SmartContractWatchCallback, SmartContractModel } from '../../core'; import { type DexRootAbi } from '../../models/dex/abi'; import { type DexExpectedAccountAddressAbiParams, type DexExpectedPairAddressAbiParams, type DexExpectedPoolAddressAbiParams, DexUtils } from '../../models/dex/DexUtils'; import { type DexDecodedEvent, type DexDecodedTransaction, type DexDeployAccountParams, type DexDeployPairParams, type DexDeployPoolParams } from '../../models/dex/types'; import { type Forceable, type Silentable, type Syncable, type Watchable } from '../../types'; export interface DexCtorOptions { ttl?: number; watchDebounceDelay?: number; } export interface DexCreateOptions extends DexCtorOptions, Syncable, Watchable { watchCallback?: VoidFunction; } export interface DexData { manager: Address; owner: Address; vault: Address; } interface SyncOptions extends Forceable, Silentable { ttl?: number; } export declare class Dex extends SmartContractModel<DexData> { protected readonly _connection: ProviderRpcClient; protected readonly options?: Readonly<DexCtorOptions> | undefined; protected readonly _provider?: ProviderRpcClient | undefined; static Utils: typeof DexUtils; /** * @param {ProviderRpcClient} _connection * Standalone RPC client that doesn't require connection to the TVM wallet provider * @param {Address | string} address * DexRoot root address * @param {Readonly<DexCtorOptions>} [options] * (optional) DexRoot Smart Contract Model options * @param {ProviderRpcClient} [_provider] * (optional) RPC provider that require connection to the TVM wallet */ constructor(_connection: ProviderRpcClient, address: Address | string, options?: Readonly<DexCtorOptions> | undefined, _provider?: ProviderRpcClient | undefined); /** * @param {ProviderRpcClient} connection * Standalone RPC client that doesn't require connection to the TVM wallet provider * @param {Address | string} address * DexRoot root address * @param {Readonly<DexCreateOptions>} [options] * (optional) DexRoot Smart Contract Model options * @param {ProviderRpcClient} [provider] * (optional) RPC provider that require connection to the TVM wallet */ static create(connection: ProviderRpcClient, address: Address | string, options?: Readonly<DexCreateOptions>, provider?: ProviderRpcClient): Promise<Dex>; sync(options?: SyncOptions): Promise<void>; watch(callback?: SmartContractWatchCallback<DexData>): Promise<Subscriber>; unwatch(): Promise<void>; deployAccount(params: DexDeployAccountParams, args?: Partial<SendInternalParams>): Promise<Transaction | undefined>; /** * Stream-based **DexPair** deployment request * @param {DexDeployPairParams} params * @param {Partial<SendInternalParams>} args * @return {Promise<Transaction | undefined>} */ deployPair(params: DexDeployPairParams, args?: Partial<SendInternalParams>): Promise<Transaction | undefined>; /** * Stream-based **DexStablePool** deployment request * @param {DexDeployPoolParams} params * @param {Partial<SendInternalParams>} args * @return {Promise<Transaction | undefined>} */ deployStablePool(params: DexDeployPoolParams, args?: Partial<SendInternalParams>): Promise<Transaction | undefined>; getExpectedAccountAddress(params: DexExpectedAccountAddressAbiParams): Promise<Address>; getExpectedPairAddress(params: DexExpectedPairAddressAbiParams): Promise<Address>; getExpectedPoolAddress(params: DexExpectedPoolAddressAbiParams): Promise<Address>; get manager(): DexData['manager']; get owner(): DexData['owner']; get vault(): DexData['vault']; decodeEvent(args: DecodeEventParams<typeof DexRootAbi>): Promise<DexDecodedEvent | undefined>; decodeTransaction(args: DecodeTransactionParams<typeof DexRootAbi>): Promise<DexDecodedTransaction | undefined>; decodeTransactionEvents(transaction: Transaction): Promise<DexDecodedEvent[]>; } export {};