0.2.3 • Published 11 months ago

web3-errors-extract v0.2.3

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

Web3 Errors Extract

ES Version Node Version

Web3 Errors Extract is a TypeScript implementation of the Ethereum JSON RPC API to get/extract EVM-based web3 transaction revert messages or any other errors.

Installation

You can install the package using NPM

Using NPM

npm install web3-errors-extract

Using Yarn

yarn add web3-errors-extract

Getting Started

Prerequisites

Usage

const { Web3errors } = require("web3-errors-extract");

OR

import { Web3errors } from "web3-errors-extract";


const ABI1 = [{
    "type":"function",
    "name":"foo",
    "inputs": [{"name":"a","type":"uint256"}],
    "outputs": [{"name":"b","type":"address"}]
},{
    "type":"event",
    "name":"Event",
    "inputs": [{"name":"a","type":"uint256","indexed":true},{"name":"b","type":"bytes32","indexed":false}],
}]

const ABI2 = [{
    "type":"function",
    "name":"foo",
    "inputs": [{"name":"a","type":"uint256"}],
    "outputs": [{"name":"b","type":"address"}]
},{
    "type":"event",
    "name":"Event",
    "inputs": [{"name":"a","type":"uint256","indexed":true},{"name":"b","type":"bytes32","indexed":false}],
}]

const err = new web3errors("YOUR RPC URL OR PROVIDER", [ABI1, ABI2]: OPTIONAL ARRAY OF ABIs);

/*
 * Get an error message for a specific tx hash
 */
err.getErrOfTx("0x1234......fff").then(console.log).catch(console.error);


/*
 * Get an error message by providing an exception error object of any blockchain (send or call) tx you received in return
 */
err.getErrorMessage(EXCEPTION ERROR OBJECT).then(console.log).catch(console.error);
0.2.3

11 months ago

0.2.2

11 months ago

0.1.0

1 year ago

0.2.1

11 months ago

0.1.2

1 year ago

0.2.0

1 year ago

0.1.1

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago