diff --git a/app/src/main/java/com/bitchat/android/wallet/service/CashuService.kt b/app/src/main/java/com/bitchat/android/wallet/service/CashuService.kt index e18982c1..6ac84aeb 100644 --- a/app/src/main/java/com/bitchat/android/wallet/service/CashuService.kt +++ b/app/src/main/java/com/bitchat/android/wallet/service/CashuService.kt @@ -283,11 +283,8 @@ class CashuService { val amount = decodedToken.amount.toLong() Log.d(TAG, "Token validation successful, amount: $amount") - - // TODO: Implement proper token receiving using CDK FFI - // The CDK FFI doesn't have a direct receive() method - // This might involve using prepareSend() or another approach - // wallet!!.receive(token) + + wallet!!.receive(token) Result.success(amount) diff --git a/app/src/main/jniLibs/arm64-v8a/libcdk_ffi.so b/app/src/main/jniLibs/arm64-v8a/libcdk_ffi.so index af744d00..d7872f6a 100755 Binary files a/app/src/main/jniLibs/arm64-v8a/libcdk_ffi.so and b/app/src/main/jniLibs/arm64-v8a/libcdk_ffi.so differ diff --git a/app/src/main/kotlin/uniffi/cdk_ffi/cdk_ffi.kt b/app/src/main/kotlin/uniffi/cdk_ffi/cdk_ffi.kt index 76034510..2a2682d6 100644 --- a/app/src/main/kotlin/uniffi/cdk_ffi/cdk_ffi.kt +++ b/app/src/main/kotlin/uniffi/cdk_ffi/cdk_ffi.kt @@ -745,6 +745,8 @@ internal interface UniffiForeignFutureCompleteVoid : com.sun.jna.Callback { + + @@ -801,6 +803,8 @@ internal interface UniffiLib : Library { ): RustBuffer.ByValue fun uniffi_cdk_ffi_fn_method_ffiwallet_prepare_send(`ptr`: Pointer,`amount`: RustBuffer.ByValue,`options`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue + fun uniffi_cdk_ffi_fn_method_ffiwallet_receive(`ptr`: Pointer,`token`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue fun uniffi_cdk_ffi_fn_method_ffiwallet_send(`ptr`: Pointer,`amount`: RustBuffer.ByValue,`options`: RustBuffer.ByValue,`memo`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue fun uniffi_cdk_ffi_fn_method_ffiwallet_unit(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, @@ -939,6 +943,8 @@ internal interface UniffiLib : Library { ): Short fun uniffi_cdk_ffi_checksum_method_ffiwallet_prepare_send( ): Short + fun uniffi_cdk_ffi_checksum_method_ffiwallet_receive( + ): Short fun uniffi_cdk_ffi_checksum_method_ffiwallet_send( ): Short fun uniffi_cdk_ffi_checksum_method_ffiwallet_unit( @@ -998,6 +1004,9 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) { if (lib.uniffi_cdk_ffi_checksum_method_ffiwallet_prepare_send() != 46706.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_cdk_ffi_checksum_method_ffiwallet_receive() != 57605.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_cdk_ffi_checksum_method_ffiwallet_send() != 15473.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -1598,6 +1607,11 @@ public interface FfiWalletInterface { fun `prepareSend`(`amount`: FfiAmount, `options`: FfiSendOptions): FfiPreparedSend + /** + * Receive token + */ + fun `receive`(`token`: kotlin.String): FfiAmount + fun `send`(`amount`: FfiAmount, `options`: FfiSendOptions, `memo`: FfiSendMemo?): FfiToken fun `unit`(): kotlin.String @@ -1813,6 +1827,22 @@ open class FfiWallet: Disposable, AutoCloseable, FfiWalletInterface { + /** + * Receive token + */ + @Throws(FfiException::class)override fun `receive`(`token`: kotlin.String): FfiAmount { + return FfiConverterTypeFFIAmount.lift( + callWithPointer { + uniffiRustCallWithError(FfiException) { _status -> + UniffiLib.INSTANCE.uniffi_cdk_ffi_fn_method_ffiwallet_receive( + it, FfiConverterString.lower(`token`),_status) +} + } + ) + } + + + @Throws(FfiException::class)override fun `send`(`amount`: FfiAmount, `options`: FfiSendOptions, `memo`: FfiSendMemo?): FfiToken { return FfiConverterTypeFFIToken.lift( callWithPointer {