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

zetrix-development-toolkit

v1.1.8

Published

A Zetrix development environment for professionals. It facilitates performing frequent tasks, such as running tests, interacting with a smart contract.

Downloads

548

Readme

Zetrix Development Toolkit

A Zetrix development environment for professionals. It facilitates performing frequent tasks, such as compiling smart contract and scripts for deployment and testing.

Docs & Useful Links

Getting Started

This is a Node.js package available through the npm registry. Before installing, download and install Node.js. Node.js 6.0.0 or higher is required. Installation is done using the npm install command:

First, we initialize a NodeJS project by running the following command:

$ npm init

We then install the Zetrix development toolkit:

$ npm install zetrix-development-toolkit

We can then run the command to initialize the Zetrix development toolkit. You need to give your project folder a name, and for the purpose of this example, we will name the folder template.

$ npx zetrix-init template

We then update the scripts section of the package.json with the following:

"scripts": {
  "compile:ztp20": "concat -o [PROJECT NAME]/build/compiledZtp20.js [PROJECT NAME]/contracts/ztp20/base.js [PROJECT NAME]/contracts/ztp20/body.js [PROJECT NAME]/contracts/ztp20/init.js",
  "compile:ztp721": "concat -o [PROJECT NAME]/build/compiledZtp721.js [PROJECT NAME]/contracts/ztp721/base.js [PROJECT NAME]/contracts/ztp721/body.js [PROJECT NAME]/contracts/ztp721/init.js",
  "compile:ztp1155": "concat -o [PROJECT NAME]/build/compiledZtp1155.js [PROJECT NAME]/contracts/ztp1155/base.js [PROJECT NAME]/contracts/ztp1155/body.js [PROJECT NAME]/contracts/ztp1155/init.js",
  "deploy": "node ./[PROJECT NAME]/scripts/01_deploy.js",
  "test": "npx mocha ./[PROJECT NAME]/tests/test-01.js"
}

Update the placeholder [PROJECT NAME] with the name of the folder you have chosen. Remember to also update the placeholder [PROJECT NAME] in the 01_deploy.js file.

Then create a .env file in the root of your project and insert your key/value pairs in the following format of KEY=VALUE:

If you're using the Zetrix testnet:

NODE_URL=test-node.zetrix.com

If you're using the Zetrix mainnet:

NODE_URL=node.zetrix.com

Insert the Zetrix address you are going to use to deploy the smart contract from

ZTX_ADDRESS=[YOUR ZETRIX ADDRESS]

Insert the private key of the Zetrix address you are going to use to deploy the smart contract from

PRIVATE_KEY=[THE PRIVATE KEY TO YOUR ZETRIX ADDRESS]

After all of the above have been completed, we can now proceed to compile the smart contract in the contracts folder. In the scripts section, the compile command essentially compiles the contents from the specified files, so if you have different names for the files or if you would like to add more files to compile, you may do so by adding those file names into the compile command, and importantly, in order (1-base-starting.js and 3-base-ending.js should remain at the top and bottom of the compiled.js file respectively). The command by default compiles a standard ZTP-20 smart contract from the contracts folder. Once you have updated the command, you can then run:

$ npm run compile

A file named compiled.js should be created under the build folder. The file will consist of all the contents from the individual files specified in the compile command in the scripts section of package.json.

We can finally deploy the contract with the following command:

$ npm run deploy

Upon successful deployment of the smart contract, the contract address should be printed in the terminal. Copy the contract address upon successful deployment of the smart contract and paste into the contractAddress variable in test-01.js.

Update the test-01.js script to tailor it to test the different functions in your own smart contract. We have given a sample input to call the testMethod function under the 2-body-ZTP20.js file.

We can then run the test with the following command:

$ npm run test

This is the end of the tutorial. Happy coding!

License

MIT