Trader Joe

/getprice

Returns the swap quotation for the given token pair.

GET https://api.expand.network/dex/getprice

Query Parameters

Name
Type
Description

rpc

String

Remote procedural call URL.

dexId*

String

path*

String

Comma separated values of token addresses whose price is to be fetched.

amountIn*

String

Amount of token.

https://api.expand.network/dex/getprice?dexId=2100&path=0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7%2C0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB&amountIn=1000000000000000000

/getuserliquidity

Returns the balance of a particular token pair of an account.

GET https://api.expand.network/dex/getuserliquidity

Query Parameters

Name
Type
Description

rpc

String

Remote procedural call URL.

tokenA*

String

Token Address of first token.

dexId*

String

tokenB*

String

Token Address of second token.

address*

String

User public address.

id*

String

Bin ID whose liquidity is to be fetched.

https://api.expand.network/dex/getuserliquidity?tokenA=0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7&tokenB=0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E&address=0x41917217DD34CEAd24Daa02b4Ca07bDE9E5FcD1d&dexId=2100&id=8376649

/getpoolliquidity

Returns the total liquidity for a specified pool.

GET https://api.expand.network/dex/getpoolliquidity

Query Parameters

Name
Type
Description

rpc

String

Remote procedural call URL.

poolAddress*

String

Pool address whose liquidity is to be fetched.

dexId*

String

id*

String

Bin ID whose liquidity is to be fetched.

https://api.expand.network/dex/getpoolliquidity?dexId=2100&poolAddress=0xD446eb1660F766d533BeCeEf890Df7A69d26f7d1&id=8376653

/gettokenliquidity

Returns the individual token liquidity within the specified liquidity pool.

GET https://api.expand.network/dex/gettokenliquidity

Query Parameters

Name
Type
Description

rpc

String

Remote procedural call URL.

poolAddress*

String

The pool address.

dexId*

String

https://api.expand.network/dex/gettokenliquidity?dexId=2100&poolAddress=0x9f8973FB86b35C307324eC31fd81Cf565E2F4a63

/swap

Initiate a swap transaction on a specified DEX.

POST https://api.expand.network/dex/swap

Request Body

Name
Type
Description

dexId*

String

path*

Array

Comma-separated values of token addresses, inside an array, to swap.

amountIn*

String

Amount of token to be swapped.

amountOutMin*

String

Minimum amount accepted as a result of swap.

to*

String

Address of the recipient of the token.

from*

String

Address of the sender of the token.

gas*

String

Maximum gas limit provided by the sender, for the transaction.

rpc

String

Remote procedural call URL.

gasPriority

String

low, medium, or high.

slippage

String

Percentage of total swap value. By default, 1.

0 <= slippage value <= 100

involveBaseToken

String

If a base token is involved in the swap; 0 for erc20 -> erc20, 1 for base -> erc20 ("from" address should be of equivalent wrapped token), 2 for erc20 -> base ("to" address should be of equivalent wrapped token).

By default, 0 .

deadline*

String

Deadline for the transaction to be executed (UNIX Timestamp).

{
    "dexId": "2100",
    "amountIn": "10000000000",
    "amountOutMin": "100",
    "path": [
        "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
        "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"
    ],
    "to": "0xa67E9B68c41b0f26184D64C26e0b2B81466E5994",
    "deadline": "1753156839",
    "from": "0xa67E9B68c41b0f26184D64C26e0b2B81466E5994",
    "gas": "100000"
}

With gasPriority:

{
    "dexId": "2100",
    "amountIn": "10000000000",
    "amountOutMin": "100",
    "path": [
        "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
        "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"
    ],
    "to": "0xa67E9B68c41b0f26184D64C26e0b2B81466E5994",
    "deadline": "1753156839",
    "from": "0xa67E9B68c41b0f26184D64C26e0b2B81466E5994",
    "gas": "100000",
    "gasPriority": "high"
}

With Slippage:

{
    "dexId": "2100",
    "amountIn": "10000000000",
    "amountOutMin": "100",
    "path": [
        "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
        "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"
    ],
    "to": "0xa67E9B68c41b0f26184D64C26e0b2B81466E5994",
    "deadline": "1753156839",
    "from": "0xa67E9B68c41b0f26184D64C26e0b2B81466E5994",
    "gas": "100000",
    "slippage": "6"
}

/addliquidity

Add liquidity to a specified pool in a specified DEX.

POST https://api.expand.network/dex/addliquidity

Request Body

Name
Type
Description

dexId*

String

tokenA*

String

Address of the first token being added.

tokenB*

String

Address of the second token being added.

amountA*

String

Desired amount of token A.

amountB*

String

Desired amount of token B.

amountAMin*

String

Minimum amount of token A.

amountBMin*

String

Minimum amount of token B.

deadline*

String

Deadline for the transaction to be executed (UNIX Timestamp).

to*

String

Address of the recipient of the token.

from*

String

Address of the sender of the token.

gas*

String

Maximum gas limit provided by the sender, for the transaction.

rpc

String

Remote procedural call URL.

gasPriority

String

low, medium, or high.

slippage

String

Percentage of total value. By default, 1.

0 <= slippage value <= 100

strategy

String

spotUniform, curve or bidask.

By default, spotUniform.

{
    "dexId": "2100",
    "tokenA": "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
    "tokenB": "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
    "amountA": "10000000000000000",
    "amountB": "1000",
    "amountAMin": "1000000000",
    "amountBMin": "100",
    "to": "0xa67E9B68c41b0f26184D64C26e0b2B81466E5994",
    "deadline": "1706678170",
    "from": "0xa67E9B68c41b0f26184D64C26e0b2B81466E5994",
    "gas": "530000",
    "strategy": "bidask"
}

With gasPriority (medium):

{
    "dexId": "2100",
    "tokenA": "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
    "tokenB": "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
    "amountA": "10000000000000000",
    "amountB": "1000",
    "amountAMin": "1000000000",
    "amountBMin": "100",
    "to": "0xa67E9B68c41b0f26184D64C26e0b2B81466E5994",
    "deadline": "1706678170",
    "from": "0xa67E9B68c41b0f26184D64C26e0b2B81466E5994",
    "gas": "530000",
    "strategy": "bidask",
    "gasPriority": "medium"
}

With Slippage:

{
    "dexId": "2100",
    "tokenA": "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
    "tokenB": "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
    "amountA": "10000000000000000",
    "amountB": "1000",
    "amountAMin": "1000000000",
    "amountBMin": "100",
    "to": "0xa67E9B68c41b0f26184D64C26e0b2B81466E5994",
    "deadline": "1706678170",
    "from": "0xa67E9B68c41b0f26184D64C26e0b2B81466E5994",
    "gas": "530000",
    "strategy": "bidask",
    "slippage": "5"
}

/removeliquidity

Remove liquidity from a specified pool for a specified DEX.

POST https://api.expand.network/dex/removeliquidity

Request Body

Name
Type
Description

dexId*

String

amountAMin*

String

Minimum amount of Token A.

deadline*

String

Deadline for the transaction to be executed (UNIX Timestamp).

from*

String

Address of the sender of the token.

gas*

String

Maximum gas limit provided by the sender, for the transaction.

rpc

String

Remote procedural call URL.

tokenA*

String

Address of the first token being removed.

tokenB*

String

Address of the second token being removed.

amountBMin*

String

Minimum amount of Token B.

gasPriority

String

low, medium, or high.

binStep*

String

Difference between two consecutive bins.

ids*

Array

Bin IDs that liquidity should be removed from.

amounts*

Array

LBToken(Liquidity Book Token) amount that should be removed.

to*

String

Address of the recipient of the token.

slippage

String

Percentage of total swap value. By default, 1.

0 <= slippage value <= 100

{
    "dexId": "2100",
    "tokenA": "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
    "tokenB": "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
    "amountBMin": "150",
    "amountAMin": "9140195223753",
    "to": "0xa67E9B68c41b0f26184D64C26e0b2B81466E5994",
    "deadline": "1705994811",
    "from": "0xa67E9B68c41b0f26184D64C26e0b2B81466E5994",
    "gas": "0",
    "binStep": "20",
    "ids": [
        "8375816",
        "8375817",
        "8375818",
        "8375819",
        "8375820",
        "8375821",
        "8375822",
        "8375823",
        "8375824",
        "8375825",
        "8375826"
    ],
    "amounts": [
        "6125082604576892342340742933771827806208",
        "6125082604576892342340742933771827806208",
        "6125082604576892342340742933771827806208",
        "6125082604576892342340742933771827806208",
        "6092234575456602778057561670181153099728",
        "27680318192948304012362129290692653566283",
        "49451196782276463859932823798226771515026",
        "49649387794231952910105025177550757137373",
        "49747539066384995844387966236176975326734",
        "49845022333457547462772063936365946907208",
        "49759874534344782452838208519883050222759"
    ]
}

With gasPriority:

{
    "dexId": "2100",
    "tokenA": "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
    "tokenB": "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
    "amountBMin": "150",
    "amountAMin": "9140195223753",
    "to": "0xa67E9B68c41b0f26184D64C26e0b2B81466E5994",
    "deadline": "1705994811",
    "from": "0xa67E9B68c41b0f26184D64C26e0b2B81466E5994",
    "gas": "0",
    "gasPriority": "high",
    "binStep": "20",
    "ids": [
        "8375816",
        "8375817",
        "8375818",
        "8375819",
        "8375820",
        "8375821",
        "8375822",
        "8375823",
        "8375824",
        "8375825",
        "8375826"
    ],
    "amounts": [
        "6125082604576892342340742933771827806208",
        "6125082604576892342340742933771827806208",
        "6125082604576892342340742933771827806208",
        "6125082604576892342340742933771827806208",
        "6092234575456602778057561670181153099728",
        "27680318192948304012362129290692653566283",
        "49451196782276463859932823798226771515026",
        "49649387794231952910105025177550757137373",
        "49747539066384995844387966236176975326734",
        "49845022333457547462772063936365946907208",
        "49759874534344782452838208519883050222759"
    ]
}

With Slippage:

{
    "dexId": "2100",
    "tokenA": "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
    "tokenB": "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
    "amountBMin": "150",
    "amountAMin": "9140195223753",
    "to": "0xa67E9B68c41b0f26184D64C26e0b2B81466E5994",
    "slippage": "7",
    "deadline": "1705994811",
    "from": "0xa67E9B68c41b0f26184D64C26e0b2B81466E5994",
    "gas": "0",
    "binStep": "20",
    "ids": [
        "8375816",
        "8375817",
        "8375818",
        "8375819",
        "8375820",
        "8375821",
        "8375822",
        "8375823",
        "8375824",
        "8375825",
        "8375826"
    ],
    "amounts": [
        "6125082604576892342340742933771827806208",
        "6125082604576892342340742933771827806208",
        "6125082604576892342340742933771827806208",
        "6125082604576892342340742933771827806208",
        "6092234575456602778057561670181153099728",
        "27680318192948304012362129290692653566283",
        "49451196782276463859932823798226771515026",
        "49649387794231952910105025177550757137373",
        "49747539066384995844387966236176975326734",
        "49845022333457547462772063936365946907208",
        "49759874534344782452838208519883050222759"
    ]
}

Last updated