Socket
Socket
Sign inDemoInstall

erc20-contract-js

Package Overview
Dependencies
1
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    erc20-contract-js

Simple JS library used to manipulate with ERC-20 token contracts


Version published
Weekly downloads
57
increased by171.43%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

erc20-contract-js

Simple JS library used to manipulate with ERC-20 token contracts

Build Status npm version license

Install

Yarn

yarn add erc20-contract-js

NPM

npm install erc20-contract-js

Example

const Web3 = require('web3');
const ERC20Contract = require('erc20-contract-js');

// Web3 instance
const web3 = new Web3(
	new Web3.providers.HttpProvider('https://mainnet.infura.io')
);

const walletAddr = '0x8d12a197cb00d4747a1fe03395095ce2a5cc6819', // EtherDelta contract address
	contractAddr = '0x86fa049857e0209aa7d9e616f7eb3b3b78ecfdb0'; // EOS contract address

// Create new instance of ERC20Contract
const erc20Contract = new ERC20Contract(web3, contractAddr);

// Get balance of
erc20Contract.balanceOf(walletAddr).call()
	.then(balance => console.log(`Balance: ${balance}`));

// Get total supply
erc20Contract.totalSupply().call()
	.then(totalBalance => console.log(`Total supply: ${totalBalance}`));

// Get allowance
erc20Contract.allowance(walletAddr, walletAddr).call()
	.then(allowance => console.log(`Allowance: ${allowance}`));

Testing

$ yarn test
$ npm test

Contribute

Contributions to the package are always welcome!

  • Report any bugs or issues you find on the issue tracker.
  • You can grab the source code at the package's Git repository.

Donation

ETH: 0x58aaa089338901fcf5fb59342c97c17fa3dd1229

License

All contents of this package are licensed under the MIT license.

Keywords

FAQs

Last updated on 23 Feb 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc