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"
        }
    ]
}

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"
        }
    ]
}

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"
        }
    ]
}

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             
        }
    ]
}

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"
        }
    ]
}

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"
        }
    ]
}

Last updated