Skip to content

Commit 78301bd

Browse files
Fix wrong sendTransaction request bug.
1 parent fec0bc0 commit 78301bd

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Sources/web3swift/API/APIMethod.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public enum APIRequest {
2525
// ??
2626
case estimateGas(TransactionParameters, BlockNumber)
2727
case sendRawTransaction(Hash)
28-
case sendTransaction(TransactionParameters, BlockNumber)
28+
case sendTransaction(TransactionParameters)
2929
case getTransactionByHash(Hash)
3030
case getTransactionReceipt(Hash)
3131
case getLogs(EventFilterParameters)
@@ -148,8 +148,8 @@ extension APIRequest {
148148
case let .sendRawTransaction(hash):
149149
return [RequestParameter.string(hash)]
150150

151-
case .sendTransaction(let transactionParameters, let blockNumber):
152-
return [RequestParameter.transaction(transactionParameters), RequestParameter.string(blockNumber.stringValue)]
151+
case let .sendTransaction(transactionParameters):
152+
return [RequestParameter.transaction(transactionParameters)]
153153

154154
case .getTransactionByHash(let hash):
155155
return [RequestParameter.string(hash)]
@@ -240,6 +240,7 @@ extension APIRequest {
240240
guard let httpResponse = response as? HTTPURLResponse,
241241
200 ..< 400 ~= httpResponse.statusCode else { throw Web3Error.connectionError }
242242

243+
// FIXME: Add throwing an error from is server fails.
243244
/// This bit of code is purposed to work with literal types that comes in Response in hexString type.
244245
/// Currently it's just any kind of Integers like `(U)Int`, `Big(U)Int`.
245246
if Result.self == UInt.self || Result.self == Int.self || Result.self == BigInt.self || Result.self == BigUInt.self {

Sources/web3swift/EthereumAPICalls/Ethereum/Eth+SendTransaction.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ extension web3.Eth {
4949
// FIXME: Add appropriate error
5050
guard let transactionParameters = transaction.encodeAsDictionary(from: transactionOptions?.from) else { throw Web3Error.unknownError }
5151

52-
let request: APIRequest = .sendTransaction(transactionParameters, transactionOptions?.callOnBlock ?? .latest)
52+
let request: APIRequest = .sendTransaction(transactionParameters)
5353
let response: APIResponse<Hash> = try await APIRequest.sendRequest(with: self.provider, for: request)
5454

5555
let result = TransactionSendingResult(transaction: assembledTransaction, hash: response.result)

0 commit comments

Comments
 (0)