import { AbiFunction } from 'abitype'; import { EvmBridgeStep } from '../../../types/api/bridge'; import { EvmSigner } from '../../../types/signers/evmSigner'; import { HashportTransactionState, HashportTransactionData } from '../../../types/state'; declare const METHODS: readonly ["approve", "mint", "burn", "burnWithPermit", "lock", "unlock", "erc721Payment", "erc721Fee", "burnERC721", "mintERC721"]; type ContractMethod = (typeof METHODS)[number]; type ContractResultStateKeys = 'evmTransactionHash' | 'evmApprovalAmount' | 'nftPaymentToken' | 'nftFeeAmount' | 'erc20ApprovalTransactionHash' | 'erc721ApprovalTransactionHash' | 'confirmationTransactionHashOrId'; type ContractInteractionResult = { result: { [Key in ContractResultStateKeys]: Key extends 'erc20ApprovalTransactionHash' | 'erc721ApprovalTransactionHash' | 'confirmationTransactionHashOrId' | 'evmTransactionHash' ? { hash: `0x${string}`; key: Key; value?: undefined; } : { hash?: undefined; key: Key; value: Required[Key]; }; }[ContractResultStateKeys]; confirmations?: number; }; type _EvmContractHandler = Record Promise>; /** * Handles submitting EVM contract calls to the hashport router contract. A new instance must be * created for each step received from the API. */ export declare class EvmContractHandler implements _EvmContractHandler { signer: EvmSigner; step: EvmBridgeStep; transactionData: HashportTransactionData; abi: [AbiFunction]; functionName: ContractMethod; constructor(signer: EvmSigner, step: EvmBridgeStep, transactionData: HashportTransactionData); /** * @private * Formats arguments required for submitting "burn" or "lock" transactions to the router * contract. For fungible transactions only. */ private prepareBurnOrLockArgs; /** * @private * Signs typed data in accordance with {@link https://eips.ethereum.org/EIPS/eip-712 EIP712} for * the "burnWithPermit" method. * @param {string} spender The router contract address * @param {BigInt} value The token amount to bridge, formatted in wei * @param {BigInt} deadline One hour past the timestamp of the current block. */ private prepareBurnSignature; /** * @private * Approves an ERC20 token to the router contract. For fungible tokens, this step must be * completed before submitting "lock", "burn", or "burnWithPermit" transactions. For nonfungible * tokens, it must be completed before "burnERC721" transactions. If the token has already been * approved for the current amount or more, the function will return the amount without * performing a contract write method. * @param {BigInt} amount The amount to approve to the router contract. * @param targetAddress The address of the spender. In this case, the router contract. */ private approveERC20; /** * @private * Approves a wrapped ERC721 representation of a native Hedera NFT to the router contract * address for burning. Must be completed before the "burnERC721" step in order to port the NFT * back to Hedera. * @param {string} erc721Address The address of the wrapped ERC721 representation. * @param {BigInt} nftSerial The tokenId of the ERC721 to burn (in Hedera terms, the serial number). * @param {string} spender The address of the spender. In this case, the router contract. */ private approveERC721; /** * Handles token approvals to the router contract for both ERC20 and ERC721 tokens. */ approve(): Promise; /** * Handles minting wrapped ERC20 representations of native Hedera tokens after the Hedera * deposit transaction has been made. Requires majority and signatures from the validators. */ mint(): Promise; /** * Handles unlocking native EVM assets after the wrapped Hedera representations have been * returned to the bridge. Requires majority and signatures from the validators. */ unlock(): Promise; /** * Handles burning wrapped ERC20 representations of native Hedera assets. Requires signed typed * data. Validators will wait a designated number of block confirmations before sending native * assets to the user. Note: In the case of a Hedera asset other than HBAR, the target Hedera * asset MUST be associated to the receiving Hedera account. Failure to do so will result in a * stuck transaction. */ burnWithPermit(): Promise; /** * Handles burning wrapped ERC20 representations of native Hedera assets. Requires tokens to be * approved to the router contract. Validators will wait a designated number of block * confirmations before sending native assets to the user. Note: In the case of a Hedera asset * other than HBAR, the target Hedera asset MUST be associated to the receiving Hedera account. * Failure to do so will result in a stuck transaction. */ burn(): Promise; /** * Handles locking native EVM tokens in the router contract. Requires tokens to be approved to * the router contract. Validators will wait a designated number of block confirmations before * sending native assets to the user. Note: The target Hedera asset MUST be associated to the * receiving Hedera account. Failure to do so will result in a stuck transaction. */ lock(): Promise; /** * Handles minting wrapped ERC721 representations of native Hedera NFTs. Requires majority and * signatures from the validators. */ mintERC721(): Promise; /** * Handles burning wrapped ERC721 representations of native Hedera NFTs. Requires both the ERC20 * payment token and ERC721 in question to be approved to the router contract. Validators will * wait a designated number of block confirmations before sending the Hedera native NFT to the * user. Note: The target Hedera NFT MUST be associated to the receiving Hedera account. * Failure to do so will result in a stuck transaction. */ burnERC721(): Promise; /** * Performs a contract read to get the address of ERC20 payment token for porting the wrapped * ERC721 representation of a Hedera NFT back to Hedera. */ erc721Payment(): Promise; /** * Performs a contract read to get the amount of payment token required to complete porting a * wrapped ERC721 representation of a Hedera NFT back to Hedera. */ erc721Fee(): Promise; /** * Executes the contract call for the current EVM step. */ execute(): Promise; } export {};