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

abiniser

v0.5.1

Published

Truffle post processor to generate ABI and deployment repository files

Downloads

11

Readme

Abiniser

Truffle post processor to generate and maintain ABI and deployments files for FE use. Abiniser aims to address the shortcoming of truffle-contract json format which can't handle multiple deployments of same contract source file and can't manage multiple ABI versions.

Abiniser works on files generated by truffle and its output keeps track of abi version and deployments on different networks.

Abineser's abi and deployment files output is intended to be added to repository so it can be used by front end code.

It's an alpha implementation, being tested on Augmint projects. Expect breaking changes (e.g. output format changes) even with minor version bumps.

Usage

Install

$ npm -g install abiniser

Workflow

Each time your abis changed or a new deployment (to any network) done abiniser should be run. It will automatically create new abi file version (based on abi hash) and will add new entries to deployment files. These can be safely checked in

TODO: more description on the workflow

Run

$ abiniser -h

Usage: abiniser [options] [command]

Truffle post processor to generate ABI and deployment repository files

Options:
  -V, --version                            output the version number
  -h, --help                               output usage information

Commands:
  generate|gen [options]                   Generate deployment and abi files from Truffle generated JSON files
  removeSourceEntries|removeSrc [options]  remove source entries from all deployment files
  check [options]                          Basic integrity check of files generated. Checks references between Abi files and deployment files

  More info: https://github.com/Augmint/abiniser

  Examples:
      abiniser generate
        Creates abi and deployments jsons from all truffle contract json files listed in abiniser.json config file

###Generate deploy and abi files

$abiniser generate -h
Usage: generate|gen [options]

Generate deployment and abi files from Truffle generated JSON files

Options:
  -c, --config-file [value]             Sets abiniser config file. (default: "./abiniser.json")
  -a, --abi-output-dir [value]          Sets abi output directory. (default: "./abiniser/abis")
  -d, --deployments-output-dir [value]  Sets deployments output directory. (default: "./abiniser/deployments")
  -n, --network-id [value]              Generate deployments file only for the given network id number
  -i, --input-dir [value]               Sets input directory with truffle contract json files. (default: "./build/contracts")
  -r, --regenerate                      Regenerate abi and deploy files even if they exists with same abi hash
  -s, --source-include                  Include contract source in generated deploy file
  -h, --help                            output usage information

Create abiniser.json file with the list of contract files to work on:

{
    "truffleContractFiles": ["Contract1.json", "Contract2.json"]
}

You can set command line options in abiniser.json too.

Output format

Abi files

One file per contract and abi version is generated:

abiniser/abis/<Contract Name>_<Abi version hash>.json

Each file contains the contract's Abi in Solidity ABI JSON format.

Deployment files

abiniser/deployments/<Network Id>/<Contract Name>_DEPLOYS.json files:

{
    "contractName": "<contract name>",
    "latestAbiHash": "7fde219f…",
    "deployedAbis": {
        "7fde219f…": {
            "latestDeployedAddress": "7fde219f…",
            "deployments": {
                "7fde219f…": {
                    "generatedAt": "<ISO86901 timestamp>",
                    "truffleContractFileUpdatedAt": "<ISO86901 timestamp when source truffle contracts json was generated>",
                    "deployTransactionHash": "0x12…",
                    "compiler": {
                        "name": "solc",
                        "version": "0.4.23"
                    },
                    "sourceHash": "7fde219f…",
                    "bytecodeHash": "a454e8ba…",
                    "deployedBytecodeHash": "55abcee…",
                    "source": "<source code from truffle contract json>"
                }
                "0xab444b...": {…}
            }
        },

        "a454e8ba… ": {
            "latestDeployedAddress": "a9de219f…",
            "deployments": {…}
        }
    }
}

Maintenance features

Checks on generated files

$ abiniser check -h
Usage: check [options]

Basic integrity check of files generated. Checks references between Abi files and deployment files

Options:
  -a, --abi-output-dir [value]          Sets abi output directory to work on. (default: "./abiniser/abis")
  -d, --deployments-output-dir [value]  Sets deployments output directory to work on. (default: "./abiniser/deployments")
  -h, --help                            output usage information

Remove all source entries from deploy files already generated by abiniser

$ abiniser removeSourceEntries -h
Usage: removeSourceEntries|removeSrc [options]

remove source entries from all deployment files

Options:
  -d, --deployments-output-dir [value]  Sets deployments output directory to work on. (default: "./abiniser/deployments")
  -h, --help                            output usage information

Contribution

Issue reports, feature suggestions and PRs are more than welcome.

Authors

Initial version

Check the whole team on augmint.org

Licence

This project is licensed under the MIT license - see the LICENSE file for details.