uniswapv2_portfolio
Get the account's positions and assets in the Uniswap v2 protocol.
You can specify the account address and then you can query the account's Locked, Liquidity Pool, Reward, Staked assets in the Uniswap V2 protocol. Using this API, you are able to acknowledge the detailed information like Locked, Liquidity Pool token infos and USD amount of each token as well as the sections. Some DeFi investigation and strategies can be made by calling this API.
Supported on Ethereum.

Parameters

Object - An object with the following fields (required):
  • protocol(string, required) - "uniswapv2".
  • accountAddress(hex string, required) - The account you intend to check.

Returns

Object - An object with the following fields:
  • id(integer number) - json-rpc id.
  • jsonrpc(string) - json-rpc version.
  • result(object) - an object with the following fields:
    • tokenInfos(array of objects, defined below) - sorted in ascending order by USD amount.
    • depositUsdAmount(string) - the account's deposit USD amount in this protocol.
    • usdAmount(string) - the account's USD assets in this agreement, see how usdAmount is calculated.
    • claimableRewardAmount(string) - the account claimable USD amount.
  • Object schema:
    • contractAddress(hex string) - the contract address of the erc20 token on chain.
    • symbol(string) - the symbol of erc20 token.
    • balance(string) - the balance of user's token.
    • usdValue(string) - the USD balance of user's token.
    • section(string) - the categories of token assets : Liquidity Pool, Staked...
    • tokens(array of token objects) - the USD balance of user's token.
    • Token Object schema:
    • contractAddress(string) - erc20 token address
    • symbol(string) - the symbol of erc20 token.
    • balance(string) - the balance of user's token.
    • usdValue(string) - the USD balance of user's token.

Example

Request

curl --location --request POST 'https://apis.blockvision.org/v1/<api key>' \
--header 'Content-Type: application/json' \
--data-raw '{
"id": 1,
"jsonrpc": "2.0",
"method": "account_defiPortfolio",
"params": {
"protocol":"uniswapv2",
"accountAddress": "0x3e78c293c2488e08a033c32938f3cdf4017ad448"
}
}'

Result

{
"jsonrpc": "2.0",
"id": 1,
"result": {
"accountUsdAmount": "7838081",
"lpTokensInfos": [
{
"contractAddress": "0xB4e16d0168e52d35CaCD2c6185b44281Ec28C9Dc",
"name": "Uniswap V2",
"symbol": "UNI-V2",
"totalSupply": "0.71",
"balance": "0.04",
"usdValue": "7838081",
"tokens": [
{
"contractAddress": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"symbol": "USDC",
"balance": "3918514.80"
},
{
"contractAddress": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"symbol": "WETH",
"balance": "2081.66"
}
]
}
]
}
}
Copy link
Outline
Parameters
Returns
Example
Request
Result