Enum bdk_cli::OfflineWalletSubCommand
source · [−]pub enum OfflineWalletSubCommand {
GetNewAddress,
ListUnspent,
ListTransactions,
GetBalance,
CreateTx {
recipients: Vec<(Script, u64)>,
send_all: bool,
enable_rbf: bool,
offline_signer: bool,
utxos: Option<Vec<OutPoint>>,
unspendable: Option<Vec<OutPoint>>,
fee_rate: Option<f32>,
external_policy: Option<String>,
internal_policy: Option<String>,
},
BumpFee {
txid: String,
shrink_address: Option<Address>,
offline_signer: bool,
utxos: Option<Vec<OutPoint>>,
unspendable: Option<Vec<OutPoint>>,
fee_rate: f32,
},
Policies,
PublicDescriptor,
Sign {
psbt: String,
assume_height: Option<u32>,
trust_witness_utxo: Option<bool>,
},
ExtractPsbt {
psbt: String,
},
FinalizePsbt {
psbt: String,
assume_height: Option<u32>,
trust_witness_utxo: Option<bool>,
},
CombinePsbt {
psbt: Vec<String>,
},
}Expand description
Offline Wallet sub-command
CliSubCommand::Wallet sub-commands that do not require a blockchain client and network
connection. These sub-commands use only the provided descriptor or locally cached wallet
information.
Example
let address_sub_command = OfflineWalletSubCommand::from_iter(&["wallet", "get_new_address"]);
assert!(matches!(
address_sub_command,
OfflineWalletSubCommand::GetNewAddress
));To capture wallet sub-commands from a string vector without a preceeding binary name you can
create a custom struct the includes the NoBinaryName clap setting and wraps the WalletSubCommand
enum. See also the bdk-cli
example app.
Example
#[derive(Debug, StructOpt, Clone, PartialEq)]
#[structopt(name = "BDK CLI", setting = AppSettings::NoBinaryName,
version = option_env ! ("CARGO_PKG_VERSION").unwrap_or("unknown"),
author = option_env ! ("CARGO_PKG_AUTHORS").unwrap_or(""))]
struct ReplOpts {
/// Wallet sub-command
#[structopt(subcommand)]
pub subcommand: OfflineWalletSubCommand,
}
let repl_opts = ReplOpts::from_iter(&["get_new_address"]);
assert!(matches!(
repl_opts.subcommand,
OfflineWalletSubCommand::GetNewAddress
));Variants
GetNewAddress
Generates a new external address
ListUnspent
Lists the available spendable UTXOs
ListTransactions
Lists all the incoming and outgoing transactions of the wallet
GetBalance
Returns the current wallet balance
CreateTx
Fields
send_all: boolSends all the funds (or all the selected utxos). Requires only one recipients of value 0
enable_rbf: boolEnables Replace-By-Fee (BIP125)
offline_signer: boolMake a PSBT that can be signed by offline signers and hardware wallets. Forces the addition of non_witness_utxo and more details to let the signer identify the change output.
Creates a new unsigned transaction
BumpFee
Fields
txid: StringTXID of the transaction to update
shrink_address: Option<Address>Allows the wallet to reduce the amount to the specified address in order to increase fees.
offline_signer: boolMake a PSBT that can be signed by offline signers and hardware wallets. Forces the addition of non_witness_utxo and more details to let the signer identify the change output.
utxos: Option<Vec<OutPoint>>Selects which utxos must be added to the tx. Unconfirmed utxos cannot be used
unspendable: Option<Vec<OutPoint>>Marks an utxo as unspendable, in case more inputs are needed to cover the extra fees
fee_rate: f32The new targeted fee rate in sat/vbyte
Bumps the fees of an RBF transaction
Policies
Returns the available spending policies for the descriptor
PublicDescriptor
Returns the public version of the wallet’s descriptor(s)
Sign
Fields
psbt: StringSets the PSBT to sign
Signs and tries to finalize a PSBT
ExtractPsbt
Fields
psbt: StringSets the PSBT to extract
Extracts a raw transaction from a PSBT
FinalizePsbt
Fields
psbt: StringSets the PSBT to finalize
Finalizes a PSBT
CombinePsbt
Fields
Combines multiple PSBTs into one
Trait Implementations
sourceimpl Clone for OfflineWalletSubCommand
impl Clone for OfflineWalletSubCommand
sourcefn clone(&self) -> OfflineWalletSubCommand
fn clone(&self) -> OfflineWalletSubCommand
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for OfflineWalletSubCommand
impl Debug for OfflineWalletSubCommand
sourceimpl PartialEq<OfflineWalletSubCommand> for OfflineWalletSubCommand
impl PartialEq<OfflineWalletSubCommand> for OfflineWalletSubCommand
sourcefn eq(&self, other: &OfflineWalletSubCommand) -> bool
fn eq(&self, other: &OfflineWalletSubCommand) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourcefn ne(&self, other: &OfflineWalletSubCommand) -> bool
fn ne(&self, other: &OfflineWalletSubCommand) -> bool
This method tests for !=.
sourceimpl StructOpt for OfflineWalletSubCommand
impl StructOpt for OfflineWalletSubCommand
sourcefn from_clap(matches: &ArgMatches<'_>) -> Self
fn from_clap(matches: &ArgMatches<'_>) -> Self
Builds the struct from clap::ArgMatches. It’s guaranteed to succeed
if matches originates from an App generated by StructOpt::clap called on
the same type, otherwise it must panic. Read more
sourcefn from_args() -> Self
fn from_args() -> Self
Builds the struct from the command line arguments (std::env::args_os).
Calls clap::Error::exit on failure, printing the error message and aborting the program. Read more
sourcefn from_args_safe() -> Result<Self, Error>
fn from_args_safe() -> Result<Self, Error>
Builds the struct from the command line arguments (std::env::args_os).
Unlike StructOpt::from_args, returns clap::Error on failure instead of aborting the program,
so calling .exit is up to you. Read more
sourcefn from_iter<I>(iter: I) -> Self where
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString>,
<I as IntoIterator>::Item: Clone,
fn from_iter<I>(iter: I) -> Self where
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString>,
<I as IntoIterator>::Item: Clone,
Gets the struct from any iterator such as a Vec of your making.
Print the error message and quit the program in case of failure. Read more
sourcefn from_iter_safe<I>(iter: I) -> Result<Self, Error> where
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString>,
<I as IntoIterator>::Item: Clone,
fn from_iter_safe<I>(iter: I) -> Result<Self, Error> where
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString>,
<I as IntoIterator>::Item: Clone,
Gets the struct from any iterator such as a Vec of your making. Read more
impl StructuralPartialEq for OfflineWalletSubCommand
Auto Trait Implementations
impl RefUnwindSafe for OfflineWalletSubCommand
impl Send for OfflineWalletSubCommand
impl Sync for OfflineWalletSubCommand
impl Unpin for OfflineWalletSubCommand
impl UnwindSafe for OfflineWalletSubCommand
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more