Uniswap V3

Supported Chains

Available on Ethereum Mainnet and Testnet, Arbitrum, Avalanche, Base, Binance Smart Chain, and Polygon.

Available Endpoints:

Click on the endpoint to jump to the section with full details

  • /getprice GET - Returns the swap quotation for a given token pair on Uniswap V3.

  • /getuserliquidity GET - Returns the balance of a particular token pair of accounts.

  • /getpoolliquidity GET - Returns the total liquidity for a specified pool.

  • /gettokenliquidity GET - Returns the individual token liquidity within the specified liquidity pool.

  • /getliquidityholders GET - Returns the total number of liquidity holders in a specified pool.

  • /getindividualposition GET - Returns the liquidity position for a specified user address across all the pools for a given DEX.

  • /getpoolindividualliquidity GET - Returns all user addresses, block numbers, and token position details for a specified pool address.

  • /gethistoricaltimeseries GET - Returns historical time series transactions for a specific pool address. Available on Ethereum only.

  • /gethistoricaltransactions GET - Returns historical transactions focusing on swaps associated with a specific pool address. Available on Ethereum only.

  • /gethistoricalpoolchartdata GET - Returns OHCLV (Open, High, Close, Low, and Volume) data for a specified time interval. Available on Ethereum only.

  • /getpooltradedata GET - Returns trade data for a specified pool, block range, and event type. Available on Ethereum only.

  • /swap POST - Initiate a swap transaction on a specified DEX.

  • /addliquidity POST - Add liquidity to a specified pool in a specified DEX.

  • /removeliquidity POST - Remove liquidity from a specified pool in a specified DEX.

DEX IDs

Many endpoints have a parameter where you can provide a DEX ID.

Below is a list of DEX IDs related to Uniswap V3. Please see the DEX ID page for a complete DEX ID list and more information.

DEX NameChainDEX ID

Uniswap V3

Ethereum

1300

Uniswap V3 Testnet

Ethereum Testnet

1302

Uniswap V3

Avalanche

1305

Uniswap V3

Binance Smart Chain

1306

Uniswap V3

Polygon

1307

Uniswap V3

Arbitrum

1308

Uniswap V3

Base

1309

Endpoint Details

/getprice

Returns the swap quotation for a given token pair on Uniswap V3

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

Query Parameters

NameTypeDescription

rpc

String

Remote procedural call URL.

dexId*

String

See the DEX ID page for a list of all DEX IDs. The DEX ID for Uniswap V3 on Ethereum is 1300.

path*

String

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

amountIn*

String

Amount of token.

poolFees

String

Different pool based on the fees. By default, it is selected as 3000.

https://api.expand.network/dex/getprice?dexId=1300&path=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xdac17f958d2ee523a2206206994597c13d831ec7&amountIn=10000000000000000000

back to top

/getuserliquidity

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

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

Query Parameters

NameTypeDescription

rpc

String

Remote procedural call URL.

tokenId*

String

The token ID for uniswap V3 liquidity position.

dexId*

String

Refer to DexId page for details.

https://api.expand.network/dex/getuserliquidity?dexId=1300&tokenId=3238

back to top

/getpoolliquidity

Returns the total liquidity for a specified pool.

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

Query Parameters

NameTypeDescription

rpc

String

Remote procedural call URL.

poolAddress*

String

Pool address whose liquidity is to be fetched.

dexId*

String

Refer to DEX ID page for details.

https://api.expand.network/dex/getpoolliquidity?dexId=1300&poolAddress=0xC12aF0C4AA39D3061c56cD3CB19f5e62dEeaeBdE

back to top

/gettokenliquidity

Returns the individual token liquidity within the specified liquidity pool.

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

Query Parameters

NameTypeDescription

rpc

String

Remote procedural call URL.

poolAddress*

String

The pool address.

dexId*

String

Refer to DEX ID page for details.

https://api.expand.network/dex/gettokenliquidity?dexId=1300&poolAddress=0xC12aF0C4AA39D3061c56cD3CB19f5e62dEeaeBdE

back to top

/getliquidityholders

Returns the total number of liquidity holders in a specified pool.

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

Query Parameters

NameTypeDescription

rpc

String

Remote procedural call URL.

poolAddress*

String

The pool address.

dexId*

String

Refer to DEX ID page for details.

https://api.expand.network/dex/getliquidityholders?dexId=1300&poolAddress=0xC2e9F25Be6257c210d7Adf0D4Cd6E3E881ba25f8

back to top

/getindividualposition

Returns the liquidity position for a specified user address across all the pools for a given DEX.

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

Query Parameters

NameTypeDescription

rpc

String

Remote procedural call URL.

address*

String

The public address of the liquidity holder.

dexId*

String

Refer to DEX ID page for details.

poolAddresses

String

The pool Addresses whose liquidity is to be fetched. (Comma-separated vaules)

https://api.expand.network/dex/getindividualposition?address=0xc36442b4a4522e871399cd717abdd847ab11fe88&poolAddresses=0x971194A53Dddc8Ccfa96d5DD1E42Cd9d15746827&dexId=1300

back to top

/getpoolindividualliquidity

Returns all user addresses, block numbers, and token position details for a specified pool address.

GET https://historicallp.api.expand.network/dex/getpoolindividualliquidity

Query Parameters

NameTypeDescription

rpc

String

Remote procedural call URL.

poolAddress*

String

The pool address.

dexId*

String

Refer to DEX ID page for details.

endPage

String

Index of the last page that user wants to query.

By default: startPage+9

startPage

String

Index of the start page that user wants to query.

By default: endPage-9

https://historicallp.api.expand.network/dex/getpoolindividualliquidity?startPage=9&endPage=10&poolAddress=0xc63b0708e2f7e69cb8a1df0e1389a98c35a76d52&dexId=1300

back to top

/gethistoricaltimeseries

Get historical time series transactions for a specific pool address. Available on Ethereum only.

GET https://historicaltrade.api.expand.network/dex/gethistoricaltimeseries

Query Parameters

NameTypeDescription

dexId*

String

Refer to DEX ID page for details.

endBlock

String

Last block of the range.

startBlock

String

Starting block of the range.

poolAddress*

String

Pool address whose time series is to be fetched.

https://historicaltrade.api.expand.network/dex/gethistoricaltimeseries?dexId=1300&poolAddress=0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640

back to top

/gethistoricaltransactions

Get the historical transactions focusing on swaps associated with a specific pool address. Available on Ethereum only.

GET https://historicaltrade.api.expand.network/dex/gethistoricaltransactions

Query Parameters

NameTypeDescription

dexId*

String

Refer to DEX ID page for details.

endBlock

String

Last block of the range.

startBlock

String

Starting block of the range.

poolAddress*

String

Pool address whose transactions is to be fetched.

https://historicaltrade.api.expand.network/dex/gethistoricaltransactions?poolAddress=0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8&dexId=1300&startBlock=18709774&endBlock=18711525

back to top

/gethistoricalpoolchartdata

Returns OHCLV (Open, High, Close, Low, and Volume) data for a specified time interval. Available on Ethereum only.

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

Query Parameters

NameTypeDescription

dexId*

String

Refer to DEX ID page for details.

interval

String

15 mins(by default), 30 mins, 60 mins, and 90 mins.

limit

String

No of iteration. Start limit is 100 and maximum limit is 500.

poolAddress*

String

Pool address whose transactions is to be fetched.

rpc

String

Remote procedural call URL.

https://api.expand.network/dex/gethistoricalpoolchartdata?dexId=1300&poolAddress=0xCBCdF9626bC03E24f779434178A73a0B4bad62eD&interval=15m&limit=100

back to top

/getpooltradedata

Returns trade data for a specified pool, block range, and event type. Available on Ethereum only.

GET https://historicaltrade.api.expand.network/dex/getpooltradedata

Query Parameters

NameTypeDescription

dexId*

String

Refer to DEX ID page for details.

endBlock

String

Last block of the range.

startBlock

String

Starting block of the range.

poolAddress*

String

Pool address whose data is to be fetched.

eventType

String

Swap, Burn or Mint(by default).

https://historicaltrade.api.expand.network/dex/getpooltradedata?poolAddress=0x5777d92f208679db4b9778590fa3cab3ac9e2168&dexId=1300&eventType=Swap

back to top

/swap

Initiate a swap transaction on a specified DEX.

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

Request Body

NameTypeDescription

rpc

String

Remote procedural call URL.

dexId*

String

Refer to the DEX ID page for details.

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.

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.

poolFees

String

Different pool based on the fees. By default, it is selected as 3000.

gasPriority

String

low, medium, or high.

slippage

String

Percentage of total swap value. By default, 1.

0 <= slippage value <= 10

{
    "dexId": "1300",
    "amountIn": "1000000000000000",
    "amountOutMin": "0",
    "path": ["0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2","0x6B175474E89094C44Da98b954EedeAC495271d0F"],
    "to": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "poolFees": "2975",
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "gas": "173376"
}

With gasPriority (medium):

{
    "dexId": "1300",
    "amountIn": "1000000000",
    "amountOutMin": "0",
    "path": [
        "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
        "0x6B175474E89094C44Da98b954EedeAC495271d0F"
    ],
    "to": "0x6Fb447Ae94F5180254D436A693907a1f57696900",
    "from": "0x6Fb447Ae94F5180254D436A693907a1f57696900",
    "gas": "173376",
    "gasPriority": "medium"
}

With Slippage:

{
    "dexId": "1300",
    "amountIn": "1000000",
    "amountOutMin": "999831028599930500",
    "path": [
        "0xdAC17F958D2ee523a2206206994597C13D831ec7",
        "0x6B175474E89094C44Da98b954EedeAC495271d0F"
    ],
    "to": "0x22cf65ae3fa16d6379e72f4b4c2401c1b7c69731",
    "deadline": "1711931771",
    "from": "0x22cf65ae3fa16d6379e72f4b4c2401c1b7c69731",
    "gas": "933376",
    "gasPriority": "high",
    "slippage": "1"
}

back to top

/addliquidity

Add liquidity to a specified pool in a specified DEX.

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

Request Body

NameTypeDescription

dexId*

String

Refer to the DEX ID page for details.

tokenA*

String

Address of the first token being added.

tokenB*

String

Address of the second token being added.

poolFees*

String

Different pool based on the fees.

amountADesired*

String

Desired amount of token A.

amountBDesired*

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.

tokenId

String

The token ID for uniswap V3 liquidity position.

gasPriority

String

low, medium, or high.

slippage

String

Percentage of total value. By default, 1.

0 <= slippage value <= 10

{
    "dexId": "1300",
    "tokenA": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
    "tokenB": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
    "poolFees": "3000",
    "amountADesired": "1000000000000000",
    "amountBDesired": "1294471768449933344",
    "amountAMin": "0",
    "amountBMin": "0",
    "deadline": "1666193668",
    "to": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "gas": "5446762"
}

With gasPriority (medium):

{
    "dexId": "1300",
    "tokenA": "0x6B175474E89094C44Da98b954EedeAC495271d0F", 
    "tokenB": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", 
    "amountADesired": "1000000000000000",
    "amountBDesired": "999",
    "amountAMin": "0",
    "amountBMin": "0",
    "poolFees":"3000",
    "from": "0x356dB816602c85e2075774bB77D13995c8Bab023",
    "to":"0x356dB816602c85e2075774bB77D13995c8Bab023",
    "deadline":"1699966737054",
    "gas": "123444",
    "gasPriority":"medium"
}

With Slippage:

{
    "dexId": "1300",
    "tokenA": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
    "tokenB": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
    "poolFees": "3000",
    "amountADesired": "1000000000000000",
    "amountBDesired": "1294471768449933344",
    "amountAMin": "0",
    "amountBMin": "0",
    "deadline": "1666193668",
    "to": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "gas": "5446762",
    "slippage": "5"
}

back to top

/removeliquidity

Remove liquidity from a specified pool for a specified DEX.

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

Request Body

NameTypeDescription

dexId*

String

Refer to the DEX ID page for details.

tokenId*

String

The token ID for uniswap V3 liquidity position.

amountAMin

String

Minimum amount of Token A.

amountAMax

String

Maximum amount of Token A.

amountBMax

String

Maximum amount of Token B.

recipient

String

Recipient for sweep tokens.

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.

liquidity*

string

The liquidity to be removed.

amountBMin

String

Minimum amount of Token B.

gasPriority

String

low, medium, or high.

slippage

String

Percentage of total value. By default, 1.

0 <= slippage value <= 10

{
    "dexId": "1300",
    "tokenId": "38177",
    "tokenA":"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
    "liquidity": "499737032187727318211",
    "amountAMin": "0",
    "amountBMin": "0",
    "deadline": "1763180052",
    "recipient": "0x0000000000000000000000000000000000000000",
    "amountAMax": "340282366920938463463374607431768211455",
    "amountBMax": "340282366920938463463374607431768211455",
    "tokenB": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "gas": "2421200"
}

With gasPriority:

{
    "dexId": "1300",
    "tokenId": "609214",
    "tokenA": "0x9813037ee2218799597d83D4a5B6F3b6778218d9",
    "liquidity": "202694601337334530",
    "chainId": "1",
    "amountAMin": "0",
    "amountBMin": "0",
    "recipientA": "0x0000000000000000000000000000000000000000",
    "amountAMax": "340282366920938463463374607431768211455",
    "amountBMax": "340282366920938463463374607431768211455",
    "amountMinimumA": "0",
    "recipientB": "0x4C99D660A51D41bE5D47D66a3d89d5B83D92f27E",
    "to": "0x4C99D660A51D41bE5D47D66a3d89d5B83D92f27E",
    "deadline": "1700642704004",
    "from": "0x4C99D660A51D41bE5D47D66a3d89d5B83D92f27E",
    "gas": "80000",
    "gasPriority":"medium"
}

With slippage:

{
    "dexId": "1300",
    "tokenId": "38177",
    "tokenA": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
    "liquidity": "499737032187727318211",
    "amountAMin": "10000000",
    "amountBMin": "10000000",
    "deadline": "1763180052",
    "recipient": "0x0000000000000000000000000000000000000000",
    "amountAMax": "340282366920938463463374607431768211455",
    "amountBMax": "340282366920938463463374607431768211455",
    "tokenB": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "gas": "2421200",
    "slippage": "9.50"
}

back to top

Last updated