@@ -53,7 +53,9 @@ public class ERC20: IERC20, ERC20BaseProperties {
53
53
let contract = self . contract
54
54
var transactionOptions = TransactionOptions ( )
55
55
transactionOptions. callOnBlock = . latest
56
- let result = try await contract. read ( " balanceOf " , parameters: [ account] as [ AnyObject ] , extraData: Data ( ) , transactionOptions: self . transactionOptions) !. call ( transactionOptions: transactionOptions)
56
+ let result = try await contract
57
+ . read ( " balanceOf " , parameters: [ account] as [ AnyObject ] , extraData: Data ( ) , transactionOptions: self . transactionOptions) !
58
+ . call ( transactionOptions: transactionOptions)
57
59
guard let res = result [ " 0 " ] as? BigUInt else { throw Web3Error . processingError ( desc: " Failed to get result of expected type from the Ethereum node " ) }
58
60
return res
59
61
}
@@ -62,7 +64,9 @@ public class ERC20: IERC20, ERC20BaseProperties {
62
64
let contract = self . contract
63
65
var transactionOptions = TransactionOptions ( )
64
66
transactionOptions. callOnBlock = . latest
65
- let result = try await contract. read ( " allowance " , parameters: [ originalOwner, delegate] as [ AnyObject ] , extraData: Data ( ) , transactionOptions: self . transactionOptions) !. call ( transactionOptions: transactionOptions)
67
+ let result = try await contract
68
+ . read ( " allowance " , parameters: [ originalOwner, delegate] as [ AnyObject ] , extraData: Data ( ) , transactionOptions: self . transactionOptions) !
69
+ . call ( transactionOptions: transactionOptions)
66
70
guard let res = result [ " 0 " ] as? BigUInt else { throw Web3Error . processingError ( desc: " Failed to get result of expected type from the Ethereum node " ) }
67
71
return res
68
72
}
@@ -75,7 +79,9 @@ public class ERC20: IERC20, ERC20BaseProperties {
75
79
basicOptions. callOnBlock = . latest
76
80
77
81
// get the decimals manually
78
- let callResult = try await contract. read ( " decimals " , transactionOptions: basicOptions) !. call ( )
82
+ let callResult = try await contract
83
+ . read ( " decimals " , transactionOptions: basicOptions) !
84
+ . call ( )
79
85
var decimals = BigUInt ( 0 )
80
86
guard let dec = callResult [ " 0 " ] , let decTyped = dec as? BigUInt else {
81
87
throw Web3Error . inputError ( desc: " Contract may be not ERC20 compatible, can not get decimals " ) }
@@ -97,7 +103,9 @@ public class ERC20: IERC20, ERC20BaseProperties {
97
103
basicOptions. callOnBlock = . latest
98
104
99
105
// get the decimals manually
100
- let callResult = try await contract. read ( " decimals " , transactionOptions: basicOptions) !. call ( )
106
+ let callResult = try await contract
107
+ . read ( " decimals " , transactionOptions: basicOptions) !
108
+ . call ( )
101
109
var decimals = BigUInt ( 0 )
102
110
guard let dec = callResult [ " 0 " ] , let decTyped = dec as? BigUInt else {
103
111
throw Web3Error . inputError ( desc: " Contract may be not ERC20 compatible, can not get decimals " ) }
@@ -120,7 +128,9 @@ public class ERC20: IERC20, ERC20BaseProperties {
120
128
basicOptions. callOnBlock = . latest
121
129
122
130
// get the decimals manually
123
- let callResult = try await contract. read ( " decimals " , transactionOptions: basicOptions) !. call ( )
131
+ let callResult = try await contract
132
+ . read ( " decimals " , transactionOptions: basicOptions) !
133
+ . call ( )
124
134
var decimals = BigUInt ( 0 )
125
135
guard let dec = callResult [ " 0 " ] , let decTyped = dec as? BigUInt else {
126
136
throw Web3Error . inputError ( desc: " Contract may be not ERC20 compatible, can not get decimals " ) }
@@ -143,7 +153,9 @@ public class ERC20: IERC20, ERC20BaseProperties {
143
153
basicOptions. callOnBlock = . latest
144
154
145
155
// get the decimals manually
146
- let callResult = try await contract. read ( " decimals " , transactionOptions: basicOptions) !. call ( )
156
+ let callResult = try await contract
157
+ . read ( " decimals " , transactionOptions: basicOptions) !
158
+ . call ( )
147
159
var decimals = BigUInt ( 0 )
148
160
guard let dec = callResult [ " 0 " ] , let decTyped = dec as? BigUInt else {
149
161
throw Web3Error . inputError ( desc: " Contract may be not ERC20 compatible, can not get decimals " ) }
@@ -162,7 +174,9 @@ public class ERC20: IERC20, ERC20BaseProperties {
162
174
let contract = self . contract
163
175
var transactionOptions = TransactionOptions ( )
164
176
transactionOptions. callOnBlock = . latest
165
- let result = try await contract. read ( " totalSupply " , parameters: [ AnyObject] ( ) , extraData: Data ( ) , transactionOptions: self . transactionOptions) !. call ( transactionOptions: transactionOptions)
177
+ let result = try await contract
178
+ . read ( " totalSupply " , parameters: [ AnyObject] ( ) , extraData: Data ( ) , transactionOptions: self . transactionOptions) !
179
+ . call ( transactionOptions: transactionOptions)
166
180
guard let res = result [ " 0 " ] as? BigUInt else { throw Web3Error . processingError ( desc: " Failed to get result of expected type from the Ethereum node " ) }
167
181
return res
168
182
}
0 commit comments