These are the web3 commands:
Starting with a project:
init <--browser|--server|--server-api> [options] Starts the setup, will then ask questions like NPM does (name of project etc).
Will create a basic web or node app for them.
options:
--browser
--server
--server-api - could hook into express and generate them a entire boilerplate node API?
Development commands:
run Starts a node and the project or serves them the browser if they 'init --browser'
Authenticatation - login to the CLI to do authenticated tasks
web3 login <private-key> Login to your eth account
web3 logout Logout the authenticated account
web3 create [entropy] Creates a new account with the CLI
Account - manage authenticated accounts in the CLI (throwing some ideas out)
web3 wallet create [entropy] Generates one or more accounts in the wallet.
If wallets already exist they will not be overridden.
web3 wallet add <privatekey> Adds an account using a private key or account object to the wallet.
web3 wallet rm <index> Removes an account from the wallet.
web3 wallet clear Securely empties the wallet and removes all its accounts.
web3 wallet encrypt <password>
web3 wallet decrypt
web3 wallet load <password>
web3 wallet ls
EthPM managment:
web3 ethpm publish <packageName> Adds a contract package to the current project
web3 ethpm uninstall <packageName> Removes a contract package to the current project
web3 ethpm update <packageName> Updates a contract package to the current project
(could just use publish all the time)
web3 ethpm ls Lists the contract packages in the current project
web3 ethpm install Install all ethpm packages
web3 ethpm install [<packageName>[@version]> Installs a ethpm package to the current project
web3 ethpm owner ls <packageName> See who the owner(s) of the package is
web3 ethpm owner change <privatekey> Change the owner of a package (only work if you sign it)
and only work if you authenticated with the CLI
ENS management:
web3 ens registry Returns the network specific ENS registry
web3 ens resolver <ENSName> Returns the resolver contract to an Ethereum address.
web3 ens owner <ENSName> Returns the owner of the ens domain
web3 ens owner change <ENSName> <address> Sets the address of an ENS name in his resolver.
Generating of code (generate:*):
web3 generate <tool> [options] Generates certain files depeneding on the tool
Ideas:
web3 generate <contract> Generates a contract class based on the contract abi
web3 generate <sign> [sign|sign-transaction|send-sign-transaction] - Generates a code basic class with code examples
web3 generate interface
web3 generate class
web3 generate enum
web3 generate types <ABI> Generate full typings for a ABI
web3 generate code <ABI> Generate classes for the code ?? pretty neat idea!
.. surely we will discover move on the way!
Call a JSON-RPC method:
web3 jsonrpc <network> <version> <method> [<params>] <id> Calls an JSON-RPC method
Contract calls:
web3 contract <method> [params] call [<required-options>] Calls an contract method based on the current project (maybe json interface is defined in the package.json or something, so we don't have to ask for it everytime) ?
web3 contract <method> [params] send [<required-options>] send using
web3 contract <method> estimateGas [<required-options>]
web3 contract <method> encodeABI [<required-options>]
web3 contract events ls List all events for the contract
web3 contract events ls --past List only past events for a contract
Open documents
web3 doc <package | keyword> Open document to the package and what it does
Version:
web3 version Outputs web3 CLI version.
Alias:
web3 alias add .. Add your own alias mappings for the CLI
web3 alias rm .. Remove your alias mappings
Star:
web3 stars Returns all the things you have starred
web3 star doc <name> <url> Star a documentation so you can easily get back to it
.. maybe other things we can star?
ping:
web3 ping <network|customrpc> Check if network is alive
deploy??!:
Do we want to hook in auto deployment or here? basically doing the hard lifting in truffle and allowing ease of deployment, with a single CLI tool?
... think we can do cool things like `web3 audit` to audit code to try to make sure its secure as well. Probably for v2.
- Which "runtimes" should it support (node.js, angular, react, vue.js, ...)
- (Josh: think the CLI should be built in node we can use npm to deploy it and make it install globally for users.
Users are use to this experience so i think it makes sense. Stuff like
commander
etc can help us create a lovely CLI design). - Do we want to use yeoman for the setup?
- What are the setup steps? - (Josh: npm install web-cli -g)
- Which options will this command have? - (Josh: put my suggestions above)
- Should it have the possibility to select a node type (parity, geth, ganache, ...) (Josh: maybe could be nice)
web3 run --watch --net="dev"
- Build on file change (wrapper of framework cli) (Josh: yeah like how angular do it, on changing a file it rebuilds. Defo worth having)
- Select the node to connect
web3 build --browser --node
- Creates a build with the browser config
- Creates a build with the node config
- Do we want a ethpm.json as truffle has or do we just extending the package.json of npm? (Sam: I would just extend the package.json) (Josh: After looking at the package.json below i think we should have our own json file 'web3-cli.json' like angular do)
- Which additional options should the command add have?
web3 add mypackage@1.2.1 --save
> Package mypackage@1.2.1 would be added to the package.json.
> Package mypackage@1.2.1 successfully added.
<package name>@<version>
web3 remove MYPackage
> Package with name MYPackage removed.
(Josh: probs would go with rm
to follow npm
linux CLI style)
- The EthPM package name
web3 generate:contract <packageName|--abi|--address> --out --types
> Contract with name TestContract created in PATH.
- The EthPM package name
- The root of the path should be the project folder root (e.g. "./assets/ContractABI").
- Default path is "./"
- The root of the path should be the project folder root (e.g "./contracts/").
- The contract address or an ENS name to a contract
- Generates a TypeScript interface from the ABI. (Josh: This is a brilliant idea, i mentioned this above as well, defo something we should include, i was also thinking we could generate a entire class of their funtionalty written in JS or TS, we could easily define a base line app for them based on the ABI?)
web3 method <methodName: eth:*, shh:*, ...> <options: methodParameters>
> '0x0'
(Josh: Put my ideas above think we should have a generic one i.e. jsonrpc [] . I also think we should handle 'send' 'estimateGas' etc within calling methods for a contract)
- All methods defined in namespaces (e.g. eth:call)
- How should the JSON-RPC method parameters are given to the method? (Josh: have to work out the most elegant way for this as we wouldnt want to command to get complex)
The post install hook of npm should be used to installing the contract dependencies.
//... package.json (Josh: probs best to put this in its own json file after looking at this, 'web3-cli.json' like angular do)
{
"web3": {
"build": {
"browser": {
provider: ["metamask", "mist", "status", "brave"] // ["ws:168.111.0.1:8564"]
},
"node": {
provider: "ws:168.111.0.1:8564"// IPC_PATH | http://
}
},
"mainnet": {
provider: "ws:168.111.0.1:8564" // IPC_PATH | http://
},
"development": {
"net": "ganache", // ["geth", {protocol: 'HTTP', ...}]
"truffle": false, // If true truffle will be used for the deploying of the contracts
"rootDir": "./",
"packages": "./node_modules/"
},
"dependencies": {
"myContractPackage": "^0.1.0",
"myChainContractPackage: "0x0",
"myENSNameContractPackage: "contract.eth"
}
}
}
I would not have these options here because they are steps in the setup:
This should be kept as simple as before:
I think the Auth commands should be together with the wallet command. I would also add a
wallet list
command to show all accounts.I would use namespaces for the commands because we have name conflicts for the commands.
For example:
web3 ens:owner --change|--c
I would like to have the syntax of them like this:
web3 generate:contract ...
Are these commands really required I think generate:contract is enough:
What exactly should this do?
generate code
I would like this more:
On send or call could also be a setup shown:
I would define it like this:
This should output all installed ethereum node versions, web3 version, solc version and the angular/react version.
I would not add such a command to the cli. (alias is a default unix command)
I would not add such a command to the cli.
I would not add such a command to the cli. (ping is a default unix command)
I would not add such a command to the cli the deployment should be done by the developer it self.
This is a nice idea but I would not add it because of the responsibilities web3 will have with this command. I think it would need a security team to provide something like this that audits all the packages on ethPM and for writing some analyzing tools.