Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dune-ts

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dune-ts

Unofficial Dune Analytics Typescript Client

  • 1.1.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

API Calls are now included in the dune free tier, which makes this library obsolete.
You should rather follow the dune documentation to make programmatic calls to the Dune API.


Dune TS

npm npm bundle size
Linter Badge Formatter Badge JavaScript Style Guide nps friendly
Coverage Status GitHub Code Quality Workflow Status
License Badge

Unofficial Dune Analytics Typescript Client.

Motivation

Dune Analytics is a great tool for querying blockchain data. However, it is currently only browser based which is not very developer friendly. An official API is being developed but is only opened in private beta. This library aims to provide an alternative way to integrate Dune Analytics into your Typescript projects.

Features

  • Authentication with password and username.
  • Fetch results from Dune Analytics queries with parameters

Installation

pnpm add dune-ts
yarn add dune-ts
npm install dune-ts

Setup

Define DUNE_PASSWORD and DUNE_USERNAME environment variables.
Alternatively, you can pass the credentials to the Dune constructor.

Local Development

Setup: npm run setup
Check available scripts: nps
Fetch Query Results: nps "query -q <query-id> -u <username> -p <password>"

How To Use

Dune.query requires a queryId (can be looked up in the URL of the query https://dune.com/queries/<queryId>) and accepts an optional array describing your query parameters (that you defined in the online query editor).

  • number parameter: { key: 'parameterName', value: '123', type: 'number' }
  • text parameter: { key: 'parameterName', value: '123', type: 'text' }
  • date parameter: { key: 'parameterName', value: new Date(), type: 'datetime' }
  • list parameter: not supported by this lib yet
import { Dune } from 'dune-ts'

const dune = new Dune({ password, username })

const { columns, data } = await dune.query(queryId, [
  { key: 'key', value: 'value', type: 'text' },
])

Example

Disclaimer

This is an experimental library. It'll break as soon as Dune Analytics change their graphql endpoints (URL or parameters).
This isn't free of bugs either. Contributions are welcome!

Contribute

Credits

Based on itzmestar/duneanalytics

Keywords

FAQs

Package last updated on 11 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc