From bb2f36db277a5fcd1ff9949395749bab33635af6 Mon Sep 17 00:00:00 2001 From: Bartosz Rozwarski Date: Tue, 23 Jan 2024 11:33:16 +0100 Subject: [PATCH] fix compatibility issue --- .../WalletConnectSign/Engine/Common/SessionEngine.swift | 4 ++-- Sources/WalletConnectSign/Request.swift | 8 ++++---- Sources/WalletConnectSign/Services/HistoryService.swift | 2 +- Sources/WalletConnectSign/SignDecryptionService.swift | 2 +- Sources/WalletConnectSign/Types/Session/SessionType.swift | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Sources/WalletConnectSign/Engine/Common/SessionEngine.swift b/Sources/WalletConnectSign/Engine/Common/SessionEngine.swift index 9d252423f..9d0c034f6 100644 --- a/Sources/WalletConnectSign/Engine/Common/SessionEngine.swift +++ b/Sources/WalletConnectSign/Engine/Common/SessionEngine.swift @@ -63,7 +63,7 @@ final class SessionEngine { guard session.hasPermission(forMethod: request.method, onChain: request.chainId) else { throw WalletConnectError.invalidPermissions } - let chainRequest = SessionType.RequestParams.Request(method: request.method, params: request.params, expiry: request.expiryTimestamp) + let chainRequest = SessionType.RequestParams.Request(method: request.method, params: request.params, expiryTimestamp: request.expiryTimestamp) let sessionRequestParams = SessionType.RequestParams(request: chainRequest, chainId: request.chainId) let ttl = try request.calculateTtl() let protocolMethod = SessionRequestProtocolMethod(ttl: ttl) @@ -229,7 +229,7 @@ private extension SessionEngine { method: payload.request.request.method, params: payload.request.request.params, chainId: payload.request.chainId, - expiry: payload.request.request.expiry + expiryTimestamp: payload.request.request.expiryTimestamp ) guard let session = sessionStore.getSession(forTopic: topic) else { return respondError(payload: payload, reason: .noSessionForTopic, protocolMethod: protocolMethod) diff --git a/Sources/WalletConnectSign/Request.swift b/Sources/WalletConnectSign/Request.swift index f5404ec0b..3898d45df 100644 --- a/Sources/WalletConnectSign/Request.swift +++ b/Sources/WalletConnectSign/Request.swift @@ -30,7 +30,7 @@ public struct Request: Codable, Equatable { } let calculatedExpiry = UInt64(Date().timeIntervalSince1970) + UInt64(ttl) - self.init(id: RPCID(JsonRpcID.generate()), topic: topic, method: method, params: params, chainId: chainId, expiry: calculatedExpiry) + self.init(id: RPCID(JsonRpcID.generate()), topic: topic, method: method, params: params, chainId: chainId, expiryTimestamp: calculatedExpiry) } init(id: RPCID, topic: String, method: String, params: C, chainId: Blockchain, ttl: TimeInterval = 300) throws where C: Codable { @@ -39,16 +39,16 @@ public struct Request: Codable, Equatable { } let calculatedExpiry = UInt64(Date().timeIntervalSince1970) + UInt64(ttl) - self.init(id: id, topic: topic, method: method, params: AnyCodable(params), chainId: chainId, expiry: calculatedExpiry) + self.init(id: id, topic: topic, method: method, params: AnyCodable(params), chainId: chainId, expiryTimestamp: calculatedExpiry) } - internal init(id: RPCID, topic: String, method: String, params: AnyCodable, chainId: Blockchain, expiry: UInt64?) { + internal init(id: RPCID, topic: String, method: String, params: AnyCodable, chainId: Blockchain, expiryTimestamp: UInt64?) { self.id = id self.topic = topic self.method = method self.params = params self.chainId = chainId - self.expiryTimestamp = expiry + self.expiryTimestamp = expiryTimestamp } func isExpired(currentDate: Date = Date()) -> Bool { diff --git a/Sources/WalletConnectSign/Services/HistoryService.swift b/Sources/WalletConnectSign/Services/HistoryService.swift index 95129d427..a34f52bb5 100644 --- a/Sources/WalletConnectSign/Services/HistoryService.swift +++ b/Sources/WalletConnectSign/Services/HistoryService.swift @@ -50,7 +50,7 @@ private extension HistoryService { method: request.request.method, params: request.request.params, chainId: request.chainId, - expiry: request.request.expiry + expiryTimestamp: request.request.expiryTimestamp ) return (mappedRequest, record.id) diff --git a/Sources/WalletConnectSign/SignDecryptionService.swift b/Sources/WalletConnectSign/SignDecryptionService.swift index 8b0e82125..588d07337 100644 --- a/Sources/WalletConnectSign/SignDecryptionService.swift +++ b/Sources/WalletConnectSign/SignDecryptionService.swift @@ -37,7 +37,7 @@ public class SignDecryptionService { method: request.request.method, params: request.request.params, chainId: request.chainId, - expiry: request.request.expiry + expiryTimestamp: request.request.expiryTimestamp ) return request diff --git a/Sources/WalletConnectSign/Types/Session/SessionType.swift b/Sources/WalletConnectSign/Types/Session/SessionType.swift index cc838f084..d4411aa9a 100644 --- a/Sources/WalletConnectSign/Types/Session/SessionType.swift +++ b/Sources/WalletConnectSign/Types/Session/SessionType.swift @@ -43,7 +43,7 @@ internal enum SessionType { struct Request: Codable, Equatable { let method: String let params: AnyCodable - let expiry: UInt64? + let expiryTimestamp: UInt64? } }