Crates.io | block_scanner |
lib.rs | block_scanner |
version | 0.1.2 |
source | src |
created_at | 2022-11-09 03:28:59.696115 |
updated_at | 2022-11-16 07:25:59.054785 |
description | Ethereum-like block parser |
homepage | https://github.com/messagebox-link/evm_block_scanner |
repository | https://github.com/messagebox-link/evm_block_scanner |
max_upload_size | |
id | 708511 |
size | 16,083 |
该库用于获取以太坊系的区块信息,交易详情,最新区块高度
3
功能
get_block_latest_number()
get_transactions_for_block(number)
get_transaction_receipt_for_hash(hash)
样例
// New BlockScanner
let bs = BlockScanner {
url: vec!["https://cloudflare-eth.com/".to_string(), "https://mainnet.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161".to_string()],
retry: Default::default(),
id: "1".to_string(),
};
// Get latest number
let latest_number = bs.get_block_latest_number().await.unwrap();
// Get block info by latest number
let block_info = bs.get_transactions_for_block(latest_number).await.unwrap();
// Get transaction info by 0x80fdaa7f5f54cbe28b84f41afb9543cf0c9eb0d9f4b8a620c2fb5faf0b1c2810
let transaction_info = bs.get_transaction_receipt_for_hash("0x80fdaa7f5f54cbe28b84f41afb9543cf0c9eb0d9f4b8a620c2fb5faf0b1c2810").await.unwrap();