Skip to content

Commit

Permalink
cancel invite
Browse files Browse the repository at this point in the history
  • Loading branch information
Evanfeenstra committed Aug 7, 2024
1 parent 44ae57c commit fe65b90
Show file tree
Hide file tree
Showing 6 changed files with 52 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 = "07b708050eaa4e77d1d62028cadb8b5809b30b36", features = [
sphinx = { git = "https://github.com/stakwork/sphinx", rev = "2de79ab96a4d0af2b5492ba5168444c217ff4d63", features = [
"msg",
"bindings",
"macaroon",
Expand Down
13 changes: 13 additions & 0 deletions sphinx-ffi/src/auto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,19 @@ pub fn code_from_invite(invite_qr: String) -> Result<String> {
.map_err(|e| SphinxError::SendFailed { r: e.to_string() })?)
}

pub fn cancel_invite(
seed: String,
unique_time: String,
full_state: Vec<u8>,
invite_code: String,
) -> Result<RunReturn> {
Ok(
bindings::cancel_invite(&seed, &unique_time, &full_state, &invite_code)
.map_err(|e| SphinxError::SendFailed { r: e.to_string() })?
.into(),
)
}

pub fn read(
seed: String,
unique_time: String,
Expand Down
15 changes: 15 additions & 0 deletions sphinx-ffi/src/sphinxrs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2386,6 +2386,18 @@ public func `codeFromInvite`(`inviteQr`: String) throws -> String {
)
}

public func `cancelInvite`(`seed`: String, `uniqueTime`: String, `state`: Data, `inviteCode`: String) throws -> RunReturn {
return try FfiConverterTypeRunReturn.lift(
try rustCallWithError(FfiConverterTypeSphinxError.lift) {
uniffi_sphinxrs_fn_func_cancel_invite(
FfiConverterString.lower(`seed`),
FfiConverterString.lower(`uniqueTime`),
FfiConverterData.lower(`state`),
FfiConverterString.lower(`inviteCode`),$0)
}
)
}

public func `getDefaultTribeServer`(`state`: Data) throws -> String {
return try FfiConverterString.lift(
try rustCallWithError(FfiConverterTypeSphinxError.lift) {
Expand Down Expand Up @@ -2822,6 +2834,9 @@ private var initializationResult: InitializationResult {
if (uniffi_sphinxrs_checksum_func_code_from_invite() != 40279) {
return InitializationResult.apiChecksumMismatch
}
if (uniffi_sphinxrs_checksum_func_cancel_invite() != 49457) {
return InitializationResult.apiChecksumMismatch
}
if (uniffi_sphinxrs_checksum_func_get_default_tribe_server() != 13603) {
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 @@ -227,6 +227,8 @@ namespace sphinxrs {
[Throws=SphinxError]
string code_from_invite(string invite_qr);
[Throws=SphinxError]
RunReturn cancel_invite(string seed, string unique_time, bytes state, string invite_code);
[Throws=SphinxError]
string get_default_tribe_server(bytes state);
[Throws=SphinxError]
RunReturn read(string seed, string unique_time, bytes state, string pubkey, u64 msg_idx);
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 @@ -181,6 +181,8 @@ RustBuffer uniffi_sphinxrs_fn_func_parse_invite(RustBuffer invite_qr, RustCallSt
);
RustBuffer uniffi_sphinxrs_fn_func_code_from_invite(RustBuffer invite_qr, RustCallStatus *_Nonnull out_status
);
RustBuffer uniffi_sphinxrs_fn_func_cancel_invite(RustBuffer seed, RustBuffer unique_time, RustBuffer state, RustBuffer invite_code, RustCallStatus *_Nonnull out_status
);
RustBuffer uniffi_sphinxrs_fn_func_get_default_tribe_server(RustBuffer state, RustCallStatus *_Nonnull out_status
);
RustBuffer uniffi_sphinxrs_fn_func_read(RustBuffer seed, RustBuffer unique_time, RustBuffer state, RustBuffer pubkey, uint64_t msg_idx, RustCallStatus *_Nonnull out_status
Expand Down Expand Up @@ -405,6 +407,9 @@ uint16_t uniffi_sphinxrs_checksum_func_parse_invite(void
);
uint16_t uniffi_sphinxrs_checksum_func_code_from_invite(void

);
uint16_t uniffi_sphinxrs_checksum_func_cancel_invite(void

);
uint16_t uniffi_sphinxrs_checksum_func_get_default_tribe_server(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 @@ -482,6 +482,8 @@ internal interface _UniFFILib : Library {
): RustBuffer.ByValue
fun uniffi_sphinxrs_fn_func_code_from_invite(`inviteQr`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
): RustBuffer.ByValue
fun uniffi_sphinxrs_fn_func_cancel_invite(`seed`: RustBuffer.ByValue,`uniqueTime`: RustBuffer.ByValue,`state`: RustBuffer.ByValue,`inviteCode`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
): RustBuffer.ByValue
fun uniffi_sphinxrs_fn_func_get_default_tribe_server(`state`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
): RustBuffer.ByValue
fun uniffi_sphinxrs_fn_func_read(`seed`: RustBuffer.ByValue,`uniqueTime`: RustBuffer.ByValue,`state`: RustBuffer.ByValue,`pubkey`: RustBuffer.ByValue,`msgIdx`: Long,_uniffi_out_err: RustCallStatus,
Expand Down Expand Up @@ -648,6 +650,8 @@ internal interface _UniFFILib : Library {
): Short
fun uniffi_sphinxrs_checksum_func_code_from_invite(
): Short
fun uniffi_sphinxrs_checksum_func_cancel_invite(
): Short
fun uniffi_sphinxrs_checksum_func_get_default_tribe_server(
): Short
fun uniffi_sphinxrs_checksum_func_read(
Expand Down Expand Up @@ -882,6 +886,9 @@ private fun uniffiCheckApiChecksums(lib: _UniFFILib) {
if (lib.uniffi_sphinxrs_checksum_func_code_from_invite() != 40279.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
if (lib.uniffi_sphinxrs_checksum_func_cancel_invite() != 49457.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
if (lib.uniffi_sphinxrs_checksum_func_get_default_tribe_server() != 13603.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
Expand Down Expand Up @@ -2925,6 +2932,15 @@ fun `codeFromInvite`(`inviteQr`: String): String {

@Throws(SphinxException::class)

fun `cancelInvite`(`seed`: String, `uniqueTime`: String, `state`: ByteArray, `inviteCode`: String): RunReturn {
return FfiConverterTypeRunReturn.lift(
rustCallWithError(SphinxException) { _status ->
_UniFFILib.INSTANCE.uniffi_sphinxrs_fn_func_cancel_invite(FfiConverterString.lower(`seed`),FfiConverterString.lower(`uniqueTime`),FfiConverterByteArray.lower(`state`),FfiConverterString.lower(`inviteCode`),_status)
})
}

@Throws(SphinxException::class)

fun `getDefaultTribeServer`(`state`: ByteArray): String {
return FfiConverterString.lift(
rustCallWithError(SphinxException) { _status ->
Expand Down

0 comments on commit fe65b90

Please sign in to comment.