> For the complete documentation index, see [llms.txt](https://docs.rabbitswap.xyz/rabbitswap/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rabbitswap.xyz/rabbitswap/for-developer/rabbitswap-api/swap.md).

# 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,
})
```
