Skip to main content

sendTon

Sends native TON to a recipient address.

Usage

import { sendTon, isTonWalletAccount, NANOTON_PER_TON } from "@dynamic-labs-sdk/ton";
import { getPrimaryWalletAccount } from "@dynamic-labs-sdk/client";

const walletAccount = getPrimaryWalletAccount();

if (walletAccount && isTonWalletAccount(walletAccount)) {
  const { transactionHash } = await sendTon({
    walletAccount,
    transaction: {
      recipientAddress: "UQDrjaLahLkMB-hMCmkzOyBuHJ186Qg_CZQhrOhIPBr0oDkB",
      amount: BigInt(100000000), // 0.1 TON in nanotons
    },
  });

  console.log("Transaction hash:", transactionHash);
}

Parameters

ParameterTypeDescription
transaction.recipientAddressstringThe recipient’s TON address
transaction.amountbigintThe amount to send in nanotons
walletAccountTonWalletAccountThe wallet account to send from
clientDynamicClient (optional)The Dynamic client instance. Only required when using multiple clients.

Returns

Promise<TonSendTransactionResponse> - A promise that resolves to an object containing:
  • transactionHash - The hash of the submitted transaction

Errors

ErrorDescription
NotTonProviderErrorThrown if the wallet account’s provider is not a TON provider

Notes

  • The amount is specified in nanotons (1 TON = 1,000,000,000 nanotons). You can use the exported NANOTON_PER_TON constant for conversion.