Struct coinmarket::ethereum::Web3
source · [−]pub struct Web3 { /* private fields */ }
Implementations
sourceimpl Web3
impl Web3
pub fn new(provider: Web3Provider) -> Self
sourcepub fn get_balance<S: Into<String>>(&self, address: S) -> Result<String, Error> where
S: Into<String>,
pub fn get_balance<S: Into<String>>(&self, address: S) -> Result<String, Error> where
S: Into<String>,
Retrieves the client’s Ethereum balance as Wei.
Example
extern crate coinmarket;
use coinmarket::ethereum::{Web3, Web3Provider};
fn main() {
let network = Web3::new(Web3Provider::MainNet);
let balance = network.get_balance("0x9De8991C56F622175274fb358f981AF6F903a799")
.expect("parser error");
println!("{}", balance);
}
sourcepub fn get_total_supply(&self) -> Result<String, Error>
pub fn get_total_supply(&self) -> Result<String, Error>
Retrieves the client’s Ethereum balance as Wei.
Example
extern crate coinmarket;
use coinmarket::ethereum::{Web3, Web3Provider};
fn main() {
let network = Web3::new(Web3Provider::MainNet);
let total_supply = network.get_total_supply().expect("parser error");
println!("{}", total_supply);
}
sourcepub fn get_last_price(&self) -> Result<EthPrice, Error>
pub fn get_last_price(&self) -> Result<EthPrice, Error>
Retrieves the client’s Ethereum balance as Wei.
Example
extern crate coinmarket;
use coinmarket::ethereum::{Web3, Web3Provider};
fn main() {
let network = Web3::new(Web3Provider::MainNet);
let last_price = network.get_last_price().expect("parser error");
println!("{}", last_price);
}
pub fn get_transactions<S: Into<String>>(
&self,
address: S,
start_block: i64,
end_block: i64
) -> Result<Vec<EthTransaction>, Error> where
S: Into<String>,
Auto Trait Implementations
impl RefUnwindSafe for Web3
impl Send for Web3
impl Sync for Web3
impl Unpin for Web3
impl UnwindSafe for Web3
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more