Git Product home page Git Product logo

cli's Introduction

Archway Developer CLI

Archway CLI Version Downloads/Week Tests CodeQL Codacy Badge License

Develop WASM smart contracts with the Archway Network's Developer CLI.

Dependencies

Make sure you've installed and configured all dependencies. For the full installation and setup instructions, visit the docs.

If you are on a Linux machine with a distribution different from Ubuntu, you may need to install the GNOME Keyring, or any other keyring compatible with the Secret service API.

CLI Installation

Install the latest published version

npm i -g @archwayhq/cli

Install the pre-release version

npm i -g @archwayhq/cli@pre

Install the development version

npm i -g 'github:archway-network/cli'

Commands

cli's People

Contributors

aelesbao avatar dependabot[bot] avatar drewstaylor avatar edjroz avatar eliasmpw avatar emperorjm avatar ethanill avatar loverdos avatar macku99 avatar mojtaba-esk avatar wotori avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cli's Issues

Restructure the Config module

  • Add support to workspace management for repositories with multiple contracts
  • Rename the config file to archway.json
  • Move the deployments to a separate file
  • The network config should be compatible with the chain registry from Cosmos

┆Issue is synchronized with this Jira Task by Unito

Command to migrate contracts

Description

Add a command where we can migrate our contracts

Proposed Solution

Add the command

TODO

  • Add command to migrate contracts

┆Issue is synchronized with this Jira Task by Unito

Change broadcast mode to `sync` on `deploy` command

Description

deploy: all tx should use broadcast mode = sync

Proposed Solution

Change all tx to use the --broadcast-mode sync and then query the tx status to fetch the stored wasm code and contract address.

TODO

  • Set broadcast-mode to sync for transactions
  • Query tx status to fetch stored wasm and address

prj root dir

It could be useful If CLI automatically determine current user path (instead of hard-coded path in config.json) and along with It the project path as well, this could safe user from loosing info from successful deployment process and In general made project more robust for errors.

Add ability to select wallet on `deploy`

Description

deploy: send tx should list available wallets in keychain first

Proposed Solution

List available wallets before running send tx
If a single wallet, always pick the first one

e.g. Add up/down arrow to select the wallet

TODO

  • List wallets before running send tx

┆Issue is synchronized with this Jira Task by Unito

Add support for contracts in sub-folders

Description

Right now, our new command create a contract in the root. But could add the ability of having it in sub-folders.
So a user could, for example, have front-end and the contract into the same repo/folder

Proposed Solution

Add the ability to have contracts in sub-folders

TODO

  • Add the ability to have contracts in sub-folders

Add `--contract` argument to `query`

Description

<< TBC if this description is accurate >>
User can't run the query command if not in the project root path

Proposed Solution

Add a --contract argument so the user can specify which contract they are querying

TODO

  • Refactor the query file according to the other command (like tx for example)
  • Add an argument to the command
  • Add tests

Dev CLI Docker broken in v1.2.0

Docker version of archwayd currently does not work on any platforms.

  • This file details the differences between using Docker vs local archwayd for queries
  • This file details the differences between using Docker vs local archwayd for txs

Move common option parsing to a shared lib

The deploy commands have many similarities in the optional args accepted and the parsing function is almost the same between them. This could be moved into a shared lib.

Note: This might be dropped after the restructuring of the cli sub-commands.

┆Issue is synchronized with this Jira Task by Unito

Spin up local chain from CLI

Description

Ideally, we would add the ability to spin-up a local chain. That support engineers to run tests locally and not to depend on our test nets

Proposed Solution

Add the ability to spin-up a local chain

TODO

  • Add ability to Spin-up local chain
  • Add ability to Shutdown local chain

┆Issue is synchronized with this Jira Task by Unito

Refactor the `new` command

Description

Currently, the $ archway new command is splitting between create and configure.
If a user has an issue in one of those steps, they might not know how to move forward.

Proposed Solution

Break the new command as create and configure

TODO

  • Add command create
  • Add command configure

┆Issue is synchronized with this Jira Task by Unito

Update the `metadata` command to work with the new rewards module

Description

The latest version of archwayd deprecated the gastracker module and split it into two parts, one for tracking the gas and another for rewards actions. This refactor broke the archway metadata command in the CLI, which should now use the new rewards module.

Tasks

  • Change the archwayd command called in the TxCommands.
  • Adjust the ContractMetadata params for the transaction.
  • Adjust the CLI flags.

Error: Cannot find module 'axios'

Hi, I am not sure if this repo is ready to be used or not. I was just trying to set it up and play with some archway commands for the purpose of documentation. I faced this error:

Command I ran:

$ archway 

Error I faced:

node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'axios'
Require stack:
- /home/moji/tendermint/archway-cli/util/faucet.js
- /home/moji/tendermint/archway-cli/util/index.js
- /home/moji/tendermint/archway-cli/main.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:94:18)
    at Object.<anonymous> (/home/moji/tendermint/archway-cli/util/faucet.js:5:20)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/moji/tendermint/archway-cli/util/faucet.js',
    '/home/moji/tendermint/archway-cli/util/index.js',
    '/home/moji/tendermint/archway-cli/main.js'
  ]
}

it seems like a package is missing because when I installed it manually, it works without a problem.

$ npm install -g axios

Cheers

error: no such subcommand: `generate`

Creating new Archway project...
✔ Choose a name for your project … awt
✔ Do you want to use a starter template? … yes
✔ Choose a template › CW721 with on-chain metadata
✔ Select the project environment › Testnet
✔ Select a testnet to use › Constantine
error: no such subcommand: `generate`

Failed to create project
Error: Process exited with code 101
    at ChildProcess.done (/home/user/.npm/lib/node_modules/@archwayhq/cli/node_modules/promisify-child-process/index.cjs:70:19)
    at ChildProcess.emit (node:events:520:28)
    at maybeClose (node:internal/child_process:1092:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5) {
  code: 101,
  signal: null,
  stdout: '',
  stderr: ''
}

archway new || Error: Please check if the Git user / repository exists || Caused by: unsupported URL protocol; class=Net (12)

$ node -v
v18.2.0

npm -v
8.9.0

archway --version
1.2.0

 rustc --version
rustc 1.62.0 (a8314ef7d 2022-06-27)

archway new 

Creating new Archway project...
✔ Choose a name for your project … basic-nft
✔ Do you want to use a starter template? … yes
✔ Choose a template › CW721 with on-chain metadata
✔ Select the project environment › Testnet
✔ Select a testnet to use › Constantine
Error: Please check if the Git user / repository exists.

Caused by:
    unsupported URL protocol; class=Net (12)

Failed to create project
Error: Process exited with code 1
    at ChildProcess.done (/home/devfullstack/.nvm/versions/node/v18.2.0/lib/node_modules/@archwayhq/cli/node_modules/promisify-child-process/index.cjs:70:19)
    at ChildProcess.emit (node:events:527:28)
    at maybeClose (node:internal/child_process:1090:16)
    at ChildProcess._handle.onexit (node:internal/child_process:302:5) {
  code: 1,
  signal: null,
  stdout: '',
  stderr: ''
}

Add Security.md Security Policy for Reporting Vulnerabilities Appropriately

It is important to create a policy for reporting security vulnerabilities for smart contract and blockchain projects outside of github issues. This can often be a security.md or SECURITY.md file that is referenced in the readme.md

Example:
see https://github.com/CosmosContracts/juno/blob/main/SECURITY.md as an example from the cosmos ecosystem.

Full Disclosure:
I am a part of SecurityDAO https://secdao.xyz/ and our DAO does security audits and security consulting for cosmos projects and cosmwasm smart contracts

┆Issue is synchronized with this Jira Task by Unito

Add version check

Description

we should be able to check the current version of the CLI and manage it.
That could mean:

  • Is this version deprecated? Should we block any command force-update?
  • Do we have a newer version and want to offer an update (warning log message)
  • All good, user running latest version

TODO

  • Add ability to manage version (where do we store that info?)
  • Add check on the CLI code - logging / force-udpate

Publish Dev CLI fixes

We need to publish the changes we've made to the dev CLI; however, we'll need to fix the Docker problem first.

DONE:

  • Query module updated to use new format
  • Escrow template added to code templates

TODO:

  • Add Docker fixes (see Issue #95) and test them
  • Update semvar
  • Publish to NPM

Unit test all the CLI commands

Description

We need to unit test all the CLI commands before the release

Proposed Solution

Unit test all the commands

TODO

  • Unit test deploy
  • Unit test new
  • << list here all the missing commands >>

┆Issue is synchronized with this Jira Task by Unito

archway deploy -

seems like a bug. I can't add reward wallet in build process.
But If I enter wallet adress in config.json developer.rewardAddress deploing process went smooth.

Enter keyring passphrase:Error: rpc error: code = InvalidArgument desc = failed to execute message; message index: 0: Error parsing into type test_3::msg::InstantiateMsg: missing field `count`: instantiate wasm contract failed: invalid requestUsage:
  archwayd tx wasm instantiate [code_id_int64] [json_encoded_init_args] --label [text] --admin [address,optional] --amount [coins,optional] [flags]```

include a changelog file

Currently there's no changelog which makes it unintuitive check changes among versions.

Ideally we would compile all changes and versions into a file before changes grow too much.

creating of a new projects using Archway developer CLI fails in the case when the name of new project is inputed using the "snake_case" or "dash-case", as well as the "camelCase". Only the monolith input give a successful result

creating of a new projects using Archway developer CLI fails in the case when the name of new project is inputed using the "snake_case" or "dash-case", as well as the "camelCase". Only the monolith input give a successful result

"snake_case" result
Screenshot 2022-04-14 at 13 30 44

Screenshot 2022-04-14 at 13 33 19

Suggest it's a bug because the Archway developer CLI implements CosmWasm functionality, and the ComsmWasm project creating gives a successful result when "snake_case" and "dash-case" is used in the project name

Screenshot 2022-04-14 at 13 52 16

STEPS TO REPRODUCE:

create new project using Archway developer CLI using "archway new" command:
$ archway new

input name of the new project using "snake_case" or "dash-case"
example name: my_test_project

Rename `config.json` to `archway.json`

Description

Currently we have the config.json file, but it might conflict with other files, as it is a common filename (especially if we add the contract sub-folder capability)

Proposed Solution

Rename config.json to archway.json

Open question: How to handle older versions that still have config.json as a file?

TODO

  • Rename config file
  • Add command to migrate older versions (config.json)

┆Issue is synchronized with this Jira Task by Unito

`root` access required to run docker on some machines

On some machines, running docker requires root access.
So we either have to play with system access control and give such permission to the regular user, which might not be very secure practice or we need to make sure to follow all the steps in documentations with root access.

What issues can happen if we do not use root access?

  1. Once we want to run archway deploy, since it runs docker in the background it raises a Permission denied error. So user's might run this specific command with root permissions which yields in some other strange errors due to not having all the required tools in the root path and missing some environmental variables
  2. In case of using OS based keyring manager, you may create a wallet with your regular user and run the archway deploy with root access, which gives some other error from the Cosmos-SDK like Error: empty address string is not allowed because it cannot find your account under the root user.

Refactor the `deploy` command

Description

Currently, the $ archway deploy command is splitting between store and instantiate.
If a user has an issue in one of those steps, they might not know how to move forward.

Proposed Solution

Break the deploy command as store, instantiate and metadata

TODO

  • Add --optimize to build command
  • Add command store
  • Add command instantiate
  • Add command metadata

Verify balance before running `deploy`

Description

The CLI is not checking the user balance before running the deploy. Which might lead to errors while running deploy

Proposed Solution

Verify the balance before running deploy

TODO

  • Add verification check

┆Issue is synchronized with this Jira Task by Unito

Fix dependabot alerts and automated review for CLI

As can be seen here we need to fix security warnings

Note: Since this will only be dependency patch which changes only the package files, we should not update the semvar version; or, we could keep the version ID and simply add -rc

Add `@archwayhq/arch3.js` to the CLI

Description

Our CLI depends on Docker images or the user compiling everything locally.

Proposed Solution

We could add an RPC client to our CLI.

Tasks

  • Remove the dependency on archwayd binary
  • Use the @archwayhq/arch3-core package for RPC calls
  • Use the @archwayhq/arch3-keystore package for key management

┆Issue is synchronized with this Jira Task by Unito

Automate CLI doc generation

Description

Right now, the docs are updated manually and might get out of sync

Proposed Solution

Add the ability to update our documentation automatically

TODO

  • Automatically generate documentation on release

┆Issue is synchronized with this Jira Task by Unito

archway new - fails because of global git credentials

Perhaps it would be better to remove git commit dependencie. For example I do not store global creds and setup It manually (with scripts) for each independent project.

Switched to a new branch 'main'

*** Please tell me who you are.

Run

  git config --global user.email "[email protected]"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'user@hp.(none)')
Failed to create project
Process exited with code 128

Permission denied - diff command

CLI uses diff command src/commands/deploy.js at this line:
await spawn('diff', [remotePath, remoteDownloadPath], { encoding: 'utf8' })
It's not working out of the box because default permissions of the folder ~/.archway does not allow this.
It's not really obvious why cli crash because It only says:

Downloading wasm code to artifacts/cw721_metadata_onchain_download.wasm
Failed to deploy project
Error: Process exited with code 2
    at ChildProcess.done (/home/wotori/git/wotori/archway-cli/node_modules/promisify-child-process/index.cjs:70:19)
    at ChildProcess.emit (node:events:390:28)
    at maybeClose (node:internal/child_process:1064:16)
    at Socket.<anonymous> (node:internal/child_process:450:11)
    at Socket.emit (node:events:390:28)
    at Pipe.<anonymous> (node:net:687:12)

so it would be great to add an error handler or create a folder ~/.archway with sufficient access for diff command by default.

This command made the everything work again: sudo chmod -R 777 ~/.archway.

Failed to run `archway deploy`

The following errors when trying to deploy following the doc:

Validating artifact deployed to torii-1...
Downloading wasm code to artifacts/hello_world_download.wasm

Failed to deploy project
Error: Process exited with code 2
    at ChildProcess.done (/home/ubuntu/.nvm/versions/node/v17.9.0/lib/node_modules/@archwayhq/cli/node_modules/promisify-child-process/index.cjs:70:19)
    at ChildProcess.emit (node:events:527:28)
    at maybeClose (node:internal/child_process:1090:16)
    at Socket.<anonymous> (node:internal/child_process:449:11)
    at Socket.emit (node:events:527:28)
    at Pipe.<anonymous> (node:net:715:12)

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.