Covalent: Covalent Spotlights Use Cases with Wallet Data
Author

Leilani Ledingham

Product, Covalent

Covalent Spotlights Use Cases with Wallet Data

Jun 30, 2022

TL;DR

  • Covalent’s best-in-class balances endpoints allow you to fetch all ERC20 and NFT tokens for an address with just one API call
  • Try out our Web3 Wallet Component on GitHub for an easy way to display token balances
  • Head to our Web3 Starter Resources repository to get started with an array of code templates -feel free to give it a ⭐️
  • Follow the ‘Why JSON-RPC doesn’t scale for Web3 data’ Code Along to explore fetching token balances through RPCs compared to the Covalent API

Covalent and Wallet Data

Wallets are the backbone of Web3, allowing users to connect to blockchain-based protocols and store asset data in a way that doesn’t require intermediaries or centralized solutions. Under the hood, Web3 wallets are key-based, meaning users are responsible for remembering a public key, private key and a seed phrase to allow them access to send and receive transactions.

On the front-end, the purpose of a wallet is to display a list of token balances held by a user, making it easier to keep track of on-chain activity. For that use case, Covalent is the leading data solution, returning a full list of ERC20 and NFT token balances for any address with just one API call.

Querying Token Balances

To find and get started with Covalent’s balances endpoints, keep reading or watch the video 😃.

Covalent currently provides five endpoints related specifically to tokens, however to build a wallet you only really need one: Get token balances for address. Specifying the ID of the blockchain you are querying and the wallet address, this endpoints returns ERC20, ERC721 (NFT) and ERC1155 token balances and their current spot prices. Network native tokens like ETH on Ethereum are also returned even though it’s not a token contract. Therefore, with just one endpoint developers can create the majority of the display on popular wallets such as Rainbow Wallet (below).

rainbow wallet

Additionally, Covalent supports over 35 blockchains all through a single Unified API, making it quick and easy to get data across multiple chains. For the wallet use case, the token balances endpoints eliminate the need to use multiple RPCs and query tokens one by one. This is a big time-saver for developers, and makes applications built with the Covalent API more scalable.

Other balances endpoints provided by Covalent:

  • Get historical portfolio value over time
  • Get ERC20 token transfers for address
  • Get token holders as of any block height
  • Get changes in token holders between two block heights

Wallet Component and Other Resources

As a developer-focused company we want to make it easy for anyone to get started building in Web3. One of the ways we contribute to this goal is by creating code-templates, components, and other resources that are open to everyone.

Below, is a wallet component that provides a balances table for any given wallet address and chainID across supported blockchains.

token balances

To integrate this component, simply follow the README here and install with npm: npm install @covalenthq/web3-components. The sample code is shown below.

wallet

To explore our other code templates, check out the Web3 Starter Resources repository here, including Why JSON-RPC doesn’t scale for Web3 data, a Code Along. If you like our templates, give us some ⭐️ power!

About Covalent

Covalent provides the industry-leading Unified API bringing visibility to billions of Web3 data points. Developers use Covalent to build exciting multi-chain applications like crypto wallets, NFT galleries, and investor dashboard tools utilizing data from 50+ blockchains. Covalent is trusted by a community of 40,000+ developers and powers data for 3000+ applications including 0x, Zerion, Rainbow Wallet, Rotki, Bitski and many others.

Website | Discord | Telegram | Twitter | Youtube | 微信公众号

Sign up for our newsletter.
Stay updated on our latest product launches, network updates, research insights, token economics related news, and more!