@avalanche-sdk/interchain
Version:
Interchain package for handling ICM/ICTT messages
111 lines • 7.08 kB
TypeScript
import { ChainConfig } from "../chains/types/chainConfig";
import { DeployTokenHomeContractParams } from "./types/deployTokenHomeContractParams";
import { DeployTokenRemoteContractParams } from "./types/deployTokenRemoteContractParams";
import { RegisterRemoteWithHomeParams } from "./types/registerRemoteWithHomeParams";
import { SendTokenParams } from "./types/sendTokenParams";
import { DeployERC20TokenParams } from "./types/deployERC20Token";
import { ApproveTokenParams } from "./types/approveTokenParams";
export declare class ICTT {
private sourceChain;
private destinationChain;
private gasLimit;
constructor(sourceChain?: ChainConfig, destinationChain?: ChainConfig, gasLimit?: bigint);
/**
* Deploys a new ERC20 token on the source chain.
* @param params - The parameters for deploying the ERC20 token.
* @param params.walletClient - The wallet client to use for deploying the ERC20 token.
* @param params.sourceChain - The source chain to deploy the ERC20 token on.
* @param params.name - The name of the token.
* @param params.symbol - The symbol of the token.
* @param params.initialSupply - The initial supply of the token.
* @param params.recipient - The recipient of the newly minted tokens.
* @returns The transaction hash and the contract address of the deployed ERC20 token.
*/
deployERC20Token(params: DeployERC20TokenParams): Promise<{
txHash: `0x${string}`;
contractAddress: `0x${string}`;
}>;
/**
* Approves the token for the token home contract on the source chain.
* @param params - The parameters for approving the token.
* @param params.walletClient - The wallet client to use for approving the token.
* @param params.sourceChain - The source chain to approve the token on.
* @param params.tokenHomeContract - The address of the token home contract to approve the token for.
* @param params.tokenAddress - The address of the token to approve.
* @param params.amountInBaseUnit - The amount of the token to approve.
* @returns The transaction hash of the approval.
*/
approveToken(params: ApproveTokenParams): Promise<{
txHash: `0x${string}`;
}>;
/**
* Deploy a token home contract on the source chain.
* @param params - The parameters for deploying the token home contract.
* @param params.walletClient - The wallet client to use for deploying the token home contract.
* @param params.sourceChain - The source chain to deploy the token home contract on.
* @param params.erc20TokenAddress - The address of the ERC20 token to be used as the token home contract.
* @param params.minimumTeleporterVersion - The minimum teleporter version required for the token home contract.
* @param params.tokenHomeCustomByteCode - Optional. The customized bytecode for the token home contract.
* @param params.tokenHomeCustomABI - Optional. The customized ABI for the token home contract.
* @returns The transaction hash and the contract address of the deployed token home contract.
*/
deployTokenHomeContract(params: DeployTokenHomeContractParams): Promise<{
txHash: `0x${string}`;
contractAddress: `0x${string}`;
}>;
/**
* Deploy a token remote contract on the destination chain.
* @param params - The parameters for deploying the token remote contract.
* @param params.walletClient - The wallet client to use for deploying the token remote contract.
* @param params.sourceChain - The source chain to deploy the token remote contract on.
* @param params.destinationChain - The destination chain to deploy the token remote contract on.
* @param params.tokenHomeContract - The address of the token home contract to be used as the token remote contract.
* @param params.tokenRemoteCustomByteCode - Optional. The customized bytecode for the token remote contract.
* @param params.tokenRemoteCustomABI - Optional. The customized ABI for the token remote contract.
* @returns The transaction hash and the contract address of the deployed token remote contract.
*/
deployTokenRemoteContract(params: DeployTokenRemoteContractParams): Promise<{
txHash: `0x${string}`;
contractAddress: `0x${string}`;
}>;
/**
* Emits event from the TokenRemote contract to get it registered with the TokenHome contract on the source chain.
* @param params - The parameters for registering the token remote contract with the token home contract.
* @param params.walletClient - The wallet client to use for registering the token remote contract with the token home contract.
* @param params.sourceChain - The source chain to register the token remote contract with the token home contract on.
* @param params.destinationChain - The destination chain to register the token remote contract with the token home contract on.
* @param params.tokenRemoteContract - The address of the token remote contract to be registered with the token home contract.
* @param params.feeTokenAddress - Optional. The address of the fee token to be used for the registration.
* @param params.feeAmount - Optional. The amount of the fee to be used for the registration.
* @returns The transaction hash of the registration.
*/
registerRemoteWithHome(params: RegisterRemoteWithHomeParams): Promise<{
txHash: `0x${string}`;
}>;
/**
* Sends tokens from the TokenHome contract on the source chain to the TokenRemote contract on the destination chain.
* @param params - The parameters for sending the tokens.
* @param params.walletClient - The wallet client to use for sending the tokens.
* @param params.sourceChain - The source chain to send the tokens from.
* @param params.destinationChain - The destination chain to send the tokens to.
* @param params.tokenHomeContract - The address of the token home contract to send the tokens from.
* @param params.tokenRemoteContract - The address of the token remote contract to send the tokens to.
* @param params.recipient - The address of the recipient of the tokens.
* @param params.amountInBaseUnit - The amount of the tokens to be sent.
* @param params.feeTokenAddress - Optional. The address of the fee token to be used for the transfer.
* @param params.feeAmount - Optional. The amount of the fee to be used for the transfer.
* @returns The transaction hash of the transfer.
*/
sendToken(params: SendTokenParams): Promise<{
txHash: `0x${string}`;
}>;
}
/**
* Creates a new ICTT client.
* @param sourceChain - The default source chain to use for the client.
* @param destinationChain - The default destination chain to use for the client.
* @param gasLimit - The default gas limit to use for the client.
* @returns A new ICTT client.
*/
export declare function createICTTClient(sourceChain?: ChainConfig, destinationChain?: ChainConfig, gasLimit?: bigint): ICTT;
//# sourceMappingURL=ictt.d.ts.map