Sending Transactions
This guide explains how to send cross-chain transactions from TON to TAC EVM using the TAC SDK. The core of hybrid dApp development is sending transactions through the TON Adapter to execute operations on EVM contracts.
The sendCrossChainTransaction
method is the primary function for sending data and assets from TON to TAC EVM. It creates a transaction on the TON side that initiates a cross-chain operation.
Understanding Cross-Chain Transactions
A cross-chain transaction in TAC typically involves:
- A call to an EVM contract on TAC
- Optional asset transfers (tokens) between chains
- Tracking the transaction’s progress across chains
Basic Transaction Structure
Here’s how to create and send a basic cross-chain transaction:
Parameter Encoding for EVM Methods
When calling an EVM contract method, you need to encode parameters correctly. Use the ethers.js ABI encoder:
Always include the full method signature including parameter types in methodName
(e.g., "swap(bytes,bytes)"
) or the transaction will fail. The method must accept two bytes
parameters.
Asset Bridging
You can bridge assets (tokens) from TON to TAC as part of your transaction:
You can also use raw amounts if you prefer:
Cross-Chain Transaction Examples
Example 1: Simple Contract Call (No Asset Transfer)
Example 2: Token Swap on DEX
Example 3: Adding Liquidity to a Pool
Transaction Simulation
Before sending a transaction, you can simulate it to estimate gas costs and check for potential issues:
Error Handling
When sending transactions, several types of errors can occur:
Was this page helpful?