Skip to content

Commit ac419c0

Browse files
grunchclaude
andcommitted
feat: bump mostro-core to 0.11.0 and handle anti-abuse bond flow
The Mostro daemon now ships the taker's anti-abuse bond hold-invoice as a separate Action::PayBondInvoice before the trade hold-invoice. With mostro-core 0.10 the variant was unknown, so the rumor failed to deserialize and takesell/takebuy responses surfaced as "Error serializing message" with no follow-up. Bumps mostro-core to 0.11.0 and wires the new Action::PayBondInvoice and Status::WaitingTakerBond variants into the DM parser/display so takers see the bond invoice and the trade continues to the existing PayInvoice flow afterwards. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 348b368 commit ac419c0

3 files changed

Lines changed: 52 additions & 3 deletions

File tree

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ reqwest = { version = "0.12.23", default-features = false, features = [
4646
"json",
4747
"rustls-tls",
4848
] }
49-
mostro-core = "0.10.0"
49+
mostro-core = "0.11.0"
5050
lnurl-rs = { version = "0.9.0", default-features = false, features = ["ureq"] }
5151
pretty_env_logger = "0.5.0"
5252
sqlx = { version = "0.8.6", features = ["sqlite", "runtime-tokio-rustls"] }

src/parser/dms.rs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,26 @@ fn handle_pay_invoice_display(order: &Option<mostro_core::order::SmallOrder>, in
7878
println!();
7979
}
8080

81+
fn handle_pay_bond_invoice_display(order: &Option<mostro_core::order::SmallOrder>, invoice: &str) {
82+
print_section_header("🪙 Anti-Abuse Bond Invoice");
83+
if let Some(order) = order {
84+
if let Some(order_id) = order.id {
85+
println!("📋 Order ID: {}", order_id);
86+
}
87+
print_amount_info(order.amount);
88+
print_fiat_code(&order.fiat_code);
89+
println!("💵 Fiat Amount: {}", order.fiat_amount);
90+
}
91+
println!();
92+
println!("⚡ LIGHTNING BOND INVOICE TO PAY:");
93+
println!("─────────────────────────────────────");
94+
println!("{}", invoice);
95+
println!("─────────────────────────────────────");
96+
println!("💡 Pay this hold invoice to lock your taker bond.");
97+
println!("💡 The trade hold invoice will arrive next.");
98+
println!();
99+
}
100+
81101
/// Format payload details for DM table display
82102
fn format_payload_details(payload: &Payload, action: &Action) -> String {
83103
match payload {
@@ -113,6 +133,7 @@ fn format_payload_details(payload: &Payload, action: &Action) -> String {
113133
Status::Expired => "⏰",
114134
Status::SettledHoldInvoice => "💰",
115135
Status::InProgress => "🔄",
136+
Status::WaitingTakerBond => "🪙",
116137
};
117138

118139
let kind_emoji = match o.kind.as_ref().unwrap_or(&mostro_core::order::Kind::Sell) {
@@ -486,6 +507,33 @@ pub async fn print_commands_results(message: &MessageKind, ctx: &Context) -> Res
486507
}
487508
Ok(())
488509
}
510+
// mostro-core 0.11: anti-abuse bond invoice sent right after a takebuy/takesell.
511+
Action::PayBondInvoice => {
512+
if let Some(Payload::PaymentRequest(order, invoice, _)) = &message.payload {
513+
handle_pay_bond_invoice_display(order, invoice);
514+
515+
if let Some(order) = order {
516+
if let Some(req_id) = message.request_id {
517+
if let Err(e) = save_order(
518+
order.clone(),
519+
&ctx.trade_keys,
520+
req_id,
521+
ctx.trade_index,
522+
&ctx.pool,
523+
)
524+
.await
525+
{
526+
println!("❌ Failed to save order: {}", e);
527+
return Err(anyhow::anyhow!("Failed to save order: {}", e));
528+
}
529+
print_success_message("Order saved successfully!");
530+
} else {
531+
return Err(anyhow::anyhow!("No request id found in message"));
532+
}
533+
}
534+
}
535+
Ok(())
536+
}
489537
Action::CantDo => {
490538
println!("❌ Action Cannot Be Completed");
491539
println!("═══════════════════════════════════════");
@@ -844,6 +892,7 @@ pub async fn print_direct_messages(
844892
let action_icon = match inner.action {
845893
Action::NewOrder => "🆕",
846894
Action::AddInvoice | Action::PayInvoice => "⚡",
895+
Action::PayBondInvoice => "🪙",
847896
Action::FiatSent | Action::FiatSentOk => "💸",
848897
Action::Release | Action::Released => "🔓",
849898
Action::Cancel | Action::Canceled => "🚫",

0 commit comments

Comments
 (0)