Skip to content

Commit

Permalink
Fix include send requests when building txs
Browse files Browse the repository at this point in the history
  • Loading branch information
buffrr committed Jan 22, 2025
1 parent 7819599 commit ce6fdef
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
13 changes: 12 additions & 1 deletion wallet/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,16 @@ impl Iterator for BuilderIterator<'_> {
);
}
}
if !params.sends.is_empty() {
// TODO: resolved address recipient
for send in &params.sends {
detailed_tx.add_send(
send.amount,
None,
send.recipient.script_pubkey(),
);
}
}
Some(Ok(detailed_tx))
}
StackOp::Open(params) => {
Expand Down Expand Up @@ -789,14 +799,15 @@ impl Builder {
}
if !opens.is_empty()
|| !transfers.is_empty()
|| !sends.is_empty()
|| !executes.is_empty()
|| auction_outputs.is_some()
{
stack.push(StackOp::Prepare(CreateParams {
opens,
executes,
transfers,
sends: vec![],
sends,
bidouts: auction_outputs,
}));
}
Expand Down
5 changes: 3 additions & 2 deletions wallet/src/tx_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub struct BidoutEventDetails {
pub struct SendEventDetails {
#[serde(skip_serializing_if = "Option::is_none")]
pub to_space: Option<String>,
pub resolved_address: ScriptBuf,
pub script_pubkey: ScriptBuf,
pub amount: Amount,
}

Expand Down Expand Up @@ -344,7 +344,7 @@ impl TxRecord {
details: Some(
serde_json::to_value(SendEventDetails {
to_space,
resolved_address,
script_pubkey: resolved_address,
amount,
})
.expect("json value"),
Expand Down Expand Up @@ -526,6 +526,7 @@ impl FromStr for TxEventKind {
"send" => Ok(TxEventKind::Send),
"script" => Ok(TxEventKind::Script),
"fee-bump" => Ok(TxEventKind::FeeBump),
"buy" => Ok(TxEventKind::Buy),
_ => Err("invalid event kind"),
}
}
Expand Down

0 comments on commit ce6fdef

Please sign in to comment.