> For the complete documentation index, see [llms.txt](https://docs.ston.fi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ston.fi/developer-section/common/transaction-sending/tonconnect.md).

# TonConnect

Pass built DEX/Farm parameters to a connected TON wallet without rebuilding a swap.

Use this recipe inside an application with a configured `TonConnectUIProvider`. `txParams` is the complete array built by a DEX/Farm guide for the connected wallet. A one-message operation is an array of length one. Verify the wallet network and advertised message capacity before sending.

```tsx
import { beginCell, storeStateInit, type SenderArguments } from "@ton/core";
import { useTonAddress, useTonConnectUI } from "@tonconnect/ui-react";

export function SendTransactionButton({
  txParams,
}: {
  txParams: SenderArguments[];
}) {
  const walletAddress = useTonAddress();
  const [tonConnectUI] = useTonConnectUI();

  return (
    <button
      onClick={async () => {
        if (!walletAddress || txParams.length === 0) {
          throw new Error("Connect the builder's wallet and provide its messages");
        }
        const result = await tonConnectUI.sendTransaction({
          validUntil: Math.floor(Date.now() / 1000) + 300,
          messages: txParams.map((params) => ({
            address: params.to.toString(),
            amount: params.value.toString(),
            payload: params.body?.toBoc().toString("base64"),
            stateInit: params.init
              ? beginCell().store(storeStateInit(params.init)).endCell()
                  .toBoc().toString("base64")
              : undefined,
          })),
        });
        // Store result.boc and follow the product's result/tracking instructions.
        console.log("Submitted external message:", result.boc);
      }}
    >
      Submit transaction
    </button>
  );
}
```

This input shape covers SDK `get*TxParams` output. For Omniston's built transaction and optional state init, use the [TON adapter](/developer-section/omniston/sdk/ton.md#adapt-all-messages). Do not use `messages[0]` when a builder returns multiple messages.

See the [TonConnect message documentation](https://docs.ton.org/develop/dapps/ton-connect/message-builders) for provider setup and wallet capabilities. Keep wallet errors in application state, and follow the selected product's result instructions after submission.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.ston.fi/developer-section/common/transaction-sending/tonconnect.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
