import { TransactionReceipt, BytesLike, AddressLike, BigNumberish } from 'ethers'; import { Provider } from 'ethers'; import { TokenAmountStruct, TokenInfoStruct } from '../../typechain-types/contracts/core/CrossChainLayer'; import { NFTInfoStruct, NFTAmountStruct } from '../../typechain-types/contracts/core/Structs.sol/IStructsInterface'; /** * Token amount info to bridge for out message * @param evmAddress The EVM address of the token * @param amount The amount of tokens */ export type TokenAmount = TokenAmountStruct; /** * Jetton token info * @param name The name of the token * @param symbol The symbol of the token * @param decimals The number of decimals of the token * @param tvmAddress The TVM address of the token */ export type JettonInfo = TokenInfoStruct; /** * Mint info for a jetton token * @param info The jetton token info * @param amount The amount of tokens to mint */ export type TokenMintInfo = { info: JettonInfo; amount: bigint; }; /** * Mint info for a jetton token * @param info The jetton token info * @param mintAmount The amount of tokens to mint */ export type TVMFeeInfo = { tvmProtocolFee: bigint; tvmExecutorFee: bigint; }; export type TokenTVMFeeInfo = { amount: bigint; evmAddress?: string; jettonInfo?: JettonInfo; }; /** * Unlock info for an original evm token * @param evmAddress The EVM address of the token * @param amount The amount of tokens to unlock */ export type TokenUnlockInfo = TokenAmount; /** * NFT amount info to bridge for out message * @param evmAddress The EVM address of the token * @param tokenId The token id of the NFT * @param amount The amount of NFTs (for ERC1155) */ export type NFTAmount = NFTAmountStruct; /** * TON nft collection info * @param name The name of the NFT collection * @param symbol The symbol of the NFT collection * @param baseURI The base URI of the NFT collection * @param tvmAddress The TVM address of the NFT collection */ export type NFTInfo = NFTInfoStruct; /** * Mint info for an NFT * @param info The ton nft collection info * @param tokenId The token id of the NFT */ export type NFTMintInfo = { info: NFTInfo; tokenId: bigint; }; /** * Unlock info for an original evm NFT * @param evmAddress The EVM address of the token * @param tokenId The token id of the NFT * @param amount The amount of NFTs (for ERC1155) */ export type NFTUnlockInfo = NFTAmount; /** * Out message info * @param shardsKey The tracking key of the out message * @param operationId The operation id of the out message * @param callerAddress The EVM caller address of the out message * @param targetAddress The TVM target address of the out message * @param payload The TVM payload of the out message * @param protocolFee The protocol fee * @param executorFee The executor fee * @param tvmValidExecutors The list of valid executors for TVM * @param tokensBurned The list of tokens burned for bridge to TON - origin tvm jettons * @param tokensLocked The list of tokens locked for bridge to TON - origin evm erc20 * @param nftsBurned The list of NFTs burned for bridge to TON - origin tvm nft * @param nftsLocked The list of NFTs locked for bridge to TON - origin evm nft (erc721 or erc1155) */ export type OutMessageInfo = { shardsKey: BigNumberish; operationId: BytesLike; callerAddress: AddressLike; targetAddress: string; payload: string; protocolFee: bigint; executorFee: bigint; tvmValidExecutors: string[]; tokensBurned: TokenAmount[]; tokensLocked: TokenAmount[]; nftsBurned: NFTAmount[]; nftsLocked: NFTAmount[]; }; /** * Deploy info for a token * @param evmAddress The EVM address of the deployed token * @param tvmAddress The TVM address of the origin jetton token */ export type DeployInfo = { evmAddress: string; tvmAddress: string; }; /** * Send message result * @param receipt The transaction receipt of the message * @param deployedTokens The list of deployed tokens * @param outMessages The list of out messages */ export type SendMessageOutput = { receipt: TransactionReceipt; deployedTokens: DeployInfo[]; outMessages: OutMessageInfo[]; }; /** * Test SDK for local testing */ export declare class TacLocalTestSdk { private contracts; private admin; private sequencer; private executor; private crossChainLayerAddress; private smartAccountFactoryAddress; private settingsAddress; private tokenUtilsAddress; private wTACAddress; private NATIVE_TOKEN_ADDRESS; private TON_TOKEN_ADDRESS; private inited; /** Create a new instance of the SDK * @param provider The ethers provider * @returns The CrossChainLayer contract address */ create(provider: Provider): Promise; /** Set up the cross chain layer with native TAC balance for testing */ lockNativeTacOnCrossChainLayer(amount: bigint): Promise; /** Get protocol fee */ getProtolFee(): Promise; /** * Parse out message events from the transaction receipt * @param receipt the transaction receipt * @returns array of OutMessageInfo */ parseOutMessages(receipt: TransactionReceipt): OutMessageInfo[]; /** * Parse token created events from the transaction receipt * @param receipt The transaction receipt * @returns array of DeployInfo */ parseTokenCreated(receipt: TransactionReceipt): DeployInfo[]; getCrossChainLayerAddress(): string; getSmartAccountFactoryAddress(): string; getWrappedTONAddress(): string; getSettingsAddress(): string; getWTACAddress(): string; getNativeTokenAddress(): string; getEVMJettonAddress(tvmAddress: string): string; getEVMNFTCollectionAddress(tvmAddress: string): string; getNativeTonInfo(): JettonInfo; /** Send message via cross chain layer * @param shardsKey The tracking key of the message * @param target The target address for the message, may be "" if needs just bridge * @param methodName The method name to call on the target, may be "" if needs just bridge * @param callArguments The encoded argumets that will be passed to the target, may be "" if needs just bridge * @param tvmCaller The TVM caller address of the message * @param mintTokens The list of tokens to mint, originally locked on the TVM, will be deployed if not exist * @param unlockTokens The list of tokens to unlock, originally locked on the EVM * @param tacUnlockAmount The amount of native TAC to unlock * @param extraData The untrusted extra data of the message, provided by executor (optional) * @param operationId The operation id of the message (optional) * @param timestamp The timestamp of the message (optional) * @param gasLimit The gasLimit of the message (optional) * @param forceSend Should we force sending the message in case of an error via simulation? (false by default) * @returns Object of SendMessageOutput struct */ sendMessage(shardsKey: bigint, target: string, methodName: string, callArguments: BytesLike, tvmCaller: string, mintTokens: TokenMintInfo[], unlockTokens: TokenUnlockInfo[], tacUnlockAmount: bigint, extraData?: BytesLike | undefined, operationId?: BytesLike | undefined, timestamp?: bigint | undefined, gasLimit?: bigint, forceSend?: boolean): Promise; /** Send message via cross chain layer * @param shardsKey The tracking key of the message * @param target The target address for the message, may be "" if needs just bridge * @param methodName The method name to call on the target, may be "" if needs just bridge * @param callArguments The encoded argumets that will be passed to the target, may be "" if needs just bridge * @param tvmCaller The TVM caller address of the message * @param mintTokens The list of tokens to mint, originally locked on the TVM, will be deployed if not exist * @param unlockTokens The list of tokens to unlock, originally locked on the EVM * @param mintNFTs The list of NFTs to mint, originally locked on the TVM, will be deployed if not exist * @param unlockNFTs The list of NFTs to unlock, originally locked on the EVM * @param tacUnlockAmount The amount of native TAC to unlock * @param extraData The untrusted extra data of the message, provided by executor (optional) * @param operationId The operation id of the message (optional) * @param timestamp The timestamp of the message (optional) * @param gasLimit The gasLimit of the message (optional) * @param forceSend Should we force sending the message in case of an error via simulation? (false by default) * @returns Object of SendMessageOutput struct */ sendMessageWithNFT(shardsKey: bigint, target: string, methodName: string, callArguments: BytesLike, tvmCaller: string, mintTokens: TokenMintInfo[], unlockTokens: TokenUnlockInfo[], mintNFTs: NFTMintInfo[], unlockNFTs: NFTUnlockInfo[], tacUnlockAmount: bigint, extraData?: BytesLike | undefined, operationId?: BytesLike | undefined, timestamp?: bigint | undefined, gasLimit?: bigint, forceSend?: boolean): Promise; }