Skip to content

Commit

Permalink
update libxmtp for epoch and members fixes (#283)
Browse files Browse the repository at this point in the history
* update libxmtp for epoch and members fixes

* fix the bindings

* potential ci fix

---------

Co-authored-by: cameronvoell <[email protected]>
Co-authored-by: Naomi Plasterer <[email protected]>
  • Loading branch information
3 people authored Aug 7, 2024
1 parent 89d4d0f commit 5ba480d
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 43 deletions.
2 changes: 1 addition & 1 deletion dev/local/compose
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
set -eou pipefail

docker-compose -f dev/local/docker-compose.yml -p "xmtp-android" "$@"
docker compose -f dev/local/docker-compose.yml -p "xmtp-android" "$@"
4 changes: 2 additions & 2 deletions library/src/main/java/libxmtp-version.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: d36e048d
Version: 7d414613
Branch: main
Date: 2024-07-29 22:56:54 +0000
Date: 2024-08-07 00:18:12 +0000
84 changes: 44 additions & 40 deletions library/src/main/java/xmtpv3.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ open class RustBuffer : Structure() {
// When dealing with these fields, make sure to call `toULong()`.
@JvmField
var capacity: Long = 0

@JvmField
var len: Long = 0

@JvmField
var data: Pointer? = null

Expand Down Expand Up @@ -135,6 +137,7 @@ class RustBufferByReference : ByReference(16) {
open class ForeignBytes : Structure() {
@JvmField
var len: Int = 0

@JvmField
var data: Pointer? = null

Expand Down Expand Up @@ -223,6 +226,7 @@ internal const val UNIFFI_CALL_UNEXPECTED_ERROR = 2.toByte()
internal open class UniffiRustCallStatus : Structure() {
@JvmField
var code: Byte = 0

@JvmField
var error_buf: RustBuffer.ByValue = RustBuffer.ByValue()

Expand Down Expand Up @@ -264,7 +268,7 @@ interface UniffiRustCallStatusErrorHandler<E> {
// Call a rust function that returns a Result<>. Pass in the Error class companion that corresponds to the Err
private inline fun <U, E : kotlin.Exception> uniffiRustCallWithError(
errorHandler: UniffiRustCallStatusErrorHandler<E>,
callback: (UniffiRustCallStatus) -> U,
callback: (UniffiRustCallStatus) -> U
): U {
var status = UniffiRustCallStatus()
val return_value = callback(status)
Expand All @@ -275,7 +279,7 @@ private inline fun <U, E : kotlin.Exception> uniffiRustCallWithError(
// Check UniffiRustCallStatus and throw an error if the call wasn't successful
private fun <E : kotlin.Exception> uniffiCheckCallStatus(
errorHandler: UniffiRustCallStatusErrorHandler<E>,
status: UniffiRustCallStatus,
status: UniffiRustCallStatus
) {
if (status.isSuccess()) {
return
Expand Down Expand Up @@ -325,7 +329,7 @@ internal inline fun <T, reified E : Throwable> uniffiTraitInterfaceCallWithError
callStatus: UniffiRustCallStatus,
makeCall: () -> T,
writeReturn: (T) -> Unit,
lowerError: (E) -> RustBuffer.ByValue,
lowerError: (E) -> RustBuffer.ByValue
) {
try {
writeReturn(makeCall())
Expand Down Expand Up @@ -380,7 +384,7 @@ private fun findLibraryName(componentName: String): String {
}

private inline fun <reified Lib : Library> loadIndirect(
componentName: String,
componentName: String
): Lib {
return Native.load<Lib>(findLibraryName(componentName), Lib::class.java)
}
Expand Down Expand Up @@ -2210,7 +2214,7 @@ internal suspend fun <T, F, E : kotlin.Exception> uniffiRustCallAsync(
completeFunc: (Long, UniffiRustCallStatus) -> F,
freeFunc: (Long) -> Unit,
liftFunc: (F) -> T,
errorHandler: UniffiRustCallStatusErrorHandler<E>,
errorHandler: UniffiRustCallStatusErrorHandler<E>
): T {
try {
do {
Expand Down Expand Up @@ -2594,7 +2598,7 @@ private class JavaLangRefCleaner : UniffiCleaner {
}

private class JavaLangRefCleanable(
val cleanable: java.lang.ref.Cleaner.Cleanable,
val cleanable: java.lang.ref.Cleaner.Cleanable
) : UniffiCleaner.Cleanable {
override fun clean() = cleanable.clean()
}
Expand All @@ -2603,7 +2607,7 @@ public interface FfiConversationsInterface {

suspend fun `createGroup`(
`accountAddresses`: List<kotlin.String>,
`opts`: FfiCreateGroupOptions,
`opts`: FfiCreateGroupOptions
): FfiGroup

suspend fun `list`(`opts`: FfiListConversationsOptions): List<FfiGroup>
Expand Down Expand Up @@ -2705,7 +2709,7 @@ open class FfiConversations : Disposable, AutoCloseable, FfiConversationsInterfa
@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
override suspend fun `createGroup`(
`accountAddresses`: List<kotlin.String>,
`opts`: FfiCreateGroupOptions,
`opts`: FfiCreateGroupOptions
): FfiGroup {
return uniffiRustCallAsync(
callWithPointer { thisPtr ->
Expand Down Expand Up @@ -3103,7 +3107,7 @@ public interface FfiGroupInterface {
suspend fun `updatePermissionPolicy`(
`permissionUpdateType`: FfiPermissionUpdateType,
`permissionPolicyOption`: FfiPermissionPolicy,
`metadataField`: FfiMetadataField?,
`metadataField`: FfiMetadataField?
)

companion object
Expand Down Expand Up @@ -3995,7 +3999,7 @@ open class FfiGroup : Disposable, AutoCloseable, FfiGroupInterface {
override suspend fun `updatePermissionPolicy`(
`permissionUpdateType`: FfiPermissionUpdateType,
`permissionPolicyOption`: FfiPermissionPolicy,
`metadataField`: FfiMetadataField?,
`metadataField`: FfiMetadataField?
) {
return uniffiRustCallAsync(
callWithPointer { thisPtr ->
Expand Down Expand Up @@ -4655,7 +4659,7 @@ public interface FfiSignatureRequestInterface {
suspend fun `addScwSignature`(
`signatureBytes`: kotlin.ByteArray,
`address`: kotlin.String,
`chainRpcUrl`: kotlin.String,
`chainRpcUrl`: kotlin.String
)

suspend fun `isReady`(): kotlin.Boolean
Expand Down Expand Up @@ -4790,7 +4794,7 @@ open class FfiSignatureRequest : Disposable, AutoCloseable, FfiSignatureRequestI
override suspend fun `addScwSignature`(
`signatureBytes`: kotlin.ByteArray,
`address`: kotlin.String,
`chainRpcUrl`: kotlin.String,
`chainRpcUrl`: kotlin.String
) {
return uniffiRustCallAsync(
callWithPointer { thisPtr ->
Expand Down Expand Up @@ -5352,7 +5356,7 @@ public interface FfiV2ApiClientInterface {

suspend fun `subscribe`(
`request`: FfiV2SubscribeRequest,
`callback`: FfiV2SubscriptionCallback,
`callback`: FfiV2SubscriptionCallback
): FfiV2Subscription

companion object
Expand Down Expand Up @@ -5551,7 +5555,7 @@ open class FfiV2ApiClient : Disposable, AutoCloseable, FfiV2ApiClientInterface {
@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
override suspend fun `subscribe`(
`request`: FfiV2SubscribeRequest,
`callback`: FfiV2SubscriptionCallback,
`callback`: FfiV2SubscriptionCallback
): FfiV2Subscription {
return uniffiRustCallAsync(
callWithPointer { thisPtr ->
Expand Down Expand Up @@ -6046,7 +6050,7 @@ public interface FfiXmtpClientInterface {
*/
suspend fun `addWallet`(
`existingWalletAddress`: kotlin.String,
`newWalletAddress`: kotlin.String,
`newWalletAddress`: kotlin.String
): FfiSignatureRequest

suspend fun `applySignatureRequest`(`signatureRequest`: FfiSignatureRequest)
Expand Down Expand Up @@ -6172,7 +6176,7 @@ open class FfiXmtpClient : Disposable, AutoCloseable, FfiXmtpClientInterface {
@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
override suspend fun `addWallet`(
`existingWalletAddress`: kotlin.String,
`newWalletAddress`: kotlin.String,
`newWalletAddress`: kotlin.String
): FfiSignatureRequest {
return uniffiRustCallAsync(
callWithPointer { thisPtr ->
Expand Down Expand Up @@ -6560,7 +6564,7 @@ data class FfiCreateGroupOptions(
var `groupImageUrlSquare`: kotlin.String?,
var `groupDescription`: kotlin.String?,
var `groupPinnedFrameUrl`: kotlin.String?,
var `customPermissionPolicySet`: FfiPermissionPolicySet?,
var `customPermissionPolicySet`: FfiPermissionPolicySet?
) {

companion object
Expand Down Expand Up @@ -6601,7 +6605,7 @@ public object FfiConverterTypeFfiCreateGroupOptions :

data class FfiCursor(
var `digest`: kotlin.ByteArray,
var `senderTimeNs`: kotlin.ULong,
var `senderTimeNs`: kotlin.ULong
) {

companion object
Expand Down Expand Up @@ -6630,7 +6634,7 @@ public object FfiConverterTypeFfiCursor : FfiConverterRustBuffer<FfiCursor> {
data class FfiEnvelope(
var `contentTopic`: kotlin.String,
var `timestampNs`: kotlin.ULong,
var `message`: kotlin.ByteArray,
var `message`: kotlin.ByteArray
) {

companion object
Expand Down Expand Up @@ -6663,7 +6667,7 @@ data class FfiGroupMember(
var `inboxId`: kotlin.String,
var `accountAddresses`: List<kotlin.String>,
var `installationIds`: List<kotlin.ByteArray>,
var `permissionLevel`: FfiPermissionLevel,
var `permissionLevel`: FfiPermissionLevel
) {

companion object
Expand Down Expand Up @@ -6698,7 +6702,7 @@ public object FfiConverterTypeFfiGroupMember : FfiConverterRustBuffer<FfiGroupMe
data class FfiListConversationsOptions(
var `createdAfterNs`: kotlin.Long?,
var `createdBeforeNs`: kotlin.Long?,
var `limit`: kotlin.Long?,
var `limit`: kotlin.Long?
) {

companion object
Expand Down Expand Up @@ -6732,7 +6736,7 @@ data class FfiListMessagesOptions(
var `sentBeforeNs`: kotlin.Long?,
var `sentAfterNs`: kotlin.Long?,
var `limit`: kotlin.Long?,
var `deliveryStatus`: FfiDeliveryStatus?,
var `deliveryStatus`: FfiDeliveryStatus?
) {

companion object
Expand Down Expand Up @@ -6772,7 +6776,7 @@ data class FfiMessage(
var `senderInboxId`: kotlin.String,
var `content`: kotlin.ByteArray,
var `kind`: FfiGroupMessageKind,
var `deliveryStatus`: FfiDeliveryStatus,
var `deliveryStatus`: FfiDeliveryStatus
) {

companion object
Expand Down Expand Up @@ -6816,7 +6820,7 @@ public object FfiConverterTypeFfiMessage : FfiConverterRustBuffer<FfiMessage> {
data class FfiPagingInfo(
var `limit`: kotlin.UInt,
var `cursor`: FfiCursor?,
var `direction`: FfiSortDirection,
var `direction`: FfiSortDirection
) {

companion object
Expand Down Expand Up @@ -6853,7 +6857,7 @@ data class FfiPermissionPolicySet(
var `updateGroupNamePolicy`: FfiPermissionPolicy,
var `updateGroupDescriptionPolicy`: FfiPermissionPolicy,
var `updateGroupImageUrlSquarePolicy`: FfiPermissionPolicy,
var `updateGroupPinnedFrameUrlPolicy`: FfiPermissionPolicy,
var `updateGroupPinnedFrameUrlPolicy`: FfiPermissionPolicy
) {

companion object
Expand Down Expand Up @@ -6899,7 +6903,7 @@ public object FfiConverterTypeFfiPermissionPolicySet :


data class FfiPublishRequest(
var `envelopes`: List<FfiEnvelope>,
var `envelopes`: List<FfiEnvelope>
) {

companion object
Expand All @@ -6923,7 +6927,7 @@ public object FfiConverterTypeFfiPublishRequest : FfiConverterRustBuffer<FfiPubl


data class FfiV2BatchQueryRequest(
var `requests`: List<FfiV2QueryRequest>,
var `requests`: List<FfiV2QueryRequest>
) {

companion object
Expand All @@ -6948,7 +6952,7 @@ public object FfiConverterTypeFfiV2BatchQueryRequest :


data class FfiV2BatchQueryResponse(
var `responses`: List<FfiV2QueryResponse>,
var `responses`: List<FfiV2QueryResponse>
) {

companion object
Expand Down Expand Up @@ -6976,7 +6980,7 @@ data class FfiV2QueryRequest(
var `contentTopics`: List<kotlin.String>,
var `startTimeNs`: kotlin.ULong,
var `endTimeNs`: kotlin.ULong,
var `pagingInfo`: FfiPagingInfo?,
var `pagingInfo`: FfiPagingInfo?
) {

companion object
Expand Down Expand Up @@ -7010,7 +7014,7 @@ public object FfiConverterTypeFfiV2QueryRequest : FfiConverterRustBuffer<FfiV2Qu

data class FfiV2QueryResponse(
var `envelopes`: List<FfiEnvelope>,
var `pagingInfo`: FfiPagingInfo?,
var `pagingInfo`: FfiPagingInfo?
) {

companion object
Expand All @@ -7037,7 +7041,7 @@ public object FfiConverterTypeFfiV2QueryResponse : FfiConverterRustBuffer<FfiV2Q


data class FfiV2SubscribeRequest(
var `contentTopics`: List<kotlin.String>,
var `contentTopics`: List<kotlin.String>
) {

companion object
Expand Down Expand Up @@ -8268,7 +8272,7 @@ suspend fun `createClient`(
`accountAddress`: kotlin.String,
`nonce`: kotlin.ULong,
`legacySignedPrivateKeyProto`: kotlin.ByteArray?,
`historySyncUrl`: kotlin.String?,
`historySyncUrl`: kotlin.String?
): FfiXmtpClient {
return uniffiRustCallAsync(
UniffiLib.INSTANCE.uniffi_xmtpv3_fn_func_create_client(
Expand Down Expand Up @@ -8338,7 +8342,7 @@ suspend fun `createV2Client`(`host`: kotlin.String, `isSecure`: kotlin.Boolean):
@Throws(GenericException::class)
fun `diffieHellmanK256`(
`privateKeyBytes`: kotlin.ByteArray,
`publicKeyBytes`: kotlin.ByteArray,
`publicKeyBytes`: kotlin.ByteArray
): kotlin.ByteArray {
return FfiConverterByteArray.lift(
uniffiRustCallWithError(GenericException) { _status ->
Expand Down Expand Up @@ -8382,7 +8386,7 @@ suspend fun `getInboxIdForAddress`(
`logger`: FfiLogger,
`host`: kotlin.String,
`isSecure`: kotlin.Boolean,
`accountAddress`: kotlin.String,
`accountAddress`: kotlin.String
): kotlin.String? {
return uniffiRustCallAsync(
UniffiLib.INSTANCE.uniffi_xmtpv3_fn_func_get_inbox_id_for_address(
Expand Down Expand Up @@ -8450,7 +8454,7 @@ fun `publicKeyFromPrivateKeyK256`(`privateKeyBytes`: kotlin.ByteArray): kotlin.B
@Throws(GenericException::class)
fun `recoverAddress`(
`signatureBytes`: kotlin.ByteArray,
`predigestMessage`: kotlin.String,
`predigestMessage`: kotlin.String
): kotlin.String {
return FfiConverterString.lift(
uniffiRustCallWithError(GenericException) { _status ->
Expand All @@ -8467,7 +8471,7 @@ fun `recoverAddress`(
@Throws(GenericException::class)
fun `recoverPublicKeyK256Keccak256`(
`message`: kotlin.ByteArray,
`signature`: kotlin.ByteArray,
`signature`: kotlin.ByteArray
): kotlin.ByteArray {
return FfiConverterByteArray.lift(
uniffiRustCallWithError(GenericException) { _status ->
Expand All @@ -8484,7 +8488,7 @@ fun `recoverPublicKeyK256Keccak256`(
@Throws(GenericException::class)
fun `recoverPublicKeyK256Sha256`(
`message`: kotlin.ByteArray,
`signature`: kotlin.ByteArray,
`signature`: kotlin.ByteArray
): kotlin.ByteArray {
return FfiConverterByteArray.lift(
uniffiRustCallWithError(GenericException) { _status ->
Expand Down Expand Up @@ -8512,7 +8516,7 @@ fun `sha256`(`input`: kotlin.ByteArray): kotlin.ByteArray {
fun `userPreferencesDecrypt`(
`publicKey`: kotlin.ByteArray,
`privateKey`: kotlin.ByteArray,
`message`: kotlin.ByteArray,
`message`: kotlin.ByteArray
): kotlin.ByteArray {
return FfiConverterByteArray.lift(
uniffiRustCallWithError(GenericException) { _status ->
Expand All @@ -8531,7 +8535,7 @@ fun `userPreferencesDecrypt`(
fun `userPreferencesEncrypt`(
`publicKey`: kotlin.ByteArray,
`privateKey`: kotlin.ByteArray,
`message`: kotlin.ByteArray,
`message`: kotlin.ByteArray
): kotlin.ByteArray {
return FfiConverterByteArray.lift(
uniffiRustCallWithError(GenericException) { _status ->
Expand All @@ -8551,7 +8555,7 @@ fun `verifyK256Sha256`(
`signedBy`: kotlin.ByteArray,
`message`: kotlin.ByteArray,
`signature`: kotlin.ByteArray,
`recoveryId`: kotlin.UByte,
`recoveryId`: kotlin.UByte
): kotlin.Boolean {
return FfiConverterBoolean.lift(
uniffiRustCallWithError(GenericException) { _status ->
Expand Down
Binary file modified library/src/main/jniLibs/arm64-v8a/libuniffi_xmtpv3.so
Binary file not shown.
Binary file modified library/src/main/jniLibs/armeabi-v7a/libuniffi_xmtpv3.so
Binary file not shown.
Binary file modified library/src/main/jniLibs/x86/libuniffi_xmtpv3.so
Binary file not shown.
Binary file modified library/src/main/jniLibs/x86_64/libuniffi_xmtpv3.so
Binary file not shown.

0 comments on commit 5ba480d

Please sign in to comment.