Skip to content

Commit

Permalink
Amend
Browse files Browse the repository at this point in the history
  • Loading branch information
raphjaph committed Nov 26, 2024
1 parent ab3a6ed commit f99458b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/subcommand/wallet/sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ group(
pub(crate) struct Sign {
#[arg(
long,
help = "Sign with either <ADDRESS>, <OUTPUT> or <INSCRIPTION_ID>."
help = "Sign with public from address, output, or inscription id."
)]
sign_with: Signer,
signer: Signer,
#[arg(long, help = "Sign <TEXT>.")]
text: Option<String>,
#[arg(long, help = "Sign contents of <FILE>.")]
Expand All @@ -30,7 +30,7 @@ pub(crate) struct Sign {

impl Sign {
pub(crate) fn run(&self, wallet: Wallet) -> SubcommandResult {
let address = match &self.sign_with {
let address = match &self.signer {
Signer::Address(address) => address.clone().require_network(wallet.chain().network())?,
Signer::Inscription(inscription) => Address::from_str(
&wallet
Expand Down
16 changes: 7 additions & 9 deletions tests/wallet/sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn sign() {
let text = "HelloWorld";

let sign = CommandBuilder::new(format!(
"wallet sign --sign-with {} --text {text}",
"wallet sign --signer {} --text {text}",
address.clone().assume_checked(),
))
.core(&core)
Expand Down Expand Up @@ -60,7 +60,7 @@ fn sign_file() {
let address = addresses.first_key_value().unwrap().0;

let sign = CommandBuilder::new(format!(
"wallet sign --sign-with {} --file hello.txt",
"wallet sign --signer {} --file hello.txt",
address.clone().assume_checked(),
))
.write("hello.txt", "Hello World")
Expand Down Expand Up @@ -112,12 +112,10 @@ fn sign_for_inscription() {

let text = "HelloWorld";

let sign = CommandBuilder::new(format!(
"wallet sign --sign-with {inscription} --text {text}",
))
.core(&core)
.ord(&ord)
.run_and_deserialize_output::<SignOutput>();
let sign = CommandBuilder::new(format!("wallet sign --signer {inscription} --text {text}",))
.core(&core)
.ord(&ord)
.run_and_deserialize_output::<SignOutput>();

assert!(addresses.contains_key(&sign.address));
}
Expand All @@ -141,7 +139,7 @@ fn sign_for_output() {

let text = "HelloWorld";

let sign = CommandBuilder::new(format!("wallet sign --sign-with {output} --text {text}",))
let sign = CommandBuilder::new(format!("wallet sign --signer {output} --text {text}",))
.core(&core)
.ord(&ord)
.run_and_deserialize_output::<SignOutput>();
Expand Down

0 comments on commit f99458b

Please sign in to comment.