feat: add checks for TimedOut payments (#266)

This commit is contained in:
yse
2024-06-06 17:03:01 +02:00
committed by GitHub
parent f8a44ca878
commit 054b8c6d3b
14 changed files with 379 additions and 147 deletions

View File

@@ -192,6 +192,10 @@ typedef struct wire_cst_PaymentError_Generic {
struct wire_cst_list_prim_u_8_strict *err; struct wire_cst_list_prim_u_8_strict *err;
} wire_cst_PaymentError_Generic; } wire_cst_PaymentError_Generic;
typedef struct wire_cst_PaymentError_InvalidInvoice {
struct wire_cst_list_prim_u_8_strict *err;
} wire_cst_PaymentError_InvalidInvoice;
typedef struct wire_cst_PaymentError_LwkError { typedef struct wire_cst_PaymentError_LwkError {
struct wire_cst_list_prim_u_8_strict *err; struct wire_cst_list_prim_u_8_strict *err;
} wire_cst_PaymentError_LwkError; } wire_cst_PaymentError_LwkError;
@@ -211,6 +215,7 @@ typedef struct wire_cst_PaymentError_SignerError {
typedef union PaymentErrorKind { typedef union PaymentErrorKind {
struct wire_cst_PaymentError_Generic Generic; struct wire_cst_PaymentError_Generic Generic;
struct wire_cst_PaymentError_InvalidInvoice InvalidInvoice;
struct wire_cst_PaymentError_LwkError LwkError; struct wire_cst_PaymentError_LwkError LwkError;
struct wire_cst_PaymentError_Refunded Refunded; struct wire_cst_PaymentError_Refunded Refunded;
struct wire_cst_PaymentError_SendError SendError; struct wire_cst_PaymentError_SendError SendError;

View File

@@ -8,6 +8,8 @@ enum LiquidSdkError {
[Error] [Error]
enum PaymentError { enum PaymentError {
"AlreadyClaimed", "AlreadyClaimed",
"AlreadyPaid",
"PaymentInProgress",
"AmountOutOfRange", "AmountOutOfRange",
"Generic", "Generic",
"InvalidOrExpiredFees", "InvalidOrExpiredFees",

View File

@@ -35,6 +35,12 @@ pub enum PaymentError {
#[error("The specified funds have already been claimed")] #[error("The specified funds have already been claimed")]
AlreadyClaimed, AlreadyClaimed,
#[error("The specified funds have already been sent")]
AlreadyPaid,
#[error("The payment is already in progress")]
PaymentInProgress,
#[error("Invoice amount is out of range")] #[error("Invoice amount is out of range")]
AmountOutOfRange, AmountOutOfRange,
@@ -47,8 +53,8 @@ pub enum PaymentError {
#[error("Cannot pay: not enough funds")] #[error("Cannot pay: not enough funds")]
InsufficientFunds, InsufficientFunds,
#[error("The specified invoice is not valid")] #[error("The specified invoice is not valid: {err}")]
InvalidInvoice, InvalidInvoice { err: String },
#[error("The generated preimage is not valid")] #[error("The generated preimage is not valid")]
InvalidPreimage, InvalidPreimage,

View File

@@ -347,40 +347,47 @@ impl CstDecode<crate::error::PaymentError> for wire_cst_payment_error {
fn cst_decode(self) -> crate::error::PaymentError { fn cst_decode(self) -> crate::error::PaymentError {
match self.tag { match self.tag {
0 => crate::error::PaymentError::AlreadyClaimed, 0 => crate::error::PaymentError::AlreadyClaimed,
1 => crate::error::PaymentError::AmountOutOfRange, 1 => crate::error::PaymentError::AlreadyPaid,
2 => { 2 => crate::error::PaymentError::PaymentInProgress,
3 => crate::error::PaymentError::AmountOutOfRange,
4 => {
let ans = unsafe { self.kind.Generic }; let ans = unsafe { self.kind.Generic };
crate::error::PaymentError::Generic { crate::error::PaymentError::Generic {
err: ans.err.cst_decode(), err: ans.err.cst_decode(),
} }
} }
3 => crate::error::PaymentError::InvalidOrExpiredFees, 5 => crate::error::PaymentError::InvalidOrExpiredFees,
4 => crate::error::PaymentError::InsufficientFunds, 6 => crate::error::PaymentError::InsufficientFunds,
5 => crate::error::PaymentError::InvalidInvoice,
6 => crate::error::PaymentError::InvalidPreimage,
7 => { 7 => {
let ans = unsafe { self.kind.InvalidInvoice };
crate::error::PaymentError::InvalidInvoice {
err: ans.err.cst_decode(),
}
}
8 => crate::error::PaymentError::InvalidPreimage,
9 => {
let ans = unsafe { self.kind.LwkError }; let ans = unsafe { self.kind.LwkError };
crate::error::PaymentError::LwkError { crate::error::PaymentError::LwkError {
err: ans.err.cst_decode(), err: ans.err.cst_decode(),
} }
} }
8 => crate::error::PaymentError::PairsNotFound, 10 => crate::error::PaymentError::PairsNotFound,
9 => crate::error::PaymentError::PaymentTimeout, 11 => crate::error::PaymentError::PaymentTimeout,
10 => crate::error::PaymentError::PersistError, 12 => crate::error::PaymentError::PersistError,
11 => { 13 => {
let ans = unsafe { self.kind.Refunded }; let ans = unsafe { self.kind.Refunded };
crate::error::PaymentError::Refunded { crate::error::PaymentError::Refunded {
err: ans.err.cst_decode(), err: ans.err.cst_decode(),
refund_tx_id: ans.refund_tx_id.cst_decode(), refund_tx_id: ans.refund_tx_id.cst_decode(),
} }
} }
12 => { 14 => {
let ans = unsafe { self.kind.SendError }; let ans = unsafe { self.kind.SendError };
crate::error::PaymentError::SendError { crate::error::PaymentError::SendError {
err: ans.err.cst_decode(), err: ans.err.cst_decode(),
} }
} }
13 => { 15 => {
let ans = unsafe { self.kind.SignerError }; let ans = unsafe { self.kind.SignerError };
crate::error::PaymentError::SignerError { crate::error::PaymentError::SignerError {
err: ans.err.cst_decode(), err: ans.err.cst_decode(),
@@ -1194,6 +1201,7 @@ pub struct wire_cst_payment_error {
#[derive(Clone, Copy)] #[derive(Clone, Copy)]
pub union PaymentErrorKind { pub union PaymentErrorKind {
Generic: wire_cst_PaymentError_Generic, Generic: wire_cst_PaymentError_Generic,
InvalidInvoice: wire_cst_PaymentError_InvalidInvoice,
LwkError: wire_cst_PaymentError_LwkError, LwkError: wire_cst_PaymentError_LwkError,
Refunded: wire_cst_PaymentError_Refunded, Refunded: wire_cst_PaymentError_Refunded,
SendError: wire_cst_PaymentError_SendError, SendError: wire_cst_PaymentError_SendError,
@@ -1207,6 +1215,11 @@ pub struct wire_cst_PaymentError_Generic {
} }
#[repr(C)] #[repr(C)]
#[derive(Clone, Copy)] #[derive(Clone, Copy)]
pub struct wire_cst_PaymentError_InvalidInvoice {
err: *mut wire_cst_list_prim_u_8_strict,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct wire_cst_PaymentError_LwkError { pub struct wire_cst_PaymentError_LwkError {
err: *mut wire_cst_list_prim_u_8_strict, err: *mut wire_cst_list_prim_u_8_strict,
} }

View File

@@ -866,38 +866,45 @@ impl SseDecode for crate::error::PaymentError {
return crate::error::PaymentError::AlreadyClaimed; return crate::error::PaymentError::AlreadyClaimed;
} }
1 => { 1 => {
return crate::error::PaymentError::AmountOutOfRange; return crate::error::PaymentError::AlreadyPaid;
} }
2 => { 2 => {
return crate::error::PaymentError::PaymentInProgress;
}
3 => {
return crate::error::PaymentError::AmountOutOfRange;
}
4 => {
let mut var_err = <String>::sse_decode(deserializer); let mut var_err = <String>::sse_decode(deserializer);
return crate::error::PaymentError::Generic { err: var_err }; return crate::error::PaymentError::Generic { err: var_err };
} }
3 => { 5 => {
return crate::error::PaymentError::InvalidOrExpiredFees; return crate::error::PaymentError::InvalidOrExpiredFees;
} }
4 => {
return crate::error::PaymentError::InsufficientFunds;
}
5 => {
return crate::error::PaymentError::InvalidInvoice;
}
6 => { 6 => {
return crate::error::PaymentError::InvalidPreimage; return crate::error::PaymentError::InsufficientFunds;
} }
7 => { 7 => {
let mut var_err = <String>::sse_decode(deserializer); let mut var_err = <String>::sse_decode(deserializer);
return crate::error::PaymentError::LwkError { err: var_err }; return crate::error::PaymentError::InvalidInvoice { err: var_err };
} }
8 => { 8 => {
return crate::error::PaymentError::PairsNotFound; return crate::error::PaymentError::InvalidPreimage;
} }
9 => { 9 => {
return crate::error::PaymentError::PaymentTimeout; let mut var_err = <String>::sse_decode(deserializer);
return crate::error::PaymentError::LwkError { err: var_err };
} }
10 => { 10 => {
return crate::error::PaymentError::PersistError; return crate::error::PaymentError::PairsNotFound;
} }
11 => { 11 => {
return crate::error::PaymentError::PaymentTimeout;
}
12 => {
return crate::error::PaymentError::PersistError;
}
13 => {
let mut var_err = <String>::sse_decode(deserializer); let mut var_err = <String>::sse_decode(deserializer);
let mut var_refundTxId = <String>::sse_decode(deserializer); let mut var_refundTxId = <String>::sse_decode(deserializer);
return crate::error::PaymentError::Refunded { return crate::error::PaymentError::Refunded {
@@ -905,11 +912,11 @@ impl SseDecode for crate::error::PaymentError {
refund_tx_id: var_refundTxId, refund_tx_id: var_refundTxId,
}; };
} }
12 => { 14 => {
let mut var_err = <String>::sse_decode(deserializer); let mut var_err = <String>::sse_decode(deserializer);
return crate::error::PaymentError::SendError { err: var_err }; return crate::error::PaymentError::SendError { err: var_err };
} }
13 => { 15 => {
let mut var_err = <String>::sse_decode(deserializer); let mut var_err = <String>::sse_decode(deserializer);
return crate::error::PaymentError::SignerError { err: var_err }; return crate::error::PaymentError::SignerError { err: var_err };
} }
@@ -1355,31 +1362,35 @@ impl flutter_rust_bridge::IntoDart for crate::error::PaymentError {
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
match self { match self {
crate::error::PaymentError::AlreadyClaimed => [0.into_dart()].into_dart(), crate::error::PaymentError::AlreadyClaimed => [0.into_dart()].into_dart(),
crate::error::PaymentError::AmountOutOfRange => [1.into_dart()].into_dart(), crate::error::PaymentError::AlreadyPaid => [1.into_dart()].into_dart(),
crate::error::PaymentError::PaymentInProgress => [2.into_dart()].into_dart(),
crate::error::PaymentError::AmountOutOfRange => [3.into_dart()].into_dart(),
crate::error::PaymentError::Generic { err } => { crate::error::PaymentError::Generic { err } => {
[2.into_dart(), err.into_into_dart().into_dart()].into_dart() [4.into_dart(), err.into_into_dart().into_dart()].into_dart()
} }
crate::error::PaymentError::InvalidOrExpiredFees => [3.into_dart()].into_dart(), crate::error::PaymentError::InvalidOrExpiredFees => [5.into_dart()].into_dart(),
crate::error::PaymentError::InsufficientFunds => [4.into_dart()].into_dart(), crate::error::PaymentError::InsufficientFunds => [6.into_dart()].into_dart(),
crate::error::PaymentError::InvalidInvoice => [5.into_dart()].into_dart(), crate::error::PaymentError::InvalidInvoice { err } => {
crate::error::PaymentError::InvalidPreimage => [6.into_dart()].into_dart(),
crate::error::PaymentError::LwkError { err } => {
[7.into_dart(), err.into_into_dart().into_dart()].into_dart() [7.into_dart(), err.into_into_dart().into_dart()].into_dart()
} }
crate::error::PaymentError::PairsNotFound => [8.into_dart()].into_dart(), crate::error::PaymentError::InvalidPreimage => [8.into_dart()].into_dart(),
crate::error::PaymentError::PaymentTimeout => [9.into_dart()].into_dart(), crate::error::PaymentError::LwkError { err } => {
crate::error::PaymentError::PersistError => [10.into_dart()].into_dart(), [9.into_dart(), err.into_into_dart().into_dart()].into_dart()
}
crate::error::PaymentError::PairsNotFound => [10.into_dart()].into_dart(),
crate::error::PaymentError::PaymentTimeout => [11.into_dart()].into_dart(),
crate::error::PaymentError::PersistError => [12.into_dart()].into_dart(),
crate::error::PaymentError::Refunded { err, refund_tx_id } => [ crate::error::PaymentError::Refunded { err, refund_tx_id } => [
11.into_dart(), 13.into_dart(),
err.into_into_dart().into_dart(), err.into_into_dart().into_dart(),
refund_tx_id.into_into_dart().into_dart(), refund_tx_id.into_into_dart().into_dart(),
] ]
.into_dart(), .into_dart(),
crate::error::PaymentError::SendError { err } => { crate::error::PaymentError::SendError { err } => {
[12.into_dart(), err.into_into_dart().into_dart()].into_dart() [14.into_dart(), err.into_into_dart().into_dart()].into_dart()
} }
crate::error::PaymentError::SignerError { err } => { crate::error::PaymentError::SignerError { err } => {
[13.into_dart(), err.into_into_dart().into_dart()].into_dart() [15.into_dart(), err.into_into_dart().into_dart()].into_dart()
} }
} }
} }
@@ -1872,49 +1883,56 @@ impl SseEncode for crate::error::PaymentError {
crate::error::PaymentError::AlreadyClaimed => { crate::error::PaymentError::AlreadyClaimed => {
<i32>::sse_encode(0, serializer); <i32>::sse_encode(0, serializer);
} }
crate::error::PaymentError::AmountOutOfRange => { crate::error::PaymentError::AlreadyPaid => {
<i32>::sse_encode(1, serializer); <i32>::sse_encode(1, serializer);
} }
crate::error::PaymentError::Generic { err } => { crate::error::PaymentError::PaymentInProgress => {
<i32>::sse_encode(2, serializer); <i32>::sse_encode(2, serializer);
}
crate::error::PaymentError::AmountOutOfRange => {
<i32>::sse_encode(3, serializer);
}
crate::error::PaymentError::Generic { err } => {
<i32>::sse_encode(4, serializer);
<String>::sse_encode(err, serializer); <String>::sse_encode(err, serializer);
} }
crate::error::PaymentError::InvalidOrExpiredFees => { crate::error::PaymentError::InvalidOrExpiredFees => {
<i32>::sse_encode(3, serializer);
}
crate::error::PaymentError::InsufficientFunds => {
<i32>::sse_encode(4, serializer);
}
crate::error::PaymentError::InvalidInvoice => {
<i32>::sse_encode(5, serializer); <i32>::sse_encode(5, serializer);
} }
crate::error::PaymentError::InvalidPreimage => { crate::error::PaymentError::InsufficientFunds => {
<i32>::sse_encode(6, serializer); <i32>::sse_encode(6, serializer);
} }
crate::error::PaymentError::LwkError { err } => { crate::error::PaymentError::InvalidInvoice { err } => {
<i32>::sse_encode(7, serializer); <i32>::sse_encode(7, serializer);
<String>::sse_encode(err, serializer); <String>::sse_encode(err, serializer);
} }
crate::error::PaymentError::PairsNotFound => { crate::error::PaymentError::InvalidPreimage => {
<i32>::sse_encode(8, serializer); <i32>::sse_encode(8, serializer);
} }
crate::error::PaymentError::PaymentTimeout => { crate::error::PaymentError::LwkError { err } => {
<i32>::sse_encode(9, serializer); <i32>::sse_encode(9, serializer);
<String>::sse_encode(err, serializer);
} }
crate::error::PaymentError::PersistError => { crate::error::PaymentError::PairsNotFound => {
<i32>::sse_encode(10, serializer); <i32>::sse_encode(10, serializer);
} }
crate::error::PaymentError::Refunded { err, refund_tx_id } => { crate::error::PaymentError::PaymentTimeout => {
<i32>::sse_encode(11, serializer); <i32>::sse_encode(11, serializer);
}
crate::error::PaymentError::PersistError => {
<i32>::sse_encode(12, serializer);
}
crate::error::PaymentError::Refunded { err, refund_tx_id } => {
<i32>::sse_encode(13, serializer);
<String>::sse_encode(err, serializer); <String>::sse_encode(err, serializer);
<String>::sse_encode(refund_tx_id, serializer); <String>::sse_encode(refund_tx_id, serializer);
} }
crate::error::PaymentError::SendError { err } => { crate::error::PaymentError::SendError { err } => {
<i32>::sse_encode(12, serializer); <i32>::sse_encode(14, serializer);
<String>::sse_encode(err, serializer); <String>::sse_encode(err, serializer);
} }
crate::error::PaymentError::SignerError { err } => { crate::error::PaymentError::SignerError { err } => {
<i32>::sse_encode(13, serializer); <i32>::sse_encode(15, serializer);
<String>::sse_encode(err, serializer); <String>::sse_encode(err, serializer);
} }
} }

View File

@@ -15,7 +15,7 @@ pub(crate) fn current_migrations() -> Vec<&'static str> {
) STRICT;", ) STRICT;",
"CREATE TABLE IF NOT EXISTS send_swaps ( "CREATE TABLE IF NOT EXISTS send_swaps (
id TEXT NOT NULL PRIMARY KEY, id TEXT NOT NULL PRIMARY KEY,
invoice TEXT NOT NULL, invoice TEXT NOT NULL UNIQUE,
preimage TEXT, preimage TEXT,
payer_amount_sat INTEGER NOT NULL, payer_amount_sat INTEGER NOT NULL,
receiver_amount_sat INTEGER NOT NULL, receiver_amount_sat INTEGER NOT NULL,

View File

@@ -456,18 +456,28 @@ impl LiquidSdk {
} }
fn validate_invoice(&self, invoice: &str) -> Result<Bolt11Invoice, PaymentError> { fn validate_invoice(&self, invoice: &str) -> Result<Bolt11Invoice, PaymentError> {
let invoice = invoice let invoice = invoice.trim().parse::<Bolt11Invoice>().map_err(|err| {
.trim() PaymentError::InvalidInvoice {
.parse::<Bolt11Invoice>() err: err.to_string(),
.map_err(|_| PaymentError::InvalidInvoice)?; }
})?;
match (invoice.network().to_string().as_str(), self.config.network) { match (invoice.network().to_string().as_str(), self.config.network) {
("bitcoin", Network::Mainnet) => {} ("bitcoin", Network::Mainnet) => {}
("testnet", Network::Testnet) => {} ("testnet", Network::Testnet) => {}
_ => return Err(PaymentError::InvalidInvoice), _ => {
return Err(PaymentError::InvalidInvoice {
err: "Invoice cannot be paid on the current network".to_string(),
})
}
} }
ensure_sdk!(!invoice.is_expired(), PaymentError::InvalidInvoice); ensure_sdk!(
!invoice.is_expired(),
PaymentError::InvalidInvoice {
err: "Invoice has expired".to_string()
}
);
Ok(invoice) Ok(invoice)
} }
@@ -607,7 +617,17 @@ impl LiquidSdk {
); );
let swap = match self.persister.fetch_send_swap_by_invoice(&req.invoice)? { let swap = match self.persister.fetch_send_swap_by_invoice(&req.invoice)? {
Some(swap) => swap, Some(swap) => match swap.state {
Pending => return Err(PaymentError::PaymentInProgress),
Complete => return Err(PaymentError::AlreadyPaid),
Failed => {
return Err(PaymentError::InvalidInvoice {
err: "Payment has already failed. Please try with another invoice."
.to_string(),
})
}
_ => swap,
},
None => { None => {
let keypair = utils::generate_keypair(); let keypair = utils::generate_keypair();
let refund_public_key = boltz_client::PublicKey { let refund_public_key = boltz_client::PublicKey {
@@ -774,17 +794,25 @@ impl LiquidSdk {
let create_response = self.swapper.create_receive_swap(v2_req)?; let create_response = self.swapper.create_receive_swap(v2_req)?;
let swap_id = create_response.id.clone(); let swap_id = create_response.id.clone();
let invoice = Bolt11Invoice::from_str(&create_response.invoice) let invoice = Bolt11Invoice::from_str(&create_response.invoice).map_err(|err| {
.map_err(|_| PaymentError::InvalidInvoice)?; PaymentError::InvalidInvoice {
let payer_amount_sat = invoice err: err.to_string(),
.amount_milli_satoshis() }
.ok_or(PaymentError::InvalidInvoice)? })?;
/ 1000; let payer_amount_sat =
invoice
.amount_milli_satoshis()
.ok_or(PaymentError::InvalidInvoice {
err: "Invoice does not contain an amount".to_string(),
})?
/ 1000;
// Double check that the generated invoice includes our data // Double check that the generated invoice includes our data
// https://docs.boltz.exchange/v/api/dont-trust-verify#lightning-invoice-verification // https://docs.boltz.exchange/v/api/dont-trust-verify#lightning-invoice-verification
if invoice.payment_hash().to_string() != preimage_hash { if invoice.payment_hash().to_string() != preimage_hash {
return Err(PaymentError::InvalidInvoice); return Err(PaymentError::InvalidInvoice {
err: "Invalid preimage returned by swapper".to_string(),
});
}; };
let create_response_json = ReceiveSwap::from_boltz_struct_to_json( let create_response_json = ReceiveSwap::from_boltz_struct_to_json(
@@ -929,7 +957,10 @@ impl LiquidSdk {
.strip_prefix("lightning:") .strip_prefix("lightning:")
.or(input.strip_prefix("LIGHTNING:")) .or(input.strip_prefix("LIGHTNING:"))
.unwrap_or(input); .unwrap_or(input);
let invoice = Bolt11Invoice::from_str(input).map_err(|_| PaymentError::InvalidInvoice)?; let invoice =
Bolt11Invoice::from_str(input).map_err(|err| PaymentError::InvalidInvoice {
err: err.to_string(),
})?;
// Try to take payee pubkey from the tagged fields, if doesn't exist recover it from the signature // Try to take payee pubkey from the tagged fields, if doesn't exist recover it from the signature
let payee_pubkey: String = match invoice.payee_pub_key() { let payee_pubkey: String = match invoice.payee_pub_key() {
@@ -947,7 +978,9 @@ impl LiquidSdk {
let timestamp = invoice let timestamp = invoice
.timestamp() .timestamp()
.duration_since(UNIX_EPOCH) .duration_since(UNIX_EPOCH)
.map_err(|_| PaymentError::InvalidInvoice)? .map_err(|err| PaymentError::InvalidInvoice {
err: err.to_string(),
})?
.as_secs(); .as_secs();
let routing_hints = invoice let routing_hints = invoice
.route_hints() .route_hints()

View File

@@ -398,7 +398,7 @@ impl SendSwapStateHandler {
err: format!("Cannot transition from {from_state:?} to Complete state"), err: format!("Cannot transition from {from_state:?} to Complete state"),
}), }),
(Created, TimedOut) => Ok(()), (Created | TimedOut, TimedOut) => Ok(()),
(_, TimedOut) => Err(PaymentError::Generic { (_, TimedOut) => Err(PaymentError::Generic {
err: format!("Cannot transition from {from_state:?} to TimedOut state"), err: format!("Cannot transition from {from_state:?} to TimedOut state"),
}), }),
@@ -410,7 +410,10 @@ impl SendSwapStateHandler {
fn verify_payment_hash(preimage: &str, invoice: &str) -> Result<(), PaymentError> { fn verify_payment_hash(preimage: &str, invoice: &str) -> Result<(), PaymentError> {
let preimage = Preimage::from_str(preimage)?; let preimage = Preimage::from_str(preimage)?;
let preimage_hash = preimage.sha256.to_string(); let preimage_hash = preimage.sha256.to_string();
let invoice = Bolt11Invoice::from_str(invoice).map_err(|_| PaymentError::InvalidInvoice)?; let invoice =
Bolt11Invoice::from_str(invoice).map_err(|err| PaymentError::InvalidInvoice {
err: err.to_string(),
})?;
let invoice_payment_hash = invoice.payment_hash(); let invoice_payment_hash = invoice.payment_hash();
(invoice_payment_hash.to_string() == preimage_hash) (invoice_payment_hash.to_string() == preimage_hash)

View File

@@ -24,13 +24,17 @@ sealed class PaymentError with _$PaymentError implements FrbException {
const PaymentError._(); const PaymentError._();
const factory PaymentError.alreadyClaimed() = PaymentError_AlreadyClaimed; const factory PaymentError.alreadyClaimed() = PaymentError_AlreadyClaimed;
const factory PaymentError.alreadyPaid() = PaymentError_AlreadyPaid;
const factory PaymentError.paymentInProgress() = PaymentError_PaymentInProgress;
const factory PaymentError.amountOutOfRange() = PaymentError_AmountOutOfRange; const factory PaymentError.amountOutOfRange() = PaymentError_AmountOutOfRange;
const factory PaymentError.generic({ const factory PaymentError.generic({
required String err, required String err,
}) = PaymentError_Generic; }) = PaymentError_Generic;
const factory PaymentError.invalidOrExpiredFees() = PaymentError_InvalidOrExpiredFees; const factory PaymentError.invalidOrExpiredFees() = PaymentError_InvalidOrExpiredFees;
const factory PaymentError.insufficientFunds() = PaymentError_InsufficientFunds; const factory PaymentError.insufficientFunds() = PaymentError_InsufficientFunds;
const factory PaymentError.invalidInvoice() = PaymentError_InvalidInvoice; const factory PaymentError.invalidInvoice({
required String err,
}) = PaymentError_InvalidInvoice;
const factory PaymentError.invalidPreimage() = PaymentError_InvalidPreimage; const factory PaymentError.invalidPreimage() = PaymentError_InvalidPreimage;
const factory PaymentError.lwkError({ const factory PaymentError.lwkError({
required String err, required String err,

View File

@@ -248,6 +248,88 @@ abstract class PaymentError_AlreadyClaimed extends PaymentError {
const PaymentError_AlreadyClaimed._() : super._(); const PaymentError_AlreadyClaimed._() : super._();
} }
/// @nodoc
abstract class _$$PaymentError_AlreadyPaidImplCopyWith<$Res> {
factory _$$PaymentError_AlreadyPaidImplCopyWith(
_$PaymentError_AlreadyPaidImpl value, $Res Function(_$PaymentError_AlreadyPaidImpl) then) =
__$$PaymentError_AlreadyPaidImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$PaymentError_AlreadyPaidImplCopyWithImpl<$Res>
extends _$PaymentErrorCopyWithImpl<$Res, _$PaymentError_AlreadyPaidImpl>
implements _$$PaymentError_AlreadyPaidImplCopyWith<$Res> {
__$$PaymentError_AlreadyPaidImplCopyWithImpl(
_$PaymentError_AlreadyPaidImpl _value, $Res Function(_$PaymentError_AlreadyPaidImpl) _then)
: super(_value, _then);
}
/// @nodoc
class _$PaymentError_AlreadyPaidImpl extends PaymentError_AlreadyPaid {
const _$PaymentError_AlreadyPaidImpl() : super._();
@override
String toString() {
return 'PaymentError.alreadyPaid()';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is _$PaymentError_AlreadyPaidImpl);
}
@override
int get hashCode => runtimeType.hashCode;
}
abstract class PaymentError_AlreadyPaid extends PaymentError {
const factory PaymentError_AlreadyPaid() = _$PaymentError_AlreadyPaidImpl;
const PaymentError_AlreadyPaid._() : super._();
}
/// @nodoc
abstract class _$$PaymentError_PaymentInProgressImplCopyWith<$Res> {
factory _$$PaymentError_PaymentInProgressImplCopyWith(_$PaymentError_PaymentInProgressImpl value,
$Res Function(_$PaymentError_PaymentInProgressImpl) then) =
__$$PaymentError_PaymentInProgressImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$PaymentError_PaymentInProgressImplCopyWithImpl<$Res>
extends _$PaymentErrorCopyWithImpl<$Res, _$PaymentError_PaymentInProgressImpl>
implements _$$PaymentError_PaymentInProgressImplCopyWith<$Res> {
__$$PaymentError_PaymentInProgressImplCopyWithImpl(
_$PaymentError_PaymentInProgressImpl _value, $Res Function(_$PaymentError_PaymentInProgressImpl) _then)
: super(_value, _then);
}
/// @nodoc
class _$PaymentError_PaymentInProgressImpl extends PaymentError_PaymentInProgress {
const _$PaymentError_PaymentInProgressImpl() : super._();
@override
String toString() {
return 'PaymentError.paymentInProgress()';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is _$PaymentError_PaymentInProgressImpl);
}
@override
int get hashCode => runtimeType.hashCode;
}
abstract class PaymentError_PaymentInProgress extends PaymentError {
const factory PaymentError_PaymentInProgress() = _$PaymentError_PaymentInProgressImpl;
const PaymentError_PaymentInProgress._() : super._();
}
/// @nodoc /// @nodoc
abstract class _$$PaymentError_AmountOutOfRangeImplCopyWith<$Res> { abstract class _$$PaymentError_AmountOutOfRangeImplCopyWith<$Res> {
factory _$$PaymentError_AmountOutOfRangeImplCopyWith(_$PaymentError_AmountOutOfRangeImpl value, factory _$$PaymentError_AmountOutOfRangeImplCopyWith(_$PaymentError_AmountOutOfRangeImpl value,
@@ -448,6 +530,8 @@ abstract class _$$PaymentError_InvalidInvoiceImplCopyWith<$Res> {
factory _$$PaymentError_InvalidInvoiceImplCopyWith( factory _$$PaymentError_InvalidInvoiceImplCopyWith(
_$PaymentError_InvalidInvoiceImpl value, $Res Function(_$PaymentError_InvalidInvoiceImpl) then) = _$PaymentError_InvalidInvoiceImpl value, $Res Function(_$PaymentError_InvalidInvoiceImpl) then) =
__$$PaymentError_InvalidInvoiceImplCopyWithImpl<$Res>; __$$PaymentError_InvalidInvoiceImplCopyWithImpl<$Res>;
@useResult
$Res call({String err});
} }
/// @nodoc /// @nodoc
@@ -457,31 +541,60 @@ class __$$PaymentError_InvalidInvoiceImplCopyWithImpl<$Res>
__$$PaymentError_InvalidInvoiceImplCopyWithImpl( __$$PaymentError_InvalidInvoiceImplCopyWithImpl(
_$PaymentError_InvalidInvoiceImpl _value, $Res Function(_$PaymentError_InvalidInvoiceImpl) _then) _$PaymentError_InvalidInvoiceImpl _value, $Res Function(_$PaymentError_InvalidInvoiceImpl) _then)
: super(_value, _then); : super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? err = null,
}) {
return _then(_$PaymentError_InvalidInvoiceImpl(
err: null == err
? _value.err
: err // ignore: cast_nullable_to_non_nullable
as String,
));
}
} }
/// @nodoc /// @nodoc
class _$PaymentError_InvalidInvoiceImpl extends PaymentError_InvalidInvoice { class _$PaymentError_InvalidInvoiceImpl extends PaymentError_InvalidInvoice {
const _$PaymentError_InvalidInvoiceImpl() : super._(); const _$PaymentError_InvalidInvoiceImpl({required this.err}) : super._();
@override
final String err;
@override @override
String toString() { String toString() {
return 'PaymentError.invalidInvoice()'; return 'PaymentError.invalidInvoice(err: $err)';
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) ||
(other.runtimeType == runtimeType && other is _$PaymentError_InvalidInvoiceImpl); (other.runtimeType == runtimeType &&
other is _$PaymentError_InvalidInvoiceImpl &&
(identical(other.err, err) || other.err == err));
} }
@override @override
int get hashCode => runtimeType.hashCode; int get hashCode => Object.hash(runtimeType, err);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$PaymentError_InvalidInvoiceImplCopyWith<_$PaymentError_InvalidInvoiceImpl> get copyWith =>
__$$PaymentError_InvalidInvoiceImplCopyWithImpl<_$PaymentError_InvalidInvoiceImpl>(this, _$identity);
} }
abstract class PaymentError_InvalidInvoice extends PaymentError { abstract class PaymentError_InvalidInvoice extends PaymentError {
const factory PaymentError_InvalidInvoice() = _$PaymentError_InvalidInvoiceImpl; const factory PaymentError_InvalidInvoice({required final String err}) = _$PaymentError_InvalidInvoiceImpl;
const PaymentError_InvalidInvoice._() : super._(); const PaymentError_InvalidInvoice._() : super._();
String get err;
@JsonKey(ignore: true)
_$$PaymentError_InvalidInvoiceImplCopyWith<_$PaymentError_InvalidInvoiceImpl> get copyWith =>
throw _privateConstructorUsedError;
} }
/// @nodoc /// @nodoc

View File

@@ -868,39 +868,45 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
case 0: case 0:
return PaymentError_AlreadyClaimed(); return PaymentError_AlreadyClaimed();
case 1: case 1:
return PaymentError_AmountOutOfRange(); return PaymentError_AlreadyPaid();
case 2: case 2:
return PaymentError_PaymentInProgress();
case 3:
return PaymentError_AmountOutOfRange();
case 4:
return PaymentError_Generic( return PaymentError_Generic(
err: dco_decode_String(raw[1]), err: dco_decode_String(raw[1]),
); );
case 3:
return PaymentError_InvalidOrExpiredFees();
case 4:
return PaymentError_InsufficientFunds();
case 5: case 5:
return PaymentError_InvalidInvoice(); return PaymentError_InvalidOrExpiredFees();
case 6: case 6:
return PaymentError_InvalidPreimage(); return PaymentError_InsufficientFunds();
case 7: case 7:
return PaymentError_LwkError( return PaymentError_InvalidInvoice(
err: dco_decode_String(raw[1]), err: dco_decode_String(raw[1]),
); );
case 8: case 8:
return PaymentError_PairsNotFound(); return PaymentError_InvalidPreimage();
case 9: case 9:
return PaymentError_PaymentTimeout(); return PaymentError_LwkError(
err: dco_decode_String(raw[1]),
);
case 10: case 10:
return PaymentError_PersistError(); return PaymentError_PairsNotFound();
case 11: case 11:
return PaymentError_PaymentTimeout();
case 12:
return PaymentError_PersistError();
case 13:
return PaymentError_Refunded( return PaymentError_Refunded(
err: dco_decode_String(raw[1]), err: dco_decode_String(raw[1]),
refundTxId: dco_decode_String(raw[2]), refundTxId: dco_decode_String(raw[2]),
); );
case 12: case 14:
return PaymentError_SendError( return PaymentError_SendError(
err: dco_decode_String(raw[1]), err: dco_decode_String(raw[1]),
); );
case 13: case 15:
return PaymentError_SignerError( return PaymentError_SignerError(
err: dco_decode_String(raw[1]), err: dco_decode_String(raw[1]),
); );
@@ -1417,35 +1423,40 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
case 0: case 0:
return PaymentError_AlreadyClaimed(); return PaymentError_AlreadyClaimed();
case 1: case 1:
return PaymentError_AmountOutOfRange(); return PaymentError_AlreadyPaid();
case 2: case 2:
return PaymentError_PaymentInProgress();
case 3:
return PaymentError_AmountOutOfRange();
case 4:
var var_err = sse_decode_String(deserializer); var var_err = sse_decode_String(deserializer);
return PaymentError_Generic(err: var_err); return PaymentError_Generic(err: var_err);
case 3:
return PaymentError_InvalidOrExpiredFees();
case 4:
return PaymentError_InsufficientFunds();
case 5: case 5:
return PaymentError_InvalidInvoice(); return PaymentError_InvalidOrExpiredFees();
case 6: case 6:
return PaymentError_InvalidPreimage(); return PaymentError_InsufficientFunds();
case 7: case 7:
var var_err = sse_decode_String(deserializer); var var_err = sse_decode_String(deserializer);
return PaymentError_LwkError(err: var_err); return PaymentError_InvalidInvoice(err: var_err);
case 8: case 8:
return PaymentError_PairsNotFound(); return PaymentError_InvalidPreimage();
case 9: case 9:
return PaymentError_PaymentTimeout(); var var_err = sse_decode_String(deserializer);
return PaymentError_LwkError(err: var_err);
case 10: case 10:
return PaymentError_PersistError(); return PaymentError_PairsNotFound();
case 11: case 11:
return PaymentError_PaymentTimeout();
case 12:
return PaymentError_PersistError();
case 13:
var var_err = sse_decode_String(deserializer); var var_err = sse_decode_String(deserializer);
var var_refundTxId = sse_decode_String(deserializer); var var_refundTxId = sse_decode_String(deserializer);
return PaymentError_Refunded(err: var_err, refundTxId: var_refundTxId); return PaymentError_Refunded(err: var_err, refundTxId: var_refundTxId);
case 12: case 14:
var var_err = sse_decode_String(deserializer); var var_err = sse_decode_String(deserializer);
return PaymentError_SendError(err: var_err); return PaymentError_SendError(err: var_err);
case 13: case 15:
var var_err = sse_decode_String(deserializer); var var_err = sse_decode_String(deserializer);
return PaymentError_SignerError(err: var_err); return PaymentError_SignerError(err: var_err);
default: default:
@@ -1956,37 +1967,42 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
switch (self) { switch (self) {
case PaymentError_AlreadyClaimed(): case PaymentError_AlreadyClaimed():
sse_encode_i_32(0, serializer); sse_encode_i_32(0, serializer);
case PaymentError_AmountOutOfRange(): case PaymentError_AlreadyPaid():
sse_encode_i_32(1, serializer); sse_encode_i_32(1, serializer);
case PaymentError_Generic(err: final err): case PaymentError_PaymentInProgress():
sse_encode_i_32(2, serializer); sse_encode_i_32(2, serializer);
case PaymentError_AmountOutOfRange():
sse_encode_i_32(3, serializer);
case PaymentError_Generic(err: final err):
sse_encode_i_32(4, serializer);
sse_encode_String(err, serializer); sse_encode_String(err, serializer);
case PaymentError_InvalidOrExpiredFees(): case PaymentError_InvalidOrExpiredFees():
sse_encode_i_32(3, serializer);
case PaymentError_InsufficientFunds():
sse_encode_i_32(4, serializer);
case PaymentError_InvalidInvoice():
sse_encode_i_32(5, serializer); sse_encode_i_32(5, serializer);
case PaymentError_InvalidPreimage(): case PaymentError_InsufficientFunds():
sse_encode_i_32(6, serializer); sse_encode_i_32(6, serializer);
case PaymentError_LwkError(err: final err): case PaymentError_InvalidInvoice(err: final err):
sse_encode_i_32(7, serializer); sse_encode_i_32(7, serializer);
sse_encode_String(err, serializer); sse_encode_String(err, serializer);
case PaymentError_PairsNotFound(): case PaymentError_InvalidPreimage():
sse_encode_i_32(8, serializer); sse_encode_i_32(8, serializer);
case PaymentError_PaymentTimeout(): case PaymentError_LwkError(err: final err):
sse_encode_i_32(9, serializer); sse_encode_i_32(9, serializer);
case PaymentError_PersistError(): sse_encode_String(err, serializer);
case PaymentError_PairsNotFound():
sse_encode_i_32(10, serializer); sse_encode_i_32(10, serializer);
case PaymentError_Refunded(err: final err, refundTxId: final refundTxId): case PaymentError_PaymentTimeout():
sse_encode_i_32(11, serializer); sse_encode_i_32(11, serializer);
case PaymentError_PersistError():
sse_encode_i_32(12, serializer);
case PaymentError_Refunded(err: final err, refundTxId: final refundTxId):
sse_encode_i_32(13, serializer);
sse_encode_String(err, serializer); sse_encode_String(err, serializer);
sse_encode_String(refundTxId, serializer); sse_encode_String(refundTxId, serializer);
case PaymentError_SendError(err: final err): case PaymentError_SendError(err: final err):
sse_encode_i_32(12, serializer); sse_encode_i_32(14, serializer);
sse_encode_String(err, serializer); sse_encode_String(err, serializer);
case PaymentError_SignerError(err: final err): case PaymentError_SignerError(err: final err):
sse_encode_i_32(13, serializer); sse_encode_i_32(15, serializer);
sse_encode_String(err, serializer); sse_encode_String(err, serializer);
} }
} }

View File

@@ -713,67 +713,77 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
wireObj.tag = 0; wireObj.tag = 0;
return; return;
} }
if (apiObj is PaymentError_AmountOutOfRange) { if (apiObj is PaymentError_AlreadyPaid) {
wireObj.tag = 1; wireObj.tag = 1;
return; return;
} }
if (apiObj is PaymentError_PaymentInProgress) {
wireObj.tag = 2;
return;
}
if (apiObj is PaymentError_AmountOutOfRange) {
wireObj.tag = 3;
return;
}
if (apiObj is PaymentError_Generic) { if (apiObj is PaymentError_Generic) {
var pre_err = cst_encode_String(apiObj.err); var pre_err = cst_encode_String(apiObj.err);
wireObj.tag = 2; wireObj.tag = 4;
wireObj.kind.Generic.err = pre_err; wireObj.kind.Generic.err = pre_err;
return; return;
} }
if (apiObj is PaymentError_InvalidOrExpiredFees) { if (apiObj is PaymentError_InvalidOrExpiredFees) {
wireObj.tag = 3;
return;
}
if (apiObj is PaymentError_InsufficientFunds) {
wireObj.tag = 4;
return;
}
if (apiObj is PaymentError_InvalidInvoice) {
wireObj.tag = 5; wireObj.tag = 5;
return; return;
} }
if (apiObj is PaymentError_InvalidPreimage) { if (apiObj is PaymentError_InsufficientFunds) {
wireObj.tag = 6; wireObj.tag = 6;
return; return;
} }
if (apiObj is PaymentError_InvalidInvoice) {
var pre_err = cst_encode_String(apiObj.err);
wireObj.tag = 7;
wireObj.kind.InvalidInvoice.err = pre_err;
return;
}
if (apiObj is PaymentError_InvalidPreimage) {
wireObj.tag = 8;
return;
}
if (apiObj is PaymentError_LwkError) { if (apiObj is PaymentError_LwkError) {
var pre_err = cst_encode_String(apiObj.err); var pre_err = cst_encode_String(apiObj.err);
wireObj.tag = 7; wireObj.tag = 9;
wireObj.kind.LwkError.err = pre_err; wireObj.kind.LwkError.err = pre_err;
return; return;
} }
if (apiObj is PaymentError_PairsNotFound) { if (apiObj is PaymentError_PairsNotFound) {
wireObj.tag = 8; wireObj.tag = 10;
return; return;
} }
if (apiObj is PaymentError_PaymentTimeout) { if (apiObj is PaymentError_PaymentTimeout) {
wireObj.tag = 9; wireObj.tag = 11;
return; return;
} }
if (apiObj is PaymentError_PersistError) { if (apiObj is PaymentError_PersistError) {
wireObj.tag = 10; wireObj.tag = 12;
return; return;
} }
if (apiObj is PaymentError_Refunded) { if (apiObj is PaymentError_Refunded) {
var pre_err = cst_encode_String(apiObj.err); var pre_err = cst_encode_String(apiObj.err);
var pre_refund_tx_id = cst_encode_String(apiObj.refundTxId); var pre_refund_tx_id = cst_encode_String(apiObj.refundTxId);
wireObj.tag = 11; wireObj.tag = 13;
wireObj.kind.Refunded.err = pre_err; wireObj.kind.Refunded.err = pre_err;
wireObj.kind.Refunded.refund_tx_id = pre_refund_tx_id; wireObj.kind.Refunded.refund_tx_id = pre_refund_tx_id;
return; return;
} }
if (apiObj is PaymentError_SendError) { if (apiObj is PaymentError_SendError) {
var pre_err = cst_encode_String(apiObj.err); var pre_err = cst_encode_String(apiObj.err);
wireObj.tag = 12; wireObj.tag = 14;
wireObj.kind.SendError.err = pre_err; wireObj.kind.SendError.err = pre_err;
return; return;
} }
if (apiObj is PaymentError_SignerError) { if (apiObj is PaymentError_SignerError) {
var pre_err = cst_encode_String(apiObj.err); var pre_err = cst_encode_String(apiObj.err);
wireObj.tag = 13; wireObj.tag = 15;
wireObj.kind.SignerError.err = pre_err; wireObj.kind.SignerError.err = pre_err;
return; return;
} }
@@ -1555,12 +1565,9 @@ class RustLibWire implements BaseWire {
_dummy_method_to_enforce_bundlingPtr.asFunction<int Function()>(); _dummy_method_to_enforce_bundlingPtr.asFunction<int Function()>();
} }
typedef DartPostCObjectFnType = ffi.Pointer<ffi.NativeFunction<DartPostCObjectFnTypeFunction>>; typedef DartPostCObjectFnType
typedef DartPostCObjectFnTypeFunction = ffi.Bool Function(DartPort port_id, ffi.Pointer<ffi.Void> message); = ffi.Pointer<ffi.NativeFunction<ffi.Bool Function(DartPort port_id, ffi.Pointer<ffi.Void> message)>>;
typedef DartDartPostCObjectFnTypeFunction = bool Function(
DartDartPort port_id, ffi.Pointer<ffi.Void> message);
typedef DartPort = ffi.Int64; typedef DartPort = ffi.Int64;
typedef DartDartPort = int;
final class wire_cst_list_prim_u_8_strict extends ffi.Struct { final class wire_cst_list_prim_u_8_strict extends ffi.Struct {
external ffi.Pointer<ffi.Uint8> ptr; external ffi.Pointer<ffi.Uint8> ptr;
@@ -1810,6 +1817,10 @@ final class wire_cst_PaymentError_Generic extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> err; external ffi.Pointer<wire_cst_list_prim_u_8_strict> err;
} }
final class wire_cst_PaymentError_InvalidInvoice extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> err;
}
final class wire_cst_PaymentError_LwkError extends ffi.Struct { final class wire_cst_PaymentError_LwkError extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> err; external ffi.Pointer<wire_cst_list_prim_u_8_strict> err;
} }
@@ -1831,6 +1842,8 @@ final class wire_cst_PaymentError_SignerError extends ffi.Struct {
final class PaymentErrorKind extends ffi.Union { final class PaymentErrorKind extends ffi.Union {
external wire_cst_PaymentError_Generic Generic; external wire_cst_PaymentError_Generic Generic;
external wire_cst_PaymentError_InvalidInvoice InvalidInvoice;
external wire_cst_PaymentError_LwkError LwkError; external wire_cst_PaymentError_LwkError LwkError;
external wire_cst_PaymentError_Refunded Refunded; external wire_cst_PaymentError_Refunded Refunded;

View File

@@ -23,6 +23,6 @@ dev_dependencies:
test: ^1.25.5 test: ^1.25.5
dependencies: dependencies:
ffi: ^2.1.2 ffi: ^2.1.2
flutter_rust_bridge: ^2.0.0-dev.36 flutter_rust_bridge: 2.0.0-dev.36
freezed_annotation: ^2.4.1 freezed_annotation: ^2.4.1
meta: ^1.12.0 # meta is pinned to version 1.12.0 by integration_test from the flutter SDK. meta: ^1.12.0 # meta is pinned to version 1.12.0 by integration_test from the flutter SDK.

View File

@@ -806,6 +806,10 @@ final class wire_cst_PaymentError_Generic extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> err; external ffi.Pointer<wire_cst_list_prim_u_8_strict> err;
} }
final class wire_cst_PaymentError_InvalidInvoice extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> err;
}
final class wire_cst_PaymentError_LwkError extends ffi.Struct { final class wire_cst_PaymentError_LwkError extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> err; external ffi.Pointer<wire_cst_list_prim_u_8_strict> err;
} }
@@ -827,6 +831,8 @@ final class wire_cst_PaymentError_SignerError extends ffi.Struct {
final class PaymentErrorKind extends ffi.Union { final class PaymentErrorKind extends ffi.Union {
external wire_cst_PaymentError_Generic Generic; external wire_cst_PaymentError_Generic Generic;
external wire_cst_PaymentError_InvalidInvoice InvalidInvoice;
external wire_cst_PaymentError_LwkError LwkError; external wire_cst_PaymentError_LwkError LwkError;
external wire_cst_PaymentError_Refunded Refunded; external wire_cst_PaymentError_Refunded Refunded;