Skip to content

Commit 0053a36

Browse files
authored
fix: pre-flight KeyError in _send_tx (#18)
1 parent 0757f21 commit 0053a36

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

bnbagent/core/contract_mixin.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ def _send_tx(self, fn, value: int = 0, gas: int = 2_000_000, skip_preflight: boo
5555
if not skip_preflight:
5656
import concurrent.futures as _cf
5757
_call_params = {
58-
"from": tx["from"],
59-
"to": tx["to"],
60-
"data": tx["data"],
58+
"from": self._account,
59+
"to": tx.get("to"),
60+
"data": tx.get("data", "0x"),
6161
"value": tx.get("value", 0),
62-
"gas": tx["gas"],
62+
"gas": tx.get("gas", gas),
6363
}
6464
with _cf.ThreadPoolExecutor(max_workers=1) as _pool:
6565
_future = _pool.submit(self.w3.eth.call, _call_params)

0 commit comments

Comments
 (0)