Skip to content

Commit 6945072

Browse files
committed
Add transaction result formatters for type and chainId
- Add transaction result formatters for `type` and `chainId` to convert from values to ``int`` if ``hexadecimal`` if the field is not null
1 parent e0da839 commit 6945072

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

newsfragments/2491.feature.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add transaction result formatters for `type` and `chainId` to convert values to ``int`` if ``hexadecimal`` if the field is not null

tests/core/utilities/test_valid_transaction_params.py

-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ def test_assert_valid_transaction_params_invalid_param():
5555

5656

5757
FULL_TXN_DICT = {
58-
'chainId': 1,
5958
'type': '0x2',
6059
'from': '0x0',
6160
'to': '0x1',

web3/_utils/method_formatters.py

+2
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ def is_attrdict(val: Any) -> bool:
169169
'hash': to_hexbytes(32),
170170
'v': apply_formatter_if(is_not_null, to_integer_if_hex),
171171
'standardV': apply_formatter_if(is_not_null, to_integer_if_hex),
172+
'type': apply_formatter_if(is_not_null, to_integer_if_hex),
173+
'chainId': apply_formatter_if(is_not_null, to_integer_if_hex),
172174
}
173175

174176

0 commit comments

Comments
 (0)