Skip to content

Commit 3dce03d

Browse files
Merge pull request #53 from kumulynja/payment-timestamp
add latestUpdateTimestamp to PaymentDetails
2 parents a63db29 + 38c89a0 commit 3dce03d

File tree

8 files changed

+31
-2252
lines changed

8 files changed

+31
-2252
lines changed

ios/Classes/frb_generated.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,7 @@ typedef struct wire_cst_payment_details {
482482
uint64_t *amount_msat;
483483
int32_t direction;
484484
int32_t status;
485+
uint64_t latest_update_timestamp;
485486
} wire_cst_payment_details;
486487

487488
typedef struct wire_cst_channel_details {

lib/src/generated/api/types.dart

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,12 +1259,16 @@ class PaymentDetails {
12591259
/// The status of the payment.
12601260
final PaymentStatus status;
12611261

1262+
/// The timestamp, in seconds since start of the UNIX epoch, when this entry was last updated.
1263+
final BigInt latestUpdateTimestamp;
1264+
12621265
const PaymentDetails({
12631266
required this.id,
12641267
required this.kind,
12651268
this.amountMsat,
12661269
required this.direction,
12671270
required this.status,
1271+
required this.latestUpdateTimestamp,
12681272
});
12691273

12701274
@override
@@ -1273,7 +1277,8 @@ class PaymentDetails {
12731277
kind.hashCode ^
12741278
amountMsat.hashCode ^
12751279
direction.hashCode ^
1276-
status.hashCode;
1280+
status.hashCode ^
1281+
latestUpdateTimestamp.hashCode;
12771282

12781283
@override
12791284
bool operator ==(Object other) =>
@@ -1284,7 +1289,8 @@ class PaymentDetails {
12841289
kind == other.kind &&
12851290
amountMsat == other.amountMsat &&
12861291
direction == other.direction &&
1287-
status == other.status;
1292+
status == other.status &&
1293+
latestUpdateTimestamp == other.latestUpdateTimestamp;
12881294
}
12891295

12901296
/// Represents the direction of a payment.

lib/src/generated/frb_generated.dart

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3693,14 +3693,15 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi {
36933693
PaymentDetails dco_decode_payment_details(dynamic raw) {
36943694
// Codec=Dco (DartCObject based), see doc to use other codecs
36953695
final arr = raw as List<dynamic>;
3696-
if (arr.length != 5)
3697-
throw Exception('unexpected arr length: expect 5 but see ${arr.length}');
3696+
if (arr.length != 6)
3697+
throw Exception('unexpected arr length: expect 6 but see ${arr.length}');
36983698
return PaymentDetails(
36993699
id: dco_decode_payment_id(arr[0]),
37003700
kind: dco_decode_payment_kind(arr[1]),
37013701
amountMsat: dco_decode_opt_box_autoadd_u_64(arr[2]),
37023702
direction: dco_decode_payment_direction(arr[3]),
37033703
status: dco_decode_payment_status(arr[4]),
3704+
latestUpdateTimestamp: dco_decode_u_64(arr[5]),
37043705
);
37053706
}
37063707

@@ -5733,12 +5734,14 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi {
57335734
var var_amountMsat = sse_decode_opt_box_autoadd_u_64(deserializer);
57345735
var var_direction = sse_decode_payment_direction(deserializer);
57355736
var var_status = sse_decode_payment_status(deserializer);
5737+
var var_latestUpdateTimestamp = sse_decode_u_64(deserializer);
57365738
return PaymentDetails(
57375739
id: var_id,
57385740
kind: var_kind,
57395741
amountMsat: var_amountMsat,
57405742
direction: var_direction,
5741-
status: var_status);
5743+
status: var_status,
5744+
latestUpdateTimestamp: var_latestUpdateTimestamp);
57425745
}
57435746

57445747
@protected
@@ -7745,6 +7748,7 @@ class coreApiImpl extends coreApiImplPlatform implements coreApi {
77457748
sse_encode_opt_box_autoadd_u_64(self.amountMsat, serializer);
77467749
sse_encode_payment_direction(self.direction, serializer);
77477750
sse_encode_payment_status(self.status, serializer);
7751+
sse_encode_u_64(self.latestUpdateTimestamp, serializer);
77487752
}
77497753

77507754
@protected

lib/src/generated/frb_generated.io.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3139,6 +3139,8 @@ abstract class coreApiImplPlatform extends BaseApiImpl<coreWire> {
31393139
wireObj.amount_msat = cst_encode_opt_box_autoadd_u_64(apiObj.amountMsat);
31403140
wireObj.direction = cst_encode_payment_direction(apiObj.direction);
31413141
wireObj.status = cst_encode_payment_status(apiObj.status);
3142+
wireObj.latest_update_timestamp =
3143+
cst_encode_u_64(apiObj.latestUpdateTimestamp);
31423144
}
31433145

31443146
@protected
@@ -7268,6 +7270,9 @@ final class wire_cst_payment_details extends ffi.Struct {
72687270

72697271
@ffi.Int32()
72707272
external int status;
7273+
7274+
@ffi.Uint64()
7275+
external int latest_update_timestamp;
72717276
}
72727277

72737278
final class wire_cst_channel_details extends ffi.Struct {

rust/src/api/types.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,8 @@ pub struct PaymentDetails {
749749
pub direction: PaymentDirection,
750750
/// The status of the payment.
751751
pub status: PaymentStatus,
752+
/// The timestamp, in seconds since start of the UNIX epoch, when this entry was last updated.
753+
pub latest_update_timestamp: u64,
752754
}
753755

754756
impl From<ldk_node::payment::PaymentDetails> for PaymentDetails {
@@ -759,6 +761,7 @@ impl From<ldk_node::payment::PaymentDetails> for PaymentDetails {
759761
amount_msat: value.amount_msat,
760762
direction: value.direction.into(),
761763
kind: value.kind.into(),
764+
latest_update_timestamp: value.latest_update_timestamp,
762765
}
763766
}
764767
}

rust/src/frb_generated.io.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,6 +1180,7 @@ impl CstDecode<crate::api::types::PaymentDetails> for wire_cst_payment_details {
11801180
amount_msat: self.amount_msat.cst_decode(),
11811181
direction: self.direction.cst_decode(),
11821182
status: self.status.cst_decode(),
1183+
latest_update_timestamp: self.latest_update_timestamp.cst_decode(),
11831184
}
11841185
}
11851186
}
@@ -1991,6 +1992,7 @@ impl NewWithNullPtr for wire_cst_payment_details {
19911992
amount_msat: core::ptr::null_mut(),
19921993
direction: Default::default(),
19931994
status: Default::default(),
1995+
latest_update_timestamp: Default::default(),
19941996
}
19951997
}
19961998
}
@@ -4072,6 +4074,7 @@ pub struct wire_cst_payment_details {
40724074
amount_msat: *mut u64,
40734075
direction: i32,
40744076
status: i32,
4077+
latest_update_timestamp: u64,
40754078
}
40764079
#[repr(C)]
40774080
#[derive(Clone, Copy)]

rust/src/frb_generated.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3498,12 +3498,14 @@ impl SseDecode for crate::api::types::PaymentDetails {
34983498
let mut var_amountMsat = <Option<u64>>::sse_decode(deserializer);
34993499
let mut var_direction = <crate::api::types::PaymentDirection>::sse_decode(deserializer);
35003500
let mut var_status = <crate::api::types::PaymentStatus>::sse_decode(deserializer);
3501+
let mut var_latestUpdateTimestamp = <u64>::sse_decode(deserializer);
35013502
return crate::api::types::PaymentDetails {
35023503
id: var_id,
35033504
kind: var_kind,
35043505
amount_msat: var_amountMsat,
35053506
direction: var_direction,
35063507
status: var_status,
3508+
latest_update_timestamp: var_latestUpdateTimestamp,
35073509
};
35083510
}
35093511
}
@@ -5154,6 +5156,7 @@ impl flutter_rust_bridge::IntoDart for crate::api::types::PaymentDetails {
51545156
self.amount_msat.into_into_dart().into_dart(),
51555157
self.direction.into_into_dart().into_dart(),
51565158
self.status.into_into_dart().into_dart(),
5159+
self.latest_update_timestamp.into_into_dart().into_dart(),
51575160
]
51585161
.into_dart()
51595162
}
@@ -6971,6 +6974,7 @@ impl SseEncode for crate::api::types::PaymentDetails {
69716974
<Option<u64>>::sse_encode(self.amount_msat, serializer);
69726975
<crate::api::types::PaymentDirection>::sse_encode(self.direction, serializer);
69736976
<crate::api::types::PaymentStatus>::sse_encode(self.status, serializer);
6977+
<u64>::sse_encode(self.latest_update_timestamp, serializer);
69746978
}
69756979
}
69766980

0 commit comments

Comments
 (0)