@@ -86,14 +86,12 @@ public class ERC1400: IERC1400, ERC20BaseProperties {
86
86
}
87
87
88
88
public func getBalance( account: EthereumAddress ) async throws -> BigUInt {
89
- transaction. callOnBlock = . latest
90
89
let result = try await contract. createReadOperation ( " balanceOf " , parameters: [ account] as [ AnyObject ] , extraData: Data ( ) ) !. callContractMethod ( )
91
90
guard let res = result [ " 0 " ] as? BigUInt else { throw Web3Error . processingError ( desc: " Failed to get result of expected type from the Ethereum node " ) }
92
91
return res
93
92
}
94
93
95
94
public func getAllowance( originalOwner: EthereumAddress , delegate: EthereumAddress ) async throws -> BigUInt {
96
- transaction. callOnBlock = . latest
97
95
let result = try await contract. createReadOperation ( " allowance " , parameters: [ originalOwner, delegate] as [ AnyObject ] , extraData: Data ( ) ) !. callContractMethod ( )
98
96
guard let res = result [ " 0 " ] as? BigUInt else { throw Web3Error . processingError ( desc: " Failed to get result of expected type from the Ethereum node " ) }
99
97
return res
@@ -156,7 +154,6 @@ public class ERC1400: IERC1400, ERC20BaseProperties {
156
154
}
157
155
158
156
public func totalSupply( ) async throws -> BigUInt {
159
- transaction. callOnBlock = . latest
160
157
let result = try await contract. createReadOperation ( " totalSupply " , parameters: [ AnyObject] ( ) , extraData: Data ( ) ) !. callContractMethod ( )
161
158
guard let res = result [ " 0 " ] as? BigUInt else { throw Web3Error . processingError ( desc: " Failed to get result of expected type from the Ethereum node " ) }
162
159
return res
@@ -183,7 +180,6 @@ public class ERC1400: IERC1400, ERC20BaseProperties {
183
180
184
181
// ERC1400 methods
185
182
public func getDocument( name: Data ) async throws -> ( String , Data ) {
186
- transaction. callOnBlock = . latest
187
183
let result = try await contract. createReadOperation ( " getDocument " , parameters: [ name] as [ AnyObject ] , extraData: Data ( ) ) !. callContractMethod ( )
188
184
guard let res = result [ " 0 " ] as? ( String , Data ) else { throw Web3Error . processingError ( desc: " Failed to get result of expected type from the Ethereum node " ) }
189
185
return res
@@ -196,14 +192,12 @@ public class ERC1400: IERC1400, ERC20BaseProperties {
196
192
}
197
193
198
194
public func balanceOfByPartition( partition: Data , tokenHolder: EthereumAddress ) async throws -> BigUInt {
199
- transaction. callOnBlock = . latest
200
195
let result = try await contract. createReadOperation ( " balanceOfByPartition " , parameters: [ partition, tokenHolder] as [ AnyObject ] , extraData: Data ( ) ) !. callContractMethod ( )
201
196
guard let res = result [ " 0 " ] as? BigUInt else { throw Web3Error . processingError ( desc: " Failed to get result of expected type from the Ethereum node " ) }
202
197
return res
203
198
}
204
199
205
200
public func partitionsOf( tokenHolder: EthereumAddress ) async throws -> [ Data ] {
206
- transaction. callOnBlock = . latest
207
201
let result = try await contract. createReadOperation ( " partitionsOf " , parameters: [ tokenHolder] as [ AnyObject ] , extraData: Data ( ) ) !. callContractMethod ( )
208
202
guard let res = result [ " 0 " ] as? [ Data ] else { throw Web3Error . processingError ( desc: " Failed to get result of expected type from the Ethereum node " ) }
209
203
return res
@@ -286,7 +280,6 @@ public class ERC1400: IERC1400, ERC20BaseProperties {
286
280
}
287
281
288
282
public func isControllable( ) async throws -> Bool {
289
- transaction. callOnBlock = . latest
290
283
let result = try await contract. createReadOperation ( " isControllable " , parameters: [ AnyObject] ( ) , extraData: Data ( ) ) !. callContractMethod ( )
291
284
guard let res = result [ " 0 " ] as? Bool else { throw Web3Error . processingError ( desc: " Failed to get result of expected type from the Ethereum node " ) }
292
285
return res
@@ -355,21 +348,18 @@ public class ERC1400: IERC1400, ERC20BaseProperties {
355
348
}
356
349
357
350
public func isOperator( operator user: EthereumAddress , tokenHolder: EthereumAddress ) async throws -> Bool {
358
- transaction. callOnBlock = . latest
359
351
let result = try await contract. createReadOperation ( " isOperator " , parameters: [ user, tokenHolder] as [ AnyObject ] , extraData: Data ( ) ) !. callContractMethod ( )
360
352
guard let res = result [ " 0 " ] as? Bool else { throw Web3Error . processingError ( desc: " Failed to get result of expected type from the Ethereum node " ) }
361
353
return res
362
354
}
363
355
364
356
public func isOperatorForPartition( partition: Data , operator user: EthereumAddress , tokenHolder: EthereumAddress ) async throws -> Bool {
365
- transaction. callOnBlock = . latest
366
357
let result = try await contract. createReadOperation ( " isOperatorForPartition " , parameters: [ partition, user, tokenHolder] as [ AnyObject ] , extraData: Data ( ) ) !. callContractMethod ( )
367
358
guard let res = result [ " 0 " ] as? Bool else { throw Web3Error . processingError ( desc: " Failed to get result of expected type from the Ethereum node " ) }
368
359
return res
369
360
}
370
361
371
362
public func isIssuable( ) async throws -> Bool {
372
- transaction. callOnBlock = . latest
373
363
let result = try await contract. createReadOperation ( " isIssuable " , parameters: [ AnyObject] ( ) , extraData: Data ( ) ) !. callContractMethod ( )
374
364
guard let res = result [ " 0 " ] as? Bool else { throw Web3Error . processingError ( desc: " Failed to get result of expected type from the Ethereum node " ) }
375
365
return res
@@ -490,8 +480,6 @@ public class ERC1400: IERC1400, ERC20BaseProperties {
490
480
}
491
481
492
482
public func canTransfer( to: EthereumAddress , amount: String , data: [ UInt8 ] ) async throws -> ( [ UInt8 ] , Data ) {
493
- transaction. callOnBlock = . latest
494
-
495
483
// get the decimals manually
496
484
let callResult = try await contract. createReadOperation ( " decimals " ) !. callContractMethod ( )
497
485
var decimals = BigUInt ( 0 )
@@ -510,8 +498,6 @@ public class ERC1400: IERC1400, ERC20BaseProperties {
510
498
}
511
499
512
500
public func canTransferFrom( originalOwner: EthereumAddress , to: EthereumAddress , amount: String , data: [ UInt8 ] ) async throws -> ( [ UInt8 ] , Data ) {
513
- transaction. callOnBlock = . latest
514
-
515
501
// get the decimals manually
516
502
let callResult = try await contract. createReadOperation ( " decimals " ) !. callContractMethod ( )
517
503
var decimals = BigUInt ( 0 )
@@ -530,8 +516,6 @@ public class ERC1400: IERC1400, ERC20BaseProperties {
530
516
}
531
517
532
518
public func canTransferByPartition( originalOwner: EthereumAddress , to: EthereumAddress , partition: Data , amount: String , data: [ UInt8 ] ) async throws -> ( [ UInt8 ] , Data , Data ) {
533
- transaction. callOnBlock = . latest
534
-
535
519
// get the decimals manually
536
520
let callResult = try await contract. createReadOperation ( " decimals " ) !. callContractMethod ( )
537
521
var decimals = BigUInt ( 0 )
@@ -552,14 +536,12 @@ public class ERC1400: IERC1400, ERC20BaseProperties {
552
536
553
537
extension ERC1400 : IERC777 {
554
538
public func canImplementInterfaceForAddress( interfaceHash: Data , addr: EthereumAddress ) async throws -> Data {
555
- transaction. callOnBlock = . latest
556
539
let result = try await contract. createReadOperation ( " canImplementInterfaceForAddress " , parameters: [ interfaceHash, addr] as [ AnyObject ] , extraData: Data ( ) ) !. callContractMethod ( )
557
540
guard let res = result [ " 0 " ] as? Data else { throw Web3Error . processingError ( desc: " Failed to get result of expected type from the Ethereum node " ) }
558
541
return res
559
542
}
560
543
561
544
public func getInterfaceImplementer( addr: EthereumAddress , interfaceHash: Data ) async throws -> EthereumAddress {
562
- transaction. callOnBlock = . latest
563
545
let result = try await contract. createReadOperation ( " getInterfaceImplementer " , parameters: [ addr, interfaceHash] as [ AnyObject ] , extraData: Data ( ) ) !. callContractMethod ( )
564
546
guard let res = result [ " 0 " ] as? EthereumAddress else { throw Web3Error . processingError ( desc: " Failed to get result of expected type from the Ethereum node " ) }
565
547
return res
@@ -578,7 +560,6 @@ extension ERC1400: IERC777 {
578
560
}
579
561
580
562
public func interfaceHash( interfaceName: String ) async throws -> Data {
581
- transaction. callOnBlock = . latest
582
563
let result = try await contract. createReadOperation ( " interfaceHash " , parameters: [ interfaceName] as [ AnyObject ] , extraData: Data ( ) ) !. callContractMethod ( )
583
564
guard let res = result [ " 0 " ] as? Data else { throw Web3Error . processingError ( desc: " Failed to get result of expected type from the Ethereum node " ) }
584
565
return res
@@ -591,21 +572,18 @@ extension ERC1400: IERC777 {
591
572
}
592
573
593
574
public func supportsInterface( interfaceID: String ) async throws -> Bool {
594
- transaction. callOnBlock = . latest
595
575
let result = try await contract. createReadOperation ( " supportsInterface " , parameters: [ interfaceID] as [ AnyObject ] , extraData: Data ( ) ) !. callContractMethod ( )
596
576
guard let res = result [ " 0 " ] as? Bool else { throw Web3Error . processingError ( desc: " Failed to get result of expected type from the Ethereum node " ) }
597
577
return res
598
578
}
599
579
600
580
public func getGranularity( ) async throws -> BigUInt {
601
- transaction. callOnBlock = . latest
602
581
let result = try await contract. createReadOperation ( " granularity " , parameters: [ ] as [ AnyObject ] , extraData: Data ( ) ) !. callContractMethod ( )
603
582
guard let res = result [ " 0 " ] as? BigUInt else { throw Web3Error . processingError ( desc: " Failed to get result of expected type from the Ethereum node " ) }
604
583
return res
605
584
}
606
585
607
586
public func getDefaultOperators( ) async throws -> [ EthereumAddress ] {
608
- transaction. callOnBlock = . latest
609
587
let result = try await contract. createReadOperation ( " defaultOperators " , parameters: [ ] as [ AnyObject ] , extraData: Data ( ) ) !. callContractMethod ( )
610
588
guard let res = result [ " 0 " ] as? [ EthereumAddress ] else { throw Web3Error . processingError ( desc: " Failed to get result of expected type from the Ethereum node " ) }
611
589
return res
@@ -626,7 +604,6 @@ extension ERC1400: IERC777 {
626
604
}
627
605
628
606
public func isOperatorFor( operator user: EthereumAddress , tokenHolder: EthereumAddress ) async throws -> Bool {
629
- transaction. callOnBlock = . latest
630
607
let result = try await contract. createReadOperation ( " isOperatorFor " , parameters: [ user, tokenHolder] as [ AnyObject ] , extraData: Data ( ) ) !. callContractMethod ( )
631
608
guard let res = result [ " 0 " ] as? Bool else { throw Web3Error . processingError ( desc: " Failed to get result of expected type from the Ethereum node " ) }
632
609
return res
0 commit comments