Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/cont_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
strategy:
matrix:
rust:
- 1.50.0 # STABLE
- 1.45.0 # MSRV
- 1.51.0 # STABLE
- 1.46.0 # MSRV
features:
- default
- repl
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

#### Added
- `CliSubCommand::Compile` enum variant and `handle_compile_subcommand()` function

#### Changed
- Make repl and electrum default features
- Remove unwraps while handling CLI commands
- Upgrade to `bdk` v0.7.x

### `bdk-cli` bin

#### Added
- New top level command "Compile" which compiles a miniscript policy to an output descriptor
- `CompactFilterOpts` to `WalletOpts` to enable compact-filter blockchain configuration

#### Changed
- Remove unwraps while handling CLI commands

## [0.2.0]

### Project
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ readme = "README.md"
license = "MIT"

[dependencies]
bdk = { version = "^0.5.1", default-features = false, features = ["all-keys"]}
bdk = { version = "^0.7", default-features = false, features = ["all-keys"]}
bdk-macros = "^0.4"
structopt = "^0.3"
serde_json = { version = "^1.0" }
Expand Down
28 changes: 17 additions & 11 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ use bdk::keys::{DerivableKey, DescriptorKey, ExtendedKey, GeneratableKey, Genera
use bdk::miniscript::miniscript;
#[cfg(feature = "compiler")]
use bdk::miniscript::policy::Concrete;
use bdk::wallet::AddressIndex;
use bdk::Error;
use bdk::SignOptions;
use bdk::{FeeRate, KeychainKind, Wallet};

/// Global options
Expand Down Expand Up @@ -692,7 +694,7 @@ where
D: BatchDatabase,
{
match offline_subcommand {
GetNewAddress => Ok(json!({"address": wallet.get_new_address()?})),
GetNewAddress => Ok(json!({"address": wallet.get_address(AddressIndex::New)?})),
ListUnspent => Ok(serde_json::to_value(&wallet.list_unspent()?)?),
ListTransactions => Ok(serde_json::to_value(&wallet.list_transactions(false)?)?),
GetBalance => Ok(json!({"satoshi": wallet.get_balance()?})),
Expand Down Expand Up @@ -722,9 +724,7 @@ where
}

if offline_signer {
tx_builder
.force_non_witness_utxo()
.include_output_redeem_witness_script();
tx_builder.include_output_redeem_witness_script();
}

if let Some(fee_rate) = fee_rate {
Expand Down Expand Up @@ -771,9 +771,7 @@ where
}

if offline_signer {
tx_builder
.force_non_witness_utxo()
.include_output_redeem_witness_script();
tx_builder.include_output_redeem_witness_script();
}

if let Some(utxos) = utxos {
Expand All @@ -800,8 +798,12 @@ where
assume_height,
} => {
let psbt = base64::decode(&psbt).unwrap();
let psbt: PartiallySignedTransaction = deserialize(&psbt).unwrap();
let (psbt, finalized) = wallet.sign(psbt, assume_height)?;
let mut psbt: PartiallySignedTransaction = deserialize(&psbt).unwrap();
let signopt = SignOptions {
assume_height,
..Default::default()
};
let finalized = wallet.sign(&mut psbt, signopt)?;
Ok(json!({"psbt": base64::encode(&serialize(&psbt)),"is_finalized": finalized,}))
}
ExtractPsbt { psbt } => {
Expand All @@ -814,9 +816,13 @@ where
assume_height,
} => {
let psbt = base64::decode(&psbt).unwrap();
let psbt: PartiallySignedTransaction = deserialize(&psbt).unwrap();
let mut psbt: PartiallySignedTransaction = deserialize(&psbt).unwrap();

let (psbt, finalized) = wallet.finalize_psbt(psbt, assume_height)?;
let signopt = SignOptions {
assume_height,
..Default::default()
};
let finalized = wallet.finalize_psbt(&mut psbt, signopt)?;
Ok(json!({ "psbt": base64::encode(&serialize(&psbt)),"is_finalized": finalized,}))
}
CombinePsbt { psbt } => {
Expand Down