1.1.5 • Published 3 months ago

dune-ts v1.1.5

Weekly downloads
-
License
AGPL-3.0
Repository
github
Last release
3 months ago

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

1.1.5

3 months ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago