This Hardhat plugin integrates the blockchain-tx-decoder
library into your Hardhat workflow. It allows you to decode Ethereum transactions, providing detailed information such as transaction data, contract interactions, and emitted events directly within your Hardhat tasks.
To install the plugin, follow these steps:
npm install --save-dev hardhat-tx-decoder
After installing the plugin, you need to add it to your Hardhat project configuration.
Import the plugin in hardhat.config.ts
:
import 'hardhat-tx-decoder';
To decode a transaction, simply run the following Hardhat command:
npx hardhat txDecode <txId> --network <network-name>
Where:
-
txId
: is the transaction hash of the Ethereum transaction you want to decode. -
network-name
is the name of the network you have configured in yourhardhat.config.js
(e.g., localhost, rinkeby, mainnet, etc.).
This command will decode the transaction with the given hash on the localhost network.
npx hardhat txDecode 0xb2f9890b5845a74376535eee721c35ca58eeb363f783df0c515b8858c98a5e0f --network localhost