From 1fc6cd67563f58b37694b4453556c5be0feb8938 Mon Sep 17 00:00:00 2001 From: august Date: Tue, 18 Apr 2023 11:38:12 +0800 Subject: [PATCH] fix: init Web3HttpProvider without chain id --- .../EthereumNetwork/Request/APIRequest+ComputedProperties.swift | 2 +- .../EthereumNetwork/Request/APIRequest+UtilityTypes.swift | 2 +- Sources/web3swift/Web3/Web3+HttpProvider.swift | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/Web3Core/EthereumNetwork/Request/APIRequest+ComputedProperties.swift b/Sources/Web3Core/EthereumNetwork/Request/APIRequest+ComputedProperties.swift index cfa7f5190..986e8332d 100644 --- a/Sources/Web3Core/EthereumNetwork/Request/APIRequest+ComputedProperties.swift +++ b/Sources/Web3Core/EthereumNetwork/Request/APIRequest+ComputedProperties.swift @@ -8,7 +8,7 @@ import Foundation extension APIRequest { - var method: REST { + public var method: REST { .POST } diff --git a/Sources/Web3Core/EthereumNetwork/Request/APIRequest+UtilityTypes.swift b/Sources/Web3Core/EthereumNetwork/Request/APIRequest+UtilityTypes.swift index ca55d622f..ba8a362f6 100644 --- a/Sources/Web3Core/EthereumNetwork/Request/APIRequest+UtilityTypes.swift +++ b/Sources/Web3Core/EthereumNetwork/Request/APIRequest+UtilityTypes.swift @@ -14,7 +14,7 @@ public struct APIResponse: Decodable where Result: APIResultType { public var result: Result } -enum REST: String { +public enum REST: String { case POST case GET } diff --git a/Sources/web3swift/Web3/Web3+HttpProvider.swift b/Sources/web3swift/Web3/Web3+HttpProvider.swift index a6411552d..da37f1df9 100755 --- a/Sources/web3swift/Web3/Web3+HttpProvider.swift +++ b/Sources/web3swift/Web3/Web3+HttpProvider.swift @@ -36,7 +36,7 @@ public class Web3HttpProvider: Web3Provider { var urlRequest = URLRequest(url: url, cachePolicy: .reloadIgnoringCacheData) urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type") urlRequest.setValue("application/json", forHTTPHeaderField: "Accept") - urlRequest.httpMethod = APIRequest.getNetwork.call + urlRequest.httpMethod = APIRequest.getNetwork.method.rawValue urlRequest.httpBody = APIRequest.getNetwork.encodedBody let response: APIResponse = try await APIRequest.send(uRLRequest: urlRequest, with: session) self.network = Networks.fromInt(response.result)