ethers.js
ethers.js copied to clipboard
I can't get transaction raw data from hash in ethers v6
Ethers Version
6.7.1
Search Terms
raw transaction data from hash
Describe the Problem
I am trying to get transaction raw data from tx hash. But I can't find any documentation or code for v6.
Code Snippet
const ETHEREUM_RPC_URL = "https://ethereum-sepolia-rpc.publicnode.com"
// Standard json rpc provider directly from ethers.js (NOT Flashbots)
const provider = new JsonRpcProvider(ETHEREUM_RPC_URL,11155111)
const tx = await provider.getTransaction("0x1bffb6dd405e8d9ce35f99eb7ed1f9b64537a0de2d73f22ba99a6726d50cb1a3");
Contract ABI
No response
Errors
No response
Environment
No response
Environment (Other)
No response
It seems that your code is correct. Did you encounter any errors? Can you add more information? The relevant code and documents have not changed much.
You should be able to use the Transaction class if you are looking for the serialized data: Transaction.from(await providers.getTransaction(hash)).serialized if I understand your question correctly?