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 🙏

© 2026 – Pkg Stats / Ryan Hefner

smart-contract-tools

v0.3.6

Published

(beta) JavaScript tools for smart contracts on the Ethereum blockchain

Readme

(beta) smart-contract-tools

JavaScript tools for smart contracts on the Ethereum blockchain

To be used for NodeJS apps, not for dApps as most functions are not asynchronous.

Basically, it creates web3 instance depending on eth node detected, shows basic info about the network and provides convenience functions.

Usage

Installation

npm install smart-contract-tools

Instantiate

code:

let $sct = require('smart-contract-tools');

example console output:

Eth Node Version:  EthereumJS TestRPC/v2.1.0/ethereum-js
Network ID: 5777  (Ganache)
Host: http://localhost:7545
Connected:  true
web3.js version: 0.20.6
Syncing:  false
Latest Block:  2
Accounts:
0x493f765e0aed2d0d66e84f465c01969db1abc76a  : 99.99999999999868 ETH
0x96c906121bcdd31273d2289f2a78241721349ca2  : 100 ETH
Default account: undefined

Deploy contract

code:

let contractDeployed = $sct.deployContractFromFile("./examples/smart-contract/TestContract.sol", "TestContract");
if (contractDeployed !== undefined) {
    console.log("[sct.use.example.js] contract deployed, contractInstance.address: ", contractDeployed.address);
} else {
    console.log("[sct.use.example.js] contract was not created");
}

output:

contract deployed, tx hash: 0xdaaa24ea0f630bde9c267d710135b5f5d71bbc69ae864d7c6f03b038b1d1b359
deployed on block: 3
contract address:  0xb1c20f4ddd8a2a73648aa812113801380503aa51

[sct.use.example.js] contract deployed, contractInstance.address:  0xb1c20f4ddd8a2a73648aa812113801380503aa51

Instantiate contract from source and an existing address

code:

let contract = $sct.getContractInstanceFromFileAndAddress(
    "./examples/smart-contract/TestContract.sol",
    "TestContract",
    contractDeployed.address
);

let txSendEth = $sct.web3.eth.sendTransaction({
    from: $sct.web3.eth.accounts[0],
    to: contract.address,
    value: contract.tokenPriceInWei.call().toNumber()
});
console.log("txSendEth:", txSendEth);

let txTransferTokens = contract.transfer.sendTransaction(
    $sct.web3.eth.accounts[0],
    contract.balanceOf.call($sct.web3.eth.accounts[0]),
    {from: $sct.web3.eth.accounts[0]}
);
console.log("txTransferTokens:", txTransferTokens);

output:

txSendEth: 0xb3838261d656adfef46282190af237d80bdf7554ff2e9d8c7f59072cea3c2434
txTransferTokens: 0xae75ea7fdbd12f636e8970a7cfb569260ef9d8bfbd9fc78b4ea349b757e887d0

List of functions

all function arguments are strings

$sct.getSolcJsCompiledSourceFromString(source, contractName)

$sct.getSolcJsCompiledSourceFromFile(pathToFile, contractName)

$sct.getContractObjFromString(source, contractName)

$sct.getContractObjFromFile(pathToFile, contractName)

$sct.deployContractFromString(source, contractName, from)

$sct.deployContractFromFile(pathToFile, contractName, from)

$sct.getContractInstanceFromStringAndAddress(source, contractName, address)

$sct.getContractInstanceFromFileAndAddress(pathToFile, contractName, address)

$sct.getTruffleContractObjFromString(source, contractName)

$sct.getTruffleContractObjFromFile(pathToFile, contractName)