Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions newsfragments/2450.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add ``chainId`` to tx params to ``TRANSACTION_PARAMS_ABI``
1 change: 1 addition & 0 deletions web3/_utils/rpc_abi.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ class RPC:
'nonce': 'uint',
'to': 'address',
'value': 'uint',
'chainId': 'uint',
}

FILTER_PARAMS_ABIS = {
Expand Down
5 changes: 3 additions & 2 deletions web3/middleware/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@

@curry
def _validate_chain_id(web3_chain_id: int, chain_id: int) -> int:
if to_integer_if_hex(chain_id) == web3_chain_id:
chain_id_int = to_integer_if_hex(chain_id)
if chain_id_int == web3_chain_id:
return chain_id
else:
raise ValidationError(
f"The transaction declared chain ID {chain_id!r}, "
f"The transaction declared chain ID {chain_id_int!r}, "
f"but the connected node is on {web3_chain_id!r}"
)

Expand Down