Skip to content

Commit

Permalink
bump sphinx
Browse files Browse the repository at this point in the history
  • Loading branch information
Evanfeenstra committed Mar 6, 2024
1 parent 627bde5 commit a055d59
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 1 deletion.
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 = "cc96d3467ed5418f441b7e28d50fd65d4ab34c8d", features = [
sphinx = { git = "https://github.com/stakwork/sphinx", rev = "916f095e3b91daaa0c2d2cfacc114c1ebe301604", features = [
"msg",
"bindings",
] }
Expand Down
5 changes: 5 additions & 0 deletions sphinx-ffi/src/auto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,11 @@ pub fn pay_invoice(
)
}

pub fn payment_hash_from_invoice(bolt11: String) -> Result<String> {
Ok(bindings::payment_hash_from_invoice(&bolt11)
.map_err(|e| SphinxError::SendFailed { r: e.to_string() })?)
}

pub fn create_tribe(
seed: String,
unique_time: String,
Expand Down
12 changes: 12 additions & 0 deletions sphinx-ffi/src/sphinxrs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1840,6 +1840,15 @@ public func `payInvoice`(`seed`: String, `uniqueTime`: String, `state`: Data, `b
)
}

public func `paymentHashFromInvoice`(`bolt11`: String) throws -> String {
return try FfiConverterString.lift(
try rustCallWithError(FfiConverterTypeSphinxError.lift) {
uniffi_sphinxrs_fn_func_payment_hash_from_invoice(
FfiConverterString.lower(`bolt11`),$0)
}
)
}

public func `createTribe`(`seed`: String, `uniqueTime`: String, `state`: Data, `tribeServerPubkey`: String, `tribeJson`: String) throws -> RunReturn {
return try FfiConverterTypeRunReturn.lift(
try rustCallWithError(FfiConverterTypeSphinxError.lift) {
Expand Down Expand Up @@ -2063,6 +2072,9 @@ private var initializationResult: InitializationResult {
if (uniffi_sphinxrs_checksum_func_pay_invoice() != 40951) {
return InitializationResult.apiChecksumMismatch
}
if (uniffi_sphinxrs_checksum_func_payment_hash_from_invoice() != 3194) {
return InitializationResult.apiChecksumMismatch
}
if (uniffi_sphinxrs_checksum_func_create_tribe() != 28873) {
return InitializationResult.apiChecksumMismatch
}
Expand Down
2 changes: 2 additions & 0 deletions sphinx-ffi/src/sphinxrs.udl
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ namespace sphinxrs {
[Throws=SphinxError]
RunReturn pay_invoice(string seed, string unique_time, bytes state, string bolt11, u64? overpay_msat);
[Throws=SphinxError]
string payment_hash_from_invoice(string bolt11);
[Throws=SphinxError]
RunReturn create_tribe(string seed, string unique_time, bytes state, string tribe_server_pubkey, string tribe_json);
[Throws=SphinxError]
RunReturn join_tribe(string seed, string unique_time, bytes state, string tribe_pubkey, string tribe_route_hint, string alias, u64 amt_msat, boolean is_private);
Expand Down
5 changes: 5 additions & 0 deletions sphinx-ffi/src/sphinxrsFFI.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ RustBuffer uniffi_sphinxrs_fn_func_make_invoice(RustBuffer seed, RustBuffer uniq
);
RustBuffer uniffi_sphinxrs_fn_func_pay_invoice(RustBuffer seed, RustBuffer unique_time, RustBuffer state, RustBuffer bolt11, RustBuffer overpay_msat, RustCallStatus *_Nonnull out_status
);
RustBuffer uniffi_sphinxrs_fn_func_payment_hash_from_invoice(RustBuffer bolt11, RustCallStatus *_Nonnull out_status
);
RustBuffer uniffi_sphinxrs_fn_func_create_tribe(RustBuffer seed, RustBuffer unique_time, RustBuffer state, RustBuffer tribe_server_pubkey, RustBuffer tribe_json, RustCallStatus *_Nonnull out_status
);
RustBuffer uniffi_sphinxrs_fn_func_join_tribe(RustBuffer seed, RustBuffer unique_time, RustBuffer state, RustBuffer tribe_pubkey, RustBuffer tribe_route_hint, RustBuffer alias, uint64_t amt_msat, int8_t is_private, RustCallStatus *_Nonnull out_status
Expand Down Expand Up @@ -297,6 +299,9 @@ uint16_t uniffi_sphinxrs_checksum_func_make_invoice(void
);
uint16_t uniffi_sphinxrs_checksum_func_pay_invoice(void

);
uint16_t uniffi_sphinxrs_checksum_func_payment_hash_from_invoice(void

);
uint16_t uniffi_sphinxrs_checksum_func_create_tribe(void

Expand Down
16 changes: 16 additions & 0 deletions sphinx-ffi/src/uniffi/sphinxrs/sphinxrs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,8 @@ internal interface _UniFFILib : Library {
): RustBuffer.ByValue
fun uniffi_sphinxrs_fn_func_pay_invoice(`seed`: RustBuffer.ByValue,`uniqueTime`: RustBuffer.ByValue,`state`: RustBuffer.ByValue,`bolt11`: RustBuffer.ByValue,`overpayMsat`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
): RustBuffer.ByValue
fun uniffi_sphinxrs_fn_func_payment_hash_from_invoice(`bolt11`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
): RustBuffer.ByValue
fun uniffi_sphinxrs_fn_func_create_tribe(`seed`: RustBuffer.ByValue,`uniqueTime`: RustBuffer.ByValue,`state`: RustBuffer.ByValue,`tribeServerPubkey`: RustBuffer.ByValue,`tribeJson`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
): RustBuffer.ByValue
fun uniffi_sphinxrs_fn_func_join_tribe(`seed`: RustBuffer.ByValue,`uniqueTime`: RustBuffer.ByValue,`state`: RustBuffer.ByValue,`tribePubkey`: RustBuffer.ByValue,`tribeRouteHint`: RustBuffer.ByValue,`alias`: RustBuffer.ByValue,`amtMsat`: Long,`isPrivate`: Byte,_uniffi_out_err: RustCallStatus,
Expand Down Expand Up @@ -556,6 +558,8 @@ internal interface _UniFFILib : Library {
): Short
fun uniffi_sphinxrs_checksum_func_pay_invoice(
): Short
fun uniffi_sphinxrs_checksum_func_payment_hash_from_invoice(
): Short
fun uniffi_sphinxrs_checksum_func_create_tribe(
): Short
fun uniffi_sphinxrs_checksum_func_join_tribe(
Expand Down Expand Up @@ -714,6 +718,9 @@ private fun uniffiCheckApiChecksums(lib: _UniFFILib) {
if (lib.uniffi_sphinxrs_checksum_func_pay_invoice() != 40951.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
if (lib.uniffi_sphinxrs_checksum_func_payment_hash_from_invoice() != 3194.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
if (lib.uniffi_sphinxrs_checksum_func_create_tribe() != 28873.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
Expand Down Expand Up @@ -2327,6 +2334,15 @@ fun `payInvoice`(`seed`: String, `uniqueTime`: String, `state`: ByteArray, `bolt

@Throws(SphinxException::class)

fun `paymentHashFromInvoice`(`bolt11`: String): String {
return FfiConverterString.lift(
rustCallWithError(SphinxException) { _status ->
_UniFFILib.INSTANCE.uniffi_sphinxrs_fn_func_payment_hash_from_invoice(FfiConverterString.lower(`bolt11`),_status)
})
}

@Throws(SphinxException::class)

fun `createTribe`(`seed`: String, `uniqueTime`: String, `state`: ByteArray, `tribeServerPubkey`: String, `tribeJson`: String): RunReturn {
return FfiConverterTypeRunReturn.lift(
rustCallWithError(SphinxException) { _status ->
Expand Down

0 comments on commit a055d59

Please sign in to comment.