There might be cases where Fordefi does not detect an asset in a vault or does not show its up-to-date balance. This happens, for example, on custom EVM chains, where Fordefi does not index incoming transactions.
If such cases, you can add an asset manually to your vault or trigger a balance update. In addition to adding tokens through the UI, you can do the same using the Fordefi API, so:
Call theĀ Create Asset Info API with the token's asset identifier to get back a Fordefi Asset ID.
Call the Refresh Assets API with the vault ID(s) and asset ID(s) to add the asset to the vault.
curl 'https://api.fordefi.com/api/v1/assets/refresh-owned-assets' \
-X POST \
-H 'content-type: application/json' \
-H 'Authorization: Bearer <API_TOKEN>' \
--data-raw '{"vault_ids":["<VAULT_ID>"], "asset_ids":["<ASSET_ID>"]}'The asset identifier you pass to Create Asset Info depends on the token type. This page includes two examples:
- Add ERC-20 tokens: tokens on EVM chains, identified by chain and contract address.
- Add Hypercore (Hyperliquid spot) assets: Hyperliquid spot tokens, identified by their token ID and index on Hyperliquid.
To add an ERC-20 token, pass the chain ID (for example, evm_1 for Ethereum Mainnet) and the token's contract address (for example, 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 for USDC on Ethereum Mainnet).
Here is a full example:
curl -X POST \
'https://api.fordefi.com/api/v1/assets/asset-infos' \
--header 'Authorization: Bearer eyJhb1234' \
--header 'Content-Type: application/json' \
--data-raw '{
"asset_identifier": {
"type": "evm",
"details": {
"type": "erc20",
"token": {
"chain":"evm_1",
"hex_repr":"0x7dd9c5cba05e151c895fde1cf355c9a1d5da6429"
}
}
}
}'And the response:
{
"id": "6f7be078-70de-4980-874d-d14eeff98cd4",
"asset_identifier": {
"type": "evm",
"details": {
"type": "erc20",
"token": {
"chain": "evm_ethereum_mainnet",
"hex_repr": "0x7DD9c5Cba05E151C895FDe1CF355C9A1D5DA6429"
}
},
"chain": {
"chain_type": "evm",
"named_chain_id": "ethereum_mainnet",
"chain_id": 1,
"unique_id": "evm_ethereum_mainnet",
"name": "Ethereum",
"native_currency_symbol": "ETH",
"native_currency_name": "Ether",
"blockchain_explorer": {
"transaction_url": "https://etherscan.io/tx/",
"address_url": "https://etherscan.io/address/",
"root_url": "https://etherscan.io/",
"transaction_format_url": "https://etherscan.io/tx/%s",
"address_format_url": "https://etherscan.io/address/%s",
"asset_format_url": "https://etherscan.io/address/%s"
},
"logo_url": "https://logos.fordefi.com/chains/evm/default/1.svg",
"is_testnet": false,
"is_enabled": true,
"gas_type": "dynamic",
"supports_secure_node": true,
"source": "default"
}
},
"name": "Golem Network Token",
"symbol": "GLM",
"decimals": 18,
"verified": true,
"metadata_uri": "",
"is_spam": false,
"logo_url": "https://logos.fordefi.com/tokens/1/0x7dd9c5cba05e151c895fde1cf355c9a1d5da6429.png",
"explorer_url": "https://etherscan.io/address/0x7DD9c5Cba05E151C895FDe1CF355C9A1D5DA6429"
}Hypercore spot tokens are not ERC-20 contracts, so the ERC-20 example does not apply to them. Use the hyperliquid details type instead, which takes the token's token_id and index on Hyperliquid.
To find these values, call the Hyperliquid spot metadata endpoint:
curl -X POST 'https://api.hyperliquid.xyz/info' \
-H 'Content-Type: application/json' \
-d '{"type": "spotMeta"}'Each entry in the tokens array of the response includes an index and a tokenId. Pass them as index and token_id. If token_id does not match the token at that index, Fordefi returns a 404 Asset_info not found error. Do not use the token's evmContract address: it identifies the linked HyperEVM token, which you add with the ERC-20 example on the HyperEVM chain.
Set chain to evm_hypercore_mainnet. Fordefi creates the asset on Hypercore.
For example, to add PURR (index 1):
curl -X POST \
'https://api.fordefi.com/api/v1/assets/asset-infos' \
--header 'Authorization: Bearer <API_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
"asset_identifier": {
"type": "evm",
"details": {
"type": "hyperliquid",
"chain": "evm_hypercore_mainnet",
"token_id": "0xc1fb593aeffbeb02f85e0308e9956a90",
"index": 1
}
}
}'The response returns the Fordefi Asset ID in id. The name is the token's full name on Hyperliquid (or its ticker if it has none) followed by (Spot), and decimals is the token's weiDecimals from the spot metadata. Abbreviated response:
{
"id": "<ASSET_ID>",
"asset_identifier": {
"type": "evm",
"details": {
"type": "hyperliquid",
"chain": "evm_hypercore_mainnet",
"token_id": "0xc1fb593aeffbeb02f85e0308e9956a90",
"index": 1
},
"chain": {
"chain_type": "evm",
"named_chain_id": "hypercore_mainnet",
"chain_id": 1337,
"unique_id": "evm_hypercore_mainnet",
"name": "HyperCore",
"native_currency_symbol": "HYPE",
"native_currency_name": "Hyperliquid",
...
}
},
"name": "PURR (Spot)",
"symbol": "PURR",
"decimals": 5,
...
}