pub struct Wallet<K, D: Descriptor<K>, L2: Layer2 = NoLayer2> { /* private fields */ }
Implementations§
Source§impl<K, D: Descriptor<K>> Wallet<K, D>
impl<K, D: Descriptor<K>> Wallet<K, D>
pub fn new_layer1(descr: D, network: Network) -> Self
Source§impl<K, D: Descriptor<K>, L2: Layer2> Wallet<K, D, L2>
impl<K, D: Descriptor<K>, L2: Layer2> Wallet<K, D, L2>
pub fn new_layer2( descr: D, l2_descr: L2::Descr, layer2: L2, network: Network, ) -> Self
pub fn set_name(&mut self, name: String)
pub fn with_descriptor<T, E>( &mut self, f: impl FnOnce(&mut D) -> Result<T, E>, ) -> Result<T, E>
pub fn data_l2(&self) -> &L2::Data
pub fn cache_l2(&self) -> &L2::Cache
pub fn with_data<T, E>( &mut self, f: impl FnOnce(&mut WalletData<L2::Data>) -> Result<T, E>, ) -> Result<T, E>
pub fn with_data_l2<T, E>( &mut self, f: impl FnOnce(&mut L2::Data) -> Result<T, E>, ) -> Result<T, E>
pub fn with_cache_l2<T, E>( &mut self, f: impl FnOnce(&mut L2::Cache) -> Result<T, E>, ) -> Result<T, E>
pub fn update<I: Indexer>(&mut self, indexer: &I) -> MayError<(), Vec<I::Error>>
pub fn to_deriver(&self) -> D
pub fn last_derivation_index( &self, keychain: impl Into<Keychain>, ) -> NormalIndex
pub fn next_address( &mut self, keychain: impl Into<Keychain>, shift: bool, ) -> Address
pub fn balance(&self) -> Sats
pub fn transactions(&self) -> &BTreeMap<Txid, WalletTx>
pub fn coins( &self, ) -> impl Iterator<Item = CoinRow<<L2::Cache as Layer2Cache>::Coin>> + '_
pub fn address_coins( &self, ) -> HashMap<DerivedAddr, Vec<CoinRow<<L2::Cache as Layer2Cache>::Coin>>>
pub fn address_balance(&self) -> impl Iterator<Item = WalletAddr> + '_
pub fn history( &self, ) -> impl Iterator<Item = TxRow<<L2::Cache as Layer2Cache>::Tx>> + '_
pub fn has_outpoint(&self, outpoint: Outpoint) -> bool
pub fn is_unspent(&self, outpoint: Outpoint) -> bool
pub fn outpoint_by( &self, outpoint: Outpoint, ) -> Result<(WalletUtxo, ScriptPubkey), NonWalletItem>
pub fn txos(&self) -> impl Iterator<Item = WalletUtxo> + '_
pub fn utxos(&self) -> impl Iterator<Item = WalletUtxo> + '_
pub fn coinselect<'a>( &'a self, up_to: Sats, selector: impl Fn(&WalletUtxo) -> bool + 'a, ) -> impl Iterator<Item = Outpoint> + 'a
Source§impl<K, D: Descriptor<K>, L2: Layer2> Wallet<K, D, L2>
impl<K, D: Descriptor<K>, L2: Layer2> Wallet<K, D, L2>
pub fn load<P>(
provider: P,
autosave: bool,
) -> Result<Wallet<K, D, L2>, PersistenceError>where
P: Clone + PersistenceProvider<WalletDescr<K, D, L2::Descr>> + PersistenceProvider<WalletData<L2::Data>> + PersistenceProvider<WalletCache<L2::Cache>> + PersistenceProvider<L2> + 'static,
pub fn set_id(&mut self, id: &impl ToString)
pub fn make_persistent<P>(
&mut self,
provider: P,
autosave: bool,
) -> Result<bool, PersistenceError>where
P: Clone + PersistenceProvider<WalletDescr<K, D, L2::Descr>> + PersistenceProvider<WalletData<L2::Data>> + PersistenceProvider<WalletCache<L2::Cache>> + PersistenceProvider<L2> + 'static,
pub fn store(&mut self) -> Result<(), PersistenceError>
Methods from Deref<Target = WalletDescr<K, D, L2::Descr>>§
Sourcepub fn generator(&self) -> &D
pub fn generator(&self) -> &D
Method borrowing WalletDescr::generator
field.
Sourcepub fn network(&self) -> Network
pub fn network(&self) -> Network
Method returning copy of WalletDescr::network
field.
Sourcepub fn layer2(&self) -> &L2
pub fn layer2(&self) -> &L2
Method borrowing WalletDescr::layer2
field.
Sourcepub fn _phantom(&self) -> &PhantomData<K>
pub fn _phantom(&self) -> &PhantomData<K>
Method borrowing WalletDescr::_phantom
field.
pub fn addresses(&self, keychain: impl Into<Keychain>) -> AddrIter<'_, K, D>
Trait Implementations§
Source§impl<K, D: Descriptor<K>, L2: Layer2> CloneNoPersistence for Wallet<K, D, L2>
impl<K, D: Descriptor<K>, L2: Layer2> CloneNoPersistence for Wallet<K, D, L2>
fn clone_no_persistence(&self) -> Self
Source§impl<K, D: Descriptor<K>, L2: Layer2> PsbtConstructor for Wallet<K, D, L2>
impl<K, D: Descriptor<K>, L2: Layer2> PsbtConstructor for Wallet<K, D, L2>
type Key = K
type Descr = D
fn descriptor(&self) -> &D
fn utxo(&self, outpoint: Outpoint) -> Option<(Utxo, ScriptPubkey)>
fn network(&self) -> Network
fn next_derivation_index( &mut self, keychain: impl Into<Keychain>, shift: bool, ) -> NormalIndex
Source§fn after_construct_psbt(&mut self, psbt: &Psbt, meta: &PsbtMeta)
fn after_construct_psbt(&mut self, psbt: &Psbt, meta: &PsbtMeta)
A hook which is called by the default
Self::construct_psbt
before returning the newly
constructed PSBT to the caller.fn construct_psbt( &mut self, coins: impl IntoIterator<Item = Outpoint>, beneficiaries: impl IntoIterator<Item = Beneficiary>, params: TxParams, ) -> Result<(Psbt, PsbtMeta), ConstructionError>
Auto Trait Implementations§
impl<K, D, L2> Freeze for Wallet<K, D, L2>
impl<K, D, L2 = NoLayer2> !RefUnwindSafe for Wallet<K, D, L2>
impl<K, D, L2> Send for Wallet<K, D, L2>
impl<K, D, L2> Sync for Wallet<K, D, L2>
impl<K, D, L2> Unpin for Wallet<K, D, L2>
impl<K, D, L2 = NoLayer2> !UnwindSafe for Wallet<K, D, L2>
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