Skip to content

Commit

Permalink
reverse param on fetchpayments
Browse files Browse the repository at this point in the history
  • Loading branch information
Evanfeenstra committed Apr 25, 2024
1 parent cde7097 commit 6fa63a1
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion sphinx-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
] }
Expand Down
2 changes: 2 additions & 0 deletions sphinx-ffi/src/auto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ pub fn fetch_payments(
scid: Option<u64>,
remote_only: Option<bool>,
min_msat: Option<u64>,
reverse: Option<bool>,
) -> Result<RunReturn> {
Ok(bindings::fetch_payments(
&seed,
Expand All @@ -584,6 +585,7 @@ pub fn fetch_payments(
scid,
remote_only,
min_msat,
reverse,
)
.map_err(|e| SphinxError::FetchMsgsFailed { r: e.to_string() })?
.into())
Expand Down
9 changes: 5 additions & 4 deletions sphinx-ffi/src/sphinxrs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
)
}
Expand Down Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion sphinx-ffi/src/sphinxrs.udl
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
2 changes: 1 addition & 1 deletion sphinx-ffi/src/sphinxrsFFI.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down
8 changes: 4 additions & 4 deletions sphinx-ffi/src/uniffi/sphinxrs/sphinxrs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
}
}
Expand Down Expand Up @@ -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)
})
}

Expand Down

0 comments on commit 6fa63a1

Please sign in to comment.