pub struct Wallet { /* private fields */ }Implementations§
Source§impl Wallet
impl Wallet
Sourcepub async fn load(
wallet_name: Option<String>,
create_on_undefined: bool,
) -> Result<Self, WalletError>
pub async fn load( wallet_name: Option<String>, create_on_undefined: bool, ) -> Result<Self, WalletError>
Load a wallet by name, optionally creating one if it doesn’t exist
Sourcepub fn get_mnemonic(&self) -> Result<&str, WalletError>
pub fn get_mnemonic(&self) -> Result<&str, WalletError>
Get the mnemonic seed phrase
Sourcepub fn get_wallet_name(&self) -> &str
pub fn get_wallet_name(&self) -> &str
Get the wallet name
Sourcepub async fn create_new_wallet(wallet_name: &str) -> Result<String, WalletError>
pub async fn create_new_wallet(wallet_name: &str) -> Result<String, WalletError>
Create a new wallet with a generated mnemonic
Sourcepub async fn import_wallet(
wallet_name: &str,
seed: Option<&str>,
) -> Result<String, WalletError>
pub async fn import_wallet( wallet_name: &str, seed: Option<&str>, ) -> Result<String, WalletError>
Import a wallet from a provided mnemonic
Sourcepub async fn get_master_secret_key(&self) -> Result<SecretKey, WalletError>
pub async fn get_master_secret_key(&self) -> Result<SecretKey, WalletError>
Get the master secret key from the mnemonic
Sourcepub async fn get_public_synthetic_key(&self) -> Result<PublicKey, WalletError>
pub async fn get_public_synthetic_key(&self) -> Result<PublicKey, WalletError>
Get the public synthetic key
Sourcepub async fn get_private_synthetic_key(&self) -> Result<SecretKey, WalletError>
pub async fn get_private_synthetic_key(&self) -> Result<SecretKey, WalletError>
Get the private synthetic key
Sourcepub async fn get_owner_puzzle_hash(&self) -> Result<Bytes32, WalletError>
pub async fn get_owner_puzzle_hash(&self) -> Result<Bytes32, WalletError>
Get the owner puzzle hash
Sourcepub async fn get_owner_public_key(&self) -> Result<String, WalletError>
pub async fn get_owner_public_key(&self) -> Result<String, WalletError>
Get the owner public key as an address
Sourcepub async fn delete_wallet(wallet_name: &str) -> Result<bool, WalletError>
pub async fn delete_wallet(wallet_name: &str) -> Result<bool, WalletError>
Delete a wallet from the keyring
Sourcepub async fn list_wallets() -> Result<Vec<String>, WalletError>
pub async fn list_wallets() -> Result<Vec<String>, WalletError>
List all wallets in the keyring
Sourcepub async fn create_key_ownership_signature(
&self,
nonce: &str,
) -> Result<String, WalletError>
pub async fn create_key_ownership_signature( &self, nonce: &str, ) -> Result<String, WalletError>
Create a key ownership signature
Sourcepub async fn verify_key_ownership_signature(
nonce: &str,
signature: &str,
public_key: &str,
) -> Result<bool, WalletError>
pub async fn verify_key_ownership_signature( nonce: &str, signature: &str, public_key: &str, ) -> Result<bool, WalletError>
Verify a key ownership signature
Sourcepub async fn select_unspent_coins(
&self,
peer: &Peer,
coin_amount: u64,
fee: u64,
omit_coins: Vec<Coin>,
) -> Result<Vec<Coin>, WalletError>
pub async fn select_unspent_coins( &self, peer: &Peer, coin_amount: u64, fee: u64, omit_coins: Vec<Coin>, ) -> Result<Vec<Coin>, WalletError>
Select unspent coins for spending
Sourcepub async fn calculate_fee_for_coin_spends(
_peer: &Peer,
_coin_spends: Option<&[CoinSpend]>,
) -> Result<u64, WalletError>
pub async fn calculate_fee_for_coin_spends( _peer: &Peer, _coin_spends: Option<&[CoinSpend]>, ) -> Result<u64, WalletError>
Calculate fee for coin spends
Sourcepub async fn is_coin_spendable(
peer: &Peer,
coin_id: &Bytes32,
) -> Result<bool, WalletError>
pub async fn is_coin_spendable( peer: &Peer, coin_id: &Bytes32, ) -> Result<bool, WalletError>
Check if a coin is spendable
Sourcepub async fn connect_random_peer(
network: NetworkType,
cert_path: &str,
key_path: &str,
) -> Result<Peer, WalletError>
pub async fn connect_random_peer( network: NetworkType, cert_path: &str, key_path: &str, ) -> Result<Peer, WalletError>
Connect to a random peer on the specified network
Sourcepub async fn connect_mainnet_peer() -> Result<Peer, WalletError>
pub async fn connect_mainnet_peer() -> Result<Peer, WalletError>
Connect to a random mainnet peer using default Chia SSL paths
Sourcepub async fn connect_testnet_peer() -> Result<Peer, WalletError>
pub async fn connect_testnet_peer() -> Result<Peer, WalletError>
Connect to a random testnet peer using default Chia SSL paths
Sourcepub fn address_to_puzzle_hash(address: &str) -> Result<Bytes32, WalletError>
pub fn address_to_puzzle_hash(address: &str) -> Result<Bytes32, WalletError>
Convert an address to a puzzle hash
Sourcepub fn puzzle_hash_to_address(
puzzle_hash: Bytes32,
prefix: &str,
) -> Result<String, WalletError>
pub fn puzzle_hash_to_address( puzzle_hash: Bytes32, prefix: &str, ) -> Result<String, WalletError>
Convert a puzzle hash to an address
Auto Trait Implementations§
impl Freeze for Wallet
impl RefUnwindSafe for Wallet
impl Send for Wallet
impl Sync for Wallet
impl Unpin for Wallet
impl UnwindSafe for Wallet
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.