From 154ff6de6bf19fac934ad01528b5247bf313e1a1 Mon Sep 17 00:00:00 2001 From: Peter Ferguson Date: Mon, 21 Oct 2024 14:00:11 +0100 Subject: [PATCH 1/2] match ios sca types to RN --- Sources/XMTPiOS/Client.swift | 4 ++-- Sources/XMTPiOS/SigningKey.swift | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Sources/XMTPiOS/Client.swift b/Sources/XMTPiOS/Client.swift index 010602d2..d1314fd7 100644 --- a/Sources/XMTPiOS/Client.swift +++ b/Sources/XMTPiOS/Client.swift @@ -210,9 +210,9 @@ public final class Client { ) } - public static func buildV3(address: String, chainId: Int64? = nil, options: ClientOptions) async throws -> Client { + public static func buildV3(address: String, chainId: UInt64? = nil, options: ClientOptions) async throws -> Client { let accountAddress = chainId != nil ? - "eip155:\(String(describing: chainId)):\(address.lowercased())" : + "eip155:\(String(describing: chainId!)):\(address.lowercased())" : address let inboxId = try await getOrCreateInboxId(options: options, address: accountAddress) diff --git a/Sources/XMTPiOS/SigningKey.swift b/Sources/XMTPiOS/SigningKey.swift index 5c720edf..c9b4971a 100644 --- a/Sources/XMTPiOS/SigningKey.swift +++ b/Sources/XMTPiOS/SigningKey.swift @@ -24,10 +24,10 @@ public protocol SigningKey { var isSmartContractWallet: Bool { get } /// The name of the chainId for example "1" - var chainId: Int64? { get } + var chainId: UInt64? { get } /// The blockNumber of the chain for example "1" - var blockNumber: Int64? { get } + var blockNumber: UInt64? { get } /// Sign the data and return a secp256k1 compact recoverable signature. func sign(_ data: Data) async throws -> Signature @@ -45,11 +45,11 @@ extension SigningKey { return false } - public var chainId: Int64? { + public var chainId: UInt64? { return nil } - public var blockNumber: Int64? { + public var blockNumber: UInt64? { return nil } From a4ff78e90c4e81b18f73161837606e1667952440 Mon Sep 17 00:00:00 2001 From: Peter Ferguson Date: Mon, 21 Oct 2024 14:02:42 +0100 Subject: [PATCH 2/2] fix unwrap chain id on ios createV3 --- Sources/XMTPiOS/Client.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/XMTPiOS/Client.swift b/Sources/XMTPiOS/Client.swift index d1314fd7..8925e642 100644 --- a/Sources/XMTPiOS/Client.swift +++ b/Sources/XMTPiOS/Client.swift @@ -197,8 +197,8 @@ public final class Client { } public static func createV3(account: SigningKey, options: ClientOptions) async throws -> Client { - let accountAddress = account.isSmartContractWallet ? - "eip155:\(String(describing: account.chainId)):\(account.address.lowercased())" : + let accountAddress = account.chainId != nil ? + "eip155:\(String(describing: account.chainId!)):\(account.address.lowercased())" : account.address let inboxId = try await getOrCreateInboxId(options: options, address: accountAddress)