@@ -8,7 +8,7 @@ import Foundation
8
8
import BigInt
9
9
10
10
fileprivate func decodeHexToData< T> ( _ container: KeyedDecodingContainer < T > , key: KeyedDecodingContainer < T > . Key , allowOptional: Bool = false ) throws -> Data ? {
11
- if ( allowOptional) {
11
+ if allowOptional {
12
12
let string = try ? container. decode ( String . self, forKey: key)
13
13
if string != nil {
14
14
guard let data = Data . fromHex ( string!) else { throw Web3Error . dataError}
@@ -23,7 +23,7 @@ fileprivate func decodeHexToData<T>(_ container: KeyedDecodingContainer<T>, key:
23
23
}
24
24
25
25
fileprivate func decodeHexToBigUInt< T> ( _ container: KeyedDecodingContainer < T > , key: KeyedDecodingContainer < T > . Key , allowOptional: Bool = false ) throws -> BigUInt ? {
26
- if ( allowOptional) {
26
+ if allowOptional {
27
27
let string = try ? container. decode ( String . self, forKey: key)
28
28
if string != nil {
29
29
guard let number = BigUInt ( string!. stripHexPrefix ( ) , radix: 16 ) else { throw Web3Error . dataError}
@@ -117,7 +117,7 @@ extension EthereumTransaction: Decodable {
117
117
// test to see if it is a EIP-1559 wrapper
118
118
if let envelope = try decodeHexToBigUInt ( container, key: . type, allowOptional: true ) {
119
119
// if present and non-sero we are a new wrapper we can't decode
120
- if ( envelope != BigInt ( 0 ) ) { throw Web3Error . dataError }
120
+ if envelope != BigInt ( 0 ) { throw Web3Error . dataError }
121
121
}
122
122
var data = try decodeHexToData ( container, key: . data, allowOptional: true )
123
123
if data != nil {
@@ -168,7 +168,7 @@ extension EthereumTransaction: Decodable {
168
168
}
169
169
170
170
let inferedChainID = self . inferedChainID
171
- if ( self . inferedChainID != nil && self . v >= BigUInt ( 37 ) ) {
171
+ if self . inferedChainID != nil && self . v >= BigUInt ( 37 ) {
172
172
self . chainID = inferedChainID
173
173
}
174
174
}
@@ -259,7 +259,7 @@ public struct TransactionReceipt: Decodable {
259
259
self . gasUsed = gasUsed
260
260
261
261
let status = try decodeHexToBigUInt ( container, key: . status, allowOptional: true )
262
- if ( status == nil ) {
262
+ if status == nil {
263
263
self . status = TXStatus . notYetProcessed
264
264
} else if status == 1 {
265
265
self . status = TXStatus . ok
@@ -370,7 +370,7 @@ public struct EventLog: Decodable {
370
370
self . logIndex = logIndex
371
371
372
372
let removed = try decodeHexToBigUInt ( container, key: . removed, allowOptional: true )
373
- if ( removed == 1 ) {
373
+ if removed == 1 {
374
374
self . removed = true
375
375
} else {
376
376
self . removed = false
0 commit comments