# Via TonWeb

Tonweb package uses the `transfer` method to send a transaction to the blockchain. An example of the usage is on their [README](https://github.com/toncenter/tonweb/blob/master/README.md?plain=1#L48-L55).

```ts
import TonWeb from "tonweb";
import TonWebMnemonic from "tonweb-mnemonic";
import { TonClient, toNano } from "@ton/ton";
import { DEX, pTON } from "@ston-fi/sdk";

const tonWeb = new TonWeb();
const client = new TonWeb.HttpProvider();

const tonClient = new TonClient({
  endpoint: "https://toncenter.com/api/v2/jsonRPC",
});

const mnemonics = Array.from(
  { length: 24 },
  (_, i) => `your mnemonic word ${i + 1}`
); // replace with your mnemonic
const keyPair = await TonWebMnemonic.mnemonicToKeyPair(mnemonics);

const wallet = new tonWeb.wallet.all.v4R2(client, {
  publicKey: keyPair.publicKey,
});

const dex = tonClient.open(new DEX.v1.Router());

const txParams = await dex.getSwapTonToJettonTxParams({
  offerAmount: toNano("1"), // swap 1 TON
  askJettonAddress: "EQA2kCVNwVsil2EM2mB0SkXytxCqQjS4mttjDpnXmwG9T6bO", // for a STON
  minAskAmount: toNano("0.1"), // but not less than 0.1 STON
  proxyTon: new pTON.v1(),
  userWalletAddress: (await wallet.getAddress()).toString(),
});

await wallet.methods
  .transfer({
    secretKey: keyPair.secretKey,
    toAddress: txParams.to.toString(),
    amount: new tonWeb.utils.BN(txParams.value),
    seqno: (await wallet.methods.seqno().call()) ?? 0,
    payload: TonWeb.boc.Cell.oneFromBoc(
      TonWeb.utils.base64ToBytes(txParams.body?.toBoc().toString("base64"))
    ),
    sendMode: 3,
  })
  .send();
```


---

# 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://docs.ston.fi/developer-section/common/transaction-sending/tonweb.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.
