@broxus/js-bridge-essentials
Version:
Bridge JavaScript Essentials library
71 lines (70 loc) • 4.74 kB
TypeScript
import { PublicKey } from '@solana/web3.js';
import { type Address, type DecodedAbiFunctionInputs, type DecodedAbiFunctionOutputs, type FullContractState, type ProviderRpcClient } from 'everscale-inpage-provider';
import { type AlienProxyAbi } from '../../models/alien-proxy/abi';
export interface MergePoolTokens {
canon: Address;
tokens: [Address, {
decimals: string;
} & {
enabled: boolean;
}][];
}
export interface EvmTokenMergeDetails {
canonicalAddress?: Address;
evmTokenAddress?: string;
isMerged: boolean;
mergePoolAddress?: Address;
mergeRouterAddress?: Address;
tvmTokenAddress?: Address;
}
export type DeriveEvmAlienTokenRootAbiParams = Omit<DecodedAbiFunctionInputs<typeof AlienProxyAbi, 'deriveEVMAlienTokenRoot'>, 'answerId'>;
export interface SolanaTokenMergeDetails {
canonicalAddress?: Address;
isMerged: boolean;
mergePoolAddress?: Address;
mergeRouterAddress?: Address;
solTokenAddress?: PublicKey;
tvmTokenAddress?: Address;
}
export type DeriveSolanaAlienTokenRootAbiParams = Omit<DecodedAbiFunctionInputs<typeof AlienProxyAbi, 'deriveSolanaAlienTokenRoot'>, 'answerId'>;
export type AlienProxyConfigurations = DecodedAbiFunctionOutputs<typeof AlienProxyAbi, 'getConfiguration'>;
export declare abstract class AlienProxyUtils {
static getConfiguration(connection: ProviderRpcClient, proxyAddress: Address | string, cachedState?: FullContractState): Promise<AlienProxyConfigurations>;
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 {Omit<DecodedAbiFunctionInputs<typeof AlienProxyAbi, 'deriveEVMAlienTokenRoot'>, 'answerId'>} params
* @param {FullContractState} [cachedState] - optional. Full contract state of the alien proxy contract
*/
static deriveEvmAlienTokenRoot(connection: ProviderRpcClient, proxyAddress: Address | string, params: DeriveEvmAlienTokenRootAbiParams, 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 {Omit<DecodedAbiFunctionInputs<typeof AlienProxyAbi, 'deriveSolanaAlienTokenRoot'>, 'answerId'>} params
* @param {FullContractState} [cachedState] - optional. Full contract state of the alien proxy contract
*/
static deriveSolanaAlienTokenRoot(connection: ProviderRpcClient, proxyAddress: Address | string, params: DeriveSolanaAlienTokenRootAbiParams, 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 getSolTokenMergeDetails(connection: ProviderRpcClient, proxyAddress: Address | string, tokenAddress: Address | string, cachedState?: FullContractState): Promise<SolanaTokenMergeDetails | undefined>;
}