Enum bdk_cli::OfflineWalletSubCommand [−][src]
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,
send_all: bool,
offline_signer: bool,
utxos: Option<Vec<OutPoint>>,
unspendable: Option<Vec<OutPoint>>,
fee_rate: f32,
},
Policies,
PublicDescriptor,
Sign {
psbt: String,
assume_height: Option<u32>,
},
ExtractPsbt {
psbt: String,
},
FinalizePsbt {
psbt: String,
assume_height: Option<u32>,
},
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
Generates a new external address
Lists the available spendable UTXOs
Lists all the incoming and outgoing transactions of the wallet
Returns the current wallet balance
Creates a new unsigned transaction
Fields of CreateTx
recipients: Vec<(Script, u64)>Adds a recipient to the transaction
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.
utxos: Option<Vec<OutPoint>>Selects which utxos must be spent
unspendable: Option<Vec<OutPoint>>Marks a utxo as unspendable
fee_rate: Option<f32>Fee rate to use in sat/vbyte
external_policy: Option<String>Selects which policy should be used to satisfy the external descriptor
internal_policy: Option<String>Selects which policy should be used to satisfy the internal descriptor
Bumps the fees of an RBF transaction
Fields of BumpFee
txid: StringTXID of the transaction to update
send_all: boolAllows the wallet to reduce the amount of the only output in order to increase fees. This is generally the expected behavior for transactions originally created with send_all
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
Returns the available spending policies for the descriptor
Returns the public version of the wallet’s descriptor(s)
Signs and tries to finalize a PSBT
Fields of Sign
Extracts a raw transaction from a PSBT
Fields of ExtractPsbt
psbt: StringSets the PSBT to extract
Finalizes a PSBT
Fields of FinalizePsbt
Combines multiple PSBTs into one
Fields of CombinePsbt
Trait Implementations
This method tests for self and other values to be equal, and is used
by ==. Read more
This method tests for !=.
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
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
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
fn 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
fn 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
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
Mutably borrows from an owned value. Read more