Skip to content

A rust library for interacting with Dune Analytics' officially supported API service.

Notifications You must be signed in to change notification settings

igneous-labs/duners

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

duners

A convenience library for executing queries and recovering results from Dune Analytics API.

Installation and Usage

cargo add duners
use chrono::{DateTime, Utc};
use duners::{client::DuneClient, dateutil::datetime_from_str};
use serde::Deserialize;

// User must declare the expected query return fields and types!
#[derive(Deserialize, Debug, PartialEq)]
struct ResultStruct {
    text_field: String,
    number_field: f64,
    #[serde(deserialize_with = "datetime_from_str")]
    date_field: DateTime<Utc>,
    list_field: String,
}

#[tokio::main]
async fn main() -> Result<(), DuneRequestError> {
    let dune = DuneClient::from_env();
    let results = dune.refresh::<ResultStruct>(1215383, None, None).await?;
    println!("{:?}", results.get_rows());
    Ok(())
}

About

A rust library for interacting with Dune Analytics' officially supported API service.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%