[][src]Enum bdk_cli::WalletSubCommand

pub enum WalletSubCommand {
    GetNewAddress,
    Sync {
        max_addresses: Option<u32>,
    },
    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>,
    },
    Broadcast {
        psbt: Option<String>,
        tx: Option<String>,
    },
    ExtractPsbt {
        psbt: String,
    },
    FinalizePsbt {
        psbt: String,
        assume_height: Option<u32>,
    },
    CombinePsbt {
        psbt: Vec<String>,
    },
    Repl,
}

Wallet sub-command

A structopt enum that parses wallet sub-command arguments from the command line or from a String vector, such as in the bdk-cli example cli wallet.

Example


let sync_sub_command = WalletSubCommand::from_iter(&["bdk-cli", "sync", "--max_addresses", "50"]);
assert!(matches!(
    sync_sub_command,
    WalletSubCommand::Sync {
        max_addresses: Some(50)
    }
));

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 ReplOpt {
    /// Wallet sub-command
    #[structopt(subcommand)]
    pub subcommand: WalletSubCommand,
}

Variants

GetNewAddress

Generates a new external address

Sync

Syncs with the chosen blockchain server

Fields of Sync

max_addresses: Option<u32>

max addresses to consider

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

Broadcast

Broadcasts a transaction to the network. Takes either a raw transaction or a PSBT to extract

Fields of Broadcast

psbt: Option<String>

Sets the PSBT to sign

tx: Option<String>

Sets the raw transaction to broadcast

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

Repl

Enter REPL command loop mode

Trait Implementations

impl Clone for WalletSubCommand[src]

impl Debug for WalletSubCommand[src]

impl PartialEq<WalletSubCommand> for WalletSubCommand[src]

impl StructOpt for WalletSubCommand[src]

impl StructOptInternal for WalletSubCommand[src]

impl StructuralPartialEq for WalletSubCommand[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,