Skip to content

Commit dce9031

Browse files
committed
eth_sendTransaction uses Method
1 parent b28a30b commit dce9031

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

web3/eth.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@
7676
)
7777
from web3.exceptions import (
7878
TimeExhausted,
79-
TransactionNotFound,
8079
)
8180
from web3.iban import (
8281
Iban,
@@ -368,7 +367,7 @@ def modifyTransaction(
368367
new_transaction = merge(current_transaction_params, transaction_params)
369368
return replace_transaction(self.web3, current_transaction, new_transaction)
370369

371-
def sendTransaction(self, transaction: TxParams) -> HexBytes:
370+
def send_transaction_munger(self, transaction: TxParams) -> Tuple[TxParams]:
372371
# TODO: move to middleware
373372
if 'from' not in transaction and is_checksum_address(self.defaultAccount):
374373
transaction = assoc(transaction, 'from', self.defaultAccount)
@@ -380,11 +379,12 @@ def sendTransaction(self, transaction: TxParams) -> HexBytes:
380379
'gas',
381380
get_buffered_gas_estimate(self.web3, transaction),
382381
)
382+
return (transaction,)
383383

384-
return self.web3.manager.request_blocking(
385-
RPC.eth_sendTransaction,
386-
[transaction],
387-
)
384+
sendTransaction: Method[Callable[[TxParams], HexBytes]] = Method(
385+
RPC.eth_sendTransaction,
386+
mungers=[send_transaction_munger]
387+
)
388388

389389
sendRawTransaction: Method[Callable[[Union[HexStr, bytes]], HexBytes]] = Method(
390390
RPC.eth_sendRawTransaction,

web3/providers/eth_tester/middleware.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ def middleware(method: RPCEndpoint, params: Any) -> RPCResponse:
327327
fill_default_from,
328328
fill_default_gas,
329329
)
330-
return make_request(method, [filled_transaction] + params[1:])
330+
return make_request(method, [filled_transaction] + list(params)[1:])
331331
elif method in (
332332
'eth_estimateGas',
333333
'eth_sendTransaction',
@@ -336,7 +336,7 @@ def middleware(method: RPCEndpoint, params: Any) -> RPCResponse:
336336
params[0],
337337
fill_default_from,
338338
)
339-
return make_request(method, [filled_transaction] + params[1:])
339+
return make_request(method, [filled_transaction] + list(params)[1:])
340340
else:
341341
return make_request(method, params)
342342
return middleware

0 commit comments

Comments
 (0)