dapplooker-sdk
v0.0.12
Published
SDK for retrieving DappLooker chart data
Downloads
38
Maintainers
Readme
DappLooker aims to empower everyone to easily understand blockchain data, do analytics and easily build beautiful charts and dashboards. You can build and share key metrics for Defi, NFT, gaming, and multi-chain protocols.
What We Do ?
DappLooker is a Web3 analytics platform that is dedicated to making blockchain analytics accessible and simplified for everyone. Our goal is to provide a seamless and user-friendly experience With our intuitive, no-code platform, you can effortlessly analyze blockchain networks and Dapps. Our No-code interface allows you to create stunning charts and dashboards, enabling you to visualize and understand complex blockchain data without the need for coding skills.
📚 Read our comprehensive documentation to learn how to start building with DappLooker.
DappLooker SDK
The dapplooker-sdk provides developers with programmatic access to reliable and comprehensive blockchain data in the Web3 environment. By integrating the DappLooker SDK, you can easily retrieve popular charts data for your decentralized applications (Dapps).
Node version: >=14
Installation
To start using the DappLooker SDK, follow these steps:
1. Install the SDK:
npm install dapplooker-sdk
2. Generate an API key:
- Create an account on the DappLooker website.
- After signing up, navigate to the API keys page.
- Click on
+ API Key
. - Provide a name for your API key and click on
Generate Key
. - Copy your API key for future use.
3. Get Your Chart UUID
- Visit the DappLooker Analytics Website
- Create a new Chart or Open a Existing Created Chart
- Click on the
API
Button - Get the UUID of your chart from Endpoint of the chart API.
4. Import the SDK
Once you have installed the SDK, import it into your project. With the imported SDK, create an instance of the DappLookerChartsAPI and make API calls using the API key and chart UUID obtained in the previous steps.
Examples
Here's an example of how you can use the DappLooker SDK:
//Javascript
const DappLookerChartsAPI = require("dapplooker-sdk");
async function getChartData() => {
let chartUUID = "dc9b69d8-7ca1-45d4-8ad0-a17f915f3f0"; // Replace it with chart UUID you are working with
let apiKey = "qzusb5p3q246ip246ab6g0p8ppzb7u"; // Replace it with your API key
let outputFormat = 'json' // This is a optional argument, valid value is `json`.
let filterParams = {
token_symbol:"btc",
subgraph_deployment:"QmXZiV6S13ha6QXq4dmaM3TB4CHcD"
} // This is a optional argument, you can pass multiple arguments which your chart supports`.
let response = await DappLookerChartsAPI.getChartData(chartUUID, apiKey, outputFormat, filterParams);
console.log("API Response Data: ", JSON.stringify(response));
};
getChartData();
> Output (With outputFormat value as json):
/*[
{"Day Timestamp":"2023-02-26","Sum of Attestation Requested Count":3.0,"Sum of Attestation Completed Count":0.0,"Success Percentage":0.0,"Failure Percentage":100.0},
{"Day Timestamp":"2023-03-05","Sum of Attestation Requested Count":16.0,"Sum of Attestation Completed Count":2.0,"Success Percentage":12.5,"Failure Percentage":87.5},
{"Day Timestamp":"2023-05-14","Sum of Attestation Requested Count":3.0,"Sum of Attestation Completed Count":0.0,"Success Percentage":0.0,"Failure Percentage":100.0}
]*/
> Output (Without outputFormat):
/*{
"rows": [["2023-02-26T00:00:00Z"]],
"cols": [{
"description": null,
"semantic_type": null,
"table_id": 872
}],
"insights": [{ "previous-value": 9}],
"results_timezone": "GMT"
}*/
The DappLooker SDK also provides TypeScript support for developers who prefer type-checking and enhanced code editor features.
//Typescript
import { DappLookerChartsAPI } from "dapplooker-sdk";
const getChartData = async () => {
let chartUUID = "dc9b69d8-7ca1-45d4-8ad0-a17f915f3f0"; // Replace it with chart UUID you are working with
let apiKey = "qzusb5p3q246ip246ab6g0p8ppzb7u"; // Replace it with your API key
let outputFormat = 'json' // This is a optional argument, valid value is `json`.
let filterParams = {
token_symbol:"btc",
subgraph_deployment:"QmXZiV6S13ha6QXq4dmaM3TB4CHcD"
} // This is a optional argument, you can pass multiple arguments which your chart supports`.
let response = await DappLookerChartsAPI.getChartData(chartUUID, apiKey, outputFormat, filterParams);
console.log("API Response Data: ", JSON.stringify(response));
};
getChartData();
> Output (With outputFormat value as json):
/*[
{"Day Timestamp":"2023-02-26","Sum of Attestation Requested Count":3.0,"Sum of Attestation Completed Count":0.0,"Success Percentage":0.0,"Failure Percentage":100.0},
{"Day Timestamp":"2023-03-05","Sum of Attestation Requested Count":16.0,"Sum of Attestation Completed Count":2.0,"Success Percentage":12.5,"Failure Percentage":87.5},
{"Day Timestamp":"2023-05-14","Sum of Attestation Requested Count":3.0,"Sum of Attestation Completed Count":0.0,"Success Percentage":0.0,"Failure Percentage":100.0}
]*/
> Output (Without outputFormat):
/*{
"rows": [["2023-02-26T00:00:00Z"]],
"cols": [{
"description": null,
"semantic_type": null,
"table_id": 872
}],
"insights": [{ "previous-value": 9}],
"results_timezone": "GMT"
}*/
Here's an example to get the data from AI studio of DappLooker
//Typescript
import { DappLookerNlqAPI } from "dapplooker-sdk";
// Get the schema details
async function getResults(): Promise<any> {
let response = await DappLookerNlqAPI.getSchemaName("");
console.log("API Response Data: ", JSON.stringify(response));
};
getResults();
// Get the data from nlq
async function getResults(): Promise<any> {
let apiKey = "YOUR_DAPPLOOKER_API_KEY"
let response = await DappLookerNlqAPI.getNlqData(apiKey, 'What is the current gas price per hour on the Ethereum network?', 'ethereum');
console.log("API Response Data: ", JSON.stringify(response));
};
getResults();
> Output :
/*
{
"success": true,
"data": {
"msg": "Visualization Result",
"vizualizationData": {
"rows": [
["<timestamp>", "<average_value>", "<low_value>"],
// More rows...
],
"cols": [
{
"display_name": "Hour",
"source": "native",
"name": "Hour",
"base_type": "type/DateTime",
"effective_type": "type/DateTime"
},
// More columns...
],
"native_form": {
"query": "<SQL_QUERY>",
"params": null
},
"results_timezone": "GMT",
"results_metadata": {
"columns": [
{
"display_name": "Hour",
"name": "Hour",
"base_type": "type/DateTime",
"effective_type": "type/DateTime"
},
// More data...
]
}
},
"questionId": "<question_id>",
"answerId": "<answer_id>",
"entityId": "<entity_id>",
"entityType": "CHART"
},
// More questions...
"nlqLogId": "<nlq_log_id>"
}
*/
By integrating the dapplooker-sdk into your Dapp, you can easily access and utilize the most reliable and comprehensive blockchain data in the Web3 environment. Start exploring the possibilities and enhancing your decentralized applications with DappLooker SDK today!
Resources
- Website To checkout our Product.
- Docs For comprehensive documentation.
- Medium To learn more about our partners, new launches, etc.
- GitHub for source code, project board, issues, and pull requests.
- Youtube Subscribe to our YouTube channel for video tutorials, demos, and informative content.
Contributing
We invite you to become a valued member of the DappLooker community, an open-source project committed to transparency in our development process. We appreciate any contributions you can make, whether it's helping us identify and fix bugs, suggesting new features, improving our documentation, or spreading the word about DappLooker.
If you come across any errors or issues while using DappLooker, please take a moment to create a bug report. Your feedback is invaluable in improving the reliability. We also value the importance of comprehensive documentation. If you find any gaps or areas that need improvement in our documentation, please don't hesitate, Your suggestions will enable us to provide better resources for our users.
If you're unsure where to begin or need assistance, we invite you to join our Discord community. We'll be more than happy to help you get started on your journey with DappLooker.
Social Links
Follow us to stay updated with the latest news and updates!
Discord | Twitter | Telegram | Linkedin