@@ -89,14 +89,14 @@ public class ERC1376: IERC1376, ERC20BaseProperties {
89
89
}
90
90
91
91
public func getBalance( account: EthereumAddress ) async throws -> BigUInt {
92
- let result = try await contract. createReadOperation ( " balanceOf " , parameters: [ account] ) !. callContractMethod ( )
92
+ let result = try await contract. createReadOperation ( " balanceOf " , parameters: [ account] ) !. call ( )
93
93
94
94
guard let res = result [ " 0 " ] as? BigUInt else { throw Web3Error . processingError ( desc: " Failed to get result of expected type from the Ethereum node " ) }
95
95
return res
96
96
}
97
97
98
98
public func getAllowance( originalOwner: EthereumAddress , delegate: EthereumAddress ) async throws -> BigUInt {
99
- let result = try await contract. createReadOperation ( " allowance " , parameters: [ originalOwner, delegate] ) !. callContractMethod ( )
99
+ let result = try await contract. createReadOperation ( " allowance " , parameters: [ originalOwner, delegate] ) !. call ( )
100
100
101
101
guard let res = result [ " 0 " ] as? BigUInt else { throw Web3Error . processingError ( desc: " Failed to get result of expected type from the Ethereum node " ) }
102
102
return res
@@ -106,7 +106,8 @@ public class ERC1376: IERC1376, ERC20BaseProperties {
106
106
transaction. callOnBlock = . latest
107
107
updateTransactionAndContract ( from: from)
108
108
// get the decimals manually
109
- let callResult = try await contract. createReadOperation ( " decimals " ) !. callContractMethod ( )
109
+ let callResult = try await contract. createReadOperation ( " decimals " ) !. call ( )
110
+
110
111
var decimals = BigUInt ( 0 )
111
112
guard let dec = callResult [ " 0 " ] , let decTyped = dec as? BigUInt else {
112
113
throw Web3Error . inputError ( desc: " Contract may be not ERC20 compatible, can not get decimals " ) }
@@ -124,7 +125,8 @@ public class ERC1376: IERC1376, ERC20BaseProperties {
124
125
transaction. callOnBlock = . latest
125
126
updateTransactionAndContract ( from: from)
126
127
// get the decimals manually
127
- let callResult = try await contract. createReadOperation ( " decimals " ) !. callContractMethod ( )
128
+ let callResult = try await contract. createReadOperation ( " decimals " ) !. call ( )
129
+
128
130
var decimals = BigUInt ( 0 )
129
131
guard let dec = callResult [ " 0 " ] , let decTyped = dec as? BigUInt else {
130
132
throw Web3Error . inputError ( desc: " Contract may be not ERC20 compatible, can not get decimals " ) }
@@ -142,7 +144,8 @@ public class ERC1376: IERC1376, ERC20BaseProperties {
142
144
transaction. callOnBlock = . latest
143
145
updateTransactionAndContract ( from: from)
144
146
// get the decimals manually
145
- let callResult = try await contract. createReadOperation ( " decimals " ) !. callContractMethod ( )
147
+ let callResult = try await contract. createReadOperation ( " decimals " ) !. call ( )
148
+
146
149
var decimals = BigUInt ( 0 )
147
150
guard let dec = callResult [ " 0 " ] , let decTyped = dec as? BigUInt else {
148
151
throw Web3Error . inputError ( desc: " Contract may be not ERC20 compatible, can not get decimals " ) }
@@ -160,7 +163,8 @@ public class ERC1376: IERC1376, ERC20BaseProperties {
160
163
transaction. callOnBlock = . latest
161
164
updateTransactionAndContract ( from: from)
162
165
// get the decimals manually
163
- let callResult = try await contract. createReadOperation ( " decimals " ) !. callContractMethod ( )
166
+ let callResult = try await contract. createReadOperation ( " decimals " ) !. call ( )
167
+
164
168
var decimals = BigUInt ( 0 )
165
169
guard let dec = callResult [ " 0 " ] , let decTyped = dec as? BigUInt else {
166
170
throw Web3Error . inputError ( desc: " Contract may be not ERC20 compatible, can not get decimals " ) }
@@ -175,7 +179,7 @@ public class ERC1376: IERC1376, ERC20BaseProperties {
175
179
}
176
180
177
181
public func totalSupply( ) async throws -> BigUInt {
178
- let result = try await contract. createReadOperation ( " totalSupply " ) !. callContractMethod ( )
182
+ let result = try await contract. createReadOperation ( " totalSupply " ) !. call ( )
179
183
180
184
guard let res = result [ " 0 " ] as? BigUInt else { throw Web3Error . processingError ( desc: " Failed to get result of expected type from the Ethereum node " ) }
181
185
return res
@@ -185,7 +189,8 @@ public class ERC1376: IERC1376, ERC20BaseProperties {
185
189
transaction. callOnBlock = . latest
186
190
updateTransactionAndContract ( from: from)
187
191
// get the decimals manually
188
- let callResult = try await contract. createReadOperation ( " decimals " ) !. callContractMethod ( )
192
+ let callResult = try await contract. createReadOperation ( " decimals " ) !. call ( )
193
+
189
194
var decimals = BigUInt ( 0 )
190
195
guard let dec = callResult [ " 0 " ] , let decTyped = dec as? BigUInt else {
191
196
throw Web3Error . inputError ( desc: " Contract may be not ERC20 compatible, can not get decimals " ) }
@@ -206,7 +211,8 @@ public class ERC1376: IERC1376, ERC20BaseProperties {
206
211
transaction. callOnBlock = . latest
207
212
updateTransactionAndContract ( from: from)
208
213
// get the decimals manually
209
- let callResult = try await contract. createReadOperation ( " decimals " ) !. callContractMethod ( )
214
+ let callResult = try await contract. createReadOperation ( " decimals " ) !. call ( )
215
+
210
216
var decimals = BigUInt ( 0 )
211
217
guard let dec = callResult [ " 0 " ] , let decTyped = dec as? BigUInt else {
212
218
throw Web3Error . inputError ( desc: " Contract may be not ERC20 compatible, can not get decimals " ) }
@@ -224,7 +230,8 @@ public class ERC1376: IERC1376, ERC20BaseProperties {
224
230
transaction. callOnBlock = . latest
225
231
updateTransactionAndContract ( from: from)
226
232
// get the decimals manually
227
- let callResult = try await contract. createReadOperation ( " decimals " ) !. callContractMethod ( )
233
+ let callResult = try await contract. createReadOperation ( " decimals " ) !. call ( )
234
+
228
235
var decimals = BigUInt ( 0 )
229
236
guard let dec = callResult [ " 0 " ] , let decTyped = dec as? BigUInt else {
230
237
throw Web3Error . inputError ( desc: " Contract may be not ERC20 compatible, can not get decimals " ) }
@@ -246,7 +253,7 @@ public class ERC1376: IERC1376, ERC20BaseProperties {
246
253
247
254
func spendableAllowance( owner: EthereumAddress , spender: EthereumAddress ) async throws -> BigUInt {
248
255
transaction. callOnBlock = . latest
249
- let result = try await contract. createReadOperation ( " spendableAllowance " , parameters: [ owner, spender] ) !. callContractMethod ( )
256
+ let result = try await contract. createReadOperation ( " spendableAllowance " , parameters: [ owner, spender] ) !. call ( )
250
257
251
258
guard let res = result [ " 0 " ] as? BigUInt else { throw Web3Error . processingError ( desc: " Failed to get result of expected type from the Ethereum node " ) }
252
259
return res
@@ -256,7 +263,8 @@ public class ERC1376: IERC1376, ERC20BaseProperties {
256
263
transaction. callOnBlock = . latest
257
264
updateTransactionAndContract ( from: from)
258
265
// get the decimals manually
259
- let callResult = try await contract. createReadOperation ( " decimals " ) !. callContractMethod ( )
266
+ let callResult = try await contract. createReadOperation ( " decimals " ) !. call ( )
267
+
260
268
var decimals = BigUInt ( 0 )
261
269
guard let dec = callResult [ " 0 " ] , let decTyped = dec as? BigUInt else {
262
270
throw Web3Error . inputError ( desc: " Contract may be not ERC20 compatible, can not get decimals " ) }
@@ -274,7 +282,8 @@ public class ERC1376: IERC1376, ERC20BaseProperties {
274
282
transaction. callOnBlock = . latest
275
283
updateTransactionAndContract ( from: from)
276
284
// get the decimals manually
277
- let callResult = try await contract. createReadOperation ( " decimals " ) !. callContractMethod ( )
285
+ let callResult = try await contract. createReadOperation ( " decimals " ) !. call ( )
286
+
278
287
var decimals = BigUInt ( 0 )
279
288
guard let dec = callResult [ " 0 " ] , let decTyped = dec as? BigUInt else {
280
289
throw Web3Error . inputError ( desc: " Contract may be not ERC20 compatible, can not get decimals " ) }
@@ -289,7 +298,7 @@ public class ERC1376: IERC1376, ERC20BaseProperties {
289
298
}
290
299
291
300
func nonceOf( owner: EthereumAddress ) async throws -> BigUInt {
292
- let result = try await contract. createReadOperation ( " nonceOf " , parameters: [ owner] ) !. callContractMethod ( )
301
+ let result = try await contract. createReadOperation ( " nonceOf " , parameters: [ owner] ) !. call ( )
293
302
294
303
guard let res = result [ " 0 " ] as? BigUInt else { throw Web3Error . processingError ( desc: " Failed to get result of expected type from the Ethereum node " ) }
295
304
return res
@@ -306,7 +315,8 @@ public class ERC1376: IERC1376, ERC20BaseProperties {
306
315
transaction. callOnBlock = . latest
307
316
updateTransactionAndContract ( from: from)
308
317
// get the decimals manually
309
- let callResult = try await contract. createReadOperation ( " decimals " ) !. callContractMethod ( )
318
+ let callResult = try await contract. createReadOperation ( " decimals " ) !. call ( )
319
+
310
320
var decimals = BigUInt ( 0 )
311
321
guard let dec = callResult [ " 0 " ] , let decTyped = dec as? BigUInt else {
312
322
throw Web3Error . inputError ( desc: " Contract may be not ERC20 compatible, can not get decimals " ) }
@@ -323,7 +333,7 @@ public class ERC1376: IERC1376, ERC20BaseProperties {
323
333
}
324
334
325
335
func directDebit( debtor: EthereumAddress , receiver: EthereumAddress ) async throws -> DirectDebit {
326
- let result = try await contract. createReadOperation ( " directDebit " , parameters: [ debtor, receiver] ) !. callContractMethod ( )
336
+ let result = try await contract. createReadOperation ( " directDebit " , parameters: [ debtor, receiver] ) !. call ( )
327
337
328
338
guard let res = result [ " 0 " ] as? DirectDebit else { throw Web3Error . processingError ( desc: " Failed to get result of expected type from the Ethereum node " ) }
329
339
return res
0 commit comments