diff --git a/LibXMTP.podspec b/LibXMTP.podspec index 22f9947..bca7852 100644 --- a/LibXMTP.podspec +++ b/LibXMTP.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'LibXMTP' - s.version = '0.5.9-beta1' + s.version = '0.5.9-beta2' s.summary = 'XMTP shared Rust code that powers cross-platform SDKs' s.homepage = 'https://github.com/xmtp/libxmtp-swift' @@ -10,7 +10,7 @@ Pod::Spec.new do |s| s.platform = :ios, '14.0', :macos, '11.0' s.swift_version = '5.3' - s.source = { :http => "https://github.com/xmtp/libxmtp/releases/download/swift-bindings-137062e/LibXMTPSwiftFFI.zip", :type => :zip } + s.source = { :http => "https://github.com/xmtp/libxmtp/releases/download/swift-bindings-387d033/LibXMTPSwiftFFI.zip", :type => :zip } s.vendored_frameworks = 'LibXMTPSwiftFFI.xcframework' s.source_files = 'Sources/LibXMTP/**/*' end diff --git a/Package.swift b/Package.swift index c86b427..2e8418d 100644 --- a/Package.swift +++ b/Package.swift @@ -27,8 +27,8 @@ let package = Package( ), .binaryTarget( name: "LibXMTPSwiftFFI", - url: "https://github.com/xmtp/libxmtp/releases/download/swift-bindings-137062e/LibXMTPSwiftFFI.zip", - checksum: "57c6338bb1ec576aaeeaf2d1283f4cf4acb90de8605d01176ebc51f5fa1bd9ff" + url: "https://github.com/xmtp/libxmtp/releases/download/swift-bindings-387d033/LibXMTPSwiftFFI.zip", + checksum: "7cd3d6fc639cf1e68f60fbe56a3ca7d50b32a1c3c43502121619c3f71f4e3777" ), .testTarget(name: "LibXMTPTests", dependencies: ["LibXMTP"]), ] diff --git a/Sources/LibXMTP/libxmtp-version.txt b/Sources/LibXMTP/libxmtp-version.txt index 8e2ce39..cb12914 100644 --- a/Sources/LibXMTP/libxmtp-version.txt +++ b/Sources/LibXMTP/libxmtp-version.txt @@ -1,3 +1,3 @@ -Version: 137062e8 +Version: 387d0333 Branch: main -Date: 2024-10-08 19:58:58 +0000 +Date: 2024-10-10 20:54:05 +0000 diff --git a/Sources/LibXMTP/xmtpv3.swift b/Sources/LibXMTP/xmtpv3.swift index bfd560b..28d6f87 100644 --- a/Sources/LibXMTP/xmtpv3.swift +++ b/Sources/LibXMTP/xmtpv3.swift @@ -2163,6 +2163,14 @@ public protocol FfiXmtpClientProtocol: AnyObject { */ func addWallet(existingWalletAddress: String, newWalletAddress: String) async throws -> FfiSignatureRequest + /** + * * Get the inbox state for each `inbox_id`. + * * + * * If `refresh_from_network` is true, the client will go to the network first to refresh the state. + * * Otherwise, the state will be read from the local database. + */ + func addressesFromInboxId(refreshFromNetwork: Bool, inboxIds: [String]) async throws -> [FfiInboxState] + func applySignatureRequest(signatureRequest: FfiSignatureRequest) async throws func canMessage(accountAddresses: [String]) async throws -> [String: Bool] @@ -2274,6 +2282,29 @@ open class FfiXmtpClient: ) } + /** + * * Get the inbox state for each `inbox_id`. + * * + * * If `refresh_from_network` is true, the client will go to the network first to refresh the state. + * * Otherwise, the state will be read from the local database. + */ + open func addressesFromInboxId(refreshFromNetwork: Bool, inboxIds: [String]) async throws -> [FfiInboxState] { + return + try await uniffiRustCallAsync( + rustFutureFunc: { + uniffi_xmtpv3_fn_method_ffixmtpclient_addresses_from_inbox_id( + self.uniffiClonePointer(), + FfiConverterBool.lower(refreshFromNetwork), FfiConverterSequenceString.lower(inboxIds) + ) + }, + pollFunc: ffi_xmtpv3_rust_future_poll_rust_buffer, + completeFunc: ffi_xmtpv3_rust_future_complete_rust_buffer, + freeFunc: ffi_xmtpv3_rust_future_free_rust_buffer, + liftFunc: FfiConverterSequenceTypeFfiInboxState.lift, + errorHandler: FfiConverterTypeGenericError.lift + ) + } + open func applySignatureRequest(signatureRequest: FfiSignatureRequest) async throws { return try await uniffiRustCallAsync( @@ -5132,6 +5163,28 @@ private struct FfiConverterSequenceTypeFfiGroupMember: FfiConverterRustBuffer { } } +private struct FfiConverterSequenceTypeFfiInboxState: FfiConverterRustBuffer { + typealias SwiftType = [FfiInboxState] + + public static func write(_ value: [FfiInboxState], into buf: inout [UInt8]) { + let len = Int32(value.count) + writeInt(&buf, len) + for item in value { + FfiConverterTypeFfiInboxState.write(item, into: &buf) + } + } + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [FfiInboxState] { + let len: Int32 = try readInt(&buf) + var seq = [FfiInboxState]() + seq.reserveCapacity(Int(len)) + for _ in 0 ..< len { + try seq.append(FfiConverterTypeFfiInboxState.read(from: &buf)) + } + return seq + } +} + private struct FfiConverterSequenceTypeFfiInstallation: FfiConverterRustBuffer { typealias SwiftType = [FfiInstallation] @@ -5730,6 +5783,9 @@ private var initializationResult: InitializationResult = { if uniffi_xmtpv3_checksum_method_ffixmtpclient_add_wallet() != 23786 { return InitializationResult.apiChecksumMismatch } + if uniffi_xmtpv3_checksum_method_ffixmtpclient_addresses_from_inbox_id() != 29264 { + return InitializationResult.apiChecksumMismatch + } if uniffi_xmtpv3_checksum_method_ffixmtpclient_apply_signature_request() != 32172 { return InitializationResult.apiChecksumMismatch }