mirror of
https://github.com/aljazceru/breez-sdk-liquid.git
synced 2025-12-23 00:44:26 +01:00
feat: add checks for TimedOut payments (#266)
This commit is contained in:
@@ -713,67 +713,77 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
||||
wireObj.tag = 0;
|
||||
return;
|
||||
}
|
||||
if (apiObj is PaymentError_AmountOutOfRange) {
|
||||
if (apiObj is PaymentError_AlreadyPaid) {
|
||||
wireObj.tag = 1;
|
||||
return;
|
||||
}
|
||||
if (apiObj is PaymentError_PaymentInProgress) {
|
||||
wireObj.tag = 2;
|
||||
return;
|
||||
}
|
||||
if (apiObj is PaymentError_AmountOutOfRange) {
|
||||
wireObj.tag = 3;
|
||||
return;
|
||||
}
|
||||
if (apiObj is PaymentError_Generic) {
|
||||
var pre_err = cst_encode_String(apiObj.err);
|
||||
wireObj.tag = 2;
|
||||
wireObj.tag = 4;
|
||||
wireObj.kind.Generic.err = pre_err;
|
||||
return;
|
||||
}
|
||||
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;
|
||||
return;
|
||||
}
|
||||
if (apiObj is PaymentError_InvalidPreimage) {
|
||||
if (apiObj is PaymentError_InsufficientFunds) {
|
||||
wireObj.tag = 6;
|
||||
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) {
|
||||
var pre_err = cst_encode_String(apiObj.err);
|
||||
wireObj.tag = 7;
|
||||
wireObj.tag = 9;
|
||||
wireObj.kind.LwkError.err = pre_err;
|
||||
return;
|
||||
}
|
||||
if (apiObj is PaymentError_PairsNotFound) {
|
||||
wireObj.tag = 8;
|
||||
wireObj.tag = 10;
|
||||
return;
|
||||
}
|
||||
if (apiObj is PaymentError_PaymentTimeout) {
|
||||
wireObj.tag = 9;
|
||||
wireObj.tag = 11;
|
||||
return;
|
||||
}
|
||||
if (apiObj is PaymentError_PersistError) {
|
||||
wireObj.tag = 10;
|
||||
wireObj.tag = 12;
|
||||
return;
|
||||
}
|
||||
if (apiObj is PaymentError_Refunded) {
|
||||
var pre_err = cst_encode_String(apiObj.err);
|
||||
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.refund_tx_id = pre_refund_tx_id;
|
||||
return;
|
||||
}
|
||||
if (apiObj is PaymentError_SendError) {
|
||||
var pre_err = cst_encode_String(apiObj.err);
|
||||
wireObj.tag = 12;
|
||||
wireObj.tag = 14;
|
||||
wireObj.kind.SendError.err = pre_err;
|
||||
return;
|
||||
}
|
||||
if (apiObj is PaymentError_SignerError) {
|
||||
var pre_err = cst_encode_String(apiObj.err);
|
||||
wireObj.tag = 13;
|
||||
wireObj.tag = 15;
|
||||
wireObj.kind.SignerError.err = pre_err;
|
||||
return;
|
||||
}
|
||||
@@ -1555,12 +1565,9 @@ class RustLibWire implements BaseWire {
|
||||
_dummy_method_to_enforce_bundlingPtr.asFunction<int Function()>();
|
||||
}
|
||||
|
||||
typedef DartPostCObjectFnType = ffi.Pointer<ffi.NativeFunction<DartPostCObjectFnTypeFunction>>;
|
||||
typedef DartPostCObjectFnTypeFunction = ffi.Bool Function(DartPort port_id, ffi.Pointer<ffi.Void> message);
|
||||
typedef DartDartPostCObjectFnTypeFunction = bool Function(
|
||||
DartDartPort port_id, ffi.Pointer<ffi.Void> message);
|
||||
typedef DartPostCObjectFnType
|
||||
= ffi.Pointer<ffi.NativeFunction<ffi.Bool Function(DartPort port_id, ffi.Pointer<ffi.Void> message)>>;
|
||||
typedef DartPort = ffi.Int64;
|
||||
typedef DartDartPort = int;
|
||||
|
||||
final class wire_cst_list_prim_u_8_strict extends ffi.Struct {
|
||||
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;
|
||||
}
|
||||
|
||||
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 {
|
||||
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 {
|
||||
external wire_cst_PaymentError_Generic Generic;
|
||||
|
||||
external wire_cst_PaymentError_InvalidInvoice InvalidInvoice;
|
||||
|
||||
external wire_cst_PaymentError_LwkError LwkError;
|
||||
|
||||
external wire_cst_PaymentError_Refunded Refunded;
|
||||
|
||||
Reference in New Issue
Block a user