Add zero-amount Receive Chain Swap (#538)

Add support for Zero-Amount Receive Chain Swaps
This commit is contained in:
ok300
2024-12-09 16:10:52 +00:00
committed by GitHub
parent 790dfa91be
commit cfc883ae00
20 changed files with 571 additions and 60 deletions

View File

@@ -271,13 +271,21 @@ pub(crate) async fn handle_command(
})
.await?;
wait_confirmation!(
format!(
"Fees: {} sat. Are the fees acceptable? (y/N) ",
prepare_response.fees_sat
),
"Payment receive halted"
);
let fees = prepare_response.fees_sat;
let confirmation_msg = match payer_amount_sat {
Some(_) => format!("Fees: {fees} sat. Are the fees acceptable? (y/N)"),
None => {
let min = prepare_response.min_payer_amount_sat;
let max = prepare_response.max_payer_amount_sat;
let service_feerate = prepare_response.service_feerate;
format!(
"Fees: {fees} sat + {service_feerate:?}% of the sent amount. \
Sender should send between {min:?} sat and {max:?} sat. \
Are the fees acceptable? (y/N)"
)
}
};
wait_confirmation!(confirmation_msg, "Payment receive halted");
let response = sdk
.receive_payment(&ReceivePaymentRequest {