# Swap

## Router Address

```
0x71eBF8972459B01A50cca14Ed351CF34213Ed742
```

## Note

&#x20;**\*\* Do not forget to test allowance of the token to the router address**&#x20;

## Steps

* From upper response, you can use it as callData for swap function (data is encoded)

```
{
    "quote": {
        "methodParameters": { // use this for swap function
            "to": "0x71eBF8972459B01A50cca14Ed351CF34213Ed742", // swap router address
            "data": "0xc04b8d59000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000004e0bd60324971ad1cbc177c0c5c1aba890d8fda90000000000000000000000000000000000000000000000000000000067f625350000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000032f15a5f9379cc8b000000000000000000000000000000000000000000000000000000000000002bc054751bdbd24ae713ba3dc9bd9434abe2abc1ce000bb80fd0288aaae91eaf935e2ec14b23486f86516c8c000000000000000000000000000000000000000000",
            "value": "1000000000000000000"
        },
        "chainId": 88,
        ...
    }
}
```

* Example if you use viem

```
const params = {
	account: walletClient.account.address,
	to: props.to,
	data: props.data,
	value: props.value ? BigInt(props.value) : undefined,
} as const

const gas = await publicClient.estimateGas(params)

const hash = await walletClient.sendTransaction({
	gas: gas,
	chain: VIEM_CHAINS[props.chainId],
	...params,
})
```


---

# 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.rabbitswap.xyz/rabbitswap/for-developer/rabbitswap-api/swap.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.
