ethers.js icon indicating copy to clipboard operation
ethers.js copied to clipboard

I can't get transaction raw data from hash in ethers v6

Open jonnyassist79 opened this issue 1 year ago • 2 comments

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

jonnyassist79 avatar Oct 02 '24 16:10 jonnyassist79

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.

jasonandjay avatar Oct 12 '24 06:10 jasonandjay

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?

ricmoo avatar Oct 16 '24 00:10 ricmoo