### Build and Test ZetaChain Contracts with Foundry - Bash Source: https://github.com/zeta-chain/toolkit/blob/main/README_RUNTEST.md Commands to compile ZetaChain smart contracts using Forge and execute the tests. This step verifies the functionality of the smart contracts after setup and dependency installation. ```bash forge build forge test ``` -------------------------------- ### Install ZetaChain Toolkit Source: https://github.com/zeta-chain/toolkit/blob/main/README.md Installs the ZetaChain Toolkit SDK using npm. This is the first step to integrate ZetaChain's cross-chain capabilities into your project. ```bash npm i @zetachain/toolkit ``` -------------------------------- ### Install ZetaChain Packages and Forge Dependencies - Bash Source: https://github.com/zeta-chain/toolkit/blob/main/README_RUNTEST.md Installs necessary JavaScript dependencies, specific ZetaChain protocol and toolkit packages (version 13.0.0 for protocol contracts), and the Forge standard library. This is a prerequisite for building and testing ZetaChain smart contracts with Foundry. ```bash yarn yarn add @zetachain/protocol-contracts@13.0.0 yarn add @zetachain/toolkit yarn add @zetachain/standard-contracts forge install foundry-rs/forge-std ``` -------------------------------- ### Cross-chain Deposit with ZetaChain Toolkit (TypeScript) Source: https://github.com/zeta-chain/toolkit/blob/main/README.md Demonstrates how to deposit tokens from an EVM-compatible chain to ZetaChain using the `evmDeposit` function. Requires an ethers signer and specifies token details and receiver address on ZetaChain. ```typescript import { evmDeposit } from "@zetachain/toolkit"; // Deposit USDC from Ethereum to ZetaChain await evmDeposit( { amount: "1.0", receiver: "0xReceiverOnZetaChain", // EOA or contract on ZetaChain token: "0xUSDC", // ERC-20 on the origin chain }, { signer: ethersSigner } ); ``` -------------------------------- ### ZetaChain Toolkit: Cross-chain Operations with TypeScript Source: https://github.com/zeta-chain/toolkit/blob/main/docs/index.md Demonstrates essential cross-chain operations using the ZetaChain Toolkit in TypeScript. It covers depositing tokens from an EVM chain to ZetaChain and making calls to contracts on connected chains from ZetaChain. This snippet requires ethers.js for signer management. ```typescript import { evmDeposit, zetachainCall } from "@zetachain/toolkit"; // Deposit USDC from Ethereum to ZetaChain await evmDeposit( { amount: "1.0", receiver: "0xReceiverOnZetaChain", // EOA or contract on ZetaChain token: "0xUSDC", // ERC-20 on the origin chain }, { signer: ethersSigner } ); // Ping a contract on Ethereum from ZetaChain await zetachainCall( { receiver: "0xRecevierContract", // contract on a connected chain function: "hello(string)", types: ["string"], values: ["alice"], zrc20: "0xZRC20", }, { signer: ethersSigner } ); ``` -------------------------------- ### Solana Deposit Source: https://github.com/zeta-chain/toolkit/blob/main/docs/index.md Deposits tokens from Solana to ZetaChain. ```APIDOC ## POST /solanaDeposit ### Description Deposits tokens from Solana to ZetaChain. This function allows you to transfer tokens from Solana to ZetaChain. It supports both native SOL and SPL tokens. ### Method POST ### Endpoint /solanaDeposit ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **params** (object) - Required - The deposit parameters. - **amount** (string) - Required - The amount of tokens to deposit. - **receiver** (string) - Required - The recipient address on ZetaChain. - **revertOptions** (object) - Required - Options for handling reverts. - **callOnRevert** (boolean) - Required - Whether to call on revert. - **revertMessage** (string) - Required - The message to include in case of revert. - **abortAddress** (string) - Optional - The address to abort to. - **onRevertGasLimit** (string | number | bigint) - Optional - The gas limit for revert. - **revertAddress** (string) - Optional - The address to revert to. - **token** (string) - Optional - The mint address of the SPL token (if not native SOL). - **options** (object) - Required - Configuration options. - **chainId** (string) - Required - The Solana chain ID. - **signer** (Keypair) - Required - The Solana keypair for signing. ### Request Example ```json { "params": { "amount": "1000000", "receiver": "zeta_receiver_address", "revertOptions": { "callOnRevert": true, "revertMessage": "Failed to deposit" }, "token": "spl_token_mint_address" }, "options": { "chainId": "devnet", "signer": "solana_keypair_object" } } ``` ### Response #### Success Response (200) - **transactionSignature** (string) - The transaction signature. #### Response Example ```json "signature456xyz" ``` ``` -------------------------------- ### EVM Deposit and Call Source: https://github.com/zeta-chain/toolkit/blob/main/docs/index.md Deposits tokens from an EVM chain to ZetaChain and makes a cross-chain call to a universal contract. ```APIDOC ## POST /evmDepositAndCall ### Description Deposits tokens and makes a cross-chain call from an EVM chain to a universal contract on ZetaChain. This function combines token deposit with a contract call in a single transaction. ### Method POST ### Endpoint /evmDepositAndCall ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **params** (object) - Required - The deposit and call parameters. - **amount** (string) - Required - The amount of tokens to deposit. - **receiver** (string) - Required - The recipient address on ZetaChain. - **revertOptions** (object) - Required - Options for handling reverts. - **callOnRevert** (boolean) - Required - Whether to call on revert. - **revertMessage** (string) - Required - The message to include in case of revert. - **abortAddress** (string) - Optional - The address to abort to. - **onRevertGasLimit** (string | number | bigint) - Optional - The gas limit for revert. - **revertAddress** (string) - Optional - The address to revert to. - **token** (string) - Optional - The address of the token contract (if not native). - **types** (string[]) - Required - The types of the function arguments. - **values** (string | bigint | boolean[]) - Required - The values of the function arguments. - **options** (object) - Required - Configuration options. - **signer** (AbstractSigner) - Required - The signer instance. - **gateway** (string) - Optional - The gateway address. - **txOptions** (object) - Optional - Transaction options. - **gasLimit** (string | number | bigint) - Optional - The gas limit for the transaction. - **gasPrice** (string | number | bigint) - Optional - The gas price for the transaction. - **value** (string | number | bigint) - Optional - The value to send with the transaction. ### Request Example ```json { "params": { "amount": "1000000", "receiver": "zeta_receiver_address", "revertOptions": { "callOnRevert": true, "revertMessage": "Failed to deposit" }, "token": "erc20_token_address", "types": ["uint256", "address"], "values": ["1000000", "0x123...abc"] }, "options": { "signer": "signer_instance", "txOptions": { "gasLimit": "200000" } } } ``` ### Response #### Success Response (200) - **transactionResponse** (ContractTransactionResponse) - The transaction receipt. #### Response Example ```json { "transactionHash": "0xabc123...", "blockHash": "0xdef456...", "blockNumber": 12345, "confirmations": 1, "from": "0xSenderAddress", "to": "0xContractAddress", "gasUsed": "50000", "logs": [], "status": 1 } ``` ``` -------------------------------- ### Deposit Tokens from Solana to ZetaChain Source: https://github.com/zeta-chain/toolkit/blob/main/docs/index.md Transfers tokens from Solana to ZetaChain, supporting native SOL and SPL tokens. Automatically handles token account creation and transfers for SPL tokens. ```typescript async solanaDeposit( params: { amount: string; receiver: string; revertOptions?: { abortAddress?: string; callOnRevert: boolean; onRevertGasLimit?: string | number | bigint; revertAddress?: string; revertMessage: string; }; token?: string; }, options: { chainId: string; signer: Keypair; } ): Promise ``` -------------------------------- ### Perform EVM Deposit and Contract Call Source: https://github.com/zeta-chain/toolkit/blob/main/docs/index.md Combines token deposit with a contract call in a single transaction from an EVM chain to ZetaChain's universal contract. Supports native and ERC20 tokens. ```typescript async evmDepositAndCall( params: { amount: string; receiver: string; revertOptions?: { abortAddress?: string; callOnRevert: boolean; onRevertGasLimit?: string | number | bigint; revertAddress?: string; revertMessage: string; }; token?: string; types: string[]; values: (string | bigint | boolean)[]; }, options: { gateway?: string; signer: AbstractSigner; txOptions?: { gasLimit?: string | number | bigint; gasPrice?: string | number | bigint; value?: string | number | bigint; }; } ): Promise ``` -------------------------------- ### Deposit and Call TON to ZetaChain Source: https://github.com/zeta-chain/toolkit/blob/main/docs/index.md Combines token deposit with a contract call in a single transaction. It allows transferring TON tokens from the TON blockchain to ZetaChain and immediately executing a function call on the universal contract. Supports raw data for non-EVM chains or types and values for EVM chains. ```typescript import { tonDepositAndCall } from "@zetachain/toolkit"; async function performTonDepositAndCall(params: any, options: any) { await tonDepositAndCall(params, options); } ``` -------------------------------- ### evmDeposit() - EVM Chain Token Deposit to ZetaChain Source: https://github.com/zeta-chain/toolkit/blob/main/docs/index.md Deposits tokens from an EVM chain to ZetaChain. Supports native tokens and ERC20 tokens, automatically handling token approval for ERC20. ```APIDOC ## EVM Chain Token Deposit to ZetaChain ### Description Deposits tokens from an EVM chain to ZetaChain. This function allows you to transfer tokens from an EVM chain to ZetaChain. It supports both native tokens (ETH, BNB, AVAX, etc.) and ERC20 tokens. For ERC20 tokens, it automatically handles token approval before deposit. ### Method POST (Implied by SDK function call) ### Endpoint Not directly exposed as a REST endpoint, but represents an SDK function call. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body (Represented by SDK function parameters) - **params** (object) - Required - The deposit parameters including amount, receiver, token address, and revert options - **amount** (string) - Required - The amount of tokens to deposit. - **receiver** (string) - Required - The recipient address on ZetaChain. - **token** (string) - Optional - The address of the token contract on the origin EVM chain. If not provided, it defaults to the native token of the chain. - **revertOptions** (object) - Optional - Options for handling reverts. - **abortAddress** (string) - Optional - Address to send funds to if the transaction reverts. - **callOnRevert** (boolean) - Required - Whether to call a specific function on revert. - **onRevertGasLimit** (string | number | bigint) - Optional - Gas limit for the revert call. - **revertAddress** (string) - Optional - Address to send the reverted transaction to. - **revertMessage** (string) - Required - The message to include in the revert. - **options** (object) - Required - Configuration options including signer and optional gateway address - **signer** (AbstractSigner) - Required - The ethers signer object. - **gateway** (string) - Optional - The gateway address. - **txOptions** (object) - Optional - Transaction options. - **gasLimit** (string | number | bigint) - Optional - Gas limit for the transaction. - **gasPrice** (string | number | bigint) - Optional - Gas price for the transaction. - **value** (string | number | bigint) - Optional - Value to send with the transaction. ### Request Example (SDK function call) ```typescript await evmDeposit( { amount: "1.0", receiver: "0xReceiverOnZetaChain", token: "0xUSDC", // ERC-20 on the origin chain revertOptions: { revertMessage: "Deposit failed" } }, { signer: ethersSigner } ); ``` ### Response #### Success Response (200) - **ContractTransactionResponse** (object) - The transaction receipt. #### Response Example (Returned by ethers.js upon successful transaction) ```json { "hash": "0x...", "gasLimit": 1000000, "gasPrice": 20000000000, "nonce": 1, "value": 0, "data": "0x...", "from": "0xSenderAddress", "to": "0xContractAddress", "wait": () => Promise.resolve({ ... }) } ``` ``` -------------------------------- ### Deposit and Call from Solana to ZetaChain Source: https://github.com/zeta-chain/toolkit/blob/main/docs/index.md The solanaDepositAndCall function allows for depositing tokens from Solana and simultaneously making a cross-chain call to a universal contract on ZetaChain. It supports both native SOL and SPL tokens, combining deposit and call actions into a single transaction. Parameters include amount, receiver, token details, function types/values, and revert options. ```typescript import { DepositAndCallParams, DepositOptions, SolanaNetwork, } from "@zetachain/sdk"; async function solanaDepositAndCall( params: DepositAndCallParams, options: DepositOptions ): Promise { // ... implementation details ... return "txSignature"; } ``` -------------------------------- ### Cross-chain Contract Call with ZetaChain Toolkit (TypeScript) Source: https://github.com/zeta-chain/toolkit/blob/main/README.md Illustrates how to invoke a contract function on a connected chain (e.g., Ethereum) from ZetaChain using `zetachainCall`. This function allows for cross-chain contract interactions, specifying the target contract, function signature, types, values, and ZRC20 address. ```typescript import { zetachainCall } from "@zetachain/toolkit"; // Ping a contract on Ethereum from ZetaChain await zetachainCall( { receiver: "0xRecevierContract", // contract on a connected chain function: "hello(string)", types: ["string"], values: ["alice"], zrc20: "0xZRC20", }, { signer: ethersSigner } ); ``` -------------------------------- ### evmCall() - EVM to ZetaChain Contract Call Source: https://github.com/zeta-chain/toolkit/blob/main/docs/index.md Makes a cross-chain call from an EVM chain to a universal contract on ZetaChain. Useful for executing contract logic across different chains without token transfers. ```APIDOC ## EVM to ZetaChain Contract Call ### Description Makes a cross-chain call from an EVM chain to a universal contract on ZetaChain. This function allows you to call a contract function on a destination EVM chain without transferring any tokens. It's useful for executing contract logic across different chains. ### Method POST (Implied by SDK function call) ### Endpoint Not directly exposed as a REST endpoint, but represents an SDK function call. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body (Represented by SDK function parameters) - **params** (object) - Required - The call parameters including receiver address, function types/values, and revert options - **receiver** (string) - Required - The address of the contract to call on ZetaChain. - **types** (string[]) - Required - An array of strings representing the types of the function arguments. - **values** (string | bigint | boolean[]) - Required - An array of values for the function arguments. - **revertOptions** (object) - Optional - Options for handling reverts. - **abortAddress** (string) - Optional - Address to send funds to if the transaction reverts. - **callOnRevert** (boolean) - Required - Whether to call a specific function on revert. - **onRevertGasLimit** (string | number | bigint) - Optional - Gas limit for the revert call. - **revertAddress** (string) - Optional - Address to send the reverted transaction to. - **revertMessage** (string) - Required - The message to include in the revert. - **options** (object) - Required - Configuration options including signer and optional gateway address - **signer** (AbstractSigner) - Required - The ethers signer object. - **gateway** (string) - Optional - The gateway address. - **txOptions** (object) - Optional - Transaction options. - **gasLimit** (string | number | bigint) - Optional - Gas limit for the transaction. - **gasPrice** (string | number | bigint) - Optional - Gas price for the transaction. - **value** (string | number | bigint) - Optional - Value to send with the transaction. ### Request Example (SDK function call) ```typescript await evmCall( { receiver: "0xRecevierContract", function: "hello(string)", types: ["string"], values: ["alice"], revertOptions: { revertMessage: "Transaction failed" } }, { signer: ethersSigner } ); ``` ### Response #### Success Response (200) - **ContractTransactionResponse** (object) - The transaction receipt. #### Response Example (Returned by ethers.js upon successful transaction) ```json { "hash": "0x...", "gasLimit": 1000000, "gasPrice": 20000000000, "nonce": 1, "value": 0, "data": "0x...", "from": "0xSenderAddress", "to": "0xContractAddress", "wait": () => Promise.resolve({ ... }) } ``` ``` -------------------------------- ### solanaDepositAndCall Source: https://github.com/zeta-chain/toolkit/blob/main/docs/index.md Deposits tokens and makes a cross-chain call from Solana to a universal contract on ZetaChain. This function combines token deposit with a contract call in a single transaction. ```APIDOC ## POST /solanaDepositAndCall ### Description Deposits tokens and makes a cross-chain call from Solana to a universal contract on ZetaChain. This function combines token deposit with a contract call in a single transaction. It allows you to transfer tokens from Solana to ZetaChain and immediately execute a function call on the universal contract. Supports both native SOL and SPL tokens. ### Method POST ### Endpoint /solanaDepositAndCall ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **params** (object) - Required - The deposit and call parameters including amount, receiver, token mint address, function types/values, and revert options - **params.amount** (string) - Required - The amount to deposit. - **params.receiver** (string) - Required - The recipient address on ZetaChain. - **params.revertOptions** (object) - Optional - Options for handling reverts. - **params.revertOptions.abortAddress?** (string) - Optional - The address to abort to on revert. - **params.revertOptions.callOnRevert** (boolean) - Required - Whether to call on revert. - **params.revertOptions.onRevertGasLimit?** (string | number | bigint) - Optional - Gas limit for revert. - **params.revertOptions.revertAddress?** (string) - Optional - The address for revert. - **params.revertOptions.revertMessage** (string) - Required - The message for revert. - **params.token?** (string) - Optional - The token mint address (for SPL tokens). - **params.types** (string[]) - Required - The types of the function call. - **params.values** (Array) - Required - The values for the function call. - **options** (object) - Required - Configuration options including chain ID and signer keypair - **options.chainId** (string) - Required - The chain ID of the target network. - **options.signer** (Keypair) - Required - The keypair for signing the transaction. ### Request Example ```json { "params": { "amount": "1000000", "receiver": "zeta_receiver_address", "token": "spl_token_address", "types": ["uint256", "address"], "values": ["100", "zeta_contract_address"], "revertOptions": { "callOnRevert": true, "revertMessage": "Transaction failed" } }, "options": { "chainId": "20", "signer": "" } } ``` ### Response #### Success Response (200) - **transactionSignature** (string) - The signature of the submitted transaction. #### Response Example ```json { "transactionSignature": "" } ``` ``` -------------------------------- ### suiDepositAndCall Source: https://github.com/zeta-chain/toolkit/blob/main/docs/index.md Deposits tokens and makes a cross-chain call from Sui to a universal contract on ZetaChain. This function combines token deposit with a contract call in a single transaction. ```APIDOC ## POST /suiDepositAndCall ### Description Deposits tokens and makes a cross-chain call from Sui to a universal contract on ZetaChain. This function combines token deposit with a contract call in a single transaction. It allows you to transfer tokens from Sui to ZetaChain and immediately execute a function call on the universal contract. Supports both native SUI and other coin types. ### Method POST ### Endpoint /suiDepositAndCall ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **params** (object) - Required - The deposit and call parameters including amount, receiver, coin type, function types/values - **params.amount** (string) - Required - The amount to deposit. - **params.receiver** (string) - Required - The recipient address on ZetaChain. - **params.token?** (string) - Optional - The type of coin to deposit (e.g., '0x2::sui::SUI'). - **params.types** (string[]) - Required - The types of the function call. - **params.values** (Array) - Required - The values for the function call. - **options** (object) - Required - Configuration options including chain ID, gas limit, gateway settings, and signer - **options.chainId** (string) - Required - The chain ID of the target network (e.g., "103", "105", "104"). - **options.gasLimit?** (string) - Optional - The gas limit for the transaction. - **options.gatewayObject?** (string) - Optional - The gateway object ID. - **options.gatewayPackage?** (string) - Optional - The gateway package ID. - **options.signer** (Ed25519Keypair) - Required - The Ed25519 keypair for signing the transaction. ### Request Example ```json { "params": { "amount": "1000000000", "receiver": "zeta_receiver_address", "token": "0x2::sui::SUI", "types": ["uint256", "address"], "values": ["100", "zeta_contract_address"] }, "options": { "chainId": "103", "signer": "" } } ``` ### Response #### Success Response (200) - **void** - The transaction has been executed. #### Response Example ```json {} ``` ``` -------------------------------- ### Deposit and Call from Sui to ZetaChain Source: https://github.com/zeta-chain/toolkit/blob/main/docs/index.md The suiDepositAndCall function enables depositing tokens from Sui and executing a cross-chain call to a universal contract on ZetaChain in one transaction. It supports native SUI and other coin types. Parameters include amount, receiver, token details, function types/values, and options for chain ID, gas limit, and signer. ```typescript import { DepositAndCallParams, SuiDepositOptions, SuiNetwork, } from "@zetachain/sdk"; async function suiDepositAndCall( params: DepositAndCallParams, options: SuiDepositOptions ): Promise { // ... implementation details ... } ``` -------------------------------- ### ZetaChain Toolkit: EVM Deposit Function Source: https://github.com/zeta-chain/toolkit/blob/main/docs/index.md The `evmDeposit` function facilitates token transfers from an EVM chain to ZetaChain. It supports both native and ERC20 tokens, automatically handling necessary approvals for ERC20 deposits. The function requires deposit parameters and signer configuration. ```typescript async evmDeposit( params: { amount: string; receiver: string; token?: string; revertOptions?: { abortAddress?: string; callOnRevert: boolean; onRevertGasLimit?: string | number | bigint; revertAddress?: string; revertMessage: string; }; }, options: { signer: AbstractSigner; gateway?: string; txOptions?: { gasLimit?: string | number | bigint; gasPrice?: string | number | bigint; value?: string | number | bigint; }; } ): Promise ``` -------------------------------- ### Deposit from Sui to ZetaChain Source: https://github.com/zeta-chain/toolkit/blob/main/docs/index.md The suiDeposit function facilitates the transfer of tokens from the Sui blockchain to ZetaChain. It handles native SUI and other coin types, automatically managing coin splitting and transaction construction. Key parameters include amount, receiver, and optional token type, with options for chain ID, gas limit, and signer. ```typescript import { DepositParams, SuiDepositOptions, SuiNetwork, } from "@zetachain/sdk"; async function suiDeposit( params: DepositParams, options: SuiDepositOptions ): Promise { // ... implementation details ... } ``` -------------------------------- ### ZetaChain Toolkit: EVM Call Function Source: https://github.com/zeta-chain/toolkit/blob/main/docs/index.md The `evmCall` function enables cross-chain contract interactions from an EVM chain to a universal contract on ZetaChain. It allows executing contract logic without token transfers. The function takes call parameters and configuration options, including signer details. ```typescript async evmCall( params: { receiver: string; revertOptions?: { abortAddress?: string; callOnRevert: boolean; onRevertGasLimit?: string | number | bigint; revertAddress?: string; revertMessage: string; }; types: string[]; values: (string | bigint | boolean)[]; }, options: { signer: AbstractSigner; gateway?: string; txOptions?: { gasLimit?: string | number | bigint; gasPrice?: string | number | bigint; value?: string | number | bigint; }; } ): Promise ``` -------------------------------- ### Execute Solana Cross-Chain Contract Call Source: https://github.com/zeta-chain/toolkit/blob/main/docs/index.md Makes a cross-chain call from Solana to a universal contract on ZetaChain without transferring tokens. Useful for executing contract logic across chains. ```typescript async solanaCall( params: { receiver: string; revertOptions?: { abortAddress?: string; callOnRevert: boolean; onRevertGasLimit?: string | number | bigint; revertAddress?: string; revertMessage: string; }; types: string[]; values: (string | bigint | boolean)[]; }, options: { chainId: string; signer: Keypair; } ): Promise ``` -------------------------------- ### Deposit from TON to ZetaChain Source: https://github.com/zeta-chain/toolkit/blob/main/docs/index.md The tonDeposit function allows users to deposit TON tokens from the TON blockchain to ZetaChain. It simplifies the process by handling wallet connections and transaction signing automatically. Parameters include amount and receiver address, with configuration options for chain ID, RPC endpoint, and wallet. ```typescript import { TonDepositParams, TonDepositOptions, } from "@zetachain/sdk"; async function tonDeposit( params: TonDepositParams, options: TonDepositOptions ): Promise { // ... implementation details ... } ``` -------------------------------- ### Solana Call Source: https://github.com/zeta-chain/toolkit/blob/main/docs/index.md Makes a cross-chain call from Solana to a universal contract on ZetaChain without transferring tokens. ```APIDOC ## POST /solanaCall ### Description Makes a cross-chain call from Solana to a universal contract on ZetaChain. This function allows you to call a contract function on a universal contract from Solana without transferring any tokens. ### Method POST ### Endpoint /solanaCall ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **params** (object) - Required - The call parameters. - **receiver** (string) - Required - The receiver address on ZetaChain. - **revertOptions** (object) - Required - Options for handling reverts. - **callOnRevert** (boolean) - Required - Whether to call on revert. - **revertMessage** (string) - Required - The message to include in case of revert. - **abortAddress** (string) - Optional - The address to abort to. - **onRevertGasLimit** (string | number | bigint) - Optional - The gas limit for revert. - **revertAddress** (string) - Optional - The address to revert to. - **types** (string[]) - Required - The types of the function arguments. - **values** (string | bigint | boolean[]) - Required - The values of the function arguments. - **options** (object) - Required - Configuration options. - **chainId** (string) - Required - The Solana chain ID. - **signer** (Keypair) - Required - The Solana keypair for signing. ### Request Example ```json { "params": { "receiver": "zeta_receiver_address", "revertOptions": { "callOnRevert": true, "revertMessage": "Failed to call" }, "types": ["uint256"], "values": ["100"] }, "options": { "chainId": "devnet", "signer": "solana_keypair_object" } } ``` ### Response #### Success Response (200) - **transactionSignature** (string) - The transaction signature. #### Response Example ```json "signature123abc" ``` ``` -------------------------------- ### suiDeposit Source: https://github.com/zeta-chain/toolkit/blob/main/docs/index.md Deposits tokens from Sui to ZetaChain. This function allows you to transfer tokens from Sui to ZetaChain and supports both native SUI and other coin types. ```APIDOC ## POST /suiDeposit ### Description Deposits tokens from Sui to ZetaChain. This function allows you to transfer tokens from Sui to ZetaChain. It supports both native SUI and other coin types. The function automatically handles coin splitting and transaction construction. ### Method POST ### Endpoint /suiDeposit ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **params** (object) - Required - The deposit parameters including amount, receiver, and optional coin type - **params.amount** (string) - Required - The amount to deposit. - **params.receiver** (string) - Required - The recipient address on ZetaChain. - **params.token?** (string) - Optional - The type of coin to deposit (e.g., '0x2::sui::SUI'). - **options** (object) - Required - Configuration options including chain ID, gas limit, gateway settings, and signer - **options.chainId** (string) - Required - The chain ID of the target network (e.g., "103", "105", "104"). - **options.gasLimit?** (string) - Optional - The gas limit for the transaction. - **options.gatewayObject?** (string) - Optional - The gateway object ID. - **options.gatewayPackage?** (string) - Optional - The gateway package ID. - **options.signer** (Ed25519Keypair) - Required - The Ed25519 keypair for signing the transaction. ### Request Example ```json { "params": { "amount": "1000000000", "receiver": "zeta_receiver_address", "token": "0x2::sui::SUI" }, "options": { "chainId": "103", "signer": "" } } ``` ### Response #### Success Response (200) - **void** - The transaction has been executed. #### Response Example ```json {} ``` ``` -------------------------------- ### tonDepositAndCall Source: https://github.com/zeta-chain/toolkit/blob/main/docs/index.md Deposits TON tokens and makes a cross-chain call from TON to a universal contract on ZetaChain. This function combines token deposit with a contract call in a single transaction. ```APIDOC ## POST /tonDepositAndCall ### Description Deposits TON tokens and makes a cross-chain call from TON to a universal contract on ZetaChain. This function combines token deposit with a contract call in a single transaction. ### Method POST ### Endpoint /tonDepositAndCall ### Parameters #### Request Body - **params** (object) - Required - The deposit and call parameters including amount, receiver, and call data - **params.amount** (string) - Required - The amount of tokens to deposit. - **params.data** (string) - Optional - Raw data string for non-EVM chains. - **params.receiver** (string) - Required - The recipient address on the destination chain. - **params.types** (string[]) - Optional - Parameter types for EVM chains. - **params.values** (string | bigint | boolean[]) - Optional - Parameter values for EVM chains. - **options** (object) - Optional - Configuration options including chain ID, RPC endpoint, wallet, and API key - **options.apiKey** (string) - Optional - API key for authentication. - **options.chainId** (string) - Required - The chain ID of the destination network. - **options.gateway** (string) - Optional - The gateway address. - **options.keyPair** (KeyPair) - Optional - Key pair for signing transactions. - **options.rpc** (string) - Required - The RPC endpoint for the network. - **options.signer** (string) - Optional - The signer address. - **options.wallet** (WalletContractV4) - Optional - The wallet contract instance. ### Request Example ```json { "params": { "amount": "1000000000000000000", "receiver": "0x...", "data": "0x...", "types": ["uint256", "address"], "values": ["100", "0x..."] }, "options": { "chainId": "zeta-testnet-1", "rpc": "https://..." } } ``` ### Response #### Success Response (200) - **None** - This function returns a Promise. #### Response Example (No specific JSON response for success, Promise resolves to void) ``` -------------------------------- ### ZetaChain Withdraw and Call Function Signature Source: https://github.com/zeta-chain/toolkit/blob/main/docs/index.md This snippet shows the TypeScript signature for the zetachainWithdrawAndCall function. It specifies the expected parameters, including withdrawal and call details, transaction options, and the return type, which is a Promise resolving to gas fee, gas ZRC20 address, and transaction response. ```typescript zetachainWithdrawAndCall( params: { amount: string; callOptions: { gasLimit: string | number | bigint; isArbitraryCall: boolean; }; data?: string; function?: string; receiver: string; revertOptions: { abortAddress?: string; callOnRevert: boolean; onRevertGasLimit?: string | number | bigint; revertAddress?: string; revertMessage: string; }; types?: string[]; values?: (string | bigint | boolean)[]; zrc20: string; }, options: { gateway?: string; signer: Wallet; txOptions?: { gasLimit?: string | number | bigint; gasPrice?: string | number | bigint; value?: string | number | bigint; }; } ): Promise<{ gasFee: bigint; gasZRC20: string; tx: ContractTransactionResponse }>; ``` -------------------------------- ### zetachainWithdraw Source: https://github.com/zeta-chain/toolkit/blob/main/docs/index.md Withdraws tokens from ZetaChain to a destination chain. It handles gas fee calculation and approval, combining approvals if the withdrawal token is the same as the gas token. ```APIDOC ## POST /zetachainWithdraw ### Description Withdraws tokens from ZetaChain to a destination chain. This function allows you to transfer ZRC20 tokens from ZetaChain to a destination chain. It automatically handles gas fee calculation and approval. If the withdrawal token is the same as the gas token, it combines the approvals into a single transaction. ### Method POST ### Endpoint /zetachainWithdraw ### Parameters #### Request Body - **params** (object) - Required - The withdrawal parameters including amount, receiver address, ZRC20 token, and revert options. - **params.amount** (string) - Required - The amount of tokens to withdraw. - **params.receiver** (string) - Required - The recipient address on the destination chain. - **params.revertOptions** (object) - Optional - Options for handling reverts. - **params.revertOptions.abortAddress** (string) - Optional - Address to abort the transaction to. - **params.revertOptions.callOnRevert** (boolean) - Required - Whether to call on revert. - **params.revertOptions.onRevertGasLimit** (string | number | bigint) - Optional - Gas limit for the revert call. - **params.revertOptions.revertAddress** (string) - Optional - Address to send revert messages to. - **params.revertOptions.revertMessage** (string) - Required - The revert message. - **params.zrc20** (string) - Required - The ZRC20 token address to withdraw. - **options** (object) - Optional - Configuration options including signer and optional gateway address. - **options.gateway** (string) - Optional - The gateway address. - **options.signer** (Wallet) - Required - The signer wallet. - **options.txOptions** (object) - Optional - Transaction options. - **options.txOptions.gasLimit** (string | number | bigint) - Optional - Gas limit for the transaction. - **options.txOptions.gasPrice** (string | number | bigint) - Optional - Gas price for the transaction. - **options.txOptions.value** (string | number | bigint) - Optional - Value to send with the transaction. ### Request Example ```json { "params": { "amount": "1000000000000000000", "receiver": "0x...", "zrc20": "0x...", "revertOptions": { "revertMessage": "Withdrawal failed" } }, "options": { "signer": "0x..." } } ``` ### Response #### Success Response (200) - **gasFee** (bigint) - The gas fee for the transaction. - **gasZRC20** (string) - The ZRC20 token address used for gas. - **tx** (ContractTransactionResponse) - The transaction receipt. #### Response Example ```json { "gasFee": "10000000000000000", "gasZRC20": "0x...", "tx": { "hash": "0x...", "gasLimit": "21000", "gasPrice": "10000000000", "nonce": 1, "value": "0" } } ``` ```