Skip to content

Commit 9f79702

Browse files
Update UInt64 to UInt since this accuracy isn't required.
1 parent 72e7ad9 commit 9f79702

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

Sources/web3swift/Web3/Web3+JSONRPC.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@
33
// Copyright © 2018 Alex Vlasov. All rights reserved.
44
//
55
// Additions to support new transaction types by Mark Loit March 2022
6+
//
7+
// Made most structs generics by Yaroslav Yashin 2022
68

79
import Foundation
810
import BigInt
911

1012
/// Global counter object to enumerate JSON RPC requests.
1113
public struct Counter {
12-
public static var counter = UInt64(1)
14+
public static var counter = UInt(1)
1315
public static var lockQueue = DispatchQueue(label: "counterQueue")
14-
public static func increment() -> UInt64 {
15-
var c: UInt64 = 0
16+
public static func increment() -> UInt {
17+
var c: UInt = 0
1618
lockQueue.sync {
1719
c = Counter.counter
1820
Counter.counter = Counter.counter + 1
@@ -27,7 +29,7 @@ public struct JSONRPCrequest: Encodable {
2729
public var jsonrpc: String = "2.0"
2830
public var method: JSONRPCmethod?
2931
public var params: [RPCParameter] = []
30-
public var id: UInt64 = Counter.increment()
32+
public var id: UInt = Counter.increment()
3133

3234
enum CodingKeys: String, CodingKey {
3335
case jsonrpc

Sources/web3swift/Web3/Web3+WebsocketProvider.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public struct InfuraWebsocketRequest: Encodable {
5757
public var jsonrpc: String = "2.0"
5858
public var method: InfuraWebsocketMethod?
5959
public var params: [RPCParameter] = []
60-
public var id: UInt64 = Counter.increment()
60+
public var id = Counter.increment()
6161

6262
enum CodingKeys: String, CodingKey {
6363
case jsonrpc

0 commit comments

Comments
 (0)