Best way to fetch an ERC20 asset ID by its contract address

I want to fetch the asset ID of an asset by its ERC20 contract address. One way to do this would be to hit v1/supported_assets and filter through all the contract_address fields on the client.

This is very slow given the size of the API response, so I’m wondering if there’s a more direct way to query for an asset given a specific ERC20 address?

Thanks!

Hi @jkraut
Welcome to the Fireblocks developer community!

If you have added the ERC20 into your vault account use this endpoint to get all vault wallets of the vault accounts in your workspace.

A vault wallet is an asset in a vault account.

This method allows fast traversal of all account balances. Get vault wallets (Paginated)

With this you can get the AssetId, but currently we do not have a way to fetch assetids by contractAddress.

Once you have the assetId and vault accountId, you can get your address using this endpoint, it will return a paginated response of the addresses for a given vault account and asset. Get addresses (Paginated)

1 Like