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

iw-eth

v1.1.0

Published

>> This project provides a simple package to realize the core logic of the wallet. If you have any questions, please ask at the following website [icanwallet](https://github.com/icanwallet/icanwallet)

Downloads

78

Readme

iw-eth

This project provides a simple package to realize the core logic of the wallet. If you have any questions, please ask at the following website icanwallet

use case

//install
npm i iw-eth -s

address

//from mnemonic
const ecc = require('iw-eth')
const wallet = ecc.fromMnemonic(mnemonic)
console.log(wallet)
//from privateKey
const wallet2 = ecc.fromPrivateKey(wallet.privateKey)
console.log(wallet2)
//check address
console.log(ecc.isAddress(wallet.address))

account

//balance
const ecc = require('iw-eth')
const balance = await ecc.balanceOf('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2')
console.log(balance)
//contract balance
const balance2 = await ecc.balanceOf('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2','0x1f9840a85d5af5bf1d1762f925bdaddc4201f984')
console.log(balance2)

/**
 * transfer
 * 
 * @param {String} privateKey
 * @param {String} token  eg. 'eth' or 'token address'
 * @param {String} receiver
 * @param {Number} amount
 * @param {Object} op gasLimit gasPrice
 * @param {Number} decimal
 * @return {Object}
 */
let rt = await ecc.transfer(privateKey, token, receiver, amount, op, decimal = 18)
/**
 * logs
 * 
 * @param {String} address
 * @param {String} token eg. 'eth' or 'token address'
 * @param {Number} page
 * @param {Number} pagesize
 * @return {Object} or {Boolean}
 */
//eth logs
const logs = await ecc.logs('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', 'eth', 1, 20)
console.log(logs)
//contract logs
const logs2 = await ecc.logs('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984', 1, 20)
console.log(logs2)

contract

const ecc = require('iw-eth')
const privateKey = '0x27388b508812e27e1bf3e550d4b94c6bf2659e3978c5639702ff24d96daed800'
/**
 * 发布一个简单的erc20合约(usdt)
 * @param {String} privateKey
 * @param {Number} total_supply 总发布多少
 * @param {String} name 代币名字
 * @param {String} symbol 代币符号
 * @param {Number} decimals 代币的位数
 * 
 */
let rt = await libs.deployErc20Contract(privateKey)
console.log(rt)
let  balance = await libs.balanceOf('0xA43b5A70B16d519d3d75E264446De5a29e8f14FA')
console.log(balance)
let rt1 = await libs.transfer(privateKey, 'eth', '0xA43b5A70B16d519d3d75E264446De5a29e8f14FA', 0.01)
//console.log(rt) 0xd9818fa453F875c2C670B51F1266297419f4051d
let balance2 = await libs.balanceOf('0x5219aeed873ca870a437cb7e9a8959855fb8544f', '0x84f08044f93ada1af6542735bb0cd7bb5278e930',6)
// console.log(balance);

let rt2 = await libs.transfer(privateKey, '0x84f08044f93ada1af6542735bb0cd7bb5278e930', '0xA43b5A70B16d519d3d75E264446De5a29e8f14FA', 0.01, 6)
console.log(rt2)