Skip to main content

Overview

The TonModule provides native TON blockchain operations including message signing, TON and Jetton transfers, balance queries, and network details. Access it via DynamicSDK.instance.ton.

Prerequisites

Get Balance

Query the TON balance for a wallet.
final sdk = DynamicSDK.instance;
final wallet = sdk.wallets.userWallets.first;

final balance = await sdk.ton.getBalance(
  walletId: wallet.id,
);
print('Balance: $balance');

Sign a Message

Sign a message using the connected TON wallet.
final signature = await sdk.ton.signMessage(
  walletId: wallet.id,
  message: 'Hello, TON!',
);
print('Signature: $signature');

Send TON

Send TON tokens to a recipient address. Returns a map containing the boc (bag of cells) and hash of the transaction.
final result = await sdk.ton.sendTon(
  walletId: wallet.id,
  to: 'EQBYLTm4nsvoqJRxs2525chuMyfNIS0Tg98TYSLttqzK5YDv',
  amount: '1000000000', // 1 TON in nanotons
  comment: 'user-12345', // optional text comment (memo)
);
print('BOC: ${result['boc']}');
print('Hash: ${result['hash']}');
ParameterTypeDescription
walletIdStringThe wallet ID to send from
toStringThe recipient TON address
amountStringAmount in nanotons (1 TON = 10^9 nanotons)
commentString?Optional plain-text comment (memo) attached to the transfer. Required by exchanges that use shared deposit addresses to credit the deposit to the correct user.
Exchanges routinely share one TON deposit address across many users and map an incoming deposit to a user via the transaction’s text comment. Pass that identifier as comment (native TON) or forwardPayload (Jettons), or the deposit won’t be credited.

Send Jettons

Send Jetton tokens (TON’s fungible token standard, similar to ERC-20) to a recipient.
final result = await sdk.ton.sendJetton(
  walletId: wallet.id,
  recipientAddress: 'EQBYLTm4nsvoqJRxs2525chuMyfNIS0Tg98TYSLttqzK5YDv',
  jettonAmount: '1000000',
  jettonMasterAddress: 'EQBlqsm144Dq6SjbPI4jjZvA1hqTIP3CvHovbIfW_t-SCALE',
  forwardPayload: 'user-12345', // optional text comment (memo)
  forwardTonAmount: '1', // nanotons forwarded with the notification
);
print('BOC: ${result['boc']}');
print('Hash: ${result['hash']}');
ParameterTypeDescription
walletIdStringThe wallet ID to send from
recipientAddressStringThe recipient TON address
jettonAmountStringAmount in the Jetton’s smallest unit
jettonMasterAddressStringThe Jetton contract master address
forwardPayloadString?Optional plain-text comment (memo) forwarded to the recipient. Use this for the deposit memo required by exchanges.
forwardTonAmountString?Optional nanotons forwarded with the transfer notification. Defaults to 1 when omitted — enough to deliver the notification.

Get Network Details

Query the network information for the connected wallet.
final details = await sdk.ton.getNetworkDetails(
  walletId: wallet.id,
);
print('Chain ID: ${details['chainId']}');
print('Network: ${details['name']}');
Returns a map with:
  • chainId - The chain identifier (e.g., -239 for mainnet, -3 for testnet)
  • name - The network name (e.g., mainnet, testnet)

Complete Example

import 'package:dynamic_sdk/dynamic_sdk.dart';

Future<void> tonExample() async {
  final sdk = DynamicSDK.instance;
  final wallet = sdk.wallets.userWallets.first;

  // Check network
  final network = await sdk.ton.getNetworkDetails(walletId: wallet.id);
  print('Connected to: ${network['name']}');

  // Check balance
  final balance = await sdk.ton.getBalance(walletId: wallet.id);
  print('Balance: $balance nanotons');

  // Sign a message
  final signature = await sdk.ton.signMessage(
    walletId: wallet.id,
    message: 'Verify wallet ownership',
  );
  print('Signature: $signature');

  // Send TON (with an optional comment / memo)
  final result = await sdk.ton.sendTon(
    walletId: wallet.id,
    to: 'EQ...',
    amount: '500000000', // 0.5 TON
    comment: 'user-12345',
  );
  print('Transaction hash: ${result['hash']}');

  // Send Jettons (forwardPayload carries the comment / memo)
  final jettonResult = await sdk.ton.sendJetton(
    walletId: wallet.id,
    recipientAddress: 'EQ...',
    jettonAmount: '1000000',
    jettonMasterAddress: 'EQ...', // USDT or other Jetton
    forwardPayload: 'user-12345',
  );
  print('Jetton transfer hash: ${jettonResult['hash']}');
}

API Reference

MethodReturnsDescription
getBalanceFuture<String>Get wallet balance
signMessageFuture<String>Sign a message
sendTonFuture<Map<String, dynamic>>Send TON, returns {boc, hash}
sendJettonFuture<Map<String, dynamic>>Send Jettons, returns {boc, hash}
getNetworkDetailsFuture<Map<String, dynamic>>Get {chainId, name}

Next Steps

Last modified on July 2, 2026