Interact with Cardano chain
in src/main.rs
:
src/main.rs
use kilnfi_connect_rs::Kiln;
use kilnfi_connect_rs::cardano::CardanoReportsRequest;
use kilnfi_connect_rs::ResponseFormat;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let api_token: String = std::env::var("KILN_API_TOKEN")
.expect("KILN_API_TOKEN is not set in the environment. It is required.");
let kiln: Kiln = Kiln::builder()
.api_token(api_token)
// no trailing slash, or else it will break
.base_url("https://api.kiln.fi/v1")
.seal()
.build()?;
// The addresses are just examples.
// PLEASE DO NOT USE THESE ADDRESSES IN PRODUCTION UNLESS THESE ARE YOURS BY SOME ACCIDENT
let _data = kiln.cardano().get_reports(&CardanoReportsRequest {
stake_addresses: vec![String::from("stake1u9a3t4rgddm4expj0ucyxhxg3ft9ugk2ry6r9w69h04ea6cfj887w")],
wallets: vec![String::from("addr1vx4hqc2l1wwzn6cuvr4hqfujt4cftukl7s59x2gr84wv7gqauh4jd")],
accounts: vec![String::from("addr1vx4hqc2l5wwzn6cuvr0hqfujt4cftukl6s58x2gr84wv7gqauh4jd")],
format: ResponseFormat::Daily,
});
let _cardano_network_stats = kiln.cardano().get_network_stats();
Ok(())
}