# human-standard-token-abi

> A simple node module that exports the [Ethereum ABI](1) for [ERC 20](2) compatible tokens.

Latest version **2.0.0** (published 2018-08-30) · ISC license · 0 weekly downloads

## Install

```sh
npm install human-standard-token-abi
pnpm add human-standard-token-abi
yarn add human-standard-token-abi
bun add human-standard-token-abi
```

## 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.0.0 |
| Published | 2018-08-30 |
| First published | 2016-12-02 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 15.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 95 |
| Author | Dan Finlay |
| Maintainers | danfinlay |
| Keywords | Ethereum, Token, Json, Abi |

## Links

- npm: https://www.npmjs.com/package/human-standard-token-abi
- Repository: https://github.com/flyswatter/human-standard-token-abi
- Homepage: https://github.com/flyswatter/human-standard-token-abi#readme
- Issues: https://github.com/flyswatter/human-standard-token-abi/issues
- npm.io page: https://npm.io/package/human-standard-token-abi

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 2.0.0 (latest) — 2018-08-30
- 1.0.2 — 2017-01-28
- 1.0.1 — 2016-12-02
- 1.0.0 — 2016-12-02

## README

# Human Standard Token ABI

A simple node module that exports the [Ethereum ABI][1] for [ERC 20][2] compatible tokens.

Requires the web3 API to be available, either by initailizing it yourself, or using a web3-injecting Javascript environment, like Geth, MetaMask, or Mist.

## Usage

``` javascript
var abi = require('human-standard-token-abi')

var token = web3.eth.contract(abi).at(contractAddress)
var addr = web3.eth.accounts[0]

// Get the token name
token.name.call(function(err, name) {
  if(err) { console.log(err) }
  if(name) { console.log('The token name is: ' + name) }
})

// Get the token symbol
token.symbol.call({from: addr}, function(err, symbol) {
  //ABI expects string here,
  if(err) { console.log(err) }
  console.log('Token symbol: ' + symbol)
})

token.totalSupply.call({from: addr}, function(err, totalSupply) {
  console.log(totalSupply)
})

token.balanceOf.call(web3.eth.accounts[0], function (err, bal) {
  if (err) { console.error(err) }
  console.log('balance is ' + bal.toString(10))
})

var value = '100' // Base 10, accounts for decimals.
token.transfer(toAddress, value, { from: addr }, function (err, txHash) {
  if (err) console.error(err)

  if (txHash) {
    console.log('Transaction sent')
    console.dir(txHash)
  }
})

```

## Run the example

First install `http-server` (`npm install -g http-server`).

Then run it in this folder: `http-server`.

Then visit that port, probably something like: `http://localhost:8080/example`.

### Rebuild the example

If you edit `example/index.js`, you'll have to rebuild by running `npm run build`.

[1]: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI
[2]: https://github.com/ethereum/EIPs/issues/20

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