Links

eco_portfolio

Get the account's positions and assets in the Eco protocol.
Through account_defiPortfolio, you can fetch the account's Pool-Staked in the eco protocol, accountAddress is necessary. Using this API, you are able to acknowledge the detailed information like Pool-Staked 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, optional) - "eco", 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":"eco",
"accountAddress": "0xc22a69ee4136fdcd8ce47ea261318c2d0d866b1f"
}
}'
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 DeFi API
bv.getAccountDeFiPortfolio({
protocol: 'eco',
accountAddress: '0xc22a69ee4136fdcd8ce47ea261318c2d0d866b1f'
}).then(console.log)

Result

{
"jsonrpc": "2.0",
"id": 1,
"result": {
"data": [
{
"websiteUrl": "https://eco.org",
"logo": "https://apis.blockvision.org/static/img/logo/eco.png",
"protocol": "Eco",
"proxy": "",
"usdAmount": "13850948",
"positionInfos": [
{
"logo": "https://apis.blockvision.org/static/img/logo/default.png",
"contractAddress": "0x3a16f2fee32827a9e476d0c87e454ab7c75c92d7",
"symbol": "ECOx",
"usdValue": "13850948",
"section": "Staked",
"balanceTokens": [
{
"contractAddress": "0xcccD1Ba9f7acD6117834E0D28F25645dECb1736a",
"symbol": "ECOx",
"balance": "17061008.00",
"usdValue": "13850948"
}
]
}
]
}
]
}
}