@broxus/js-bridge-essentials
Version:
Bridge JavaScript Essentials library
50 lines (49 loc) • 3.21 kB
TypeScript
import { type Address, type DecodedAbiFunctionInputs, type DecodedAbiFunctionOutputs, type FullContractState, type ProviderRpcClient } from 'everscale-inpage-provider';
import { type TonAlienProxyAbi } from '../../models/ton-alien-proxy/abi';
export interface MergePoolJettons {
canon: Address;
tokens: [Address, {
decimals: string;
} & {
enabled: boolean;
}][];
}
export interface EvmJettonMergeDetails {
canonicalAddress?: Address;
evmTokenAddress?: string;
isMerged: boolean;
mergePoolAddress?: Address;
mergeRouterAddress?: Address;
tonTokenAddress?: Address;
}
export type DeriveEvmAlienJettonRootAbiParams = Omit<DecodedAbiFunctionInputs<typeof TonAlienProxyAbi, 'deriveEVMAlienTokenRoot'>, 'answerId'>;
export type TonAlienProxyConfigurations = DecodedAbiFunctionOutputs<typeof TonAlienProxyAbi, 'getConfiguration'>;
export declare abstract class TonAlienProxyUtils {
static getConfiguration(connection: ProviderRpcClient, proxyAddress: Address | string, cachedState?: FullContractState): Promise<TonAlienProxyConfigurations>;
static getTonEvmConfiguration(connection: ProviderRpcClient, proxyAddress: Address | string, cachedState?: FullContractState): Promise<Address>;
/**
* Derive EVM alien token address in TVM by the given proxy address and EVM token params
* @param {ProviderRpcClient} connection
* @param {Address | string} proxyAddress
* @param {Omit<DecodedAbiFunctionInputs<typeof TonAlienProxyAbi, 'deriveEVMAlienTokenRoot'>, 'answerId'>} params
* @param {FullContractState} [cachedState] - optional. Full contract state of the alien proxy contract
*/
static deriveEvmAlienTokenRoot(connection: ProviderRpcClient, proxyAddress: Address | string, params: DeriveEvmAlienJettonRootAbiParams, cachedState?: FullContractState): Promise<Address>;
/**
* Get derive merge router address by the given TVM-like token and proxy addresses
* @param {ProviderRpcClient} connection
* @param {Address | string} proxyAddress
* @param {Address | string} tokenAddress
* @param {FullContractState} [cachedState] - optional. Full contract state of the alien proxy contract
*/
static deriveMergeRouter(connection: ProviderRpcClient, proxyAddress: Address | string, tokenAddress: Address | string, cachedState?: FullContractState): Promise<Address>;
/**
* Get merge pool address by the given merge router address
* @param {ProviderRpcClient} connection
* @param {Address | string} mergeRouterAddress
* @param {FullContractState} [cachedState] - optional. Full contract state of the merge router contract
*/
static getMergePoolAddress(connection: ProviderRpcClient, mergeRouterAddress: Address | string, cachedState?: FullContractState): Promise<Address>;
static getMergePoolTokens(connection: ProviderRpcClient, mergePoolAddress: Address | string, cachedState?: FullContractState): Promise<MergePoolJettons>;
static getEvmTokenMergeDetails(connection: ProviderRpcClient, proxyAddress: Address | string, tokenAddress: Address | string, chainId: string, cachedState?: FullContractState): Promise<EvmJettonMergeDetails | undefined>;
}