How to fetch a Smart Account's ERC-20 tokens Alchemy provides several Enhanced APIs, which are especially useful for querying information about the smart accounts you create using Account Kit, such as the account's ERC-20 Token balances using the Token API.
For the purposes of our example, we will use the Token API to query our smart account's data by extending the Alchemy Smart Account Client with Enhanced APIs.
- Install the alchemy-sdk Alchemy has developed a Typescript SDK to make development with the Enhanced APIs simple. The SDK includes ways to leverage Alchemy's Simulation API, Token API, Transact API, NFT API, Webhooks and Websockets, and more across Alchemy's supported chains. Take a look at the code here.
We will use the Alchemy SDK Client to extend our Alchemy Smart Account Client using the client's alchemyEnhancedApiActions method. That way, our client will have direct access to the Enhanced APIs.