GithubHelp home page GithubHelp logo

pinkdiamond1 / swanky-cli Goto Github PK

View Code? Open in Web Editor NEW

This project forked from inkdevhub/swanky-cli

1.0 2.0 0.0 423 KB

The all-in-one developer environment for Parity WASM smart contracts!

License: MIT License

JavaScript 1.61% TypeScript 79.93% Smarty 18.33% Batchfile 0.13%

swanky-cli's Introduction

Swanky CLI

Usage

$ npm install -g @astar-network/swanky-cli
$ swanky COMMAND
running command...
$ swanky (--version|-V|-v)
@astar-network/swanky-cli/0.1.6 darwin-x64 node-v18.2.0
$ swanky --help [COMMAND]
USAGE
  $ swanky COMMAND
...

Commands

swanky call

Call a method on a smart contract

USAGE
  $ swanky call -m <value> [-a <value>] [-d] [-g <value>] [-n <value>]

FLAGS
  -a, --args=<value>
  -d, --dry
  -g, --gas=<value>
  -m, --message=<value>  (required)
  -n, --network=<value>  Network name to connect to

DESCRIPTION
  Call a method on a smart contract

See code: dist/commands/call/index.ts

swanky check

Check installed package versions and compatibility

USAGE
  $ swanky check

DESCRIPTION
  Check installed package versions and compatibility

See code: dist/commands/check/index.ts

swanky compile

Compile the smart contract(s) in your contracts directory

USAGE
  $ swanky compile [-s]

FLAGS
  -s, --silent  Don't display compilation output

DESCRIPTION
  Compile the smart contract(s) in your contracts directory

See code: dist/commands/compile/index.ts

swanky deploy

Deploy contract to a running node

USAGE
  $ swanky deploy --account <value> -c <value> -g <value> [-a <value>] [-n <value>]

FLAGS
  -a, --args=<value>...
  -c, --contract=<value>  (required)
  -g, --gas=<value>       (required)
  -n, --network=<value>   Network name to connect to
  --account=<value>       (required) Alias of account to be used

See code: dist/commands/deploy/index.ts

swanky help [COMMAND]

Display help for swanky.

USAGE
  $ swanky help [COMMAND] [-n]

ARGUMENTS
  COMMAND  Command to show help for.

FLAGS
  -n, --nested-commands  Include all nested commands in the output.

DESCRIPTION
  Display help for swanky.

See code: @oclif/plugin-help

swanky init PROJECT_NAME

Generate a new smart contract environment

USAGE
  $ swanky init [PROJECT_NAME] [--swanky-node] [--template blank|flipper|psp22]

ARGUMENTS
  PROJECT_NAME  directory name of new project

FLAGS
  --swanky-node
  --template=<option>  <options: blank|flipper|psp22>

DESCRIPTION
  Generate a new smart contract environment

See code: dist/commands/init/index.ts

swanky node start

Start a local node

USAGE
  $ swanky node start

DESCRIPTION
  Start a local node

swanky version

USAGE
  $ swanky version [--json] [--verbose]

FLAGS
  --verbose  Show additional information about the CLI.

GLOBAL FLAGS
  --json  Format output as json.

FLAG DESCRIPTIONS
  --verbose  Show additional information about the CLI.

    Additionally shows the architecture, node version, operating system, and versions of plugins that the CLI is using.

See code: @oclif/plugin-version

Config

A newly generated project will have a swanky.config.json file.

Example:

{
  "node": {
    "localPath": "/path/to/swanky-node",
    "polkadotPalletVersions": "polkadot-v0.9.27",
    "supportedInk": "v3.3.1"
  },
  "accounts": [
    {
      "alias": "alice",
      "mnemonic": "//Alice"
    },
    {
      "alias": "bob",
      "mnemonic": "//Bob"
    }
  ],
  "networks": {
    "local": {
      "url": "ws://127.0.0.1:9944"
    },
    "astar": {
      "url": "wss://rpc.astar.network"
    },
    "shiden": {
      "url": "wss://rpc.shiden.astar.network"
    },
    "shibuya": {
      "url": "wss://rpc.shibuya.astar.network"
    }
  }
}

Network Management

You can deploy/call wasm smart contracts on any chains supporting the substrate contracts module (pallet-contracts) by swanky-cli. --network flag is available for deploy and call commands. For example,

swanky deploy --account alice --gas 100000000000 --contract flipper --args true --network shibuya

By default, swanky init prepares local/astar/shiden/shibuya endpoint for you. To add networks or change endpoint to interact with, you need to update swanky.config.json networks section.

"networks": {
  "local": {
    "url": "ws://127.0.0.1:9944"
  },
  "your_network": {
    "url": "wss://your.network"
  }
}

Notes:

  • config file format is very likely to change as the tool is under active development
  • contracts section keeps history of all deployments of specific contract
  • accounts should ONLY hold dev accounts. The more secure solution will be added in the upcoming release
  • at runtime, only localPath and nodeAddress fields of node object are being used.

swanky-cli's People

Contributors

codespool avatar pinkdiamond1 avatar shunsukew avatar zabuxx avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.