Skip to content

Commit 73a9824

Browse files
Fetch address index in verbose mode for get_new_address
1 parent 52ef313 commit 73a9824

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
@@ -902,7 +902,19 @@ where
902902
D: BatchDatabase,
903903
{
904904
match offline_subcommand {
905-
GetNewAddress => Ok(json!({"address": wallet.get_address(AddressIndex::New)?.address})),
905+
GetNewAddress => {
906+
let addr = wallet.get_address(AddressIndex::New)?;
907+
if wallet_opts.verbose {
908+
Ok(json!({
909+
"address": addr.address,
910+
"index": addr.index
911+
}))
912+
} else {
913+
Ok(json!({
914+
"address": addr.address,
915+
}))
916+
}
917+
}
906918
ListUnspent => Ok(serde_json::to_value(&wallet.list_unspent()?)?),
907919
ListTransactions => Ok(serde_json::to_value(
908920
&wallet.list_transactions(wallet_opts.verbose)?,

0 commit comments

Comments
 (0)