diff --git a/Package.swift b/Package.swift index 6b39be7d..2dae8028 100644 --- a/Package.swift +++ b/Package.swift @@ -25,7 +25,7 @@ let package = Package( .package(url: "https://github.com/1024jp/GzipSwift", from: "5.2.0"), .package(url: "https://github.com/bufbuild/connect-swift", exact: "0.12.0"), .package(url: "https://github.com/apple/swift-docc-plugin.git", from: "1.0.0"), - .package(url: "https://github.com/xmtp/libxmtp-swift.git", exact: "0.6.0"), + .package(url: "https://github.com/xmtp/libxmtp-swift.git", exact: "3.0.1"), ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. diff --git a/Sources/XMTPiOS/ApiClient.swift b/Sources/XMTPiOS/ApiClient.swift index bc58da9d..4272924b 100644 --- a/Sources/XMTPiOS/ApiClient.swift +++ b/Sources/XMTPiOS/ApiClient.swift @@ -40,6 +40,8 @@ extension GenericErrorDescribing { let .SignatureRequestError(message), let .Erc1271SignatureError(message), let .FailedToConvertToU32(message), + let .Association(message), + let .DeviceSync(message), let .Verifier(message): return message } diff --git a/Sources/XMTPiOS/Client.swift b/Sources/XMTPiOS/Client.swift index bbd9cd0a..60549b76 100644 --- a/Sources/XMTPiOS/Client.swift +++ b/Sources/XMTPiOS/Client.swift @@ -180,7 +180,7 @@ public final class Client { inboxId: String ) async throws -> Client { let (libxmtpClient, dbPath) = try await initV3Client( - accountAddress: accountAddress, + accountAddress: accountAddress.lowercased(), options: options, privateKeyBundleV1: nil, signingKey: signingKey, @@ -192,7 +192,7 @@ public final class Client { } let client = try Client( - address: accountAddress, + address: accountAddress.lowercased(), v3Client: v3Client, dbPath: dbPath, installationID: v3Client.installationId().toHex, @@ -307,7 +307,7 @@ public final class Client { message: signatureRequest.signatureText()) try await signatureRequest.addScwSignature( signatureBytes: signedData, - address: signingKey.address, + address: signingKey.address.lowercased(), chainId: UInt64(chainId), blockNumber: signingKey.blockNumber.flatMap { $0 >= 0 ? UInt64($0) : nil @@ -445,10 +445,10 @@ public final class Client { logger: XMTPLogger(), host: options.api.env.url, isSecure: options.api.env.isSecure == true, - accountAddress: address - ) ?? generateInboxId(accountAddress: address, nonce: 0) + accountAddress: address.lowercased() + ) ?? generateInboxId(accountAddress: address.lowercased(), nonce: 0) } catch { - inboxId = generateInboxId(accountAddress: address, nonce: 0) + inboxId = try generateInboxId(accountAddress: address.lowercased(), nonce: 0) } return inboxId } @@ -882,7 +882,7 @@ public final class Client { guard let client = v3Client else { throw ClientError.noV3Client("Error no V3 client initialized") } - try await client.requestHistorySync() + try await client.sendSyncRequest(kind: .messages) } public func revokeAllOtherInstallations(signingKey: SigningKey) async throws diff --git a/Sources/XMTPiOS/Conversations.swift b/Sources/XMTPiOS/Conversations.swift index 1691051c..6af9ab90 100644 --- a/Sources/XMTPiOS/Conversations.swift +++ b/Sources/XMTPiOS/Conversations.swift @@ -367,15 +367,14 @@ public actor Conversations { } do { let conversationType = - try conversation.groupMetadata() - .conversationType() - if conversationType == "dm" { + try conversation.conversationType() + if conversationType == .dm { continuation.yield( Conversation.dm( conversation.dmFromFFI( client: self.client)) ) - } else if conversationType == "group" { + } else if conversationType == .group { continuation.yield( Conversation.group( conversation.groupFromFFI( diff --git a/Sources/XMTPiOS/Extensions/Ffi.swift b/Sources/XMTPiOS/Extensions/Ffi.swift index 9da6402c..7190ac37 100644 --- a/Sources/XMTPiOS/Extensions/Ffi.swift +++ b/Sources/XMTPiOS/Extensions/Ffi.swift @@ -205,7 +205,7 @@ extension FfiConversation { } func toConversation(client: Client) throws -> Conversation { - if (try groupMetadata().conversationType() == "dm") { + if (try conversationType() == .dm) { return Conversation.dm(self.dmFromFFI(client: client)) } else { return Conversation.group(self.groupFromFFI(client: client)) diff --git a/Tests/XMTPTests/DmTests.swift b/Tests/XMTPTests/DmTests.swift index 443352b4..3329a838 100644 --- a/Tests/XMTPTests/DmTests.swift +++ b/Tests/XMTPTests/DmTests.swift @@ -130,7 +130,7 @@ class DmTests: XCTestCase { XCTAssertEqual(firstMessage.id, messageId) XCTAssertEqual(firstMessage.deliveryStatus, .published) let messages = try await dm.messages() - XCTAssertEqual(messages.count, 3) + XCTAssertEqual(messages.count, 2) try await fixtures.alixClient.conversations.sync() let sameDm = try await fixtures.alixClient.conversations.dms().last! diff --git a/Tests/XMTPTests/V3ClientTests.swift b/Tests/XMTPTests/V3ClientTests.swift index fe6f8085..d5cfc030 100644 --- a/Tests/XMTPTests/V3ClientTests.swift +++ b/Tests/XMTPTests/V3ClientTests.swift @@ -241,7 +241,7 @@ class V3ClientTests: XCTestCase { XCTAssertEqual(dmMessages.first?.body, "gm") XCTAssertEqual(dmMessages.first?.id, messageId) XCTAssertEqual(dmMessages.first?.deliveryStatus, .published) - XCTAssertEqual(dmMessages.count, 3) + XCTAssertEqual(dmMessages.count, 2) try await fixtures.caroV2V3Client.conversations.sync() let sameDm = try await fixtures.caroV2V3Client.findDm( diff --git a/XMTP.podspec b/XMTP.podspec index ba8f3070..b80eeecd 100644 --- a/XMTP.podspec +++ b/XMTP.podspec @@ -16,7 +16,7 @@ Pod::Spec.new do |spec| # spec.name = "XMTP" - spec.version = "0.16.3" + spec.version = "0.16.4" spec.summary = "XMTP SDK Cocoapod" # This description is used to generate tags and improve search results. @@ -44,5 +44,5 @@ Pod::Spec.new do |spec| spec.dependency "web3.swift" spec.dependency "GzipSwift" spec.dependency "Connect-Swift", "= 0.12.0" - spec.dependency 'LibXMTP', '= 0.6.0' + spec.dependency 'LibXMTP', '= 3.0.1' end diff --git a/XMTPiOSExample/XMTPiOSExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/XMTPiOSExample/XMTPiOSExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index c4ca3104..1e1fef94 100644 --- a/XMTPiOSExample/XMTPiOSExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/XMTPiOSExample/XMTPiOSExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -59,8 +59,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/xmtp/libxmtp-swift.git", "state" : { - "revision" : "91653cdaf999119f99189178867e32dcc53b11e8", - "version" : "0.6.0" + "revision" : "f495d4feaab40a0a6a48c1d5a99585de8107f5d2", + "version" : "3.0.1" } }, {