# buildTokenSwap

### Description

This endpoint returns the transaction detail that is needed to perform the actual swap, based on information obtained in the **Get Exchange Rate** endpoint. This endpoint will build a transaction for you, which afterward you or your user needs to execute. Each item in the response array needs to be taken, enriched with the relevant signing method and submitted against the endpoint:\ `/api/transactions/execute`

{% code overflow="wrap" %}

```javascript
public buildTokenSwap(id: string, reqParams: VyBuildTokenSwapRequest) : VyPromise<VyTransactionRequestBase[]>
```

{% endcode %}

{% tabs %}
{% tab title="Details" %}
**Parameters**

| id        | string                                                                                                 | This is the \`ID\` of the source wallet. (Wallet that holds tokens to swap) |
| --------- | ------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------- |
| reqParams | [VyBuildTokenSwapRequest](/sdk-reference/ts-js-v3/object-references/wallet/vybuildtokenswaprequest.md) | Request data for the operation                                              |

**Returns**

VyPromise<[VyTransactionRequestBase](/sdk-reference/ts-js-v3/object-references/wallet/vytransactionrequestbase.md)\[]>\
Swap transactions created successfully.
{% endtab %}
{% endtabs %}


---

# 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://sdk.venly.io/sdk-reference/ts-js-v3/function-references/wallet/token-swapping/buildtokenswap.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.
