https://github.com/bh2smith/duners
A rust library for interacting with Dune Analytics' officially supported API service.
https://github.com/bh2smith/duners
Last synced: over 1 year ago
JSON representation
A rust library for interacting with Dune Analytics' officially supported API service.
- Host: GitHub
- URL: https://github.com/bh2smith/duners
- Owner: bh2smith
- Created: 2022-12-24T07:49:50.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-07T20:20:15.000Z (over 2 years ago)
- Last Synced: 2025-04-24T03:13:37.846Z (over 1 year ago)
- Language: Rust
- Size: 42 KB
- Stars: 7
- Watchers: 2
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# duners
A convenience library for executing queries and recovering results from Dune Analytics API.
## Installation and Usage
```shell
cargo add duners
```
```rust
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,
list_field: String,
}
#[tokio::main]
async fn main() -> Result<(), DuneRequestError> {
let dune = DuneClient::from_env();
let results = dune.refresh::(1215383, None, None).await?;
println!("{:?}", results.get_rows());
Ok(())
}
```