pub struct StandardWallet { /* private fields */ }Expand description
A standard Ethereum wallet with a single private key.
This wallet type generates a random private key directly, without using a mnemonic or HD derivation.
§Example
ⓘ
use kobe_eth::StandardWallet;
let wallet = StandardWallet::generate().unwrap();
println!("Address: {}", wallet.address_string());
println!("Private Key: 0x{}", wallet.private_key_hex().as_str());Implementations§
Source§impl StandardWallet
impl StandardWallet
Sourcepub fn from_private_key_hex(hex_str: &str) -> Result<Self, Error>
pub fn from_private_key_hex(hex_str: &str) -> Result<Self, Error>
Import a wallet from a private key hex string.
§Errors
Returns an error if the hex string is invalid or the private key is invalid.
Sourcepub fn private_key_hex(&self) -> Zeroizing<String>
pub fn private_key_hex(&self) -> Zeroizing<String>
Get the private key in hex format without 0x prefix (zeroized on drop).
Sourcepub fn public_key_hex(&self) -> String
pub fn public_key_hex(&self) -> String
Get the public key in uncompressed hex format without 0x prefix.
Sourcepub fn address_string(&self) -> String
pub fn address_string(&self) -> String
Get the checksummed address string.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StandardWallet
impl RefUnwindSafe for StandardWallet
impl Send for StandardWallet
impl Sync for StandardWallet
impl Unpin for StandardWallet
impl UnwindSafe for StandardWallet
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more