Skip to main content

Crate lwk_common

Crate lwk_common 

Source
Expand description

A crate containing common code used in multiple other crate in the workspace, such as:

  • Utils to inspect a PSET: get the net effect of a PSET on a given wallet pset_balance(), or get how many signatures are missing , and which signers should provide them pset_signatures().
  • Signer trait: contains the methods to be implemented by a signer such as signing a pset or returning an xpub

To avoid circular dependencies this crate must not depend on other crate of the workspace

Re-exports§

pub use crate::precision::Precision;

Modules§

electrum_ssl
The sockets of the Blockstream Liquid Electrum servers.
precision
Module to handle the formattings of amount of assets given its precision.

Structs§

Address
A wrapper around elements::Address that checks the network and provides a more user-friendly parse errors
Amp0SignerData
Signer information necessary for full login to AMP0
Balance
Wallet balance wrapper
EncryptedStore
A Store wrapper that encrypts values using AES-256-GCM-SIV.
FakeStore
A Store implementation that intentionally persists nothing.
FileStore
A filesystem-backed implementation of Store.
InvalidBipVariant
The error type returned by Bip::from_str
InvalidBlindingKeyVariant
The error type returned by DescriptorBlindingKey::from_str
InvalidKeyOriginXpub
The error type returned by keyorigin_xpub_from_str
InvalidMultisigVariant
The variant of the multisig descriptor
InvalidSinglesigVariant
The error type returned by Singlesig::from_str
Issuance
The details of an issuance or reissuance
MemoryStore
A simple in-memory implementation of Store.
PsetBalance
The details regarding balance and amounts in a PSET
PsetDetails
The details of a Partially Signed Elements Transaction:
PsetSignatures
The details of the signatures in a PSET
Recipient
The recipient (an output not belonging to the wallet) in a PSET
SignedBalance
A signed balance of assets, to represent a balance with negative values such as the results of a transactions from the perspective of a wallet.

Enums§

AddressParseError
The error type returned by Address::parse
Bip
The variant of the descriptor like specified in the bips
DescriptorBlindingKey
Some descriptor blinding keys variant
EncryptError
Errors returned by the crypto helpers.
EncryptedStoreError
Error type for EncryptedStore operations.
Error
Multisig
The variant of the multisig descriptor
Network
The network of the elements blockchain.
QrError
Singlesig
The variant of the singlesig descriptor

Constants§

DEFAULT_FEE_RATE
Default fee rate in sats/kvb (0.1 sat/vb = 100 sats/kvb)

Traits§

Amp0Signer
AMP0 signer methods
DynStore
An object-safe key-value storage trait for use with dyn.
Signer
A trait defining methods of signers, providing blanket implementations for some methods.
Store
A generic key-value storage interface.
Stream
A trait for async read/write operations used by hardware wallet connections

Functions§

address_to_qr
Convert the given elements address to a QR code image uri
address_to_text_qr
Convert the given address in a string representing a QR code to be consumed from a terminal
burn_script
Create the same burn script that Elements Core wallet creates
calculate_fee
Calculate the fee from transaction weight and fee rate.
cipher_from_key_bytes
Create a cipher from 32 key bytes.
decrypt_with_nonce_prefix
Decrypt a payload that was encrypted with encrypt_with_random_nonce or encrypt_with_deterministic_nonce.
derive_blinding_key
Derive the blinding secret key from a confidential descriptor and a script pubkey.
derive_script_pubkey
Derive the script pubkey from a confidential descriptor and an index.
encrypt_with_deterministic_nonce
Encrypt a payload using a deterministic nonce derived from the plaintext tagged hash.
encrypt_with_random_nonce
Encrypt a payload with a random nonce.
is_provably_segwit
Whether a script pubkey is provably segwit
keyorigin_xpub_from_str
Parse a keyorigin xpub from a string
multisig_desc
Generate a multisig descriptor with the given parameters
pset_balance
Return the net balance of a PSET from the perspective of the given descriptor. It returns also the fee and the recipients (external receivers) of the PSET.
pset_debug
Create a debug string of a PSET, but remove new lines on number arrays.
pset_issuances
Return the issuances of a PSET, for each input return an Issuance but the struct must be checked with Issuance::is_issuance if it’s a real issuance or reissuance.
pset_signatures
Return the signatures of a PSET, for each input return a PsetSignatures which includes a list of signatures that are available and a list of signatures that are missing.
singlesig_desc
Generate a singlesig descriptor with the given parameters
string_to_qr
Convert the given string to a QR code image uri

Type Aliases§

BoxError
A boxed error type for use with DynStore.