[descriptors] Transform a descriptor into its "public" version
This commit is contained in:
18
src/cli.rs
18
src/cli.rs
@@ -119,6 +119,10 @@ pub fn make_cli_subcommands<'a, 'b>() -> App<'a, 'b> {
|
||||
SubCommand::with_name("policies")
|
||||
.about("Returns the available spending policies for the descriptor")
|
||||
)
|
||||
.subcommand(
|
||||
SubCommand::with_name("public_descriptor")
|
||||
.about("Returns the public version of the wallet's descriptor(s)")
|
||||
)
|
||||
.subcommand(
|
||||
SubCommand::with_name("sign")
|
||||
.about("Signs and tries to finalize a PSBT")
|
||||
@@ -271,6 +275,20 @@ where
|
||||
serde_json::to_string(&wallet.policies(ScriptType::External)?).unwrap(),
|
||||
serde_json::to_string(&wallet.policies(ScriptType::Internal)?).unwrap(),
|
||||
)))
|
||||
} else if let Some(_sub_matches) = matches.subcommand_matches("public_descriptor") {
|
||||
let external = match wallet.public_descriptor(ScriptType::External)? {
|
||||
Some(desc) => format!("{}", desc),
|
||||
None => "<NONE>".into(),
|
||||
};
|
||||
let internal = match wallet.public_descriptor(ScriptType::Internal)? {
|
||||
Some(desc) => format!("{}", desc),
|
||||
None => "<NONE>".into(),
|
||||
};
|
||||
|
||||
Ok(Some(format!(
|
||||
"External: {}\nInternal:{}",
|
||||
external, internal
|
||||
)))
|
||||
} else if let Some(sub_matches) = matches.subcommand_matches("sign") {
|
||||
let psbt = base64::decode(sub_matches.value_of("psbt").unwrap()).unwrap();
|
||||
let psbt: PartiallySignedTransaction = deserialize(&psbt).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user