diff --git a/Sources/Core/Transaction/CodableTransaction.swift b/Sources/Core/Transaction/CodableTransaction.swift index 316e4ceb8..8878aea1b 100644 --- a/Sources/Core/Transaction/CodableTransaction.swift +++ b/Sources/Core/Transaction/CodableTransaction.swift @@ -187,18 +187,17 @@ public struct CodableTransaction { return self.envelope.encode(for: type) } - public mutating func resolve(provider: Web3Provider) async { - // FIXME: Delete force try - self.gasLimit = try! await self.gasLimitPolicy.resolve(provider: provider, transaction: self) + public mutating func resolve(provider: Web3Provider) async throws { + self.gasLimit = try await self.gasLimitPolicy.resolve(provider: provider, transaction: self) if from != nil || sender != nil { - self.nonce = try! await self.resolveNonce(provider: provider) + self.nonce = try await self.resolveNonce(provider: provider) } if case .eip1559 = type { - self.maxFeePerGas = try! await self.maxFeePerGasPolicy.resolve(provider: provider) - self.maxPriorityFeePerGas = try! await self.maxPriorityFeePerGasPolicy.resolve(provider: provider) + self.maxFeePerGas = try await self.maxFeePerGasPolicy.resolve(provider: provider) + self.maxPriorityFeePerGas = try await self.maxPriorityFeePerGasPolicy.resolve(provider: provider) } else { - self.gasPrice = try! await self.gasPricePolicy.resolve(provider: provider) + self.gasPrice = try await self.gasPricePolicy.resolve(provider: provider) } } diff --git a/Sources/web3swift/Operations/ReadTransaction.swift b/Sources/web3swift/Operations/ReadTransaction.swift index 5c721db19..a5b38f436 100755 --- a/Sources/web3swift/Operations/ReadTransaction.swift +++ b/Sources/web3swift/Operations/ReadTransaction.swift @@ -34,7 +34,7 @@ public class ReadOperation { // TODO: Remove type erasing here, some broad wide protocol should be added instead public func callContractMethod() async throws -> [String: Any] { - await transaction.resolve(provider: web3.provider) + try await transaction.resolve(provider: web3.provider) // MARK: Read data from ABI flow // FIXME: This should be dropped, and after `execute()` call, just to decode raw data. let data: Data = try await self.web3.eth.callTransaction(transaction) diff --git a/Sources/web3swift/Operations/WriteOperation.swift b/Sources/web3swift/Operations/WriteOperation.swift index 89f7f3a72..9ef64b885 100755 --- a/Sources/web3swift/Operations/WriteOperation.swift +++ b/Sources/web3swift/Operations/WriteOperation.swift @@ -12,7 +12,7 @@ public class WriteOperation: ReadOperation { // FIXME: Rewrite this to CodableTransaction public func writeToChain(password: String) async throws -> TransactionSendingResult { - await transaction.resolve(provider: web3.provider) + try await transaction.resolve(provider: web3.provider) if let attachedKeystoreManager = self.web3.provider.attachedKeystoreManager { do { try Web3Signer.signTX(transaction: &transaction,