File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 3
3
// Copyright © 2018 Alex Vlasov. All rights reserved.
4
4
//
5
5
// Additions to support new transaction types by Mark Loit March 2022
6
+ //
7
+ // Made most structs generics by Yaroslav Yashin 2022
6
8
7
9
import Foundation
8
10
import BigInt
9
11
10
12
/// Global counter object to enumerate JSON RPC requests.
11
13
public struct Counter {
12
- public static var counter = UInt64 ( 1 )
14
+ public static var counter = UInt ( 1 )
13
15
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
16
18
lockQueue. sync {
17
19
c = Counter . counter
18
20
Counter . counter = Counter . counter + 1
@@ -27,7 +29,7 @@ public struct JSONRPCrequest: Encodable {
27
29
public var jsonrpc : String = " 2.0 "
28
30
public var method : JSONRPCmethod ?
29
31
public var params : [ RPCParameter ] = [ ]
30
- public var id : UInt64 = Counter . increment ( )
32
+ public var id : UInt = Counter . increment ( )
31
33
32
34
enum CodingKeys : String , CodingKey {
33
35
case jsonrpc
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ public struct InfuraWebsocketRequest: Encodable {
57
57
public var jsonrpc : String = " 2.0 "
58
58
public var method : InfuraWebsocketMethod ?
59
59
public var params : [ RPCParameter ] = [ ]
60
- public var id : UInt64 = Counter . increment ( )
60
+ public var id = Counter . increment ( )
61
61
62
62
enum CodingKeys : String , CodingKey {
63
63
case jsonrpc
You can’t perform that action at this time.
0 commit comments