helios/src/main.rs

33 lines
951 B
Rust
Raw Normal View History

2022-08-20 17:18:40 +00:00
use std::str::FromStr;
use ethers::prelude::Address;
use eyre::Result;
2022-08-16 22:59:07 +00:00
2022-08-21 13:13:56 +00:00
use client::Client;
2022-08-19 22:43:58 +00:00
2022-08-21 13:13:56 +00:00
pub mod client;
2022-08-19 22:43:58 +00:00
pub mod consensus;
2022-08-20 17:18:40 +00:00
pub mod execution;
2022-08-21 15:21:50 +00:00
pub mod common;
#[tokio::main]
async fn main() -> Result<()> {
2022-08-21 13:13:56 +00:00
let consensus_rpc = "http://testing.prater.beacon-api.nimbus.team";
let execution_rpc = "https://eth-goerli.g.alchemy.com:443/v2/o_8Qa9kgwDPf9G8sroyQ-uQtyhyWa3ao";
2022-08-19 22:43:58 +00:00
let checkpoint = "0x172128eadf1da46467f4d6a822206698e2d3f957af117dd650954780d680dc99";
2022-08-20 20:33:32 +00:00
2022-08-21 13:13:56 +00:00
let mut client = Client::new(consensus_rpc, execution_rpc, checkpoint).await?;
2022-08-19 22:43:58 +00:00
client.sync().await?;
2022-08-19 00:33:44 +00:00
2022-08-21 13:13:56 +00:00
let header = client.get_header();
println!("synced up to slot: {}", header.slot);
2022-08-20 14:10:28 +00:00
2022-08-21 13:13:56 +00:00
let address = Address::from_str("0xe0Fa62CD8543473627D337fAe1212d4E639EE932")?;
let balance = client.get_balance(address).await?;
let nonce = client.get_nonce(address).await?;
println!("balance: {}", balance);
println!("nonce: {}", nonce);
2022-08-20 14:10:28 +00:00
Ok(())
}