> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dynamic.xyz/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# TON

> Sign messages, send TON and Jettons, and query network details using the Dynamic Swift SDK.

## Overview

`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

* Dynamic SDK initialized (see [Quickstart](https://docs.dynamic.xyz/docs/swift/quickstart.md))
* User authenticated (see [Authentication](https://docs.dynamic.xyz/docs/swift/authentication.md))
* TON enabled in the [Dynamic Console](https://console.dynamic.xyz/dashboard/chains-and-networks#ton)

## Get a TON Wallet

If TON is enabled in the Dynamic Console, the user gets a TON wallet on signup. Find it via `userWallets`, or create one explicitly with `EmbeddedWalletChain.ton`:

```swift theme={"system"}
let sdk = DynamicSDK.instance()

// Filter existing
let tonWallet = sdk.wallets.userWallets.first(where: { $0.chain == "TON" })

// Or create
let wallet = try await sdk.wallets.embedded.createWallet(chain: .ton)
```

## Get Balance

Query the TON balance for a wallet. Returned as a string (nanotons) to preserve precision.

```swift theme={"system"}
let balance = try await sdk.ton.getBalance(walletId: wallet.id)
print("Balance: \(balance) nanotons")
```

## Sign a Message

Sign a message using the connected TON wallet:

```swift theme={"system"}
let signature = try await sdk.ton.signMessage(
  walletId: wallet.id,
  message: "Hello, TON!"
)
print("Signature: \(signature)")
```

## Send TON

Send TON tokens to a recipient address. Returns a `TonTransactionResult` containing the BOC and transaction hash.

```swift theme={"system"}
let result = try await sdk.ton.sendTon(
  walletId: wallet.id,
  to: "EQBYLTm4nsvoqJRxs2525chuMyfNIS0Tg98TYSLttqzK5YDv",
  amount: "1000000000", // 1 TON in nanotons
  comment: nil          // optional
)
print("BOC: \(result.boc)")
print("Hash: \(result.hash)")
```

| Parameter | Type | Description |
| - | - | - |
| `walletId` | `String` | The wallet ID to send from |
| `to` | `String` | Recipient TON address |
| `amount` | `String` | Amount in nanotons (1 TON = 10⁹ nanotons) |
| `comment` | `String?` | Optional comment to attach to the transaction |

## Send Jettons

Send Jetton tokens (TON's fungible token standard, similar to ERC-20):

```swift theme={"system"}
let result = try await sdk.ton.sendJetton(
  walletId: wallet.id,
  to: "EQBYLTm4nsvoqJRxs2525chuMyfNIS0Tg98TYSLttqzK5YDv",
  amount: "1000000",
  jettonMasterAddress: "EQBlqsm144Dq6SjbPI4jjZvA1hqTIP3CvHovbIfW_t-SCALE",
  comment: nil
)
print("Hash: \(result.hash)")
```

| Parameter | Type | Description |
| - | - | - |
| `walletId` | `String` | The wallet ID to send from |
| `to` | `String` | Recipient TON address |
| `amount` | `String` | Amount in the Jetton's smallest unit |
| `jettonMasterAddress` | `String` | Jetton master (contract) address |
| `comment` | `String?` | Optional comment |

## Get Network Details

Query the chain ID and network name for the connected wallet:

```swift theme={"system"}
let details = try await sdk.ton.getNetworkDetails(walletId: wallet.id)
print("Chain ID: \(details.chainId)")
print("Network:  \(details.name)")
```

Returned struct:

* `chainId` — `-239` for mainnet, `-3` for testnet
* `name` — `"mainnet"` or `"testnet"`

## API Reference

| Method | Returns | Description |
| - | - | - |
| `getBalance` | `String` | Get wallet balance (nanotons) |
| `signMessage` | `String` | Sign a message |
| `sendTon` | `TonTransactionResult` | Send TON, returns `{boc, hash}` |
| `sendJetton` | `TonTransactionResult` | Send Jettons, returns `{boc, hash}` |
| `getNetworkDetails` | `TonNetworkDetails` | Get `{chainId, name}` |

## Next Steps

* [Bitcoin Operations](https://docs.dynamic.xyz/docs/swift/wallets/bitcoin/overview.md) — Bitcoin operations
* [SUI Operations](https://docs.dynamic.xyz/docs/swift/wallets/sui/overview.md) — SUI operations
* [Token Balances](https://docs.dynamic.xyz/docs/swift/wallets/general/token-balances.md) — Multi-chain balance queries


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.