This package has been deprecated

Author message:

API Calls are now included in the dune free tier acount, which makes this library obsolete. You should rather follow the dune https://dune.com/docs/api to make programmatic calls to the Dune API.

dune-ts
TypeScript icon, indicating that this package has built-in type declarations

1.1.5 • Public • Published

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

  • [x] Authentication with password and username.
  • [x] 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

Package Sidebar

Install

npm i dune-ts

Weekly Downloads

6

Version

1.1.5

License

AGPL-3.0

Unpacked Size

148 kB

Total Files

64

Last publish

Collaborators

  • sripwoud