pub struct StandardWallet { /* private fields */ }Expand description
A standard Solana wallet with a single keypair.
This wallet type generates a random private key directly, without using a mnemonic or HD derivation.
§Example
ⓘ
use kobe_sol::StandardWallet;
let wallet = StandardWallet::generate().unwrap();
println!("Address: {}", wallet.address_string());
println!("Private Key: {}", wallet.private_key_hex().as_str());Implementations§
Source§impl StandardWallet
impl StandardWallet
Sourcepub fn from_bytes(bytes: &[u8; 32]) -> Self
pub fn from_bytes(bytes: &[u8; 32]) -> Self
Create a wallet from raw 32-byte secret key.
Sourcepub fn from_hex(hex_key: &str) -> Result<Self, Error>
pub fn from_hex(hex_key: &str) -> Result<Self, Error>
Create a wallet from a hex-encoded secret key.
§Errors
Returns an error if the hex is invalid or key length is wrong.
Sourcepub fn secret_bytes(&self) -> Zeroizing<[u8; 32]>
pub fn secret_bytes(&self) -> Zeroizing<[u8; 32]>
Get the secret key as raw bytes (zeroized on drop).
Sourcepub fn secret_hex(&self) -> Zeroizing<String>
pub fn secret_hex(&self) -> Zeroizing<String>
Get the secret key in hex format (zeroized on drop).
Sourcepub fn pubkey_hex(&self) -> String
pub fn pubkey_hex(&self) -> String
Get the public key in hex format.
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