Skip to content

Commit a20b1c4

Browse files
committed
Remove obsolete setting of call on block
1 parent 89a9c5d commit a20b1c4

File tree

13 files changed

+0
-104
lines changed

13 files changed

+0
-104
lines changed

Sources/web3swift/Tokens/ERC1155/Web3+ERC1155.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ public class ERC1155: IERC1155 {
6868
return
6969
}
7070
guard contract.contract.address != nil else {return}
71-
transaction.callOnBlock = .latest
7271

7372
guard let tokenIdPromise = try await contract.createReadOperation("id", parameters: [] as [AnyObject], extraData: Data())?.callContractMethod() else {return}
7473

@@ -92,7 +91,6 @@ public class ERC1155: IERC1155 {
9291
}
9392

9493
public func balanceOf(account: EthereumAddress, id: BigUInt) async throws -> BigUInt {
95-
transaction.callOnBlock = .latest
9694
let result = try await contract
9795
.createReadOperation("balanceOf", parameters: [account, id] as [AnyObject], extraData: Data())!
9896
.callContractMethod()
@@ -114,14 +112,12 @@ public class ERC1155: IERC1155 {
114112
}
115113

116114
public func isApprovedForAll(owner: EthereumAddress, operator user: EthereumAddress, scope: Data) async throws -> Bool {
117-
transaction.callOnBlock = .latest
118115
let result = try await contract.createReadOperation("isApprovedForAll", parameters: [owner, user, scope] as [AnyObject], extraData: Data())!.callContractMethod()
119116
guard let res = result["0"] as? Bool else {throw Web3Error.processingError(desc: "Failed to get result of expected type from the Ethereum node")}
120117
return res
121118
}
122119

123120
public func supportsInterface(interfaceID: String) async throws -> Bool {
124-
transaction.callOnBlock = .latest
125121
let result = try await contract.createReadOperation("supportsInterface", parameters: [interfaceID] as [AnyObject], extraData: Data())!.callContractMethod()
126122
guard let res = result["0"] as? Bool else {throw Web3Error.processingError(desc: "Failed to get result of expected type from the Ethereum node")}
127123
return res

Sources/web3swift/Tokens/ERC1376/Web3+ERC1376.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,12 @@ public class ERC1376: IERC1376, ERC20BaseProperties {
8989
}
9090

9191
public func getBalance(account: EthereumAddress) async throws -> BigUInt {
92-
transaction.callOnBlock = .latest
9392
let result = try await contract.createReadOperation("balanceOf", parameters: [account] as [AnyObject], extraData: Data())!.callContractMethod()
9493
guard let res = result["0"] as? BigUInt else {throw Web3Error.processingError(desc: "Failed to get result of expected type from the Ethereum node")}
9594
return res
9695
}
9796

9897
public func getAllowance(originalOwner: EthereumAddress, delegate: EthereumAddress) async throws -> BigUInt {
99-
transaction.callOnBlock = .latest
10098
let result = try await contract.createReadOperation("allowance", parameters: [originalOwner, delegate] as [AnyObject], extraData: Data())!.callContractMethod()
10199
guard let res = result["0"] as? BigUInt else {throw Web3Error.processingError(desc: "Failed to get result of expected type from the Ethereum node")}
102100
return res
@@ -178,7 +176,6 @@ public class ERC1376: IERC1376, ERC20BaseProperties {
178176
}
179177

180178
public func totalSupply() async throws -> BigUInt {
181-
transaction.callOnBlock = .latest
182179
let result = try await contract.createReadOperation("totalSupply", parameters: [AnyObject](), extraData: Data())!.callContractMethod()
183180
guard let res = result["0"] as? BigUInt else {throw Web3Error.processingError(desc: "Failed to get result of expected type from the Ethereum node")}
184181
return res
@@ -294,7 +291,6 @@ public class ERC1376: IERC1376, ERC20BaseProperties {
294291
}
295292

296293
func nonceOf(owner: EthereumAddress) async throws -> BigUInt {
297-
transaction.callOnBlock = .latest
298294
let result = try await contract.createReadOperation("nonceOf", parameters: [owner] as [AnyObject], extraData: Data())!.callContractMethod()
299295
guard let res = result["0"] as? BigUInt else {throw Web3Error.processingError(desc: "Failed to get result of expected type from the Ethereum node")}
300296
return res
@@ -329,7 +325,6 @@ public class ERC1376: IERC1376, ERC20BaseProperties {
329325
}
330326

331327
func directDebit(debtor: EthereumAddress, receiver: EthereumAddress) async throws -> DirectDebit {
332-
transaction.callOnBlock = .latest
333328
let result = try await contract.createReadOperation("directDebit", parameters: [debtor, receiver] as [AnyObject], extraData: Data())!.callContractMethod()
334329
guard let res = result["0"] as? DirectDebit else {throw Web3Error.processingError(desc: "Failed to get result of expected type from the Ethereum node")}
335330
return res

Sources/web3swift/Tokens/ERC1400/Web3+ERC1400.swift

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,12 @@ public class ERC1400: IERC1400, ERC20BaseProperties {
8686
}
8787

8888
public func getBalance(account: EthereumAddress) async throws -> BigUInt {
89-
transaction.callOnBlock = .latest
9089
let result = try await contract.createReadOperation("balanceOf", parameters: [account] as [AnyObject], extraData: Data())!.callContractMethod()
9190
guard let res = result["0"] as? BigUInt else {throw Web3Error.processingError(desc: "Failed to get result of expected type from the Ethereum node")}
9291
return res
9392
}
9493

9594
public func getAllowance(originalOwner: EthereumAddress, delegate: EthereumAddress) async throws -> BigUInt {
96-
transaction.callOnBlock = .latest
9795
let result = try await contract.createReadOperation("allowance", parameters: [originalOwner, delegate] as [AnyObject], extraData: Data())!.callContractMethod()
9896
guard let res = result["0"] as? BigUInt else {throw Web3Error.processingError(desc: "Failed to get result of expected type from the Ethereum node")}
9997
return res
@@ -156,7 +154,6 @@ public class ERC1400: IERC1400, ERC20BaseProperties {
156154
}
157155

158156
public func totalSupply() async throws -> BigUInt {
159-
transaction.callOnBlock = .latest
160157
let result = try await contract.createReadOperation("totalSupply", parameters: [AnyObject](), extraData: Data())!.callContractMethod()
161158
guard let res = result["0"] as? BigUInt else {throw Web3Error.processingError(desc: "Failed to get result of expected type from the Ethereum node")}
162159
return res
@@ -183,7 +180,6 @@ public class ERC1400: IERC1400, ERC20BaseProperties {
183180

184181
// ERC1400 methods
185182
public func getDocument(name: Data) async throws -> (String, Data) {
186-
transaction.callOnBlock = .latest
187183
let result = try await contract.createReadOperation("getDocument", parameters: [name] as [AnyObject], extraData: Data())!.callContractMethod()
188184
guard let res = result["0"] as? (String, Data) else {throw Web3Error.processingError(desc: "Failed to get result of expected type from the Ethereum node")}
189185
return res
@@ -196,14 +192,12 @@ public class ERC1400: IERC1400, ERC20BaseProperties {
196192
}
197193

198194
public func balanceOfByPartition(partition: Data, tokenHolder: EthereumAddress) async throws -> BigUInt {
199-
transaction.callOnBlock = .latest
200195
let result = try await contract.createReadOperation("balanceOfByPartition", parameters: [partition, tokenHolder] as [AnyObject], extraData: Data())!.callContractMethod()
201196
guard let res = result["0"] as? BigUInt else {throw Web3Error.processingError(desc: "Failed to get result of expected type from the Ethereum node")}
202197
return res
203198
}
204199

205200
public func partitionsOf(tokenHolder: EthereumAddress) async throws -> [Data] {
206-
transaction.callOnBlock = .latest
207201
let result = try await contract.createReadOperation("partitionsOf", parameters: [tokenHolder] as [AnyObject], extraData: Data())!.callContractMethod()
208202
guard let res = result["0"] as? [Data] else {throw Web3Error.processingError(desc: "Failed to get result of expected type from the Ethereum node")}
209203
return res
@@ -286,7 +280,6 @@ public class ERC1400: IERC1400, ERC20BaseProperties {
286280
}
287281

288282
public func isControllable() async throws -> Bool {
289-
transaction.callOnBlock = .latest
290283
let result = try await contract.createReadOperation("isControllable", parameters: [AnyObject](), extraData: Data())!.callContractMethod()
291284
guard let res = result["0"] as? Bool else {throw Web3Error.processingError(desc: "Failed to get result of expected type from the Ethereum node")}
292285
return res
@@ -355,21 +348,18 @@ public class ERC1400: IERC1400, ERC20BaseProperties {
355348
}
356349

357350
public func isOperator(operator user: EthereumAddress, tokenHolder: EthereumAddress) async throws -> Bool {
358-
transaction.callOnBlock = .latest
359351
let result = try await contract.createReadOperation("isOperator", parameters: [user, tokenHolder] as [AnyObject], extraData: Data())!.callContractMethod()
360352
guard let res = result["0"] as? Bool else {throw Web3Error.processingError(desc: "Failed to get result of expected type from the Ethereum node")}
361353
return res
362354
}
363355

364356
public func isOperatorForPartition(partition: Data, operator user: EthereumAddress, tokenHolder: EthereumAddress) async throws -> Bool {
365-
transaction.callOnBlock = .latest
366357
let result = try await contract.createReadOperation("isOperatorForPartition", parameters: [partition, user, tokenHolder] as [AnyObject], extraData: Data())!.callContractMethod()
367358
guard let res = result["0"] as? Bool else {throw Web3Error.processingError(desc: "Failed to get result of expected type from the Ethereum node")}
368359
return res
369360
}
370361

371362
public func isIssuable() async throws -> Bool {
372-
transaction.callOnBlock = .latest
373363
let result = try await contract.createReadOperation("isIssuable", parameters: [AnyObject](), extraData: Data())!.callContractMethod()
374364
guard let res = result["0"] as? Bool else {throw Web3Error.processingError(desc: "Failed to get result of expected type from the Ethereum node")}
375365
return res
@@ -490,8 +480,6 @@ public class ERC1400: IERC1400, ERC20BaseProperties {
490480
}
491481

492482
public func canTransfer(to: EthereumAddress, amount: String, data: [UInt8]) async throws -> ([UInt8], Data) {
493-
transaction.callOnBlock = .latest
494-
495483
// get the decimals manually
496484
let callResult = try await contract.createReadOperation("decimals" )!.callContractMethod()
497485
var decimals = BigUInt(0)
@@ -510,8 +498,6 @@ public class ERC1400: IERC1400, ERC20BaseProperties {
510498
}
511499

512500
public func canTransferFrom(originalOwner: EthereumAddress, to: EthereumAddress, amount: String, data: [UInt8]) async throws -> ([UInt8], Data) {
513-
transaction.callOnBlock = .latest
514-
515501
// get the decimals manually
516502
let callResult = try await contract.createReadOperation("decimals" )!.callContractMethod()
517503
var decimals = BigUInt(0)
@@ -530,8 +516,6 @@ public class ERC1400: IERC1400, ERC20BaseProperties {
530516
}
531517

532518
public func canTransferByPartition(originalOwner: EthereumAddress, to: EthereumAddress, partition: Data, amount: String, data: [UInt8]) async throws -> ([UInt8], Data, Data) {
533-
transaction.callOnBlock = .latest
534-
535519
// get the decimals manually
536520
let callResult = try await contract.createReadOperation("decimals" )!.callContractMethod()
537521
var decimals = BigUInt(0)
@@ -552,14 +536,12 @@ public class ERC1400: IERC1400, ERC20BaseProperties {
552536

553537
extension ERC1400: IERC777 {
554538
public func canImplementInterfaceForAddress(interfaceHash: Data, addr: EthereumAddress) async throws -> Data {
555-
transaction.callOnBlock = .latest
556539
let result = try await contract.createReadOperation("canImplementInterfaceForAddress", parameters: [interfaceHash, addr] as [AnyObject], extraData: Data())!.callContractMethod()
557540
guard let res = result["0"] as? Data else {throw Web3Error.processingError(desc: "Failed to get result of expected type from the Ethereum node")}
558541
return res
559542
}
560543

561544
public func getInterfaceImplementer(addr: EthereumAddress, interfaceHash: Data) async throws -> EthereumAddress {
562-
transaction.callOnBlock = .latest
563545
let result = try await contract.createReadOperation("getInterfaceImplementer", parameters: [addr, interfaceHash] as [AnyObject], extraData: Data())!.callContractMethod()
564546
guard let res = result["0"] as? EthereumAddress else {throw Web3Error.processingError(desc: "Failed to get result of expected type from the Ethereum node")}
565547
return res
@@ -578,7 +560,6 @@ extension ERC1400: IERC777 {
578560
}
579561

580562
public func interfaceHash(interfaceName: String) async throws -> Data {
581-
transaction.callOnBlock = .latest
582563
let result = try await contract.createReadOperation("interfaceHash", parameters: [interfaceName] as [AnyObject], extraData: Data())!.callContractMethod()
583564
guard let res = result["0"] as? Data else {throw Web3Error.processingError(desc: "Failed to get result of expected type from the Ethereum node")}
584565
return res
@@ -591,21 +572,18 @@ extension ERC1400: IERC777 {
591572
}
592573

593574
public func supportsInterface(interfaceID: String) async throws -> Bool {
594-
transaction.callOnBlock = .latest
595575
let result = try await contract.createReadOperation("supportsInterface", parameters: [interfaceID] as [AnyObject], extraData: Data())!.callContractMethod()
596576
guard let res = result["0"] as? Bool else {throw Web3Error.processingError(desc: "Failed to get result of expected type from the Ethereum node")}
597577
return res
598578
}
599579

600580
public func getGranularity() async throws -> BigUInt {
601-
transaction.callOnBlock = .latest
602581
let result = try await contract.createReadOperation("granularity", parameters: [] as [AnyObject], extraData: Data())!.callContractMethod()
603582
guard let res = result["0"] as? BigUInt else {throw Web3Error.processingError(desc: "Failed to get result of expected type from the Ethereum node")}
604583
return res
605584
}
606585

607586
public func getDefaultOperators() async throws -> [EthereumAddress] {
608-
transaction.callOnBlock = .latest
609587
let result = try await contract.createReadOperation("defaultOperators", parameters: [] as [AnyObject], extraData: Data())!.callContractMethod()
610588
guard let res = result["0"] as? [EthereumAddress] else {throw Web3Error.processingError(desc: "Failed to get result of expected type from the Ethereum node")}
611589
return res
@@ -626,7 +604,6 @@ extension ERC1400: IERC777 {
626604
}
627605

628606
public func isOperatorFor(operator user: EthereumAddress, tokenHolder: EthereumAddress) async throws -> Bool {
629-
transaction.callOnBlock = .latest
630607
let result = try await contract.createReadOperation("isOperatorFor", parameters: [user, tokenHolder] as [AnyObject], extraData: Data())!.callContractMethod()
631608
guard let res = result["0"] as? Bool else {throw Web3Error.processingError(desc: "Failed to get result of expected type from the Ethereum node")}
632609
return res

0 commit comments

Comments
 (0)