UNPKG

@broxus/js-bridge-essentials

Version:

Bridge JavaScript Essentials library

77 lines (76 loc) 7.39 kB
import { type AbiEventName, type AbiFunctionName, type Address, type DecodeEventParams, type DecodeTransactionParams, type DecodedAbiFunctionInputs, type DecodedAbiFunctionOutputs, type DecodedEvent, type DecodedTransaction, type DelayedMessageExecution, type FullContractState, type ProviderRpcClient, type SendInternalParams, type Transaction } from 'everscale-inpage-provider'; import { type AlienProxyV9Abi } from '../../models/alien-proxy/abi'; import { type EvmTokenMergeDetails, type MergePoolTokens, type SolanaTokenMergeDetails, type TvmTokenMergeDetails } from '../../models/alien-proxy/types'; export interface AlienProxyV9DeployTokenFeeAbiParams { remainingGasTo: Address | string; tokenAddress: Address | string; } export type AlienProxyV9TvmTokenFee = DecodedAbiFunctionOutputs<typeof AlienProxyV9Abi, 'getTvmTokenFee'>; export type AlienProxyV9TvmDefaultFee = DecodedAbiFunctionOutputs<typeof AlienProxyV9Abi, 'getTvmDefaultFee'>; export type AlienProxyV9TvmFees = Map<string, { incoming: string; outgoing: string; }>; export type DeriveEvmAlienTokenRootV9AbiParams = Omit<DecodedAbiFunctionInputs<typeof AlienProxyV9Abi, 'deriveEVMAlienTokenRoot'>, 'answerId'>; export type DeriveTvmAlienTokenRootV9AbiParams = Omit<DecodedAbiFunctionInputs<typeof AlienProxyV9Abi, 'deriveTVMAlienTokenRoot'>, 'answerId'>; export type DeriveSolanaAlienTokenRootV9AbiParams = Omit<DecodedAbiFunctionInputs<typeof AlienProxyV9Abi, 'deriveSolanaAlienTokenRoot'>, 'answerId'>; export type AlienProxyV9Configurations = DecodedAbiFunctionOutputs<typeof AlienProxyV9Abi, 'getConfiguration'>; export type AlienProxyV9DecodedEvent = DecodedEvent<typeof AlienProxyV9Abi, AbiEventName<typeof AlienProxyV9Abi>>; export type AlienProxyV9DecodedTransaction = DecodedTransaction<typeof AlienProxyV9Abi, AbiFunctionName<typeof AlienProxyV9Abi>>; export declare abstract class AlienProxyV9Utils { static deployTokenFee(provider: ProviderRpcClient, proxyAddress: Address | string, params: AlienProxyV9DeployTokenFeeAbiParams, args?: Partial<SendInternalParams>): Promise<DelayedMessageExecution>; static getExpectedTokenFeeAddress(connection: ProviderRpcClient, proxyAddress: Address | string, tokenAddress: Address | string, cachedState?: FullContractState): Promise<Address>; static getTvmDefaultFee(connection: ProviderRpcClient, proxyAddress: Address | string, cachedState?: FullContractState): Promise<AlienProxyV9TvmDefaultFee>; static getTvmFees(connection: ProviderRpcClient, proxyAddress: Address | string, cachedState?: FullContractState): Promise<AlienProxyV9TvmFees>; static getTvmTokenFee(connection: ProviderRpcClient, proxyAddress: Address | string, tokenAddress: Address | string, cachedState?: FullContractState): Promise<AlienProxyV9TvmTokenFee>; static getConfiguration(connection: ProviderRpcClient, proxyAddress: Address | string, cachedState?: FullContractState): Promise<AlienProxyV9Configurations>; static getTvmEvmConfiguration(connection: ProviderRpcClient, proxyAddress: Address | string, cachedState?: FullContractState): Promise<Address>; static getSolTvmConfiguration(connection: ProviderRpcClient, proxyAddress: Address | string, cachedState?: FullContractState): Promise<Address>; static getTvmSolConfiguration(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 {DeriveEvmAlienTokenRootV9AbiParams} params * @param {FullContractState} [cachedState] - optional. Full contract state of the alien proxy contract */ static deriveEvmAlienTokenRoot(connection: ProviderRpcClient, proxyAddress: Address | string, params: DeriveEvmAlienTokenRootV9AbiParams, cachedState?: FullContractState): Promise<Address>; /** * Derive TVM alien token address in TVM by the given proxy address and EVM token params * @param {ProviderRpcClient} connection * @param {Address | string} proxyAddress * @param {DeriveTvmAlienTokenRootV9AbiParams} params * @param {FullContractState} [cachedState] - optional. Full contract state of the alien proxy contract */ static deriveTvmAlienTokenRoot(connection: ProviderRpcClient, proxyAddress: Address | string, params: DeriveTvmAlienTokenRootV9AbiParams, cachedState?: FullContractState): Promise<Address>; /** * Derive Solana alien token address in TVM by the given proxy address and Solana token params * @param {ProviderRpcClient} connection * @param {Address | string} proxyAddress * @param {DeriveSolanaAlienTokenRootV9AbiParams} params * @param {FullContractState} [cachedState] - optional. Full contract state of the alien proxy contract */ static deriveSolanaAlienTokenRoot(connection: ProviderRpcClient, proxyAddress: Address | string, params: DeriveSolanaAlienTokenRootV9AbiParams, 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<MergePoolTokens>; static getEvmTokenMergeDetails(connection: ProviderRpcClient, proxyAddress: Address | string, tokenAddress: Address | string, chainId: string, cachedState?: FullContractState): Promise<EvmTokenMergeDetails | undefined>; static getTvmTokenMergeDetails(connection: ProviderRpcClient, proxyAddress: Address | string, tokenAddress: Address | string, cachedState?: FullContractState): Promise<TvmTokenMergeDetails | undefined>; static getSolTokenMergeDetails(connection: ProviderRpcClient, proxyAddress: Address | string, tokenAddress: Address | string, cachedState?: FullContractState): Promise<SolanaTokenMergeDetails | undefined>; static decodeEvent(connection: ProviderRpcClient, proxyAddress: Address | string, args: DecodeEventParams<typeof AlienProxyV9Abi>): Promise<AlienProxyV9DecodedEvent | undefined>; static decodeTransaction(connection: ProviderRpcClient, proxyAddress: Address | string, args: DecodeTransactionParams<typeof AlienProxyV9Abi>): Promise<AlienProxyV9DecodedTransaction | undefined>; static decodeTransactionEvents(connection: ProviderRpcClient, proxyAddress: Address | string, transaction: Transaction): Promise<AlienProxyV9DecodedEvent[]>; }