Skip to content

Commit

Permalink
Improve ord wallet send help message and rename output outgoing t…
Browse files Browse the repository at this point in the history
…o `asset` (ordinals#4105)
  • Loading branch information
casey authored Nov 26, 2024
1 parent 5ac126d commit 12de46f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/subcommand/wallet/burn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl Burn {
Ok(Some(Box::new(send::Output {
txid,
psbt,
outgoing: Outgoing::InscriptionId(self.inscription),
asset: Outgoing::InscriptionId(self.inscription),
fee,
})))
}
Expand Down
15 changes: 11 additions & 4 deletions src/subcommand/wallet/send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,22 @@ pub(crate) struct Send {
value_name = "AMOUNT"
)]
pub(crate) postage: Option<Amount>,
#[arg(help = "Recipient address")]
address: Address<NetworkUnchecked>,
outgoing: Outgoing,
#[arg(
help = "Outgoing asset formatted as a bitcoin amount, rune amount, sat name, satpoint, or \
inscription ID. Bitcoin amounts are `DECIMAL UNIT` where `UNIT` is one of \
`bit btc cbtc mbtc msat nbtc pbtc sat satoshi ubtc`. Rune amounts are `DECIMAL:RUNE` and \
respect divisibility"
)]
asset: Outgoing,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct Output {
pub txid: Txid,
pub psbt: String,
pub outgoing: Outgoing,
pub asset: Outgoing,
pub fee: u64,
}

Expand All @@ -31,7 +38,7 @@ impl Send {
.clone()
.require_network(wallet.chain().network())?;

let unsigned_transaction = match self.outgoing {
let unsigned_transaction = match self.asset {
Outgoing::Amount(amount) => {
Self::create_unsigned_send_amount_transaction(&wallet, address, amount, self.fee_rate)?
}
Expand Down Expand Up @@ -79,7 +86,7 @@ impl Send {
Ok(Some(Box::new(Output {
txid,
psbt,
outgoing: self.outgoing,
asset: self.asset,
fee,
})))
}
Expand Down
2 changes: 1 addition & 1 deletion tests/wallet/send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ fn send_dry_run() {
.to_sat(),
output.fee
);
assert_eq!(output.outgoing, Outgoing::InscriptionId(inscription));
assert_eq!(output.asset, Outgoing::InscriptionId(inscription));
}

#[test]
Expand Down

0 comments on commit 12de46f

Please sign in to comment.