From a6a7d9b5a0c34e7c26a6c06ec23c4614dc9f6e78 Mon Sep 17 00:00:00 2001 From: Bartosz Rozwarski Date: Thu, 27 Jun 2024 09:12:16 +0100 Subject: [PATCH 1/4] optimistic pairing removal --- .../project.xcworkspace/xcshareddata/swiftpm/Package.resolved | 2 +- .../Services/Common/Delete/PairingDeleteRequester.swift | 2 +- Sources/WalletConnectSign/Services/SignCleanupService.swift | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Example/ExampleApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Example/ExampleApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 53859947e..3198e81b5 100644 --- a/Example/ExampleApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Example/ExampleApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -186,7 +186,7 @@ "repositoryURL": "https://github.com/WalletConnect/web3modal-swift", "state": { "branch": null, - "revision": "25abd7e5471f21d662400f9763948fbf97c60c97", + "revision": "3baac675811b5fdeb689cef703e3dfc7682704e6", "version": null } } diff --git a/Sources/WalletConnectPairing/Services/Common/Delete/PairingDeleteRequester.swift b/Sources/WalletConnectPairing/Services/Common/Delete/PairingDeleteRequester.swift index f976a3cd0..0c2355301 100644 --- a/Sources/WalletConnectPairing/Services/Common/Delete/PairingDeleteRequester.swift +++ b/Sources/WalletConnectPairing/Services/Common/Delete/PairingDeleteRequester.swift @@ -22,7 +22,7 @@ class PairingDeleteRequester { let pairingDeleteParams = PairingDeleteParams(code: reason.code, message: reason.message) logger.debug("Will delete pairing for reason: message: \(reason.message) code: \(reason.code)") let request = RPCRequest(method: protocolMethod.method, params: pairingDeleteParams) - try await networkingInteractor.request(request, topic: topic, protocolMethod: protocolMethod) + try? await networkingInteractor.request(request, topic: topic, protocolMethod: protocolMethod) pairingStorage.delete(topic: topic) kms.deleteSymmetricKey(for: topic) networkingInteractor.unsubscribe(topic: topic) diff --git a/Sources/WalletConnectSign/Services/SignCleanupService.swift b/Sources/WalletConnectSign/Services/SignCleanupService.swift index 5c2a6ec1c..fef62e04c 100644 --- a/Sources/WalletConnectSign/Services/SignCleanupService.swift +++ b/Sources/WalletConnectSign/Services/SignCleanupService.swift @@ -35,7 +35,7 @@ private extension SignCleanupService { let pairing = pairingStore.getAll().map { $0.topic } let session = sessionStore.getAll().map { $0.topic } - try await networkInteractor.batchUnsubscribe(topics: pairing + session) + try? await networkInteractor.batchUnsubscribe(topics: pairing + session) } func cleanupStorages() throws { @@ -43,6 +43,6 @@ private extension SignCleanupService { sessionStore.deleteAll() sessionTopicToProposal.deleteAll() rpcHistory.deleteAll() - try kms.deleteAll() + try? kms.deleteAll() } } From 4fe67fd14dfc84b250229f842e281cc32e5e30cb Mon Sep 17 00:00:00 2001 From: Bartosz Rozwarski Date: Thu, 27 Jun 2024 09:40:36 +0100 Subject: [PATCH 2/4] no throwing function --- .../project.xcworkspace/xcshareddata/swiftpm/Package.resolved | 2 +- Sources/WalletConnectPairing/PairingClient.swift | 4 ++-- .../Services/Common/Delete/PairingDeleteRequester.swift | 2 +- Sources/Web3Wallet/Web3WalletClient.swift | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Example/ExampleApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Example/ExampleApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 3198e81b5..53859947e 100644 --- a/Example/ExampleApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Example/ExampleApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -186,7 +186,7 @@ "repositoryURL": "https://github.com/WalletConnect/web3modal-swift", "state": { "branch": null, - "revision": "3baac675811b5fdeb689cef703e3dfc7682704e6", + "revision": "25abd7e5471f21d662400f9763948fbf97c60c97", "version": null } } diff --git a/Sources/WalletConnectPairing/PairingClient.swift b/Sources/WalletConnectPairing/PairingClient.swift index 44e79f7b2..233fcd76b 100644 --- a/Sources/WalletConnectPairing/PairingClient.swift +++ b/Sources/WalletConnectPairing/PairingClient.swift @@ -128,8 +128,8 @@ public class PairingClient: PairingRegisterer, PairingInteracting, PairingClient try await pingService.ping(topic: topic) } - public func disconnect(topic: String) async throws { - try await pairingDeleteRequester.delete(topic: topic) + public func disconnect(topic: String) async { + await pairingDeleteRequester.delete(topic: topic) } public func validatePairingExistance(_ topic: String) throws { diff --git a/Sources/WalletConnectPairing/Services/Common/Delete/PairingDeleteRequester.swift b/Sources/WalletConnectPairing/Services/Common/Delete/PairingDeleteRequester.swift index 0c2355301..c8c08ba34 100644 --- a/Sources/WalletConnectPairing/Services/Common/Delete/PairingDeleteRequester.swift +++ b/Sources/WalletConnectPairing/Services/Common/Delete/PairingDeleteRequester.swift @@ -16,7 +16,7 @@ class PairingDeleteRequester { self.logger = logger } - func delete(topic: String) async throws { + func delete(topic: String) async { let reason = PairingReasonCode.userDisconnected let protocolMethod = PairingProtocolMethod.delete let pairingDeleteParams = PairingDeleteParams(code: reason.code, message: reason.message) diff --git a/Sources/Web3Wallet/Web3WalletClient.swift b/Sources/Web3Wallet/Web3WalletClient.swift index 1ca6727d2..7b062359b 100644 --- a/Sources/Web3Wallet/Web3WalletClient.swift +++ b/Sources/Web3Wallet/Web3WalletClient.swift @@ -177,7 +177,7 @@ public class Web3WalletClient { try await pairingClient.pair(uri: uri) } - public func disconnectPairing(topic: String) async throws { + public func disconnectPairing(topic: String) async { try await pairingClient.disconnect(topic: topic) } From ccf37f8b4f45c28a24379e93d39238d8568893fe Mon Sep 17 00:00:00 2001 From: Bartosz Rozwarski Date: Thu, 27 Jun 2024 10:52:12 +0100 Subject: [PATCH 3/4] fix build --- Sources/WalletConnectPairing/PairingClientProtocol.swift | 2 +- Sources/Web3Wallet/Web3WalletClient.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/WalletConnectPairing/PairingClientProtocol.swift b/Sources/WalletConnectPairing/PairingClientProtocol.swift index 905c1b4e8..f97e1458f 100644 --- a/Sources/WalletConnectPairing/PairingClientProtocol.swift +++ b/Sources/WalletConnectPairing/PairingClientProtocol.swift @@ -6,6 +6,6 @@ public protocol PairingClientProtocol { var pairingStatePublisher: AnyPublisher {get} var pairingExpirationPublisher: AnyPublisher {get} func pair(uri: WalletConnectURI) async throws - func disconnect(topic: String) async throws + func disconnect(topic: String) async func getPairings() -> [Pairing] } diff --git a/Sources/Web3Wallet/Web3WalletClient.swift b/Sources/Web3Wallet/Web3WalletClient.swift index 7b062359b..84f636b92 100644 --- a/Sources/Web3Wallet/Web3WalletClient.swift +++ b/Sources/Web3Wallet/Web3WalletClient.swift @@ -178,7 +178,7 @@ public class Web3WalletClient { } public func disconnectPairing(topic: String) async { - try await pairingClient.disconnect(topic: topic) + await pairingClient.disconnect(topic: topic) } /// For a wallet and a dApp to terminate a session From 4e3826aece1130e8fc1a16122416bc54bdf1a14c Mon Sep 17 00:00:00 2001 From: llbartekll Date: Thu, 27 Jun 2024 11:52:59 +0000 Subject: [PATCH 4/4] Set User Agent --- Sources/WalletConnectRelay/PackageConfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/WalletConnectRelay/PackageConfig.json b/Sources/WalletConnectRelay/PackageConfig.json index b9ab60bd3..ec58e3328 100644 --- a/Sources/WalletConnectRelay/PackageConfig.json +++ b/Sources/WalletConnectRelay/PackageConfig.json @@ -1 +1 @@ -{"version": "1.19.3"} +{"version": "1.19.4"}