diff --git a/.github/ISSUE_TEMPLATE/backlog-ticket.md b/.github/ISSUE_TEMPLATE/backlog-ticket.md deleted file mode 100644 index 1d1fab10..00000000 --- a/.github/ISSUE_TEMPLATE/backlog-ticket.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -name: Backlog Ticket -about: New feature/ticket for the project -title: '' -labels: '' -assignees: '' - ---- - -# Overview (What and Why) -{Write description of what the feature should be, why} - -# How -{Describe what needs to be done.} - -- [ ] Task 1 -- [ ] Task 2 - -# Definition of Done -{Write definition of done, how to verify} - -- [ ] Unit test cases (delete if not applicable) -- [ ] Docs updated (delete if not applicable) -- [ ] PR approved and merged to master (delete if not applicable) - -# Open Issues and Blockers -{Dependencies issue or PR or some other blocker.} diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml new file mode 100644 index 00000000..7524d9ba --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -0,0 +1,67 @@ +name: Bug Report +description: Create a report to help us improve +title: "[BUG]: " +labels: ["bug"] +projects: ["swanky-cli"] + +body: + - type: textarea + id: what-happened + attributes: + label: What happened? + description: Tell us what happened. In particular, tell us how and why you are using this project, and describe the bug that you encountered. Please note that we are not able to support all conceivable use cases, but the more information you are able to provide the more equipped we will be to help. + placeholder: Write your bug report here + validations: + required: true + - type: textarea + id: steps-to-reproduce + attributes: + label: Steps to reproduce + description: Replace the example steps below with actual steps to reproduce the bug you're reporting. + value: | + 1. Go to '...' + 2. Click on '....' + 3. Scroll down to '....' + 4. See error + validations: + required: true + - type: textarea + id: expected-behavior + attributes: + label: Expected behavior + description: Tell us what should happen + placeholder: Write your expected behavior here. + validations: + required: true + - type: textarea + id: actual-behavior + attributes: + label: Actual behavior + description: Tell us what happens instead + placeholder: Write your actual behavior here. + validations: + required: true + - type: textarea + id: environment + attributes: + label: Environment + description: Describe the environment in which you encountered this bug. Use the list below as a starting point and add additional information if you think it's relevant. + value: | + - Operating System + - Project version/tag: (run 'swanky version') + - Rust version (run `rustup show`) + - Node version (run `node --version`) + validations: + required: true + - type: textarea + id: logs + attributes: + label: Logs, Errors, Screenshots + description: Please provide the text of any logs or errors that you experienced; if applicable, provide screenshots to help illustrate the problem. + placeholder: | + Paste your logs here + - type: textarea + id: additional-info + attributes: + label: Additional information + description: Add any other context about the problem here. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index cf35c2d8..00000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: "[BUG]" -labels: bug -assignees: '' - ---- - -**Description** - -> Tell us what happened. In particular, tell us how and why you are using this project, and describe the bug that you encountered. Please note that we are not able to support all conceivable use cases, but the more information you are able to provide the more equipped we will be to help. - -**Steps to Reproduce** - -> Replace the example steps below with actual steps to reproduce the bug you're reporting. - -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**Expected vs. Actual Behavior** - -> What did you expect to happen after you followed the steps you described in the last section? What actually happened? - -**Environment** - -> Describe the environment in which you encountered this bug. Use the list below as a starting point and add additional information if you think it's relevant. - -- Operating system: -- Project version/tag: (run 'swanky version') -- Rust version (run `rustup show`): -- Node version (run `node --version`) - -**Logs, Errors or Screenshots** - -> Please provide the text of any logs or errors that you experienced; if applicable, provide screenshots to help illustrate the problem. - -**Additional Information** - -> Please add any other details that you think may help us solve your problem. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..ec4bb386 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: false \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/new-feature.yml b/.github/ISSUE_TEMPLATE/new-feature.yml new file mode 100644 index 00000000..9759a9cf --- /dev/null +++ b/.github/ISSUE_TEMPLATE/new-feature.yml @@ -0,0 +1,43 @@ +name: Feature request +description: New feature/ticket for the project +labels: ["enhancement"] +projects: ["swanky-cli"] + +body: + - type: textarea + id: overview + attributes: + label: Overview (What and Why) + description: Write description of what the feature should be, why + validations: + required: true + + - type: textarea + id: how + attributes: + label: How to do it? + description: Describe what needs to be done. + placeholder: | + - Task 1 + - Task 2 + validations: + required: true + + - type: textarea + id: definition-of-done + attributes: + label: Definition of Done + description: Write definition of done, how to verify + placeholder: | + - Unit test cases + - Docs updated + - PR approved and merged to master + - etc. + validations: + required: true + + - type: textarea + id: open-issues-and-blockers + attributes: + label: Open Issues and Blockers + description: Dependencies issue or PR or some other blocker. diff --git a/README.md b/README.md index 53c3aaba..3a15ee12 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,7 @@ A newly generated project will have a `swanky.config.json` file that will get po "url": "wss://rpc.shiden.astar.network" }, "shibuya": { - "url": "wss://rpc.shibuya.astar.network" + "url": "wss://shibuya.public.blastapi.io" } }, "contracts": { @@ -126,6 +126,49 @@ A newly generated project will have a `swanky.config.json` file that will get po } ``` +Also, global config will be created in your home directory, in `~/swanky` folder. +## Example: + +```json +{ + "accounts": [ + { + "alias": "alice", + "mnemonic": "//Alice", + "isDev": true, + "address": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" + }, + { + "alias": "bob", + "mnemonic": "//Bob", + "isDev": true, + "address": "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty" + }, + { + "mnemonic": "broken estate advance smooth noble place wine choose scare east effort evil", + "isDev": true, + "alias": "global", + "address": "5FhfjMxbrJnjxuP5rP1ZorNaDJdE1n5LYpd7jTi9ByfVX1P1" + } + ], + "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://shibuya.public.blastapi.io" + } + } +} +``` +You can use accounts and networks from the global config in any swanky project. + # Network Management You can deploy/call wasm smart contracts on any chains supporting the substrate contracts module ([`pallet-contracts`](https://github.com/paritytech/substrate/tree/master/frame/contracts)) by swanky-cli. @@ -187,7 +230,7 @@ $ npm install -g @astar-network/swanky-cli $ swanky COMMAND running command... $ swanky (--version|-V|-v) -@astar-network/swanky-cli/3.1.0-beta.0 darwin-x64 node-v20.2.0 +@astar-network/swanky-cli/4.0.0 darwin-x64 node-v20.2.0 $ swanky --help [COMMAND] USAGE $ swanky COMMAND @@ -199,6 +242,10 @@ USAGE * [`swanky account create`](#swanky-account-create) * [`swanky account list`](#swanky-account-list) * [`swanky account ls`](#swanky-account-ls) +* [`swanky account balance`](#swanky-account-balance) +* [`swanky account faucet`](#swanky-account-faucet) +* [`swanky account default`](#swanky-account-default) +* [`swanky clear CONTRACTNAME`](#swanky-clear-contractname) * [`swanky contract compile [CONTRACTNAME]`](#swanky-contract-compile-contractname) * [`swanky contract deploy CONTRACTNAME`](#swanky-contract-deploy-contractname) * [`swanky contract explain CONTRACTNAME`](#swanky-contract-explain-contractname) @@ -206,14 +253,21 @@ USAGE * [`swanky contract query CONTRACTNAME MESSAGENAME`](#swanky-contract-query-contractname-messagename) * [`swanky contract test [CONTRACTNAME]`](#swanky-contract-test-contractname) * [`swanky contract tx CONTRACTNAME MESSAGENAME`](#swanky-contract-tx-contractname-messagename) -* [`swanky contract typegen CONTRACTNAME`](#swanky-contract-typegen-contractname) +* [`swanky contract verify CONTRACTNAME`](#swanky-contract-verify-contractname) * [`swanky env check`](#swanky-env-check) * [`swanky env install`](#swanky-env-install) +* [`swanky generate tests`](#swanky-generate-tests) +* [`swanky generate types`](#swanky-generate-types) * [`swanky help [COMMANDS]`](#swanky-help-commands) * [`swanky init PROJECTNAME`](#swanky-init-projectname) * [`swanky node install`](#swanky-node-install) * [`swanky node purge`](#swanky-node-purge) * [`swanky node start`](#swanky-node-start) +* [`swanky node version`](#swanky-node-version) +* [`swanky node chopsticks init`](#swanky-node-chopsticks-init) +* [`swanky node chopsticks start`](#swanky-node-chopsticks-start) +* [`swanky zombienet init`](#swanky-zombienet-init) +* [`swanky zombienet start`](#swanky-zombienet-start) * [`swanky plugins`](#swanky-plugins) * [`swanky plugins:install PLUGIN...`](#swanky-pluginsinstall-plugin) * [`swanky plugins:inspect PLUGIN...`](#swanky-pluginsinspect-plugin) @@ -231,17 +285,18 @@ Create a new dev account in config ``` USAGE - $ swanky account create [-v] [-g] [-d] + $ swanky account create [-v] [-g] [-n] [-d] FLAGS - -d, --dev - -g, --generate - -v, --verbose Display more info in the result logs + -d, --dev Make this account a dev account for local network usage. + -g, --global Create account globally stored in Swanky system config. + -n, --new Generate a brand new account. + -v, --verbose Display more info in the result logs DESCRIPTION Create a new dev account in config ``` - +_See code: [src/commands/account/create.ts](https://github.com/inkdevhub/swanky-cli/blob/master/src/commands/account/create.ts)_ ## `swanky account list` List dev accounts stored in config @@ -259,6 +314,8 @@ DESCRIPTION ALIASES $ swanky account ls ``` +_See code: [src/commands/account/list.ts](https://github.com/inkdevhub/swanky-cli/blob/master/src/commands/account/list.ts)_ + ## `swanky account ls` @@ -278,7 +335,87 @@ ALIASES $ swanky account ls ``` -_See code: [dist/commands/check/index.ts](https://github.com/AstarNetwork/swanky-cli/blob/v3.1.0-beta.0/dist/commands/check/index.ts)_ +_See code: [src/commands/account/list.ts](https://github.com/inkdevhub/swanky-cli/blob/master/src/commands/account/list.ts)_ + +## `swanky account balance` + +Balance of an account + +``` +USAGE + $ swanky account balance [ALIAS] [-v] + +ARGUMENTS + ALIAS Alias of account to be used + +FLAGS + -v, --verbose Display more info in the result logs + +DESCRIPTION + Balance of an account +``` + +_See code: [src/commands/account/balance.ts](https://github.com/inkdevhub/swanky-cli/blob/master/src/commands/account/balance.ts)_ + +## `swanky account faucet` + +Transfer some tokens from faucet to an account + +``` +USAGE + $ swanky account faucet ALIAS [-v] + +ARGUMENTS + ALIAS Alias of account to be used + +FLAGS + -v, --verbose Display more info in the result logs + +DESCRIPTION + Transfer some tokens from faucet to an account +``` + +_See code: [src/commands/account/faucet.ts](https://github.com/inkdevhub/swanky-cli/blob/master/src/commands/account/faucet.ts)_ + +## `swanky account default` + +Set default account to use + +``` +USAGE +$ swanky account default [ACCOUNTALIAS] [-v] [-g] + +ARGUMENTS + ACCOUNTALIAS Alias of account to be used as default + +FLAGS + -g, --global Set default account globally in Swanky system config. + -v, --verbose Display more info in the result logs + +DESCRIPTION + Set default account to use +``` + +_See code: [src/commands/account/default.ts](https://github.com/inkdevhub/swanky-cli/blob/master/src/commands/account/default.ts)_ + +## `swanky clear [CONTRACTNAME]` + +Clear the artifacts + +``` +USAGE + $ swanky clear [CONTRACTNAME] [-v] [-a] + +ARGUMENTS + CONTRACTNAME Name of the contract artifact to clear + +FLAGS + -a, --all Select all the project artifacts for delete + -v, --verbose Display more info in the result logs + +DESCRIPTION + Clear the artifacts +``` ## `swanky contract compile [CONTRACTNAME]` @@ -286,7 +423,7 @@ Compile the smart contract(s) in your contracts directory ``` USAGE - $ swanky contract compile [CONTRACTNAME] [-v] [-r] [-a] + $ swanky contract compile [CONTRACTNAME] [-v] [-r] [--verifiable] [-a] ARGUMENTS CONTRACTNAME Name of the contract to compile @@ -295,11 +432,14 @@ FLAGS -a, --all Set all to true to compile all contracts -r, --release A production contract should always be build in `release` mode for building optimized wasm -v, --verbose Display more info in the result logs + --verifiable A production contract should be build in `verifiable` mode to deploy on a public network. Ensure Docker Engine is up and running. DESCRIPTION Compile the smart contract(s) in your contracts directory ``` +_See code: [src/commands/contract/compile.ts](https://github.com/inkdevhub/swanky-cli/blob/master/src/commands/contract/compile.ts)_ + ## `swanky contract deploy CONTRACTNAME` Deploy contract to a running node @@ -323,6 +463,9 @@ DESCRIPTION Deploy contract to a running node ``` + +_See code: [src/commands/contract/deploy.ts](https://github.com/inkdevhub/swanky-cli/blob/master/src/commands/contract/deploy.ts)_ + ## `swanky contract explain CONTRACTNAME` Explain contract messages based on the contracts' metadata @@ -341,6 +484,8 @@ DESCRIPTION Explain contract messages based on the contracts' metadata ``` +_See code: [src/commands/contract/explain.ts](https://github.com/inkdevhub/swanky-cli/blob/master/src/commands/contract/explain.ts)_ + ## `swanky contract new CONTRACTNAME` Generate a new smart contract template inside a project @@ -360,120 +505,184 @@ DESCRIPTION Generate a new smart contract template inside a project ``` +_See code: [src/commands/contract/new.ts](https://github.com/inkdevhub/swanky-cli/blob/master/src/commands/contract/new.ts)_ + + ## `swanky contract query CONTRACTNAME MESSAGENAME` Call a query message on smart contract ``` USAGE - $ swanky contract query CONTRACTNAME MESSAGENAME [-v] [-p ] [-g ] [-n ] [-a ] - [--address ] + $ swanky contract query CONTRACTNAME MESSAGENAME [-v] [-p ] [-g ] [-n ] [-a ] [--address ] ARGUMENTS CONTRACTNAME Contract to call MESSAGENAME What message to call FLAGS - -a, --account= Account to sign the transaction with + -a, --account= Account alias to sign the transaction with -g, --gas= Manually specify gas limit - -n, --network= Network name to connect to + -n, --network= [default: local] Name of network to connect to -p, --params=... [default: ] Arguments supplied to the message -v, --verbose Display more info in the result logs --address= Target specific address, defaults to last deployed. (--addr, --add) + +DESCRIPTION + Call a query message on smart contract ``` +_See code: [src/commands/contract/query.ts](https://github.com/inkdevhub/swanky-cli/blob/master/src/commands/contract/query.ts)_ + ## `swanky contract test [CONTRACTNAME]` Run tests for a given contact ``` USAGE - $ swanky contract test [CONTRACTNAME] [-v] [-a] + $ swanky contract test [CONTRACTNAME] [-v] [-a] [--mocha] ARGUMENTS CONTRACTNAME Name of the contract to test FLAGS - -a, --all Set all to true to compile all contracts + -a, --all Run tests for all contracts -v, --verbose Display more info in the result logs + --mocha Run tests with mocha DESCRIPTION Run tests for a given contact ``` +_See code: [src/commands/contract/test.ts](https://github.com/inkdevhub/swanky-cli/blob/master/src/commands/contract/test.ts)_ + ## `swanky contract tx CONTRACTNAME MESSAGENAME` Call a Tx message on smart contract ``` USAGE - $ swanky contract tx CONTRACTNAME MESSAGENAME -a [-v] [-p ] [-g ] [-n ] [--address - ] [-d] + $ swanky contract tx CONTRACTNAME MESSAGENAME [-v] [-p ] [-g ] [-n ] [-a ] [--address ] [-d] ARGUMENTS CONTRACTNAME Contract to call MESSAGENAME What message to call FLAGS - -a, --account= (required) Account to sign the transaction with + -a, --account= Account alias to sign the transaction with -d, --dry Do a dry run, without signing the transaction -g, --gas= Manually specify gas limit - -n, --network= Network name to connect to + -n, --network= [default: local] Name of network to connect to -p, --params=... [default: ] Arguments supplied to the message -v, --verbose Display more info in the result logs --address= Target specific address, defaults to last deployed. (--addr, --add) + +DESCRIPTION + Call a Tx message on smart contract ``` -## `swanky contract typegen CONTRACTNAME` +_See code: [src/commands/contract/tx.ts](https://github.com/inkdevhub/swanky-cli/blob/master/src/commands/contract/tx.ts)_ -Generate types from compiled contract metadata +## `swanky contract verify CONTRACTNAME` + +Verify the smart contract(s) in your contracts directory ``` USAGE - $ swanky contract typegen CONTRACTNAME [-v] + $ swanky contract verify [CONTRACTNAME] [-v] [-a] ARGUMENTS - CONTRACTNAME Name of the contract + CONTRACTNAME Name of the contract to verify FLAGS + -a, --all Set all to true to verify all contracts -v, --verbose Display more info in the result logs DESCRIPTION - Generate types from compiled contract metadata + Verify the smart contract(s) in your contracts directory ``` +_See code: [src/commands/contract/verify.ts](https://github.com/inkdevhub/swanky-cli/blob/master/src/commands/contract/verify.ts)_ + ## `swanky env check` Check installed package versions and compatibility ``` USAGE - $ swanky env check [-v] + $ swanky env check [-v] [-o ] FLAGS - -v, --verbose Display more info in the result logs + -o, --print= File to write output to + -v, --verbose Display more info in the result logs DESCRIPTION Check installed package versions and compatibility ``` +_See code: [src/commands/env/check.ts](https://github.com/inkdevhub/swanky-cli/blob/master/src/commands/env/check.ts)_ + ## `swanky env install` Install dev dependencies ``` USAGE - $ swanky env install [-a] [-d ] + $ swanky env install [-v] [-d ] FLAGS - -a, --all Set all to true to install all dev dependencies specified in the swanky config - -d, --deps=... [default: ] Specific dev dependencies to install in the format - -v, --verbose Display more info in the result logs + -d, --deps=... [default: ] Install the specified dev dependency name and version in the format . The following options are supported: rust, cargo-dylint, cargo-contract. For installing rust + nightly version run: env install --deps rust@nightly + -v, --verbose Display more info in the result logs DESCRIPTION Install dev dependencies ``` +_See code: [src/commands/env/install.ts](https://github.com/inkdevhub/swanky-cli/blob/master/src/commands/env/install.ts)_ + +## `swanky generate tests` + +Generate test files for the specified contract + +``` +USAGE + $ swanky generate tests [CONTRACTNAME] [-v] [--template blank|flipper|psp22] [--mocha] + +ARGUMENTS + CONTRACTNAME Name of the contract + +FLAGS + -v, --verbose Display more info in the result logs + --mocha Generate mocha test files + --template=