Dune Client TS
This package implements all the basic routes defined in the Dune API Docs. It also introduces a convenience method refresh
which combines execute
, getStatus
and getResults
in a way that makes it nearly trivial to fetch query execution results.
Install the package
yarn add @cowprotocol/ts-dune-client
import { QueryParameter, DuneClient } from "@cowprotocol/ts-dune-client";
const client = new DuneClient(apiKey);
const queryID = 1215383;
const parameters = [
QueryParameter.text("TextField", "Plain Text"),
QueryParameter.number("NumberField", 3.1415926535),
QueryParameter.date("DateField", "2022-05-04 00:00:00"),
QueryParameter.enum("ListField", "Option 1"),
];
const execution_result = await client.refresh(queryID, parameters);
console.log(execution_result.result?.rows);
Note also that the client has methods execute
, getStatus
, getResult
and cancelExecution