npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ercmanager

v1.0.5

Published

Npm package that simplifies deployment and usage of erc tokens on ethereum Blockchain

Downloads

28

Readme

Build Status NPM Version npm Web 3 Hits

Installation

npm install ercmanager --save

Usage example

Create a new ERC20 token.

const ERCManager = require('ercmanager');

let erc20 = new ERCManager({
        myAddress: "0x9CC14A288BB5cb9Ec0e85b606Cb6585BB7ca6a8E",
        privateKey: '88BAEA1C45C1434E494604F48A39EEDB780BA71086D109B78CC3B7D41AA49773'
});

erc20.create(symbol="SNK", token_name = "Kanchan Coin").then(function (data) {
    console.log(data)
});
  • The constructor creates the ERC20 token.
  • The essential parameters are address of the creator and their private key.
  • The optional parameters are gas required, maximum limit of gas and the web3 provider(default = rinkeby.infura.io).

Connect to a deployed token.

let deployed_token = new ERCManager({
    myAddress: "0x9CC14A288BB5cb9Ec0e85b606Cb6585BB7ca6a8E",
    privateKey: '88BAEA1C45C1434E494604F48A39EEDB780BA71086D109B78CC3B7D41AA49773',
    contractAddress: "0x8298cb3a2dc8fe592504dea860ad7be1882cdcfa",
});

Check balance of an account.

deployed_token.balance().then(function (data) {
    console.log(data);
})

Transfer tokens: transfer(destination_account,amount)

deployed_token.transfer("0x25666A25Ef50B0d87F1f41a47883D7583DCf7980",1).then(function (data) {
    console.log(data);
})

Approve spender to spend your tokens: approve(spender_address, amount)

deployed_token.approve("0x25666A25Ef50B0d87F1f41a47883D7583DCf7980",100).then(function (data) {
    console.log(data);
})

Transfer token from approved account to another: transferFrom(from_address, to_address, amount)

deployed_token.transferFrom("0x25666A25Ef50B0d87F1f41a47883D7583DCf7980", "0x420493959C379D8375aFFA6Bb0De9E5C87f0A4c3",100).then(function (data) {
    console.log(data);
})

Check Allowance: checkAllowance(spender_address, amount)

deployed_token.checkAllowance("0x25666A25Ef50B0d87F1f41a47883D7583DCf7980", 100).then(function (data) {
    console.log(data);
})

Watch transfer of tokens.

deployed_token.watch_transfer(function (data) {
   console.log(data.returnValues._from,data.returnValues._to,data.returnValues._value)
})

Watch Approval of tokens.

deployed_token.watch_approval(function (data) {
   console.log(data.returnValues._from,data.returnValues._to,data.returnValues._value)
})

Development setup

git clone https://github.com/SauravKanchan/ERCManager
cd ERCManager
npm install
npm test

Release History

  • 1.0.5
    • Fix Bytecode
  • 1.0.4
    • Add transferFrom, Approve, CheckAllowance
  • 1.0.3
    • Create new tokens
  • 1.0.2
    • Fix Minor bugs
  • 1.0.1
    • Add transfer
  • 1.0.0
    • Work in progress

Meta

Distributed under the MIT license. See LICENSE for more information.

LICENSE

Contributing

  • We are open to addressing bug-fixes.
  • Feel free to add issues and submit patches

Contributors