Skip to content

Commit

Permalink
route hint in keysend, asyncpay in keysend bindings, routehint in par…
Browse files Browse the repository at this point in the history
…se_invoice
  • Loading branch information
Evanfeenstra committed Jul 24, 2024
1 parent 5e429be commit 598b088
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 14 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 = "161a308b505a48a613d0d50107f1f1df72b5fbe8", features = [
sphinx = { git = "https://github.com/stakwork/sphinx", rev = "6c0b5cc85d6ce3f5907ad6e48fbc47409efa3218", features = [
"msg",
"bindings",
"macaroon",
Expand Down
15 changes: 11 additions & 4 deletions sphinx-ffi/src/auto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,19 @@ pub fn keysend(
full_state: Vec<u8>,
amt_msat: u64,
data: Option<Vec<u8>>,
route_hint: Option<String>,
) -> Result<RunReturn> {
Ok(
bindings::keysend(&seed, &unique_time, &to, &full_state, amt_msat, data)
.map_err(|e| SphinxError::SendFailed { r: e.to_string() })?
.into(),
Ok(bindings::keysend(
&seed,
&unique_time,
&to,
&full_state,
amt_msat,
data,
route_hint,
)
.map_err(|e| SphinxError::SendFailed { r: e.to_string() })?
.into())
}

fn my_img_opt(my_img: &str) -> Option<&str> {
Expand Down
7 changes: 4 additions & 3 deletions sphinx-ffi/src/sphinxrs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2177,7 +2177,7 @@ public func `send`(`seed`: String, `uniqueTime`: String, `to`: String, `msgType`
)
}

public func `keysend`(`seed`: String, `uniqueTime`: String, `to`: String, `state`: Data, `amtMsat`: UInt64, `data`: Data?) throws -> RunReturn {
public func `keysend`(`seed`: String, `uniqueTime`: String, `to`: String, `state`: Data, `amtMsat`: UInt64, `data`: Data?, `routeHint`: String?) throws -> RunReturn {
return try FfiConverterTypeRunReturn.lift(
try rustCallWithError(FfiConverterTypeSphinxError.lift) {
uniffi_sphinxrs_fn_func_keysend(
Expand All @@ -2186,7 +2186,8 @@ public func `keysend`(`seed`: String, `uniqueTime`: String, `to`: String, `state
FfiConverterString.lower(`to`),
FfiConverterData.lower(`state`),
FfiConverterUInt64.lower(`amtMsat`),
FfiConverterOptionData.lower(`data`),$0)
FfiConverterOptionData.lower(`data`),
FfiConverterOptionString.lower(`routeHint`),$0)
}
)
}
Expand Down Expand Up @@ -2773,7 +2774,7 @@ private var initializationResult: InitializationResult {
if (uniffi_sphinxrs_checksum_func_send() != 56750) {
return InitializationResult.apiChecksumMismatch
}
if (uniffi_sphinxrs_checksum_func_keysend() != 64232) {
if (uniffi_sphinxrs_checksum_func_keysend() != 58116) {
return InitializationResult.apiChecksumMismatch
}
if (uniffi_sphinxrs_checksum_func_make_media_token() != 53931) {
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 @@ -195,7 +195,7 @@ namespace sphinxrs {
[Throws=SphinxError]
RunReturn send(string seed, string unique_time, string to, u8 msg_type, string msg_json, bytes state, string my_alias, string my_img, u64 amt_msat, optional boolean is_tribe = false);
[Throws=SphinxError]
RunReturn keysend(string seed, string unique_time, string to, bytes state, u64 amt_msat, bytes? data);
RunReturn keysend(string seed, string unique_time, string to, bytes state, u64 amt_msat, bytes? data, string? route_hint);
[Throws=SphinxError]
string make_media_token(string seed, string unique_time, bytes state, string host, string muid, string to, u32 expiry);
[Throws=SphinxError]
Expand Down
2 changes: 1 addition & 1 deletion sphinx-ffi/src/sphinxrsFFI.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ RustBuffer uniffi_sphinxrs_fn_func_handle(RustBuffer topic, RustBuffer payload,
);
RustBuffer uniffi_sphinxrs_fn_func_send(RustBuffer seed, RustBuffer unique_time, RustBuffer to, uint8_t msg_type, RustBuffer msg_json, RustBuffer state, RustBuffer my_alias, RustBuffer my_img, uint64_t amt_msat, int8_t is_tribe, RustCallStatus *_Nonnull out_status
);
RustBuffer uniffi_sphinxrs_fn_func_keysend(RustBuffer seed, RustBuffer unique_time, RustBuffer to, RustBuffer state, uint64_t amt_msat, RustBuffer data, RustCallStatus *_Nonnull out_status
RustBuffer uniffi_sphinxrs_fn_func_keysend(RustBuffer seed, RustBuffer unique_time, RustBuffer to, RustBuffer state, uint64_t amt_msat, RustBuffer data, RustBuffer route_hint, RustCallStatus *_Nonnull out_status
);
RustBuffer uniffi_sphinxrs_fn_func_make_media_token(RustBuffer seed, RustBuffer unique_time, RustBuffer state, RustBuffer host, RustBuffer muid, RustBuffer to, uint32_t expiry, 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 @@ -450,7 +450,7 @@ internal interface _UniFFILib : Library {
): RustBuffer.ByValue
fun uniffi_sphinxrs_fn_func_send(`seed`: RustBuffer.ByValue,`uniqueTime`: RustBuffer.ByValue,`to`: RustBuffer.ByValue,`msgType`: Byte,`msgJson`: RustBuffer.ByValue,`state`: RustBuffer.ByValue,`myAlias`: RustBuffer.ByValue,`myImg`: RustBuffer.ByValue,`amtMsat`: Long,`isTribe`: Byte,_uniffi_out_err: RustCallStatus,
): RustBuffer.ByValue
fun uniffi_sphinxrs_fn_func_keysend(`seed`: RustBuffer.ByValue,`uniqueTime`: RustBuffer.ByValue,`to`: RustBuffer.ByValue,`state`: RustBuffer.ByValue,`amtMsat`: Long,`data`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
fun uniffi_sphinxrs_fn_func_keysend(`seed`: RustBuffer.ByValue,`uniqueTime`: RustBuffer.ByValue,`to`: RustBuffer.ByValue,`state`: RustBuffer.ByValue,`amtMsat`: Long,`data`: RustBuffer.ByValue,`routeHint`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
): RustBuffer.ByValue
fun uniffi_sphinxrs_fn_func_make_media_token(`seed`: RustBuffer.ByValue,`uniqueTime`: RustBuffer.ByValue,`state`: RustBuffer.ByValue,`host`: RustBuffer.ByValue,`muid`: RustBuffer.ByValue,`to`: RustBuffer.ByValue,`expiry`: Int,_uniffi_out_err: RustCallStatus,
): RustBuffer.ByValue
Expand Down Expand Up @@ -834,7 +834,7 @@ private fun uniffiCheckApiChecksums(lib: _UniFFILib) {
if (lib.uniffi_sphinxrs_checksum_func_send() != 56750.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
if (lib.uniffi_sphinxrs_checksum_func_keysend() != 64232.toShort()) {
if (lib.uniffi_sphinxrs_checksum_func_keysend() != 58116.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
if (lib.uniffi_sphinxrs_checksum_func_make_media_token() != 53931.toShort()) {
Expand Down Expand Up @@ -2781,10 +2781,10 @@ fun `send`(`seed`: String, `uniqueTime`: String, `to`: String, `msgType`: UByte,

@Throws(SphinxException::class)

fun `keysend`(`seed`: String, `uniqueTime`: String, `to`: String, `state`: ByteArray, `amtMsat`: ULong, `data`: ByteArray?): RunReturn {
fun `keysend`(`seed`: String, `uniqueTime`: String, `to`: String, `state`: ByteArray, `amtMsat`: ULong, `data`: ByteArray?, `routeHint`: String?): RunReturn {
return FfiConverterTypeRunReturn.lift(
rustCallWithError(SphinxException) { _status ->
_UniFFILib.INSTANCE.uniffi_sphinxrs_fn_func_keysend(FfiConverterString.lower(`seed`),FfiConverterString.lower(`uniqueTime`),FfiConverterString.lower(`to`),FfiConverterByteArray.lower(`state`),FfiConverterULong.lower(`amtMsat`),FfiConverterOptionalByteArray.lower(`data`),_status)
_UniFFILib.INSTANCE.uniffi_sphinxrs_fn_func_keysend(FfiConverterString.lower(`seed`),FfiConverterString.lower(`uniqueTime`),FfiConverterString.lower(`to`),FfiConverterByteArray.lower(`state`),FfiConverterULong.lower(`amtMsat`),FfiConverterOptionalByteArray.lower(`data`),FfiConverterOptionalString.lower(`routeHint`),_status)
})
}

Expand Down

0 comments on commit 598b088

Please sign in to comment.