@broxus/js-core
Version:
MobX-based JavaScript Core library
78 lines (77 loc) • 4.67 kB
TypeScript
import { type Address, type ProviderRpcClient, type SendInternalParams, type Subscriber, type Transaction } from 'everscale-inpage-provider';
import { SmartContractModel } from '../../core';
import { type DexDeployPoolCallbacks, type DexPairOperationCancelled, type DexPairWithdrawSuccessV2 } from '../../models';
import { type Dex } from '../../models/dex';
import { type DexStablePoolFeeParams, type DexStablePoolFullDetails, DexStablePoolUtils } from '../../models/dex-stable-pool/DexStablePoolUtils';
import { type CallId, type Forceable, type SendMessageCallback, type Silentable, type Syncable, type TransactionCallbacks, type TransactionFailureReason, type TransactionSentDetails, type TransactionSuccessResult, type Watchable } from '../../types';
export interface DexStablePoolWithdrawLiquidityCallbacks extends SendMessageCallback, TransactionCallbacks<TransactionSuccessResult<DexPairWithdrawSuccessV2>, TransactionFailureReason<DexPairOperationCancelled>, TransactionSentDetails> {
}
export interface DexStablePoolWithdrawParams extends Partial<CallId>, DexStablePoolWithdrawLiquidityCallbacks {
amount: string | number;
deployWalletGrams?: string | number;
notify?: boolean;
ownerAddress: Address | string;
ownerLpWalletAddress?: Address | string;
payload?: string;
referrer?: Address | string;
remainingGasTo?: Address | string;
}
export interface DexPoolDeployParams extends Partial<CallId>, DexDeployPoolCallbacks {
sendGasTo: Address | string;
}
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<DexStablePoolCtorOptions>} [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: DexStablePoolCreateConfig, options?: DexStablePoolCreateOptions, provider?: ProviderRpcClient): Promise<DexStablePool>;
sync(options?: Forceable & Silentable): Promise<void>;
watch(callback?: VoidFunction): 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 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'];
}