Uniswap V2 Pairs
Get pairs created between blocks 1
and latest
that trade with USDC
token 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
There is no block range limit on this endpoint.
curl -s --location --request GET \
"https://app.pangea.foundation/v1/api/uniswap/v2/pairs?chains=ETH&from_block=1&tokens__in=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" \
--header "Accept: application/jsonstream" \
--header "Accept-Encoding: gzip" --compressed \
--header "Authorization: Basic $PANGEA_AUTH" | jq
Result
[
...
{
"chain": 1,
"block_number": 10979701,
"block_hash": "0x246b405020d3af635bba059f8d48cbf3c0baf08790d2ef40346d7241dae3451b",
"transaction_hash": "0x3689e100892fa5679b7d99a3eef8c4912eb8f0a96fed79b86610cd35d84fe6cf",
"transaction_index": 11,
"log_index": 37,
"factory": "0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f",
"token0_address": "0x4e44fe174e934ff78a77bee3c2b752fd1beefdef",
"token0_decimals": 18,
"token0_name": "GOKU",
"token0_symbol": "GOKU",
"token1_address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"token1_decimals": 6,
"token1_name": "USD Coin",
"token1_symbol": "USDC",
"pair_address": "0x691d6ac2ad2b87eabb1d4219ecee7fc0768f2201",
"pair_index": 12615,
"timestamp": 1601683999
}
]
The chains
parameter accepts the "chain", "chain_code" or "chain_name" as the input. In this query it is set to ETH
, indicating that the information should be specific to the Ethereum blockchain. There are three possible values for Ethereum: ETH
, 1
or Ethereum
. These values are found on the /status
endpoint for supported chains.
The from_block
parameter is set to 16821500
, indicating that the query should begin at block number 16821500
.
The to_block
parameter is set to latest
, indicating that the query should continue until the latest block.
*_block
parameters are set to latest
by default.
The tokens__in
parameter is a filter on the token
field. Here it is set to 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
, indicating that the query should only return information on pairs that include the specified token0
or token1
address.
Uniswap V2 Pairs Examples
Tip: To get the latest 10 blocks of data try ?&from_block=-10&chains=ETH
Filter by Factory Address
curl -s --location --request GET \
"https://app.pangea.foundation/v1/api/uniswap/v2/pairs?chains=ETH&from_block=-8640&factory_address__in=0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f" \
--header "Accept: application/jsonstream" \
--header "Accept-Encoding: gzip" --compressed \
--header "Authorization: Basic $PANGEA_AUTH" | jq
This request specifies that we are interested in Uniswap V2 pairs on Ethereum, and that the query should start from the from_block
-8640
to return results from the last 24 hours. The factory_address__in
parameter is set to the Uniswap V2 factory address to ensure the query only returns pairs created by the official Uniswap V2 factory.
Filter by Factory Address and Tokens Address
curl -s --location --request GET \
"https://app.pangea.foundation/v1/api/uniswap/v2/pairs?chains=ETH&from_block=-60480&factory_address__in=0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f&tokens__in=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" \
--header "Accept: application/jsonstream" \
--header "Accept-Encoding: gzip" --compressed \
--header "Authorization: Basic $PANGEA_AUTH" | jq
If you need to filter by specific tokens, say USDC, you can use the token0__in
, token1__in
or tokens__in
parameters as described in the query parameters above. This example query filters results from the last 7 days by setting from_block
to 60480
.
Query parameters
v1/api/uniswap/v2/pairs
chains
: This parameter is used to filter the data by specific blockchain networks.from_block
: This parameter is used to filter the data by a starting block number.to_block
: This parameter is used to filter the data by an ending block number.pair_address__in
: This parameter is used to filter the data by a list of pair addresses.factory_address__in
: This parameter is used to filter the data by a list of pair factory addresses.token0__in
: This parameter is used to filter the data by a list of token0 names or symbols.token1__in
: This parameter is used to filter the data by a list of token1 names or symbols.token0_address__in
: This parameter is used to filter the data by a list of token0 addresses.token1_address__in
: This parameter is used to filter the data by a list of token1 addresses.tokens__in
: This parameter is used to filter the data by a list of token addresses, which can include both token0 and token1 addresses.