Skip to main content

Documentation Index

Fetch the complete documentation index at: https://www.dynamic.xyz/docs/llms.txt

Use this file to discover all available pages before exploring further.

dynamicClient.ton.sendTon builds, signs, and broadcasts a Toncoin transfer in a single call.

Parameters

ParameterTypeNotes
walletIdstringThe id of a wallet whose chain === 'TON'.
tostringDestination TON address (raw or user-friendly base64url form, depending on the connector).
amountstringAmount in nanotons, encoded as a string to preserve precision. 1 TON = 1_000_000_000 nanoton.
commentstring (optional)Plain-text comment attached to the transfer (encoded into the payload).

Return value

{ boc: string; hash: string }
  • hash — the transaction hash, useful for status lookups on a TON explorer.
  • boc — the base64-encoded Bag-of-Cells of the broadcasted transaction, in case you want to display or persist it.

Example

React Native
import { dynamicClient } from '<path to client file>';

const wallet = dynamicClient.wallets.userWallets.find((w) => w.chain === 'TON');
if (!wallet) {
  throw new Error('No TON wallet');
}

const { hash, boc } = await dynamicClient.ton.sendTon({
  walletId: wallet.id,
  to: 'EQ...recipient',
  amount: '500000000', // 0.5 TON
  comment: 'thanks!',
});

console.log('Broadcasted:', hash);

Converting between TON and nanotons

amount is always a nanoton string. Convert from a user-supplied TON value before calling:
const ton = '0.5';
const nano = (Number(ton) * 1e9).toString();
//=> '500000000'
For arbitrary-precision math, use BigInt:
const nano = BigInt(Math.round(parseFloat(ton) * 1e9)).toString();

Errors

sendTon rejects when:
  • The wallet is not a TON wallet, or the walletId doesn’t match a wallet in the current session.
  • The user cancels the signing prompt in the WebView.
  • The connected external wallet refuses the request (insufficient balance, network mismatch, expired TonConnect session, etc.).
  • The broadcast fails (the network rejects the message).