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

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

Creates a new unsigned transaction

Fields of CreateTx

recipients: Vec<(Script, u64)>

Adds a recipient to the transaction

send_all: bool

Sends all the funds (or all the selected utxos). Requires only one recipients of value 0

enable_rbf: bool

Enables Replace-By-Fee (BIP125)

offline_signer: bool

Make 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

BumpFee

Bumps the fees of an RBF transaction

Fields of BumpFee

txid: String

TXID of the transaction to update

send_all: bool

Allows 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: bool

Make 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: f32

The new targeted fee rate in sat/vbyte

Policies

Returns the available spending policies for the descriptor

PublicDescriptor

Returns the public version of the wallet’s descriptor(s)

Sign

Signs and tries to finalize a PSBT

Fields of Sign

psbt: String

Sets the PSBT to sign

assume_height: Option<u32>

Assume the blockchain has reached a specific height. This affects the transaction finalization, if there are timelocks in the descriptor

ExtractPsbt

Extracts a raw transaction from a PSBT

Fields of ExtractPsbt

psbt: String

Sets the PSBT to extract

FinalizePsbt

Finalizes a PSBT

Fields of FinalizePsbt

psbt: String

Sets the PSBT to finalize

assume_height: Option<u32>

Assume the blockchain has reached a specific height

CombinePsbt

Combines multiple PSBTs into one

Fields of CombinePsbt

psbt: Vec<String>

Add one PSBT to combine. This option can be repeated multiple times, one for each PSBT

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Returns clap::App corresponding to the struct.

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

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

Gets the struct from any iterator such as a Vec of your making. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.