# abi-decoder

> Nodejs and Javascript library for decoding data params and events from ethereum transactions"

Latest version **2.4.0** (published 2021-01-24) · GPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install abi-decoder
pnpm add abi-decoder
yarn add abi-decoder
bun add abi-decoder
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.4.0 |
| Published | 2021-01-24 |
| First published | 2017-02-20 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 63.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 641 |
| Author | denis@gnosis.pm |
| Maintainers | denisgranha |
| Keywords | ethereum, abi, decode |

## Links

- npm: https://www.npmjs.com/package/abi-decoder
- Repository: https://github.com/ConsenSys/abi-decoder
- Homepage: https://github.com/ConsenSys/abi-decoder#readme
- Issues: https://github.com/ConsenSys/abi-decoder/issues
- npm.io page: https://npm.io/package/abi-decoder

## Dependencies (2)

- [web3-utils](https://npm.io/package/web3-utils.md) ^1.2.1
- [web3-eth-abi](https://npm.io/package/web3-eth-abi.md) ^1.2.1

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [jwt-simple](https://npm.io/package/jwt-simple.md) — 259.5K weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads

## Recent versions

- 2.4.0 (latest) — 2021-01-24
- 2.3.0 — 2020-02-04
- 2.2.2 — 2019-09-27
- 2.2.1 — 2019-09-24
- 2.2.0 — 2019-08-12
- 2.1.0 — 2019-08-09
- 2.0.1 — 2019-07-08
- 2.0.0 — 2019-07-08
- 1.2.0 — 2018-08-14
- 1.1.0 — 2018-03-20
- 1.0.9 — 2017-10-13
- 1.0.8 — 2017-03-31
- 1.0.6 — 2017-03-22
- 1.0.4 — 2017-03-15
- 1.0.3 — 2017-02-20
- … 3 more at https://npm.io/package/abi-decoder/versions

## README

# abi-decoder
Nodejs and Javascript library for decoding data params and events from etherem transactions

# Install
```
npm install abi-decoder
bower install abi-decoder
```

# Instantiate
```js
<script src="bower_components/abi-decoder/dist/abi-decoder.js"> // Javascript
const abiDecoder = require('abi-decoder'); // NodeJS
```

# Add ABI's
Need to pass the ABI's manually to the library in order to be able to decode params later
```js
const testABI = [{"inputs": [{"type": "address", "name": ""}], "constant": true, "name": "isInstantiation", "payable": false, "outputs": [{"type": "bool", "name": ""}], "type": "function"}, {"inputs": [{"type": "address[]", "name": "_owners"}, {"type": "uint256", "name": "_required"}, {"type": "uint256", "name": "_dailyLimit"}], "constant": false, "name": "create", "payable": false, "outputs": [{"type": "address", "name": "wallet"}], "type": "function"}, {"inputs": [{"type": "address", "name": ""}, {"type": "uint256", "name": ""}], "constant": true, "name": "instantiations", "payable": false, "outputs": [{"type": "address", "name": ""}], "type": "function"}, {"inputs": [{"type": "address", "name": "creator"}], "constant": true, "name": "getInstantiationCount", "payable": false, "outputs": [{"type": "uint256", "name": ""}], "type": "function"}, {"inputs": [{"indexed": false, "type": "address", "name": "sender"}, {"indexed": false, "type": "address", "name": "instantiation"}], "type": "event", "name": "ContractInstantiation", "anonymous": false}];
abiDecoder.addABI(testABI);
```

# Decode Tx data
```js
const testData = "0x53d9d9100000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000a6d9c5f7d4de3cef51ad3b7235d79ccc95114de5000000000000000000000000a6d9c5f7d4de3cef51ad3b7235d79ccc95114daa";
const decodedData = abiDecoder.decodeMethod(testData);
```

# Decode Logs from Tx Receipt
```js
web3.eth.getTransactionReceipt("0x9199e262aaab0a6ec99558b3e9f42397c07a2bb9c6befb637643aebfb03cc32a", function(e, receipt) {
  const decodedLogs = abiDecoder.decodeLogs(receipt.logs);
});
```

---
_Source: https://npm.io/package/abi-decoder · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
