Skip to main content
Sends a Tron transaction to transfer TRX to a recipient address.

Usage

import { sendTransaction, isTronWalletAccount } from '@dynamic-labs-sdk/tron';
import { getPrimaryWalletAccount } from '@dynamic-labs-sdk/client';

const walletAccount = getPrimaryWalletAccount();

if (walletAccount && isTronWalletAccount(walletAccount)) {
  const result = await sendTransaction({
    walletAccount,
    transaction: {
      to: 'RECIPIENT_TRON_ADDRESS',
      amount: 10, // Amount in TRX
    },
  });

  console.log('Transaction result:', result);
}

Parameters

ParameterTypeDescription
transaction.tostringThe recipient’s Tron address
transaction.amountnumberThe amount to send in TRX (will be converted to SUN internally)
walletAccountTronWalletAccountThe wallet account to send from
clientDynamicClient (optional)The Dynamic client instance. Only required when using multiple clients.

Returns

Promise<TronBroadcastReturnSignedTransaction> - A promise that resolves to the broadcast result of the signed transaction.

Errors

ErrorDescription
NotTronProviderErrorThrown if the wallet account’s provider is not a Tron provider
Signing unavailable errorThrown if the wallet account is not available for signing

Notes

  • The amount is specified in TRX and is automatically converted to SUN (Tron’s smallest unit) internally.
  • The function verifies that the wallet account is available for signing before sending the transaction.