Skip to content

Commit 8d14cf5

Browse files
committed
Merge #77: Fetch address index in verbose mode for get_new_address
73a9824 Fetch address index in verbose mode for get_new_address (rajarshimaitra) Pull request description: <!-- You can erase any parts of this template not applicable to your Pull Request. --> ### Description Fixes #40 cc @thunderbiscuit ### Checklists #### All Submissions: * [x] I've signed all my commits * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk-cli/blob/master/CONTRIBUTING.md) * [x] I ran `cargo fmt` and `cargo clippy` before committing #### New Features: * [ ] I've added tests for the new feature * [ ] I've added docs for the new feature * [ ] I've updated `CHANGELOG.md` ACKs for top commit: thunderbiscuit: tested ACK [73a9824](73a9824). notmandatory: ACK 73a9824 Tree-SHA512: 643898e312061d6c405ee7a1065987a1c308fb4ae18ed52f3945e2411dd4001c951322fcc2f12fcb195e939e14df26703f8ae97b793aa8955de02cf39b2f96b1
2 parents bd510e2 + 73a9824 commit 8d14cf5

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/lib.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,19 @@ where
892892
D: BatchDatabase,
893893
{
894894
match offline_subcommand {
895-
GetNewAddress => Ok(json!({"address": wallet.get_address(AddressIndex::New)?.address})),
895+
GetNewAddress => {
896+
let addr = wallet.get_address(AddressIndex::New)?;
897+
if wallet_opts.verbose {
898+
Ok(json!({
899+
"address": addr.address,
900+
"index": addr.index
901+
}))
902+
} else {
903+
Ok(json!({
904+
"address": addr.address,
905+
}))
906+
}
907+
}
896908
ListUnspent => Ok(serde_json::to_value(&wallet.list_unspent()?)?),
897909
ListTransactions => Ok(serde_json::to_value(
898910
&wallet.list_transactions(wallet_opts.verbose)?,

0 commit comments

Comments
 (0)