Closed leeduckgo closed 3 years ago
The example is not show yet. I can get Addr from address_str:
let acct = hex!("f24ff3a9cf04c71dbc94d0b566f7a27b94566cac").into();
But I dont know how could I do the same thing with address:
let addr = ???"0x4ad37B11C3C26C545e14247E9558fa7F156cFAC8"??? let contract = Contract::from_json( web3.eth(), addr, include_bytes!("../contracts/hello_world.json"), )?;
The Address type (which is just an alias for H160) implements FromStr, which means that you can just do:
Address
H160
FromStr
let addr: Address = "0x4ad37B11C3C26C545e14247E9558fa7F156cFAC8".parse().unwrap();
The Address type (which is just an alias for H160) implements FromStr, which means that you can just do: let addr: Address = "0x4ad37B11C3C26C545e14247E9558fa7F156cFAC8".parse().unwrap();
thx a lot!
The example is not show yet. I can get Addr from address_str:
But I dont know how could I do the same thing with address: