account_defiPortfolio
Get the account's positions and assets in the supported DeFi protocol.
Through account_defiPortfolio, you can fetch the account's positions and assets in the supported DeFi protocol,
accountAddress
is necessary. Using this API, you are able to acknowledge the detailed information like Liquidity Pool, Supplied, Borrowed, Reward, Farming, Locked, Yield, Deposit, Staked assets, 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, BNB Chain, Optimism, Polygon, and Arbitrum.
Object
- An object with the following fields (required):accountAddress(hex string, required)
- the account address you want to query.
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:data(array of object)
- response data of the portfolioItemObject, click to view the detailed object description.totalUsdAmount(string, float)
- the total USD amount of the account's positions in all supported DeFi protocols.
curl
TypeScript
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": {
"accountAddress": "0x1d5e65a087ebc3d03a294412e46ce5d6882969f4"
}
}'
import { BlockVisionProvider, BvNetwork } from 'blockvision.js'
// Optional parameters, but default to eth-mainnet and default api-key.
const bv = new BlockVisionProvider(BvNetwork.ETH_MAINNET)
// Access the BlockVision Account API
bv.getAccountDeFiPortfolio({
accountAddress: '0xe1bdcd3b70e077d2d66adcbe78be3941f0bf380b'
}).then(console.log)
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"data": [
{
"websiteUrl": "https://curve.fi",
"logo": "https://apis.blockvision.org/static/img/logo/crv.png",
"protocol": "Curve",
"proxy": "",
"usdAmount": "1374463",
"positionInfos": [
{
"logo": "https://apis.blockvision.org/static/img/logo/crv.png",
"contractAddress": "0x5f3b5dfeb7b28cdbd7faba78963ee202a494e2a2",
"symbol": "CRV",
"usdValue": "986642.10",
"section": "Locked",
"unlockTime": "2026-10-29 00:00",
"balanceTokens": [
{
"contractAddress": "0x5f3b5dfeb7b28cdbd7faba78963ee202a494e2a2",
"symbol": "CRV",
"balance": "1034225.95",
"usdValue": "986642.10"
}
]
},
{
"logo": "https://apis.blockvision.org/static/img/logo/usdt.png,https://apis.blockvision.org/static/img/logo/wbtc.png,https://apis.blockvision.org/static/img/logo/weth.png",
"contractAddress": "0xDeFd8FdD20e0f34115C7018CCfb655796F6B2168",
"symbol": "USDT+WBTC+WETH",
"usdValue": "387775",
"section": "Farming",
"rewardTokens": [
{
"contractAddress": "0xD533a949740bb3306d119CC777fa900bA034cd52",
"symbol": "CRV",
"balance": "2943.09",
"usdValue": "2808"
}
],
"balanceTokens": [
{
"contractAddress": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
"symbol": "USDT",
"balance": "127882.77",
"usdValue": "127883"
},
{
"contractAddress": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",
"symbol": "WBTC",
"balance": "6.22",
"usdValue": "256536"
},
{
"contractAddress": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"symbol": "WETH",
"balance": "82.08",
"usdValue": "384967"
}
]
},
{
"logo": "https://apis.blockvision.org/static/img/logo/dai.png,https://apis.blockvision.org/static/img/logo/usdc.png,https://apis.blockvision.org/static/img/logo/usdt.png",
"contractAddress": "0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7",
"symbol": "DAI+USDC+USDT",
"usdValue": "46",
"section": "Liquidity Pool",
"balanceTokens": [
{
"contractAddress": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
"symbol": "DAI",
"balance": "15.98",
"usdValue": "16"
},
{
"contractAddress": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"symbol": "USDC",
"balance": "15.79",
"usdValue": "32"
},
{
"contractAddress": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
"symbol": "USDT",
"balance": "13.83",
"usdValue": "46"
}
]
}
]
},
{
"websiteUrl": "https://www.convexfinance.com",
"logo": "https://apis.blockvision.org/static/img/logo/cvx.png",
"protocol": "Convex",
"proxy": "",
"usdAmount": "60216",
"positionInfos": [
{
"logo": "https://apis.blockvision.org/static/img/logo/cvxcrv.png",
"contractAddress": "0x5f3b5dfeb7b28cdbd7faba78963ee202a494e2a2",
"symbol": "cvxCRV",
"usdValue": "60216",
"section": "Locked",
"unlockTime": "2022-12-29 00:00",
"rewardTokens": [
{
"contractAddress": "0x62B9c7356A2Dc64a1969e19C23e4f579F9810Aa7",
"symbol": "cvxCRV",
"balance": "965.58",
"usdValue": "866.48"
},
{
"contractAddress": "0xFEEf77d3f69374f66429C91d732A244f074bdf74",
"symbol": "cvxFXS",
"balance": "17.53",
"usdValue": "118.19"
}
],
"balanceTokens": [
{
"contractAddress": "0x62B9c7356A2Dc64a1969e19C23e4f579F9810Aa7",
"symbol": "cvxCRV",
"balance": "11485.11"
}
]
}
]
},
{
"websiteUrl": "https://www.liquity.org",
"logo": "https://apis.blockvision.org/static/img/logo/lqty.png",
"protocol": "Liquity",
"healthRateTip": "Your assests will be liquidated if the health factor is less than or equal to 1",
"proxy": "",
"usdAmount": "37193",
"positionInfos": [
{
"logo": "https://apis.blockvision.org/static/img/logo/lusd.png",
"contractAddress": "0x66017d22b0f8556afdd19fc67041899eb65a21bb",
"symbol": "LUSD",
"usdValue": "37193",
"section": "Farming",
"rewardTokens": [
{
"contractAddress": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"symbol": "ETH",
"balance": "0.15",
"usdValue": "234"
},
{
"contractAddress": "0x6dea81c8171d0ba574754ef6f8b412f2ed88c54d",
"symbol": "LQTY",
"balance": "717.87",
"usdValue": "529"
}
],
"balanceTokens": [
{
"contractAddress": "0x5f98805a4e8be255a32880fdec7f6728c6568ba0",
"symbol": "LUSD",
"balance": "35019.17",
"usdValue": "36430"
}
]
}
]
}
],
"totalUsdAmount": "1471872.00"
}
}
Last modified 14d ago