File tree Expand file tree Collapse file tree 1 file changed +20
-27
lines changed
Expand file tree Collapse file tree 1 file changed +20
-27
lines changed Original file line number Diff line number Diff line change @@ -13,24 +13,19 @@ public typealias Web3Utils = Web3.Utils
1313extension 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
2024extension 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 }
You can’t perform that action at this time.
0 commit comments