From 6fa63a1fa2b611195b8e4fd8699171f24b4718f4 Mon Sep 17 00:00:00 2001 From: Evan Feenstra Date: Thu, 25 Apr 2024 10:22:43 -0700 Subject: [PATCH] reverse param on fetchpayments --- sphinx-ffi/Cargo.toml | 2 +- sphinx-ffi/src/auto.rs | 2 ++ sphinx-ffi/src/sphinxrs.swift | 9 +++++---- sphinx-ffi/src/sphinxrs.udl | 2 +- sphinx-ffi/src/sphinxrsFFI.h | 2 +- sphinx-ffi/src/uniffi/sphinxrs/sphinxrs.kt | 8 ++++---- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/sphinx-ffi/Cargo.toml b/sphinx-ffi/Cargo.toml index 28c867f..8e9f2a0 100644 --- a/sphinx-ffi/Cargo.toml +++ b/sphinx-ffi/Cargo.toml @@ -25,7 +25,7 @@ sphinx-signer = { path = "../signer", default-features = false, features = [ "no-native", ] } sphinx-glyph = { path = "../glyph", default-features = false } -sphinx = { git = "https://github.com/stakwork/sphinx", rev = "45b40aa873092e7ed52508cb2667ada2c4bcde81", features = [ +sphinx = { git = "https://github.com/stakwork/sphinx", rev = "839ba21f5ca3b2c3c9faede46de1f0d880cc0f42", features = [ "msg", "bindings", ] } diff --git a/sphinx-ffi/src/auto.rs b/sphinx-ffi/src/auto.rs index 3af8c7f..0beca1a 100644 --- a/sphinx-ffi/src/auto.rs +++ b/sphinx-ffi/src/auto.rs @@ -574,6 +574,7 @@ pub fn fetch_payments( scid: Option, remote_only: Option, min_msat: Option, + reverse: Option, ) -> Result { Ok(bindings::fetch_payments( &seed, @@ -584,6 +585,7 @@ pub fn fetch_payments( scid, remote_only, min_msat, + reverse, ) .map_err(|e| SphinxError::FetchMsgsFailed { r: e.to_string() })? .into()) diff --git a/sphinx-ffi/src/sphinxrs.swift b/sphinx-ffi/src/sphinxrs.swift index be68694..7aac752 100644 --- a/sphinx-ffi/src/sphinxrs.swift +++ b/sphinx-ffi/src/sphinxrs.swift @@ -2185,18 +2185,19 @@ public func `fetchFirstMsgsPerKey`(`seed`: String, `uniqueTime`: String, `state` ) } -public func `fetchPayments`(`seed`: String, `uniqueTime`: String, `state`: Data, `lastMsgIdx`: UInt64?, `limit`: UInt32?, `scid`: UInt64?, `remoteOnly`: Bool?, `minMsat`: UInt64?) throws -> RunReturn { +public func `fetchPayments`(`seed`: String, `uniqueTime`: String, `state`: Data, `since`: UInt64?, `limit`: UInt32?, `scid`: UInt64?, `remoteOnly`: Bool?, `minMsat`: UInt64?, `reverse`: Bool?) throws -> RunReturn { return try FfiConverterTypeRunReturn.lift( try rustCallWithError(FfiConverterTypeSphinxError.lift) { uniffi_sphinxrs_fn_func_fetch_payments( FfiConverterString.lower(`seed`), FfiConverterString.lower(`uniqueTime`), FfiConverterData.lower(`state`), - FfiConverterOptionUInt64.lower(`lastMsgIdx`), + FfiConverterOptionUInt64.lower(`since`), FfiConverterOptionUInt32.lower(`limit`), FfiConverterOptionUInt64.lower(`scid`), FfiConverterOptionBool.lower(`remoteOnly`), - FfiConverterOptionUInt64.lower(`minMsat`),$0) + FfiConverterOptionUInt64.lower(`minMsat`), + FfiConverterOptionBool.lower(`reverse`),$0) } ) } @@ -2402,7 +2403,7 @@ private var initializationResult: InitializationResult { if (uniffi_sphinxrs_checksum_func_fetch_first_msgs_per_key() != 29398) { return InitializationResult.apiChecksumMismatch } - if (uniffi_sphinxrs_checksum_func_fetch_payments() != 18180) { + if (uniffi_sphinxrs_checksum_func_fetch_payments() != 58291) { return InitializationResult.apiChecksumMismatch } diff --git a/sphinx-ffi/src/sphinxrs.udl b/sphinx-ffi/src/sphinxrs.udl index 26c2715..06dc244 100644 --- a/sphinx-ffi/src/sphinxrs.udl +++ b/sphinx-ffi/src/sphinxrs.udl @@ -210,5 +210,5 @@ namespace sphinxrs { [Throws=SphinxError] RunReturn fetch_first_msgs_per_key(string seed, string unique_time, bytes state, u64 last_msg_idx, u32? limit, boolean? reverse); [Throws=SphinxError] - RunReturn fetch_payments(string seed, string unique_time, bytes state, u64? since, u32? limit, u64? scid, boolean? remote_only, u64? min_msat); + RunReturn fetch_payments(string seed, string unique_time, bytes state, u64? since, u32? limit, u64? scid, boolean? remote_only, u64? min_msat, boolean? reverse); }; \ No newline at end of file diff --git a/sphinx-ffi/src/sphinxrsFFI.h b/sphinx-ffi/src/sphinxrsFFI.h index b2df3c7..d75115a 100644 --- a/sphinx-ffi/src/sphinxrsFFI.h +++ b/sphinx-ffi/src/sphinxrsFFI.h @@ -187,7 +187,7 @@ RustBuffer uniffi_sphinxrs_fn_func_fetch_msgs_batch_okkey(RustBuffer seed, RustB ); RustBuffer uniffi_sphinxrs_fn_func_fetch_first_msgs_per_key(RustBuffer seed, RustBuffer unique_time, RustBuffer state, uint64_t last_msg_idx, RustBuffer limit, RustBuffer reverse, RustCallStatus *_Nonnull out_status ); -RustBuffer uniffi_sphinxrs_fn_func_fetch_payments(RustBuffer seed, RustBuffer unique_time, RustBuffer state, RustBuffer last_msg_idx, RustBuffer limit, RustBuffer scid, RustBuffer remote_only, RustBuffer min_msat, RustCallStatus *_Nonnull out_status +RustBuffer uniffi_sphinxrs_fn_func_fetch_payments(RustBuffer seed, RustBuffer unique_time, RustBuffer state, RustBuffer since, RustBuffer limit, RustBuffer scid, RustBuffer remote_only, RustBuffer min_msat, RustBuffer reverse, RustCallStatus *_Nonnull out_status ); RustBuffer ffi_sphinxrs_rustbuffer_alloc(int32_t size, RustCallStatus *_Nonnull out_status ); diff --git a/sphinx-ffi/src/uniffi/sphinxrs/sphinxrs.kt b/sphinx-ffi/src/uniffi/sphinxrs/sphinxrs.kt index cff2334..ce2add2 100644 --- a/sphinx-ffi/src/uniffi/sphinxrs/sphinxrs.kt +++ b/sphinx-ffi/src/uniffi/sphinxrs/sphinxrs.kt @@ -488,7 +488,7 @@ internal interface _UniFFILib : Library { ): RustBuffer.ByValue fun uniffi_sphinxrs_fn_func_fetch_first_msgs_per_key(`seed`: RustBuffer.ByValue,`uniqueTime`: RustBuffer.ByValue,`state`: RustBuffer.ByValue,`lastMsgIdx`: Long,`limit`: RustBuffer.ByValue,`reverse`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus, ): RustBuffer.ByValue - fun uniffi_sphinxrs_fn_func_fetch_payments(`seed`: RustBuffer.ByValue,`uniqueTime`: RustBuffer.ByValue,`state`: RustBuffer.ByValue,`lastMsgIdx`: RustBuffer.ByValue,`limit`: RustBuffer.ByValue,`scid`: RustBuffer.ByValue,`remoteOnly`: RustBuffer.ByValue,`minMsat`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus, + fun uniffi_sphinxrs_fn_func_fetch_payments(`seed`: RustBuffer.ByValue,`uniqueTime`: RustBuffer.ByValue,`state`: RustBuffer.ByValue,`since`: RustBuffer.ByValue,`limit`: RustBuffer.ByValue,`scid`: RustBuffer.ByValue,`remoteOnly`: RustBuffer.ByValue,`minMsat`: RustBuffer.ByValue,`reverse`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus, ): RustBuffer.ByValue fun ffi_sphinxrs_rustbuffer_alloc(`size`: Int,_uniffi_out_err: RustCallStatus, ): RustBuffer.ByValue @@ -827,7 +827,7 @@ private fun uniffiCheckApiChecksums(lib: _UniFFILib) { if (lib.uniffi_sphinxrs_checksum_func_fetch_first_msgs_per_key() != 29398.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } - if (lib.uniffi_sphinxrs_checksum_func_fetch_payments() != 18180.toShort()) { + if (lib.uniffi_sphinxrs_checksum_func_fetch_payments() != 58291.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } } @@ -2685,10 +2685,10 @@ fun `fetchFirstMsgsPerKey`(`seed`: String, `uniqueTime`: String, `state`: ByteAr @Throws(SphinxException::class) -fun `fetchPayments`(`seed`: String, `uniqueTime`: String, `state`: ByteArray, `lastMsgIdx`: ULong?, `limit`: UInt?, `scid`: ULong?, `remoteOnly`: Boolean?, `minMsat`: ULong?): RunReturn { +fun `fetchPayments`(`seed`: String, `uniqueTime`: String, `state`: ByteArray, `since`: ULong?, `limit`: UInt?, `scid`: ULong?, `remoteOnly`: Boolean?, `minMsat`: ULong?, `reverse`: Boolean?): RunReturn { return FfiConverterTypeRunReturn.lift( rustCallWithError(SphinxException) { _status -> - _UniFFILib.INSTANCE.uniffi_sphinxrs_fn_func_fetch_payments(FfiConverterString.lower(`seed`),FfiConverterString.lower(`uniqueTime`),FfiConverterByteArray.lower(`state`),FfiConverterOptionalULong.lower(`lastMsgIdx`),FfiConverterOptionalUInt.lower(`limit`),FfiConverterOptionalULong.lower(`scid`),FfiConverterOptionalBoolean.lower(`remoteOnly`),FfiConverterOptionalULong.lower(`minMsat`),_status) + _UniFFILib.INSTANCE.uniffi_sphinxrs_fn_func_fetch_payments(FfiConverterString.lower(`seed`),FfiConverterString.lower(`uniqueTime`),FfiConverterByteArray.lower(`state`),FfiConverterOptionalULong.lower(`since`),FfiConverterOptionalUInt.lower(`limit`),FfiConverterOptionalULong.lower(`scid`),FfiConverterOptionalBoolean.lower(`remoteOnly`),FfiConverterOptionalULong.lower(`minMsat`),FfiConverterOptionalBoolean.lower(`reverse`),_status) }) }