DEX
Get Quotes
The user will be able to get quotes of the specified token pair from different Dexs in an aggregated manner.
URL:
https://quicknode.expand.network/dex
Payload:
{
"method": "en_getQuotes",
"params": [
{
"path": [
"0x6b175474e89094c44da98b954eedeac495271d0f",
"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
],
"amountIn": "1000000000000000"
}
]
}
{
"id": 1,
"result": {
"message": "success",
"method": "en_getQuotes",
"result": [
{
"dexId": "1300",
"dexName": "UniswapV3",
"value": "999"
},
{
"dexId": "1500",
"dexName": "CurveV2",
"value": "999"
},
{
"dexId": "1000",
"dexName": "UniswapV2",
"value": "997"
},
{
"dexId": "1100",
"dexName": "SushiswapV2",
"value": "996"
}
]
},
"jsonrpc": "2.0"
}
Get User Liquidity
The user will be able to get the balance of a particular token pair of an account.
URL:
https://quicknode.expand.network/dex
Payload:
{
"method": "en_getUserLiquidity",
"params": [
{
"tokenA": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"tokenB": "0x6b175474e89094c44da98b954eedeac495271d0f",
"address": "0x6fb447ae94f5180254d436a693907a1f57696900"
}
]
}
{
"id": 1,
"result": {
"message": "success",
"method": "en_getUserLiquidity",
"result": {
"pairAddress": "0xA478c2975Ab1Ea89e8196811F51A7B7Ade33eB11",
"liquidity": "2370404879481514",
"tokenA": "109641696331105.2",
"tokenB": "173027102912280350"
}
},
"jsonrpc": "2.0"
}
Get Pool Liquidity
The user will be able to get the individual token liquidity within the specified liquidity pool.
URL:
https://quicknode.expand.network/dex
Payload:
{
"method": "en_getPoolLiquidity",
"params": [
{
"poolAddress": "0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852"
}
]
}
{
"id": 1,
"result": {
"message": "success",
"method": "en_getPoolLiquidity",
"result": {
"totalLiquidity": "367337363162120717"
}
},
"jsonrpc": "2.0"
}
Swap
The user will be able to swap tokens on different Dex.
Note: If the 'bestSwap' field is set to true, the prepared transaction will offer the optimal route for the swap.
Conversely, if the 'bestSwap' field is set to false, the prepared transaction will be sourced from multiple decentralized exchanges (DEXs), contingent on the availability of liquidity pools.
URL:
https://quicknode.expand.network/dex
Payload:
{
"method": "en_swap",
"params": [
{
"path": [
"0x6b175474e89094c44da98b954eedeac495271d0f",
"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
],
"amountIn": "1000000000000000",
"to": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
"from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
"gas": "230000",
"maxSlippage": "3",
"bestSwap": true
}
]
}
//----------------------If bestSwap is true----------------------
{
"id": 1,
"result": {
"message": "success",
"method": "en_swap",
"result": {
"from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
"to": "0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45",
"value": "0",
"gas": "230000",
"data": "0xac9650d800000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000e4472b43f300000000000000000000000000000000000000000000000000038d7ea4c6800000000000000000000000000000000000000000000000000000000000000003e4000000000000000000000000000000000000000000000000000000000000008000000000000000000000000063056e00436da25bcf48a40dfbbdcc708935100600000000000000000000000000000000000000000000000000000000000000020000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000000000000000000000000000000000000"
}
},
"jsonrpc": "2.0"
}
//----------------------If bestSwap is false----------------------
{
"id": 1,
"result": {
"message": "success",
"method": "en_swap",
"result": {
"UniswapV2": {
"from": "0xfFb4264A596751a580F046193f43064839052d6c",
"to": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
"value": "0",
"gas": "990000",
"data": "0x38ed17390000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000ffb4264a596751a580f046193f43064839052d6c0000000000000000000000000000000000000000000000000000018acb343dfd0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000006b175474e89094c44da98b954eedeac495271d0f"
},
"UniswapV3": {
"from": "0xfFb4264A596751a580F046193f43064839052d6c",
"to": "0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45",
"value": "0",
"gas": "990000",
"data": "0xac9650d800000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000e4472b43f30000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000080000000000000000000000000ffb4264a596751a580f046193f43064839052d6c0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000006b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000000000000000"
},
"SushiswapV2": {
"from": "0xfFb4264A596751a580F046193f43064839052d6c",
"to": "0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F",
"value": "0",
"gas": "990000",
"data": "0x38ed17390000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000ffb4264a596751a580f046193f43064839052d6c0000000000000000000000000000000000000000000000000000018acb343dfd0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000006b175474e89094c44da98b954eedeac495271d0f"
}
}
},
"jsonrpc": "2.0"
}
Add Liquidity
The user will be able to add liquidity on different Dex.
URL:
https://quicknode.expand.network/dex
Payload:
{
"method": "en_addLiquidity",
"params": [
{
"dexId": "1400",
"amountIn": [
"1000000000000000000",
"1000000000000000000"
],
"amountOut": "0",
"path": [
"0x6B175474E89094C44Da98b954EedeAC495271d0F",
"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
],
"fromInternalBalance": false,
"to": "0xfFb4264A596751a580F046193f43064839052d6c",
"deadline": "1694617738234",
"from": "0xfFb4264A596751a580F046193f43064839052d6c",
"gas": "230000"
}
]
}
{
"id": 1,
"result": {
"message": "success",
"method": "en_addLiquidity",
"result": {
"from": "0xfFb4264A596751a580F046193f43064839052d6c",
"to": "0xBA12222222228d8Ba445958a75a0704d566BF2C8",
"value": "0",
"gas": "230000",
"data": "0xb95cac280b09dea16768f0799065c475be02919503cb2a3500020000000000000000001a000000000000000000000000ffb4264a596751a580f046193f43064839052d6c000000000000000000000000ffb4264a596751a580f046193f43064839052d6c0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a7640000"
}
},
"jsonrpc": "2.0"
}
Remove Liquidity
The user will be able to remove liquidity on different Dex.
URL:
https://quicknode.expand.network/dex
Payload:
{
"method": "en_removeLiquidity",
"params": [
{
"dexId": "1400",
"amountOut": [
"91",
"91"
],
"path": [
"0x6B175474E89094C44Da98b954EedeAC495271d0F",
"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
],
"amountIn": "147692016912345470",
"toInternalBalance": false,
"to": "0xfFb4264A596751a580F046193f43064839052d6c",
"from": "0xfFb4264A596751a580F046193f43064839052d6c",
"gas": "230000"
}
]
}
{
"id": 1,
"result": {
"message": "success",
"method": "en_removeLiquidity",
"result": {
"from": "0xfFb4264A596751a580F046193f43064839052d6c",
"to": "0xBA12222222228d8Ba445958a75a0704d566BF2C8",
"value": "0",
"gas": "230000",
"data": "0x8bdb39130b09dea16768f0799065c475be02919503cb2a3500020000000000000000001a000000000000000000000000ffb4264a596751a580f046193f43064839052d6c000000000000000000000000ffb4264a596751a580f046193f43064839052d6c0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000005b000000000000000000000000000000000000000000000000000000000000005b00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000020cb51b5c38a97e"
}
},
"jsonrpc": "2.0"
}
Last updated