# @truffle/codec

> Library for encoding and decoding smart contract data

Latest version **0.17.3** (published 2023-09-07) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @truffle/codec
pnpm add @truffle/codec
yarn add @truffle/codec
bun add @truffle/codec
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.17.3 |
| Published | 2023-09-07 |
| First published | 2019-09-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | ^16.20 \|\| ^18.16 \|\| >=20 |
| Dependencies | 10 |
| Unpacked size | 26.7 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 13915 |
| Maintainers | rizedr, joshuafernandes, cliffoo, kevinbluer, gnidan, haltman, eggplantzzz, fainashalts, cds-amal |
| Keywords | abi, contract, decoder, encoder, ethereum, solidity, state |

## Links

- npm: https://www.npmjs.com/package/@truffle/codec
- Repository: https://github.com/trufflesuite/truffle
- Homepage: https://github.com/trufflesuite/truffle/tree/master/packages/codec#readme
- Issues: https://github.com/trufflesuite/truffle/issues
- npm.io page: https://npm.io/package/@truffle/codec

## Dependencies (10)

- [cbor](https://npm.io/package/cbor.md) ^5.2.0
- [utf8](https://npm.io/package/utf8.md) ^3.0.0
- [bn.js](https://npm.io/package/bn.js.md) ^5.1.3
- [debug](https://npm.io/package/debug.md) ^4.3.1
- [big.js](https://npm.io/package/big.js.md) ^6.0.3
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [semver](https://npm.io/package/semver.md) ^7.5.4
- [web3-utils](https://npm.io/package/web3-utils.md) 1.10.0
- [@truffle/abi-utils](https://npm.io/package/@truffle/abi-utils.md) ^1.0.3
- [@truffle/compile-common](https://npm.io/package/@truffle/compile-common.md) ^0.9.8

## 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

- 0.17.3 (latest) — 2023-09-07
- 0.14.18-visual-debugger.0 (visual-debugger) — 2023-05-12
- 0.14.4-hardhat-error.0 (hardhat-error) — 2022-08-25
- 0.13.3-typescript-migrations.0 (typescript-migrations) — 2022-07-21
- 0.11.16-decoder-beta.0 (decoder-beta) — 2021-09-29
- 0.11.13-alpha.1 (eip1559-beta) — 2021-09-13
- 0.10.10-cheerios.1 (cheerios) — 2021-06-10
- 0.10.10-decoder-no-web3.0 (decoder-no-web3) — 2021-06-09
- 0.7.0-abi-utils.0 (abi-utils) — 2020-10-12
- 0.5.10-save-intermediate.1 (save-intermediate) — 2020-07-31
- 0.5.7-next.0 (next) — 2020-07-09
- 0.5.1-tezos.0 (tezos) — 2020-04-14
- 0.3.7-alphaTez.9 (alphaTez) — 2020-02-13
- 0.3.4-truffleLogger.0 (truffleLogger) — 2020-01-16
- 3.1.0-ens-events.0 (ens-events) — 2019-09-27
- … 157 more at https://npm.io/package/@truffle/codec/versions

## README

# Truffle Codec

This module, `@truffle/codec`, provides an interface for decoding Solidity
smart contract state as well as information sent to or from smart contracts
using the Solidity ABI.  It produces output in a machine-readable form that
avoids losing any information.  It also has some rudimentary encoding
functionality, that will be expanded in the future.  This module is also
what Truffle Debugger uses for its decoding.

This is a low-level module, and it's probable that you should use the
higher-level interface [Truffle Decoder](../decoder/) instead.  That said, if
for whatever reason Truffle Decoder will not suffice for your use case, it's
possible that you may need to use this.

## Install

```
$ npm install --save @truffle/codec
```

This module does not provide a CLI; it is entirely meant to be used as part
of a larger JavaScript or TypeScript program.

## Usage and Documentation

This module has some [API
documentation](https://www.trufflesuite.com/docs/truffle/codec/index.html),
which you should see for further usage information.  Note that as this is a
low-level module mostly intended for internal Truffle use, its documentation is
sparse at the moment.

## License

As part of the larger [Truffle Suite](https://github.com/trufflesuite/truffle/),
this module is MIT-licensed.

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