How to Access the GoldRush API Using the Viem Framework: A Comprehensive Guide
The GoldRush API, renowned for its unified approach to blockchain data, offers developers seamless access to detailed information across over 200 blockchains. With the integration of GoldRush's Unified API into the Viem framework, leveraging the TypeScript-based Viem Compatible SDK, developers can now efficiently utilize blockchain data in application development. This guide will walk you through setting up and using the GoldRush API with the Viem framework, enhancing your blockchain projects with minimal API calls.
Why Use GoldRush with Viem?
GoldRush provides a robust solution for accessing comprehensive blockchain data, including transactions, balances, and NFTs, with industry-leading performance. The integration with Viem allows developers to:
Access data across multiple blockchains seamlessly.
Reduce development overhead with simplified API interactions.
Implement features quickly with high-level abstractions and pre-built functions.
Getting Started with GoldRush and Viem
1
Installation
npm install viem @covalenthq/client-viem-sdk
yarn add viem @covalenthq/client-viem-sdk
2
Setting Up a Client
3
Consuming Actions with GoldRush
const tokenBalances = await client.BalanceService.getTokenBalancesForWalletAddress("eth-mainnet", "demo.eth");
console.log(tokenBalances.data);
const walletActivity = await client.BaseService.getAddressActivity("demo.eth");
console.log(walletActivity);
const nfts = await client.NftService.getNftsForAddress("eth-mainnet", "demo.eth");
console.log(nfts);
const floorPrices = await client.NftService.getNftMarketFloorPrice("eth-mainnet", "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d");
console.log(floorPrices);
Conclusion
Integrating the GoldRush API with the Viem framework empowers developers to build more dynamic, data-rich blockchain applications. By following this guide, you can enhance your applications with extensive blockchain data accessible through a unified API, ensuring your projects are both powerful and efficient. For further details and more advanced use cases, refer to the README documentation provided with the @covalenthq/client-viem-sdk.