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

# Send a Raw Transaction

<Card title="Recommended: JavaScript SDK with React Hooks" icon="react" color="#4779FE">
  For new React apps, we recommend the JavaScript SDK with React Hooks (`@dynamic-labs-sdk/react-hooks`) instead of the legacy React SDK documented here. The JS SDK comes with many benefits such as a much smaller bundle size and other optimizations. Use the [React quickstart (JavaScript SDK)](/javascript/reference/react-quickstart) to get started.
</Card>

In this example, we are going to send a raw transaction using the TON Connect `SendTransactionRequest` format.

```tsx theme={"system"}
import { useDynamicContext } from '@dynamic-labs/sdk-react-core';
import { isTonWallet, SendTransactionRequest, CHAIN } from '@dynamic-labs/ton';

const SendRawTransactionButton = () => {
  const { primaryWallet } = useDynamicContext();

  const onSendRawTransaction = async () => {
    if (!primaryWallet || !isTonWallet(primaryWallet)) {
      throw new Error('TON wallet not found');
    }

    // Build a raw transaction request (TON Connect format)
    const request: SendTransactionRequest = {
      validUntil: Math.floor(Date.now() / 1000) + 60, // 60 seconds from now
      network: CHAIN.MAINNET, // or CHAIN.TESTNET
      messages: [
        {
          address: 'UQDrjaLahLkMB-hMCmkzOyBuHJ186Qg_CZQhrOhIPBr0oDkB',
          amount: '100000000', // Amount in nanotons (0.1 TON)
          // Optional: payload for smart contract calls (base64 encoded BOC)
          // payload: 'te6cckEBAQEADgAAGEhlbGxvLCBXT1JMRCFdy+Mw',
          // Optional: state init for contract deployment (base64 encoded BOC)
          // stateInit: '...',
        },
      ],
    };

    // Send the transaction
    const transactionHash = await primaryWallet.sendTransaction(request);

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

  return <button onClick={onSendRawTransaction}>Send Raw Transaction</button>;
};
```

## SendTransactionRequest Format

| Field        | Type        | Required | Description                                               |
| ------------ | ----------- | -------- | --------------------------------------------------------- |
| `from`       | `string`    | No       | Sender address                                            |
| `validUntil` | `number`    | Yes      | Transaction deadline (unix epoch seconds)                 |
| `network`    | `CHAIN`     | No       | Network identifier (`-239` for mainnet, `-3` for testnet) |
| `messages`   | `Message[]` | Yes      | Array of 1-4 messages                                     |

## Message Format

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