Coder Social home page Coder Social logo

circlefin / contract-cli Goto Github PK

View Code? Open in Web Editor NEW
11.0 11.0 10.0 1.02 MB

CLI for Managing Smart Contracts

License: Apache License 2.0

Dockerfile 0.55% JavaScript 4.80% Batchfile 0.18% TypeScript 65.94% Shell 28.53%
blockchain nodejs smart-contract-tools smart-contracts

contract-cli's Introduction

contract-cli

Introduction

Contract-cli is your configurable build tool for smart contracts. It makes management of your smart contracts, including compiling and testing easier and more consistent. With the contract-cli, you can:

  • configure a series of steps to execute against your smart contracts
  • create your own steps, or use provided defaults for common operations
  • execute your steps serially in a docker container and have the outputs available locally

Prerequisites

Before installing the contract-cli, the following requirements should be installed:

  • Docker Engine > version 20.10.8
  • NodeJS > version 16.16.0

Earlier versions may work but have not been tested and are not considered officially supported.

Installation

$ npm i -g @circle-fin/contract-cli

Note: We use the -g flag for global installation here to enable operation from the command line.

Quick Usage

In the root directory of your contracts and/or contract tests, run:

$ contract-cli init

If there are specific build steps you would like to include, you can specify those with the --steps flag. For example:

$ contract-cli init –steps ganache –steps truffle

This will create your config file, and directories for each step you’ve created.

Your directory may now look something like the following:

$ root_directory
├── contracts
├── tests
├── ganache
│   ├── package.json
│   ├── install.sh
│   └── execute.sh
├── truffle
│   ├── package.json
│   ├── yarn.lock
│   ├── truffle-config.js
│   ├── install.sh
│   └── execute.sh
└── config.json

At this time, you should read through and edit where necessary the config.json file. In particular, you may want to update the contractsRoot and testsRoot to locate your contracts and tests.

You may also want to look at the install.sh and execute.sh files in each step directory. Those specify how the step will be installed and/or executed.

If the step is known to the contract-cli, it will come with some defaults that you can review. If the step is unknown, you must provide custom installation and execution scripts.

Once you’ve reviewed the configuration, you can execute the cli which will run your build steps inside a container.

$ contract-cli execute

Development

We welcome pull requests adding new functionality to the CLI, or adding additional modules as steps. To get started, fork the repo, clone it locally and follow the directions below.

If you are interested in adding a new module as a known step for the contract-cli, additional information is available in ADD_STEP_README

Getting started

  1. Make sure nvm is installed: nvm ls and you are using the correct version: nvm use.
    • Please see here for installation instructions.
  2. Install dependencies yarn install
  3. Build the project yarn build

Manual testing of the CLI

  • Rebuild the project to pick up any changes with yarn build
  • Run the CLI using ./bin/run <cmd_name> e.g. ./bin/run help
  • If the cmd_name is omitted, information will be displayed about commands the CLI understands

Automated Testing

  • To run tests: yarn test
  • With coverage output: yarn test:cov
  • Run a specific test: yarn test {testFileName}

Code Linting and Formatting

The project uses eslint for code linting and prettier for formatting. To easily work with these tools in VSCode, please install the recommended extensions for the project.

  • To view/install these extensions, press CMD+SHIFT+P and type: Extensions: Show Recommended Extensions.
  • This will enable code error/warning highlighting and format on saves.
  • The linter can be run manually with yarn lint and can auto-fix problems with yarn lint:fix.
  • The linter will be automatically run on git push commands. This can be bypassed with the no-verify flag.

Join the team

If you’re energized by what we’re building at Circle, please consider joining our team by exploring Careers @ Circle.

License

Apache-2.0

contract-cli's People

Contributors

charles-squeri-circle avatar circle-smartin avatar dependabot[bot] avatar github-actions[bot] avatar jscaltreto avatar tjbaker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

contract-cli's Issues

[

[
{
txid: "dba43fd04b7ae3df8e5b596f2e7fab247c58629d622e3a5213f03a5a09684430",
version: 1,
locktime: 0,
vin: [ [Object] ],
vout: [ [Object], [Object] ],
size: 255,
weight: 1020,
fee: 10000,
status: {
confirmed: true,
block_height: 326148,
block_hash: "00000000000000001e4118adcfbb02364bc13c41c210d8811e4f39aeb3687e36",
block_time: 1413798020
}
},
...
]

curl -sSL "https://mempool.space/api/address/1wiz18xYmhRX6xStj2b9t1rwWX4GKUgpv/txs/chain"

<script src="https://mempool.space/mempool.js"></script> <script> const init = async () => {
    const { bitcoin: { addresses } } = mempoolJS({
      hostname: 'mempool.space'
    });

    const address = '1wiz18xYmhRX6xStj2b9t1rwWX4GKUgpv';
    const addressTxsChain = await addresses.getAddressTxsChain({ address });

    document.getElementById("result").textContent = JSON.stringify(addressTxsChain, undefined, 2);
    
  };
  init();
</script>

  

Originally posted by @crystalshay2es in n0shake/Public-APIs#542

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.