mirror of
https://github.com/aljazceru/breez-sdk-liquid.git
synced 2026-01-16 12:34:22 +01:00
Fix cooperative refund and improve keypair generation (#223)
* feat: add random keypair generation * Encapsulate decode_keypair in SendSwap::get_refund_keypair() * Add refund_tx_id and refund_tx_amount_sat to Payment * fix: remove blocking on refund * fix: change `refund_private_key` order * fix: rebasing * fix: set `next_unused_address` as refund output * Handle refunds in `get_info`, `list_payments` (#226) * Exclude refund txs from payment list * Adjust balance calculation to account for refunds * fix: revert boltz changes and fix locktime * Replace subquery with LEFT JOIN to get refund data * Rewrite locktime check for more clarity * Rewrite locktime check for more clarity * Fix select_payment_query in case of refunds * Include boltz-client fixes (handling of unwraps for failed broadcasts) * Cargo.toml: Use boltz-client branch instead of commit --------- Co-authored-by: ok300 <106775972+ok300@users.noreply.github.com>
This commit is contained in:
@@ -172,6 +172,8 @@ fun asPayment(payment: ReadableMap): Payment? {
|
||||
val amountSat = payment.getDouble("amountSat").toULong()
|
||||
val feesSat = if (hasNonNullKey(payment, "feesSat")) payment.getDouble("feesSat").toULong() else null
|
||||
val preimage = if (hasNonNullKey(payment, "preimage")) payment.getString("preimage") else null
|
||||
val refundTxId = if (hasNonNullKey(payment, "refundTxId")) payment.getString("refundTxId") else null
|
||||
val refundTxAmountSat = if (hasNonNullKey(payment, "refundTxAmountSat")) payment.getDouble("refundTxAmountSat").toULong() else null
|
||||
val paymentType = payment.getString("paymentType")?.let { asPaymentType(it) }!!
|
||||
val status = payment.getString("status")?.let { asPaymentState(it) }!!
|
||||
return Payment(
|
||||
@@ -181,6 +183,8 @@ fun asPayment(payment: ReadableMap): Payment? {
|
||||
amountSat,
|
||||
feesSat,
|
||||
preimage,
|
||||
refundTxId,
|
||||
refundTxAmountSat,
|
||||
paymentType,
|
||||
status,
|
||||
)
|
||||
@@ -194,6 +198,8 @@ fun readableMapOf(payment: Payment): ReadableMap {
|
||||
"amountSat" to payment.amountSat,
|
||||
"feesSat" to payment.feesSat,
|
||||
"preimage" to payment.preimage,
|
||||
"refundTxId" to payment.refundTxId,
|
||||
"refundTxAmountSat" to payment.refundTxAmountSat,
|
||||
"paymentType" to payment.paymentType.name.lowercase(),
|
||||
"status" to payment.status.name.lowercase(),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user