> ## 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.

# sendTransaction (TON)

# sendTransaction

Sends a custom TON transaction with arbitrary message payloads. This is useful for smart contract calls, multi-message transactions, and contract deployment.

## Usage

```javascript theme={"system"}
import { sendTransaction, isTonWalletAccount } from "@dynamic-labs-sdk/ton";
import { getPrimaryWalletAccount } from "@dynamic-labs-sdk/client";

const walletAccount = getPrimaryWalletAccount();

if (walletAccount && isTonWalletAccount(walletAccount)) {
  const { transactionHash } = await sendTransaction({
    walletAccount,
    request: {
      validUntil: Math.floor(Date.now() / 1000) + 60, // 60 seconds from now
      messages: [
        {
          address: "UQDrjaLahLkMB-hMCmkzOyBuHJ186Qg_CZQhrOhIPBr0oDkB",
          amount: "100000000", // 0.1 TON in nanotons
        },
      ],
    },
  });

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

## Parameters

| Parameter | Type | Description |
| - | - | - |
| `request.messages` | `array` | Array of messages to send (see Message format below) |
| `request.validUntil` | `number` | Transaction deadline as a unix epoch timestamp in seconds |
| `request.network` | `CHAIN` (optional) | Network identifier (`-239` for mainnet, `-3` for testnet) |
| `request.from` | `string` (optional) | Sender address |
| `walletAccount` | `TonWalletAccount` | The wallet account to send from |
| `client` | `DynamicClient` (optional) | The Dynamic client instance. Only required when using multiple clients. |

### Message format

| Field | Type | Description |
| - | - | - |
| `address` | `string` | Receiver's address |
| `amount` | `string` | Amount to send in nanotons |
| `payload` | `string` (optional) | Contract data as base64-encoded BOC |
| `stateInit` | `string` (optional) | State init for contract deployment as base64-encoded BOC |
| `extraCurrency` | `{ [k: number]: string }` (optional) | Extra currencies to send |

## Returns

`Promise<TonSendTransactionResponse>` - A promise that resolves to an object containing:

* `transactionHash` - The hash of the submitted transaction

## Errors

| Error | Description |
| - | - |
| `NotTonProviderError` | Thrown if the wallet account's provider is not a TON provider |

## Related functions

* [sendTon](https://docs.dynamic.xyz/docs/javascript/reference/ton/send-ton.md) - Send a simple native TON transfer
* [sendJetton](https://docs.dynamic.xyz/docs/javascript/reference/ton/send-jetton.md) - Send Jetton tokens


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