Skip to content

Commit a5a528a

Browse files
fix: swiftlint issues in Web3+Utils.swift
1 parent ae205a7 commit a5a528a

File tree

1 file changed

+20
-27
lines changed

1 file changed

+20
-27
lines changed

Sources/web3swift/Web3/Web3+Utils.swift

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,19 @@ public typealias Web3Utils = Web3.Utils
1313
extension Web3 {
1414
/// Namespaced Utils functions. Are not bound to particular web3 instance, so capitalization matters.
1515
public struct Utils {
16+
// swiftlint:disable nesting
1617
typealias Iban = IBAN
18+
// swiftlint:enable nesting
1719
}
1820
}
1921

22+
// swiftlint:disable file_length
23+
// swiftlint:disable line_length
2024
extension Web3.Utils {
2125

22-
// /// Calculate address of deployed contract deterministically based on the address of the deploying Ethereum address
23-
// /// and the nonce of this address
24-
// public static func calculateContractAddress(from: EthereumAddress, nonce: BigUInt) -> EthereumAddress? {
25-
// guard let normalizedAddress = from.addressData.setLengthLeft(32) else {return nil}
26-
// guard let data = RLP.encode([normalizedAddress, nonce]) else {return nil}
27-
// guard let contractAddressData = Utilities.sha3(data)?[12..<32] else {return nil}
28-
// guard let contractAddress = EthereumAddress(Data(contractAddressData)) else {return nil}
29-
// return contractAddress
30-
// }
31-
3226
/// Various units used in Ethereum ecosystem
3327
public enum Units {
28+
// swiftlint:disable identifier_name
3429
case eth
3530
case wei
3631
case Kwei
@@ -40,23 +35,21 @@ extension Web3.Utils {
4035
case Finney
4136

4237
var decimals: Int {
43-
get {
44-
switch self {
45-
case .eth:
46-
return 18
47-
case .wei:
48-
return 0
49-
case .Kwei:
50-
return 3
51-
case .Mwei:
52-
return 6
53-
case .Gwei:
54-
return 9
55-
case .Microether:
56-
return 12
57-
case .Finney:
58-
return 15
59-
}
38+
switch self {
39+
case .eth:
40+
return 18
41+
case .wei:
42+
return 0
43+
case .Kwei:
44+
return 3
45+
case .Mwei:
46+
return 6
47+
case .Gwei:
48+
return 9
49+
case .Microether:
50+
return 12
51+
case .Finney:
52+
return 15
6053
}
6154
}
6255
}

0 commit comments

Comments
 (0)