To get a list of a vault's assets and balances, use the Get Vault Balances API endpoint. The response contains an owned_assets list. For each element in the owned_assets list, the important fields are:
priced_assetthat contains information about the asset, including:priced_asset.asset_infocontains the metadata about the asset, such as its name, token contract address, and more.priced_asset.pricecontains the fiat price of the asset.
balancecontains the balance of the asset in the vault. Within it:balance.minedis the confirmed balance of the asset.balance.pending_incomingis the balance of the asset that is still pending in the mempool. This is only available on Bitcoin.
All balances are denominated in the token's base units. The decimals field within the token's asset_info contains specifies the conversion between base units and the display units: a display unit consists of 10**decimals base units. For example, Ether amounts are specified in wei, the decimals field is set to 18, and 1 ETH = 1018 wei.
The price of a token is given in the price.price_float field, which contains the price in cents of a single main unit of the token. For example, that would be the price in cents of 1 ETH.
See the following example:
- Production
https://api.fordefi.com/api/v1/vaults/{id}/assets
- curl
- Python
- JavaScript
- Go
- C#
- Payload
curl -i -X GET \
'https://api.fordefi.com/api/v1/vaults/{id}/assets' \
-H 'Authorization: Bearer <YOUR_JWT_HERE>'To get the combined balances of all the vaults in the workspace, you can use the List Owned Assets API endpoint.