Skip to main content

Interact with Ethereum

in src/main.rs:

src/main.rs
use kilnfi_connect_rs::Kiln;
use kilnfi_connect_rs::ethereum::EthereumReportsRequest;
use std::str::FromStr;

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 uuid = uuid::Uuid::from_str("9e1a6784-9657-4757-b463-8454a34c92b4").unwrap();

let _data = kiln.ethereum().get_reports(&EthereumReportsRequest {
validators: vec![String::from("0x8c5k22jzduc165kywrsvf5ujz4ya6mwymp2c8en")],
wallets: vec![String::from("0x8c5k22jzduc165kywrsvf5ujz4ya6mwymp2c8en")],
accounts: vec![uuid],
});
Ok(())
}