Skip to content

Commit 3c4d4a5

Browse files
committed
Merge remote-tracking branch 'origin/develop'
2 parents d65094c + b50f919 commit 3c4d4a5

File tree

8 files changed

+29
-4
lines changed

8 files changed

+29
-4
lines changed

Package.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ let package = Package(
55
name: "web3.swift",
66
platforms: [
77
.iOS(SupportedPlatform.IOSVersion.v13),
8-
.macOS(SupportedPlatform.MacOSVersion.v11)
8+
.macOS(SupportedPlatform.MacOSVersion.v11),
9+
.watchOS(.v7)
910
],
1011
products: [
1112
.library(name: "web3.swift", targets: ["web3"])

web3.swift.podspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'web3.swift'
3-
s.version = '1.4.0'
3+
s.version = '1.4.1'
44
s.license = 'MIT'
55
s.summary = 'Ethereum API for Swift'
66
s.homepage = 'https://github.com/argentlabs/web3.swift'
@@ -22,5 +22,6 @@ Pod::Spec.new do |s|
2222
s.dependency 'BigInt', '~> 5.0.0'
2323
s.dependency 'secp256k1.swift', '~> 0.1'
2424
s.dependency 'GenericJSON', '~> 2.0'
25+
s.dependency 'Logging', '~> 1.0.0'
2526

2627
end

web3swift/src/Client/EthereumClientProtocol.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import BigInt
77
import Foundation
8-
import NIOWebSocket
98

109
public enum CallResolution {
1110
case noOffchain(failOnExecutionError: Bool)
@@ -85,6 +84,9 @@ public protocol EthereumClientProtocol: AnyObject {
8584
func eth_getBlockByNumber(_ block: EthereumBlock) async throws -> EthereumBlockInfo
8685
}
8786

87+
#if canImport(NIO)
88+
import NIOWebSocket
89+
8890
public protocol EthereumClientWebSocketProtocol: EthereumClientProtocol {
8991
var delegate: EthereumWebSocketClientDelegate? { get set }
9092
var currentState: WebSocketState { get }
@@ -125,3 +127,5 @@ extension EthereumWebSocketClientDelegate {
125127

126128
func onWebSocketReconnect() {}
127129
}
130+
131+
#endif

web3swift/src/Client/EthereumWebSocketClient.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// Copyright © 2022 Argent Labs Limited. All rights reserved.
44
//
55

6+
#if canImport(NIO)
67
import BigInt
78
import Foundation
89
import GenericJSON
@@ -11,7 +12,6 @@ import NIO
1112
import NIOCore
1213
import NIOSSL
1314
import NIOWebSocket
14-
import WebSocketKit
1515

1616
#if canImport(FoundationNetworking)
1717
import FoundationNetworking
@@ -225,3 +225,5 @@ extension EthereumWebSocketClient {
225225
}
226226
}
227227
}
228+
229+
#endif

web3swift/src/Client/NetworkProviders/EventLoopGroupProvider.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@
33
// Copyright © 2022 Argent Labs Limited. All rights reserved.
44
//
55

6+
#if canImport(NIO)
7+
68
import Foundation
79
import NIOCore
810

911
public enum EventLoopGroupProvider {
1012
case shared(EventLoopGroup)
1113
case createNew
1214
}
15+
16+
#endif

web3swift/src/Client/NetworkProviders/NetworkProviderProtocol.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
// Copyright © 2022 Argent Labs Limited. All rights reserved.
44
//
55

6+
67
import Foundation
8+
#if canImport(NIO)
79
import NIOWebSocket
10+
#endif
811

912
#if canImport(FoundationNetworking)
1013
import FoundationNetworking
@@ -15,6 +18,7 @@ internal protocol NetworkProviderProtocol {
1518
func send<P: Encodable, U: Decodable>(method: String, params: P, receive: U.Type) async throws -> Any
1619
}
1720

21+
#if canImport(NIO)
1822
internal protocol WebSocketNetworkProviderProtocol: NetworkProviderProtocol {
1923
var delegate: EthereumWebSocketClientDelegate? { get set }
2024
var onReconnectCallback: (() -> Void)? { get set }
@@ -26,3 +30,4 @@ internal protocol WebSocketNetworkProviderProtocol: NetworkProviderProtocol {
2630
func addSubscription(_ subscription: EthereumSubscription, callback: @escaping (Any) -> Void)
2731
func removeSubscription(_ subscription: EthereumSubscription)
2832
}
33+
#endif

web3swift/src/Client/NetworkProviders/WebSocketConfiguration.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// Copyright © 2022 Argent Labs Limited. All rights reserved.
44
//
55

6+
#if canImport(NIO)
7+
68
import Foundation
79
import NIOSSL
810

@@ -38,3 +40,5 @@ public struct WebSocketConfiguration {
3840
self.maxReconnectAttempts = maxReconnectAttempts
3941
}
4042
}
43+
44+
#endif

web3swift/src/Client/NetworkProviders/WebSocketNetworkProvider.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// Copyright © 2022 Argent Labs Limited. All rights reserved.
44
//
55

6+
#if canImport(NIO)
7+
68
import BigInt
79
import Foundation
810
import GenericJSON
@@ -421,3 +423,5 @@ class WebSocketNetworkProvider: WebSocketNetworkProviderProtocol {
421423
}
422424
}
423425
}
426+
427+
#endif

0 commit comments

Comments
 (0)