The Covalent Wrap SDK offers a powerful interface to access blockchain data seamlessly. Leveraging the power of Polywrap, it encapsulates the intricate processes of querying blockchain data, making it easier and more efficient for developers to fetch token balances, transactions, transfers, and more without the need for manual API calls.
- Broad Data Access: Use the Wrap to retrieve comprehensive blockchain data, from token balances to detailed transaction logs.
- Cross-Platform: Built upon Polywrap, this Wrap is designed to run across a vast array of platforms, ensuring broad compatibility.
To integrate Covalent Wrap SDK into your project, utilize the npm
package manager:
npm install @polywrap/client-js
Note: Installation procedures might vary based on your specific environment. For in-depth details, kindly refer to the Polywrap documentation.
Here's a sample code that demonstrates how to fetch token balances of a specific Ethereum address:
import {PolywrapClient} from "@polywrap/client-js";
async function fetchTokenBalances() {
const accountAddress = "<0xYourEthereumAddress>";
const client = new PolywrapClient();
const result = await client.invoke({
uri: "wrapscan.io/polywrap/covalent@1.0",
method: "getTokenBalances",
args: { accountAddress },
env: {
apiKey: "<YOUR_API_KEY>",
vsCurrency: "usd",
format: 0 // JSON
}
});
console.log(result); // Outputs token balances for the given address
}
fetchTokenBalances().then(() => {
console.log("Fetching complete!");
});
Through this Wrap, you gain access to several potent functionalities, including:
- Token Balances: Retrieve token balances for a specific address.
- Token Transfers: Fetch detailed token transfer events for an address.
- Transactions: Obtain an extensive list of transactions associated with an address.
- Event Logs: Deep dive into event logs for transactions.
Each function provides valuable insights, making blockchain data more accessible and understandable, aiding in diverse applications like portfolio tracking, DApp development, and more.
We always appreciate feedback from the community. If you stumble upon issues or have suggestions, kindly open an issue on our GitHub repository. We also welcome contributions! Kindly adhere to the contribution guidelines and maintain a respectful code of conduct.
The Covalent Wrap SDK is covered under the MIT License. For extensive details, please refer to the LICENSE file.