Links

venus_portfolio

Get the account's positions and assets in the venus protocol.
Through account_defiPortfolio, you can fetch the account's Supplied, Borrowed, Reward, Staked assets and Health factor in the venus protocol, accountAddress is necessary. Using this API, you are able to acknowledge the detailed information like health rate, token infos and USD amount of each token as well as the sections. Some DeFi investigations and strategies can be made by calling this API.
Supported on BSC.

Parameters

Object - An object with the following fields (required):
  • protocol(string, optional) - "venus", If you don't specify the protocol, the API can return position data for all supported DeFi protocols.
  • 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:
    • data(array of object, defined below) - response datas of the portfolioItemObject, click to view the detailed object description.

Example

Request

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": {
"protocol":"venus",
"accountAddress": "0x489a8756c18c0b8b24ec2a2b9ff3d4d447f79bec"
}
}'
import { BlockVisionProvider, BvNetwork } from 'blockvision.js'
// Optional parameters, but default to eth-mainnet and default api-key.
const bv = new BlockVisionProvider(BvNetwork.BNB_MAINNET)
// Access the BlockVision DeFi API
bv.getAccountDeFiPortfolio({
protocol: 'venus',
accountAddress: '0x489a8756c18c0b8b24ec2a2b9ff3d4d447f79bec'
}).then(console.log)

Result

{
"jsonrpc": "2.0",
"id": 1,
"result": {
"data": [
{
"websiteUrl": "https://venus.io",
"logo": "https://apis.blockvision.org/static/img/logo/xvs.png",
"protocol": "venus",
"healthRate": "1.30",
"healthRateTip": "Your assests will be liquidated if the health factor is less than or equal to 1",
"usdAmount": "93090475",
"positionInfos": [
{
"logo": "https://apis.blockvision.org/static/img/logo/wbnb.png",
"contractAddress": "0xA07c5b74C9B40447a954e1466938b865b6BBea36",
"symbol": "WBNB",
"usdValue": "240974700",
"section": "Supplied",
"balanceTokens": [
{
"contractAddress": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
"symbol": "WBNB",
"balance": "900085.29",
"usdValue": "240974700"
}
]
},
{
"logo": "https://apis.blockvision.org/static/img/logo/busd.png",
"contractAddress": "0x95c78222B3D6e262426483D42CfA53685A67Ab9D",
"symbol": "BUSD",
"usdValue": "62643755",
"section": "Borrowed",
"balanceTokens": [
{
"contractAddress": "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56",
"symbol": "BUSD",
"balance": "62643754.94",
"usdValue": "62643755"
}
]
},
{
"logo": "https://apis.blockvision.org/static/img/logo/usdt.png",
"contractAddress": "0xfD5840Cd36d94D7229439859C0112a4185BC0255",
"symbol": "USDT",
"usdValue": "50119326",
"section": "Borrowed",
"balanceTokens": [
{
"contractAddress": "0x55d398326f99059fF775485246999027B3197955",
"symbol": "USDT",
"balance": "50085592.42",
"usdValue": "50119326"
}
]
},
{
"logo": "https://apis.blockvision.org/static/img/logo/usdc.png",
"contractAddress": "0xecA88125a5ADbe82614ffC12D0DB554E2e2867C8",
"symbol": "USDC",
"usdValue": "35121151",
"section": "Borrowed",
"balanceTokens": [
{
"contractAddress": "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
"symbol": "USDC",
"balance": "35085805.21",
"usdValue": "35121151"
}
]
},
{
"logo": "https://apis.blockvision.org/static/img/logo/xvs.png",
"contractAddress": "0xcf6bb5389c92bdda8a3747ddb454cb7a64626c63",
"symbol": "XVS",
"usdValue": "7",
"section": "Rewards",
"balanceTokens": [
{
"contractAddress": "0xcf6bb5389c92bdda8a3747ddb454cb7a64626c63",
"symbol": "XVS",
"balance": "1.56",
"usdValue": "7"
}
]
}
]
}
]
}
}