# TonConnect (React)

Torch Finance integrates seamlessly with **TonConnectUI**, making it simple to send transactions on the TON blockchain. Here's an example to demonstrate how you can use TonConnectUI to send a transaction.

Below is a code snippet that shows how to set up and send a transaction using TonConnectUI.

```typescript
function App() {
  const wallet = useTonWallet();
  const [tonconnectUI] = useTonConnectUI();
  const sdk = new TorchSDK();
  
  const onSwap = async () => {
    if (!wallet || !tonconnectUI.account) {
      alert('Please connect your wallet');
      return;
    }
    if (tonconnectUI.account?.chain !== CHAIN.TESTNET) {
      alert('Please connect to Testnet');
      return;
    }
    const swapParams: SwapParams = {
      mode: 'ExactIn',
      queryId: await generateQueryId(),
      assetIn: Asset.ton(),
      assetOut: Asset.jetton(
        Address.parse('EQC98_qAmNEptUtPc7W6xdHh_ZHrBUFpw5Ft_IzNU20QAJav')
      ),
      amountIn: toUnit('0.01', 9), // 0.01 TON
      slippageTolerance: 0.01, // 1%
    };
    const sender = Address.parse(wallet.account.address);
    const swapPayload = await sdk.getSwapPayload(sender, swapParams);

    const { boc } = await tonconnectUI.sendTransaction({
      validUntil: Date.now() + 1000 * 60, // 1 minute
      messages: [
        {
          address: swapPayload.to.toString(),
          amount: swapPayload.value.toString(),
          payload: swapPayload.body ? swapPayload.body.toString() : undefined,
        },
      ],
    });
    alert(`Swap Request Sent, Message Hash: ${boc}`);
  };
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.torch.finance/dex/developer-guide/dex-sdk-guide/how-to-send-transaction/tonconnect-react.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
