Skip to main content
TON call_data is a JSON string containing the transfer amount, asset, and matching comment:
The comment is the matching memo for both native and Jetton transfers. The payload’s amount is used as the Jetton amount in base units; for native TON, take the transfer value from the action’s amount_in_base_units instead.

Native TON

When action.token.contract is null, the transaction is a simple message to the deposit address with a comment payload.
1

Parse call_data

Extract the comment field from the JSON.
2

Build the comment cell

Create a TON cell with a 32-bit zero prefix (indicates a text comment) followed by the comment string.
3

Construct the message

Send a message to action.to_address for amount_in_base_units nanotons with the comment cell as payload.
The 32-bit zero prefix marks the body as a text comment.

Jettons

When action.token.contract is present, build a Jetton transfer and send it to the sender’s Jetton wallet — resolved through the Jetton master contract — not to the master contract itself.
1

Parse call_data

Extract both comment and amount from the JSON.
2

Resolve the sender's Jetton wallet

Use the Jetton master contract’s get_wallet_address method to look up the sender’s Jetton wallet address.
3

Build the Jetton transfer cell

Construct a cell with the Jetton transfer opcode (0x0f8a7ea5), the Jetton amount, the destination address, and a forward payload containing the comment.
4

Send the message

Send the message to the sender’s Jetton wallet address with enough TON attached to cover fees.
The attached TON and forward amounts match the values Layerswap’s own app uses; unspent excess is returned to the sender.

Send the transaction

The TON Connect tab is for browser wallets like Tonkeeper or MyTonWallet — it picks between the two builders above based on token.contract. The Server-side tab signs and sends directly with a wallet key.
The server-side example shows a native TON transfer. For Jettons, build the body as in the Jetton section and send it to the sender’s Jetton wallet address.
Store the transaction reference and track the swap.