Struct lwk_wollet::Wollet
source · pub struct Wollet { /* private fields */ }
Expand description
A watch-only wallet defined by a CT descriptor.
Implementations§
source§impl Wollet
impl Wollet
sourcepub fn new(
network: ElementsNetwork,
persister: Arc<dyn Persister + Send + Sync>,
descriptor: WolletDescriptor
) -> Result<Self, Error>
pub fn new( network: ElementsNetwork, persister: Arc<dyn Persister + Send + Sync>, descriptor: WolletDescriptor ) -> Result<Self, Error>
Create a new wallet
sourcepub fn with_fs_persist<P: AsRef<Path>>(
network: ElementsNetwork,
descriptor: WolletDescriptor,
datadir: P
) -> Result<Self, Error>
pub fn with_fs_persist<P: AsRef<Path>>( network: ElementsNetwork, descriptor: WolletDescriptor, datadir: P ) -> Result<Self, Error>
Create a new wallet persisting on file system
sourcepub fn without_persist(
network: ElementsNetwork,
descriptor: WolletDescriptor
) -> Result<Self, Error>
pub fn without_persist( network: ElementsNetwork, descriptor: WolletDescriptor ) -> Result<Self, Error>
Create a new wallet which not persist anything
sourcepub fn policy_asset(&self) -> AssetId
pub fn policy_asset(&self) -> AssetId
Get the network policy asset
sourcepub fn tx_builder(&self) -> WolletTxBuilder<'_>
pub fn tx_builder(&self) -> WolletTxBuilder<'_>
Creates a transaction builder with a reference to this wallet
sourcepub fn network(&self) -> ElementsNetwork
pub fn network(&self) -> ElementsNetwork
Get the network
sourcepub fn descriptor(&self) -> &ConfidentialDescriptor<DescriptorPublicKey>
pub fn descriptor(&self) -> &ConfidentialDescriptor<DescriptorPublicKey>
Get a reference of the wallet descriptor
sourcepub fn wollet_descriptor(&self) -> WolletDescriptor
pub fn wollet_descriptor(&self) -> WolletDescriptor
Get a copy of the wallet descriptor
sourcepub fn address(&self, index: Option<u32>) -> Result<AddressResult, Error>
pub fn address(&self, index: Option<u32>) -> Result<AddressResult, Error>
Get a wallet address
If Some return the address at the given index, otherwise the last unused address.
sourcepub fn change(&self, index: Option<u32>) -> Result<AddressResult, Error>
pub fn change(&self, index: Option<u32>) -> Result<AddressResult, Error>
Get a wallet change address
If a specific descriptor is given for change addresses it’s used to derive this address
Otherwise this is the same as address()
If Some return the address at the given index, otherwise the last unused address.
pub fn txos_inner(&self, unspent: bool) -> Result<Vec<WalletTxOut>, Error>
sourcepub fn transactions(&self) -> Result<Vec<WalletTx>, Error>
pub fn transactions(&self) -> Result<Vec<WalletTx>, Error>
Get the wallet transactions with their heights (if confirmed)
sourcepub fn transaction(&self, txid: &Txid) -> Result<Option<WalletTx>, Error>
pub fn transaction(&self, txid: &Txid) -> Result<Option<WalletTx>, Error>
Get a wallet transaction
sourcepub fn issuance(&self, asset: &AssetId) -> Result<IssuanceDetails, Error>
pub fn issuance(&self, asset: &AssetId) -> Result<IssuanceDetails, Error>
Get the issuance details for a certain asset
This only works if the asset was issued by this wallet
sourcepub fn get_details(
&self,
pset: &PartiallySignedTransaction
) -> Result<PsetDetails, Error>
pub fn get_details( &self, pset: &PartiallySignedTransaction ) -> Result<PsetDetails, Error>
Get the PSET details with respect to the wallet
sourcepub fn add_details(
&self,
pset: &mut PartiallySignedTransaction
) -> Result<(), Error>
pub fn add_details( &self, pset: &mut PartiallySignedTransaction ) -> Result<(), Error>
Add the PSET details with respect to the wallet
sourcepub fn signers(&self) -> Vec<Fingerprint>
pub fn signers(&self) -> Vec<Fingerprint>
Get the signers’ fingerprints involved in this descriptor
sourcepub fn combine(
&self,
psets: &[PartiallySignedTransaction]
) -> Result<PartiallySignedTransaction, Error>
pub fn combine( &self, psets: &[PartiallySignedTransaction] ) -> Result<PartiallySignedTransaction, Error>
Combine a vector of PSET