diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9084fbd90..06c4ad60b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -21,7 +21,7 @@ jobs: java-version: '17' - name: Gradle Run ktlint run: ./gradlew ktlintCheck --continue - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 name: Upload ktlint report if: ${{ failure() }} with: @@ -30,7 +30,7 @@ jobs: - name: Gradle Android lint library run: ./gradlew :library:lintDebug - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 name: Upload library lint report if: ${{ failure() }} with: @@ -39,7 +39,7 @@ jobs: - name: Gradle Android lint example run: ./gradlew :example:lintDebug - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 name: Upload example lint report if: ${{ failure() }} with: diff --git a/library/src/main/java/libxmtp-version.txt b/library/src/main/java/libxmtp-version.txt index 240e0b071..01524aa69 100644 --- a/library/src/main/java/libxmtp-version.txt +++ b/library/src/main/java/libxmtp-version.txt @@ -1,3 +1,3 @@ -Version: c446f94d +Version: 7e70ad48 Branch: main -Date: 2024-09-09 14:36:53 +0000 +Date: 2024-09-13 15:56:37 +0000 diff --git a/library/src/main/java/xmtpv3.kt b/library/src/main/java/xmtpv3.kt index 42a71eb4a..7f03eb773 100644 --- a/library/src/main/java/xmtpv3.kt +++ b/library/src/main/java/xmtpv3.kt @@ -928,6 +928,10 @@ internal interface UniffiLib : Library { `ptr`: Pointer, uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue + fun uniffi_xmtpv3_fn_method_ffigroup_consent_state( + `ptr`: Pointer, uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_xmtpv3_fn_method_ffigroup_created_at_ns( `ptr`: Pointer, uniffi_out_err: UniffiRustCallStatus, ): Long @@ -1024,6 +1028,10 @@ internal interface UniffiLib : Library { `ptr`: Pointer, ): Long + fun uniffi_xmtpv3_fn_method_ffigroup_update_consent_state( + `ptr`: Pointer, `state`: RustBuffer.ByValue, uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_xmtpv3_fn_method_ffigroup_update_group_description( `ptr`: Pointer, `groupDescription`: RustBuffer.ByValue, ): Long @@ -1095,7 +1103,8 @@ internal interface UniffiLib : Library { `ptr`: Pointer, `signatureBytes`: RustBuffer.ByValue, `address`: RustBuffer.ByValue, - `chainRpcUrl`: RustBuffer.ByValue, + `chainId`: Long, + `blockNumber`: Long, ): Long fun uniffi_xmtpv3_fn_method_ffisignaturerequest_is_ready( @@ -1212,6 +1221,10 @@ internal interface UniffiLib : Library { `ptr`: Pointer, `address`: RustBuffer.ByValue, ): Long + fun uniffi_xmtpv3_fn_method_ffixmtpclient_get_consent_state( + `ptr`: Pointer, `entityType`: RustBuffer.ByValue, `entity`: RustBuffer.ByValue, + ): Long + fun uniffi_xmtpv3_fn_method_ffixmtpclient_get_latest_inbox_state( `ptr`: Pointer, `inboxId`: RustBuffer.ByValue, ): Long @@ -1256,6 +1269,13 @@ internal interface UniffiLib : Library { `ptr`: Pointer, `walletAddress`: RustBuffer.ByValue, ): Long + fun uniffi_xmtpv3_fn_method_ffixmtpclient_set_consent_state( + `ptr`: Pointer, + `state`: RustBuffer.ByValue, + `entityType`: RustBuffer.ByValue, + `entity`: RustBuffer.ByValue, + ): Long + fun uniffi_xmtpv3_fn_method_ffixmtpclient_signature_request( `ptr`: Pointer, uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue @@ -1685,6 +1705,9 @@ internal interface UniffiLib : Library { fun uniffi_xmtpv3_checksum_method_ffigroup_admin_list( ): Short + fun uniffi_xmtpv3_checksum_method_ffigroup_consent_state( + ): Short + fun uniffi_xmtpv3_checksum_method_ffigroup_created_at_ns( ): Short @@ -1757,6 +1780,9 @@ internal interface UniffiLib : Library { fun uniffi_xmtpv3_checksum_method_ffigroup_sync( ): Short + fun uniffi_xmtpv3_checksum_method_ffigroup_update_consent_state( + ): Short + fun uniffi_xmtpv3_checksum_method_ffigroup_update_group_description( ): Short @@ -1850,6 +1876,9 @@ internal interface UniffiLib : Library { fun uniffi_xmtpv3_checksum_method_ffixmtpclient_find_inbox_id( ): Short + fun uniffi_xmtpv3_checksum_method_ffixmtpclient_get_consent_state( + ): Short + fun uniffi_xmtpv3_checksum_method_ffixmtpclient_get_latest_inbox_state( ): Short @@ -1883,6 +1912,9 @@ internal interface UniffiLib : Library { fun uniffi_xmtpv3_checksum_method_ffixmtpclient_revoke_wallet( ): Short + fun uniffi_xmtpv3_checksum_method_ffixmtpclient_set_consent_state( + ): Short + fun uniffi_xmtpv3_checksum_method_ffixmtpclient_signature_request( ): Short @@ -2008,6 +2040,9 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) { if (lib.uniffi_xmtpv3_checksum_method_ffigroup_admin_list() != 51010.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_xmtpv3_checksum_method_ffigroup_consent_state() != 11630.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_xmtpv3_checksum_method_ffigroup_created_at_ns() != 4894.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -2080,6 +2115,9 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) { if (lib.uniffi_xmtpv3_checksum_method_ffigroup_sync() != 24219.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_xmtpv3_checksum_method_ffigroup_update_consent_state() != 48124.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_xmtpv3_checksum_method_ffigroup_update_group_description() != 34006.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -2110,7 +2148,7 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) { if (lib.uniffi_xmtpv3_checksum_method_ffisignaturerequest_add_ecdsa_signature() != 8706.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } - if (lib.uniffi_xmtpv3_checksum_method_ffisignaturerequest_add_scw_signature() != 59425.toShort()) { + if (lib.uniffi_xmtpv3_checksum_method_ffisignaturerequest_add_scw_signature() != 23994.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } if (lib.uniffi_xmtpv3_checksum_method_ffisignaturerequest_is_ready() != 65051.toShort()) { @@ -2173,6 +2211,9 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) { if (lib.uniffi_xmtpv3_checksum_method_ffixmtpclient_find_inbox_id() != 59020.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_xmtpv3_checksum_method_ffixmtpclient_get_consent_state() != 58208.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_xmtpv3_checksum_method_ffixmtpclient_get_latest_inbox_state() != 3165.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -2206,6 +2247,9 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) { if (lib.uniffi_xmtpv3_checksum_method_ffixmtpclient_revoke_wallet() != 12211.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_xmtpv3_checksum_method_ffixmtpclient_set_consent_state() != 36178.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_xmtpv3_checksum_method_ffixmtpclient_signature_request() != 18270.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -3112,6 +3156,8 @@ public interface FfiGroupInterface { fun `adminList`(): List + fun `consentState`(): FfiConsentState + fun `createdAtNs`(): kotlin.Long fun `findMessages`(`opts`: FfiListMessagesOptions): List @@ -3166,6 +3212,8 @@ public interface FfiGroupInterface { suspend fun `sync`() + fun `updateConsentState`(`state`: FfiConsentState) + suspend fun `updateGroupDescription`(`groupDescription`: kotlin.String) suspend fun `updateGroupImageUrlSquare`(`groupImageUrlSquare`: kotlin.String) @@ -3425,6 +3473,20 @@ open class FfiGroup : Disposable, AutoCloseable, FfiGroupInterface { } + @Throws(GenericException::class) + override fun `consentState`(): FfiConsentState { + return FfiConverterTypeFfiConsentState.lift( + callWithPointer { + uniffiRustCallWithError(GenericException) { _status -> + UniffiLib.INSTANCE.uniffi_xmtpv3_fn_method_ffigroup_consent_state( + it, _status + ) + } + } + ) + } + + override fun `createdAtNs`(): kotlin.Long { return FfiConverterLong.lift( callWithPointer { @@ -3932,6 +3994,17 @@ open class FfiGroup : Disposable, AutoCloseable, FfiGroupInterface { } + @Throws(GenericException::class) + override fun `updateConsentState`(`state`: FfiConsentState) = + callWithPointer { + uniffiRustCallWithError(GenericException) { _status -> + UniffiLib.INSTANCE.uniffi_xmtpv3_fn_method_ffigroup_update_consent_state( + it, FfiConverterTypeFfiConsentState.lower(`state`), _status + ) + } + } + + @Throws(GenericException::class) @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE") override suspend fun `updateGroupDescription`(`groupDescription`: kotlin.String) { @@ -4729,7 +4802,8 @@ public interface FfiSignatureRequestInterface { suspend fun `addScwSignature`( `signatureBytes`: kotlin.ByteArray, `address`: kotlin.String, - `chainRpcUrl`: kotlin.String, + `chainId`: kotlin.ULong, + `blockNumber`: kotlin.ULong, ) suspend fun `isReady`(): kotlin.Boolean @@ -4864,7 +4938,8 @@ open class FfiSignatureRequest : Disposable, AutoCloseable, FfiSignatureRequestI override suspend fun `addScwSignature`( `signatureBytes`: kotlin.ByteArray, `address`: kotlin.String, - `chainRpcUrl`: kotlin.String, + `chainId`: kotlin.ULong, + `blockNumber`: kotlin.ULong, ) { return uniffiRustCallAsync( callWithPointer { thisPtr -> @@ -4872,7 +4947,8 @@ open class FfiSignatureRequest : Disposable, AutoCloseable, FfiSignatureRequestI thisPtr, FfiConverterByteArray.lower(`signatureBytes`), FfiConverterString.lower(`address`), - FfiConverterString.lower(`chainRpcUrl`), + FfiConverterULong.lower(`chainId`), + FfiConverterULong.lower(`blockNumber`), ) }, { future, callback, continuation -> @@ -6133,6 +6209,11 @@ public interface FfiXmtpClientInterface { suspend fun `findInboxId`(`address`: kotlin.String): kotlin.String? + suspend fun `getConsentState`( + `entityType`: FfiConsentEntityType, + `entity`: kotlin.String, + ): FfiConsentState + suspend fun `getLatestInboxState`(`inboxId`: kotlin.String): FfiInboxState fun `group`(`groupId`: kotlin.ByteArray): FfiGroup @@ -6167,6 +6248,12 @@ public interface FfiXmtpClientInterface { */ suspend fun `revokeWallet`(`walletAddress`: kotlin.String): FfiSignatureRequest + suspend fun `setConsentState`( + `state`: FfiConsentState, + `entityType`: FfiConsentEntityType, + `entity`: kotlin.String, + ) + fun `signatureRequest`(): FfiSignatureRequest? companion object @@ -6435,6 +6522,42 @@ open class FfiXmtpClient : Disposable, AutoCloseable, FfiXmtpClientInterface { } + @Throws(GenericException::class) + @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE") + override suspend fun `getConsentState`( + `entityType`: FfiConsentEntityType, + `entity`: kotlin.String, + ): FfiConsentState { + return uniffiRustCallAsync( + callWithPointer { thisPtr -> + UniffiLib.INSTANCE.uniffi_xmtpv3_fn_method_ffixmtpclient_get_consent_state( + thisPtr, + FfiConverterTypeFfiConsentEntityType.lower(`entityType`), + FfiConverterString.lower(`entity`), + ) + }, + { future, callback, continuation -> + UniffiLib.INSTANCE.ffi_xmtpv3_rust_future_poll_rust_buffer( + future, + callback, + continuation + ) + }, + { future, continuation -> + UniffiLib.INSTANCE.ffi_xmtpv3_rust_future_complete_rust_buffer( + future, + continuation + ) + }, + { future -> UniffiLib.INSTANCE.ffi_xmtpv3_rust_future_free_rust_buffer(future) }, + // lift function + { FfiConverterTypeFfiConsentState.lift(it) }, + // Error FFI converter + GenericException.ErrorHandler, + ) + } + + @Throws(GenericException::class) @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE") override suspend fun `getLatestInboxState`(`inboxId`: kotlin.String): FfiInboxState { @@ -6704,6 +6827,45 @@ open class FfiXmtpClient : Disposable, AutoCloseable, FfiXmtpClientInterface { ) } + + @Throws(GenericException::class) + @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE") + override suspend fun `setConsentState`( + `state`: FfiConsentState, + `entityType`: FfiConsentEntityType, + `entity`: kotlin.String, + ) { + return uniffiRustCallAsync( + callWithPointer { thisPtr -> + UniffiLib.INSTANCE.uniffi_xmtpv3_fn_method_ffixmtpclient_set_consent_state( + thisPtr, + FfiConverterTypeFfiConsentState.lower(`state`), + FfiConverterTypeFfiConsentEntityType.lower(`entityType`), + FfiConverterString.lower(`entity`), + ) + }, + { future, callback, continuation -> + UniffiLib.INSTANCE.ffi_xmtpv3_rust_future_poll_void( + future, + callback, + continuation + ) + }, + { future, continuation -> + UniffiLib.INSTANCE.ffi_xmtpv3_rust_future_complete_void( + future, + continuation + ) + }, + { future -> UniffiLib.INSTANCE.ffi_xmtpv3_rust_future_free_void(future) }, + // lift function + { Unit }, + + // Error FFI converter + GenericException.ErrorHandler, + ) + } + override fun `signatureRequest`(): FfiSignatureRequest? { return FfiConverterOptionalTypeFfiSignatureRequest.lift( callWithPointer { @@ -6857,6 +7019,7 @@ data class FfiGroupMember( var `accountAddresses`: List, var `installationIds`: List, var `permissionLevel`: FfiPermissionLevel, + var `consentState`: FfiConsentState, ) { companion object @@ -6869,6 +7032,7 @@ public object FfiConverterTypeFfiGroupMember : FfiConverterRustBuffer { + override fun read(buf: ByteBuffer) = try { + FfiConsentEntityType.values()[buf.getInt() - 1] + } catch (e: IndexOutOfBoundsException) { + throw RuntimeException("invalid enum value, something is very wrong!!", e) + } + + override fun allocationSize(value: FfiConsentEntityType) = 4UL + + override fun write(value: FfiConsentEntityType, buf: ByteBuffer) { + buf.putInt(value.ordinal + 1) + } +} + + +enum class FfiConsentState { + + UNKNOWN, + ALLOWED, + DENIED; + + companion object +} + + +public object FfiConverterTypeFfiConsentState : FfiConverterRustBuffer { + override fun read(buf: ByteBuffer) = try { + FfiConsentState.values()[buf.getInt() - 1] + } catch (e: IndexOutOfBoundsException) { + throw RuntimeException("invalid enum value, something is very wrong!!", e) + } + + override fun allocationSize(value: FfiConsentState) = 4UL + + override fun write(value: FfiConsentState, buf: ByteBuffer) { + buf.putInt(value.ordinal + 1) + } +} + + enum class FfiDeliveryStatus { UNPUBLISHED, diff --git a/library/src/main/jniLibs/arm64-v8a/libuniffi_xmtpv3.so b/library/src/main/jniLibs/arm64-v8a/libuniffi_xmtpv3.so index 5d3aeaf77..a7c1bb6e4 100644 Binary files a/library/src/main/jniLibs/arm64-v8a/libuniffi_xmtpv3.so and b/library/src/main/jniLibs/arm64-v8a/libuniffi_xmtpv3.so differ diff --git a/library/src/main/jniLibs/armeabi-v7a/libuniffi_xmtpv3.so b/library/src/main/jniLibs/armeabi-v7a/libuniffi_xmtpv3.so index e2fee1a2a..eeaf68bf2 100644 Binary files a/library/src/main/jniLibs/armeabi-v7a/libuniffi_xmtpv3.so and b/library/src/main/jniLibs/armeabi-v7a/libuniffi_xmtpv3.so differ diff --git a/library/src/main/jniLibs/x86/libuniffi_xmtpv3.so b/library/src/main/jniLibs/x86/libuniffi_xmtpv3.so index 76e0421fc..a8eaf0ac3 100644 Binary files a/library/src/main/jniLibs/x86/libuniffi_xmtpv3.so and b/library/src/main/jniLibs/x86/libuniffi_xmtpv3.so differ diff --git a/library/src/main/jniLibs/x86_64/libuniffi_xmtpv3.so b/library/src/main/jniLibs/x86_64/libuniffi_xmtpv3.so index e5c8548b1..d6a82fd29 100644 Binary files a/library/src/main/jniLibs/x86_64/libuniffi_xmtpv3.so and b/library/src/main/jniLibs/x86_64/libuniffi_xmtpv3.so differ