Add Custom Tokens
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, passing in the chain ID (for example,
evm_1
for Ethereum Mainnet) and a contract address (or example,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
for USDC on Ethereum Mainnet) 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>"]}'
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"
}