docs.rs failed to build lwk_wollet-0.13.0
Please check the
build logs for more information.
See
Builds for ideas on how to fix a failed build,
or
Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault,
open an issue.
LWK is a collection of libraries for Liquid wallets.
lwk_wollet is the library for Watch-Only Wallets, the wollet spelling is not a typo but highlights the fact it is Watch-Only.
A [Wollet] is defined by a CT descriptor,
which consists in a Bitcoin descriptor plus the descriptor blinding key. More precisely a subset of descriptors are supported, everything parsed by [WolletDescriptor].
Every method on the Wollet will operate on local data, without network calls. The wallet data is updated via the [Wollet::apply_update()] method.
With a wallet you can:
- Generate addresses via [
Wollet::address()].
- Pass it to a blockchain backend ([
ElectrumClient], [blocking::EsploraClient]) to retrieve wallet history via the [blocking::BlockchainBackend::full_scan()] trait.
Or asyncronously via the [asyncr::EsploraClient::full_scan()] method. The convenience method [full_scan_with_electrum_client()] is also provided.
- Create transactions, inclunding issuances, reissuances and burn via the [
TxBuilder].
- Analyze a partially signed transaction with respect to the wallet via [
Wollet::get_details()].
Examples
Generate an address
# use lwk_wollet::{WolletDescriptor, Wollet, ElementsNetwork, NoPersist};
# fn main() -> Result<(), lwk_wollet::Error> {
let desc = "ct(slip77(ab5824f4477b4ebb00a132adfd8eb0b7935cf24f6ac151add5d1913db374ce92),elwpkh([759db348/84'/1'/0']tpubDCRMaF33e44pcJj534LXVhFbHibPbJ5vuLhSSPFAw57kYURv4tzXFL6LSnd78bkjqdmE3USedkbpXJUPA1tdzKfuYSL7PianceqAhwL2UkA/<0;1>/*))#cch6wrnp";
let descriptor: WolletDescriptor = desc.parse()?;
let mut wollet = Wollet::new(
ElementsNetwork::LiquidTestnet,
NoPersist::new(), descriptor,
)?;
let addr = wollet.address(None)?;
println!("Address: {} (index {})", addr.address(), addr.index());
# Ok(())
# }
Sync wallet
# use lwk_wollet::{WolletDescriptor, Wollet, ElementsNetwork, ElectrumClient, ElectrumUrl,
full_scan_with_electrum_client};
# fn main() -> Result<(), lwk_wollet::Error> {
# let desc = "ct(slip77(ab5824f4477b4ebb00a132adfd8eb0b7935cf24f6ac151add5d1913db374ce92),elwpkh([759db348/84'/1'/0']tpubDCRMaF33e44pcJj534LXVhFbHibPbJ5vuLhSSPFAw57kYURv4tzXFL6LSnd78bkjqdmE3USedkbpXJUPA1tdzKfuYSL7PianceqAhwL2UkA/<0;1>/*))#cch6wrnp";
# let descriptor: WolletDescriptor = desc.parse()?;
# let mut wollet = Wollet::without_persist(
# ElementsNetwork::LiquidTestnet,
# descriptor,
# )?;
let electrum_url = ElectrumUrl::new("elements-testnet.blockstream.info:50002", true, true)?;
let mut electrum_client = ElectrumClient::new(&electrum_url)?;
full_scan_with_electrum_client(&mut wollet, &mut electrum_client)?;
for tx in wollet.transactions()?.into_iter().rev() {
println!("TXID: {}, balance {:?}", tx.txid, tx.balance);
}
# Ok(())
# }
Create transaction
# use lwk_wollet::{WolletDescriptor, Wollet, ElementsNetwork, UnvalidatedRecipient};
# fn main() -> Result<(), lwk_wollet::Error> {
# let desc = "ct(slip77(ab5824f4477b4ebb00a132adfd8eb0b7935cf24f6ac151add5d1913db374ce92),elwpkh([759db348/84'/1'/0']tpubDCRMaF33e44pcJj534LXVhFbHibPbJ5vuLhSSPFAw57kYURv4tzXFL6LSnd78bkjqdmE3USedkbpXJUPA1tdzKfuYSL7PianceqAhwL2UkA/<0;1>/*))#cch6wrnp";
# let descriptor: WolletDescriptor = desc.parse()?;
# let mut wollet = Wollet::without_persist(
# ElementsNetwork::LiquidTestnet,
# descriptor,
# )?;
let recipient = UnvalidatedRecipient {
satoshi: 1000,
address: "tlq1qqgpjea0jcel4tqeln5kyxlrgqx2eh4vw67ecswm54476mddy3n0klrlmty5gn0wsdw4045rtl2y2wdtr4rdu6v93zds6zn8xd".to_string(),
asset: "144c654344aa716d6f3abcc1ca90e5641e4e2a7f633bc09fe3baf64585819a49".to_string(),
};
let pset = wollet
.tx_builder()
.add_unvalidated_recipient(&recipient)?
.finish()?;
# Ok(())
# }