revert-reason
v1.0.5
Published
> Get the transaction recovery reason from the transaction hash of Ethernet Square.
Downloads
226
Readme
Project source
This item is modified on the basis of item eth-revert-reason of author shanefontaine. Since project eth-revert-reason
of author shanefontaine
has not been updated for many years, it cannot be used normally. So I updated it based on the current situation.
revert-reason
Introduction
Get the transaction recovery reason from the transaction hash of Ethernet Square.
Usage
At present, only ethers library is supported, web3 library is not supported, And the network only supports Goerli
networks of Arbitrum, Optimism and Ethereum. if necessary, you can put forward comments, I will update it immediately.
Use NetworkName
npm i revert-reason
This method does not support Arbitrum and Optimism,only Ethereum
const res = await getRevertReason(
"0x56a72a14bccafc85786dcd21592be1fe8da94964dcf3d11d5b43cc374d42edf8",
{ Network: "goerli" }
);
Use ethers.provider
This method supports Goerli
networks of Arbitrum, Optimism and Ethereum
const provider = new ethers.providers.JsonRpcProvider();
//https://eth-goerli.g.alchemy.com/v2/your-key alchemy or infura rpc
const res = await getRevertReason(
"0xcb9c1863c6f9ef9f941b30bacaf107359b90172515f87cf641e23d0f2d0a2dea",
{ CustomProvider: provider }
);
- If the transaction is successful, it will return
success
. - If the transaction fails but there is no error message, it will be return
An error occurred but no error message was given
. - If the transaction fails but there is an error message, an error result will be returned, such
ERC20: transfer amount exceeds balance
.