|
8 | 8 | TYPE_CHECKING, |
9 | 9 | Callable, |
10 | 10 | Sequence, |
11 | | - Union, |
12 | 11 | cast, |
13 | 12 | ) |
14 | 13 |
|
@@ -262,6 +261,18 @@ async def test_eth_send_transaction_max_fee_less_than_tip( |
262 | 261 | ): |
263 | 262 | await async_w3.eth.send_transaction(txn_params) # type: ignore |
264 | 263 |
|
| 264 | + @pytest.mark.asyncio |
| 265 | + async def test_eth_send_raw_transaction(self, async_w3: "Web3") -> None: |
| 266 | + # private key 0x3c2ab4e8f17a7dea191b8c991522660126d681039509dc3bb31af7c9bdb63518 |
| 267 | + # This is an unfunded account, but the transaction has a 0 gas price, so is valid. |
| 268 | + # It never needs to be mined, we just want the transaction hash back to confirm. |
| 269 | + # tx = {'to': '0x0000000000000000000000000000000000000000', 'value': 0, 'nonce': 1, 'gas': 21000, 'gasPrice': 0, 'chainId': 131277322940537} # noqa: E501 |
| 270 | + # NOTE: nonce=1 to make txn unique from the non-async version of this test |
| 271 | + raw_txn = HexBytes('0xf8650180825208940000000000000000000000000000000000000000808086eecac466e115a0ffdd42d7dee4ac85427468bc616812e49432e285e4e8f5cd9381163ac3b28108a04ec6b0d89ecbd5e89b0399f336ad50f283fafd70e86593250bf5a2adfb93d17e') # noqa: E501 |
| 272 | + expected_hash = HexStr('0x52b0ff9cb472f25872fa8ec6a62fa59454fc2ae7901cfcc6cc89d096f49b8fc1') |
| 273 | + txn_hash = await async_w3.eth.send_raw_transaction(raw_txn) # type: ignore |
| 274 | + assert txn_hash == async_w3.toBytes(hexstr=expected_hash) |
| 275 | + |
265 | 276 | @pytest.mark.asyncio |
266 | 277 | async def test_gas_price_strategy_middleware( |
267 | 278 | self, async_w3: "Web3", unlocked_account_dual_type: ChecksumAddress |
@@ -1887,27 +1898,14 @@ def test_eth_modifyTransaction_deprecated( |
1887 | 1898 | assert modified_txn['gas'] == 21000 |
1888 | 1899 | assert modified_txn['gasPrice'] == cast(int, txn_params['gasPrice']) * 2 |
1889 | 1900 |
|
1890 | | - @pytest.mark.parametrize( |
1891 | | - 'raw_transaction, expected_hash', |
1892 | | - [ |
1893 | | - ( |
1894 | | - # private key 0x3c2ab4e8f17a7dea191b8c991522660126d681039509dc3bb31af7c9bdb63518 |
1895 | | - # This is an unfunded account, but the transaction has a 0 gas price, so is valid. |
1896 | | - # It never needs to be mined, we just want the transaction hash back to confirm. |
1897 | | - # tx = {'to': '0x0000000000000000000000000000000000000000', 'value': 0, 'nonce': 0, 'gas': 21000, 'gasPrice': 0, 'chainId': 131277322940537} # noqa: E501 |
1898 | | - HexBytes('0xf8658080825208940000000000000000000000000000000000000000808086eecac466e115a038176e5f9f1c25ce470ce77856bacbc02dd728ad647bb8b18434ac62c3e8e14fa03279bb3ee1e5202580668ec62b66a7d01355de3d5c4ef18fcfcb88fac56d5f90'), # noqa: E501 |
1899 | | - '0x6ab943e675003de610b4e94f2e289dc711688df6e150da2bc57bd03811ad0f63', |
1900 | | - ), |
1901 | | - ] |
1902 | | - ) |
1903 | | - def test_eth_send_raw_transaction( |
1904 | | - self, |
1905 | | - web3: "Web3", |
1906 | | - raw_transaction: Union[HexStr, bytes], |
1907 | | - funded_account_for_raw_txn: ChecksumAddress, |
1908 | | - expected_hash: HexStr, |
1909 | | - ) -> None: |
1910 | | - txn_hash = web3.eth.send_raw_transaction(raw_transaction) |
| 1901 | + def test_eth_send_raw_transaction(self, web3: "Web3") -> None: |
| 1902 | + # private key 0x3c2ab4e8f17a7dea191b8c991522660126d681039509dc3bb31af7c9bdb63518 |
| 1903 | + # This is an unfunded account, but the transaction has a 0 gas price, so is valid. |
| 1904 | + # It never needs to be mined, we just want the transaction hash back to confirm. |
| 1905 | + # tx = {'to': '0x0000000000000000000000000000000000000000', 'value': 0, 'nonce': 0, 'gas': 21000, 'gasPrice': 0, 'chainId': 131277322940537} # noqa: E501 |
| 1906 | + raw_txn = HexBytes('0xf8658080825208940000000000000000000000000000000000000000808086eecac466e115a038176e5f9f1c25ce470ce77856bacbc02dd728ad647bb8b18434ac62c3e8e14fa03279bb3ee1e5202580668ec62b66a7d01355de3d5c4ef18fcfcb88fac56d5f90') # noqa: E501 |
| 1907 | + expected_hash = HexStr('0x6ab943e675003de610b4e94f2e289dc711688df6e150da2bc57bd03811ad0f63') |
| 1908 | + txn_hash = web3.eth.send_raw_transaction(raw_txn) |
1911 | 1909 | assert txn_hash == web3.toBytes(hexstr=expected_hash) |
1912 | 1910 |
|
1913 | 1911 | def test_eth_call( |
|
0 commit comments