Sequence Indexer Gateway API - Fetch ERC20, ERC721, and ERC1155 Tokens and Metadata
The Tokens API allows users to fetch a list of ERC20, ERC721, and ERC1155 tokens along with metadata from any wallet across multiple Ethereum networks.
Tokens Balances
In the following examples, we’re going to use the GetTokenBalances
method from
Sequence Indexer Gateway:
GetTokenBalances
- Request: POST /rpc/IndexerGateway/GetTokenBalances
- Content-Type: application/json
- Body (in JSON):
chainIds
([]int - optional) — return results only for the chains that match the given ID.networks
([]string - optional) — return results only for the chains that match the given names.accountAddress
(string) — the wallet account addresscontractAddress
: (string — optional) — the token contract addresstokenID
: (string — optional) — the ID of the tokenincludeMetadata
(boolean - optional - default: false) — toggle token metadata to be included in the responseincludeCollectionTokens
(boolean - optional - default: true) — toggle to represent ERC721 / ERC1155 tokens as a single summary item in the responsemetadataOptions
(object - optional) — additional options for metadataverifiedOnly
(boolean - optional) — return only contracts which are ‘verified’ to help reduce spamunverifiedOnly
(boolean - optional) — return only contracts which are ‘unverified’includeContracts
([]string - optional) — list of specific contract addresses to always be included, even if verifiedOnly is enabled.
These examples are based on the Fetch All Tokens example for Indexer.
Get token balances and metadata from an account on multiple Ethereum networks
Example: Retrieve token balances, along metadata for the
0x8e3E38fe7367dd3b52D1e281E4e8400447C8d8B9
account across all chains.
PRO TIP: fetching ERC721/1155 token IDs
You’ll notice that, by default, GetTokenBalances
will return at most one
token instance from each contract. In order to fetch ERC721/1155 token
balances, you must pass the contractAddress
to the GetTokenBalances
method.
This will return all of the tokens owned by accountAddress
from the specified
contractAddress
. See section below for more information.
Fetch token IDs, balances and metadata of ERC721 and ERC1155 collections.
Example: fetch token balances for a specific account and token contract on the Polygon network