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

@gnosis.pm/truffle-nice-tools

v1.3.1

Published

A set CLI tools that make truffle development feel more elegant.

Downloads

75

Readme

Truffle-nice-tools

A very simple, yet nice CLI interface toolkit for Truffle Framework development.

(Note: this toolkit uses the excellent new NPX feature of NPM to save you from a useless global install. Don't be shy. The format is npx <command>)

Install

Run npm i -D @gnosis.pm/truffle-nice-tools inside your Truffle Framework project.


Commands

Generic
npx tnt help <command>, npx tnt -h........Opens the help menu. 

Find all the options and flags availabble in individual commands by running npx tnt help .

npx tnt version, npx tnt -v...............Check the version.

Create Interface (from ABI)
npx tnt createInterface, cI <path to ABI> <options>....Creates a Solidity interface contract for the selected .json ABI.
Decoding
npx tnt decodeTransactions, npx tnt dT <options>....Decodes the transactions which have occured on your network of choice.  
  • In order to decode transactions, you will need to have an Ethereum network running, we check for port 8545 by default but if you would like to connect to a network at a different port, please simply update your process.env.CHAINPORT environment variable to the port of your Ethereum network.

  • By default, it is assumed your .json ABI files are located at /build/contracts. If you would like to change your ABI folder, please simply change the process.env.ABIFOLDER environment variable.

Network Extraction / Injection
npx tnt extractNetworks, npx tnt eN <options>.......Extracts relevant network data from your build/contracts repository. Storing it in networks.json.
npx tnt injectNetworks, npx tnt iN <options>........Injects the stored data from the networks.json file into the build/contracts ABI files via merge (it will overwrite conflicts, be warned)
Truffle build cleaning (reduce file size)

There are some parameters in truffle files like ast, legacyAST that are used by debuggers, usually you don't need that. Also the sourcePath it's something personal, might be better to remove it from the public build.

npx tnt cleanBuild
Gas Benchmarking

The Gas Benchmarking module is created to give you more accurate gas cost representation stats, through injecting gas collection stats into your tests and outputting the data.

  • ( The first index holds the contract for gas measurements, the second index holds its inheritance tree. This list should be topologically sorted for maximum benchmarking efficiency. )
  1. Execute this command:
npx tnt measureGas, npx tnt mG <options>..........This will generate benchmarks for your function gas usage, derived from your test cases. The stats are stored at `build/gas/gas-stats.json` by default, but may be modified with the `-o` option:
  • (Optional) Create a JSON file holding a mapping (preferably topologically sorted) of your contract heirarchy you want benchmarked in the format shown below:
npx tnt measureGas -f <path to .json mapping file> -o <path to your desired gas-stats location>
Example Inheritance Map
{
    "Event": ["CategoricalEvent", "ScalarEvent"],
    "StandardMarket": ["StandardMarketWithPriceLogger"],
    "Market": ["StandardMarket"],
    "MarketMaker": ["LMSRMarketMaker"],
    "Oracle": [
        "CentralizedOracle",
        "DifficultyOracle",
        "FutarchyOracle",
        "MajorityOracle",
        "SignedMessageOracle",
        "UltimateOracle"
      ],
    "StandardToken": ["EtherToken", "OutcomeToken"],
    "Token": ["StandardToken"]
}

(Pro-Tip: If you are having errors with compiling, npx will attempt to use the local Truffle install, make sure your compiler versions are the same, if you are normally using a global Truffle install. )

Special thanks to Alan Lu (@cag), Dominik Teiml (@dteiml), and @rangelife for contributing the tools and ideas for this tool kit.

Testing

To run the test suite, make sure that the truffle-nice-tools package is npm linked by running npm link from inside the folder, then proceed to execute the npm run test command.