Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
DarthMike committed Nov 30, 2022
2 parents d65094c + b50f919 commit 3c4d4a5
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ let package = Package(
name: "web3.swift",
platforms: [
.iOS(SupportedPlatform.IOSVersion.v13),
.macOS(SupportedPlatform.MacOSVersion.v11)
.macOS(SupportedPlatform.MacOSVersion.v11),
.watchOS(.v7)
],
products: [
.library(name: "web3.swift", targets: ["web3"])
Expand Down
3 changes: 2 additions & 1 deletion web3.swift.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'web3.swift'
s.version = '1.4.0'
s.version = '1.4.1'
s.license = 'MIT'
s.summary = 'Ethereum API for Swift'
s.homepage = 'https://github.com/argentlabs/web3.swift'
Expand All @@ -22,5 +22,6 @@ Pod::Spec.new do |s|
s.dependency 'BigInt', '~> 5.0.0'
s.dependency 'secp256k1.swift', '~> 0.1'
s.dependency 'GenericJSON', '~> 2.0'
s.dependency 'Logging', '~> 1.0.0'

end
6 changes: 5 additions & 1 deletion web3swift/src/Client/EthereumClientProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import BigInt
import Foundation
import NIOWebSocket

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

#if canImport(NIO)
import NIOWebSocket

public protocol EthereumClientWebSocketProtocol: EthereumClientProtocol {
var delegate: EthereumWebSocketClientDelegate? { get set }
var currentState: WebSocketState { get }
Expand Down Expand Up @@ -125,3 +127,5 @@ extension EthereumWebSocketClientDelegate {

func onWebSocketReconnect() {}
}

#endif
4 changes: 3 additions & 1 deletion web3swift/src/Client/EthereumWebSocketClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// Copyright © 2022 Argent Labs Limited. All rights reserved.
//

#if canImport(NIO)
import BigInt
import Foundation
import GenericJSON
Expand All @@ -11,7 +12,6 @@ import NIO
import NIOCore
import NIOSSL
import NIOWebSocket
import WebSocketKit

#if canImport(FoundationNetworking)
import FoundationNetworking
Expand Down Expand Up @@ -225,3 +225,5 @@ extension EthereumWebSocketClient {
}
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
// Copyright © 2022 Argent Labs Limited. All rights reserved.
//

#if canImport(NIO)

import Foundation
import NIOCore

public enum EventLoopGroupProvider {
case shared(EventLoopGroup)
case createNew
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
// Copyright © 2022 Argent Labs Limited. All rights reserved.
//


import Foundation
#if canImport(NIO)
import NIOWebSocket
#endif

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

#if canImport(NIO)
internal protocol WebSocketNetworkProviderProtocol: NetworkProviderProtocol {
var delegate: EthereumWebSocketClientDelegate? { get set }
var onReconnectCallback: (() -> Void)? { get set }
Expand All @@ -26,3 +30,4 @@ internal protocol WebSocketNetworkProviderProtocol: NetworkProviderProtocol {
func addSubscription(_ subscription: EthereumSubscription, callback: @escaping (Any) -> Void)
func removeSubscription(_ subscription: EthereumSubscription)
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// Copyright © 2022 Argent Labs Limited. All rights reserved.
//

#if canImport(NIO)

import Foundation
import NIOSSL

Expand Down Expand Up @@ -38,3 +40,5 @@ public struct WebSocketConfiguration {
self.maxReconnectAttempts = maxReconnectAttempts
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// Copyright © 2022 Argent Labs Limited. All rights reserved.
//

#if canImport(NIO)

import BigInt
import Foundation
import GenericJSON
Expand Down Expand Up @@ -421,3 +423,5 @@ class WebSocketNetworkProvider: WebSocketNetworkProviderProtocol {
}
}
}

#endif

0 comments on commit 3c4d4a5

Please sign in to comment.