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
commanderetc 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"
}
}
}
Ok yeah i agree, we need to support a simple 3 and if people want to help out or the demand is needed we add it then π
Ok perfect fine with me!
I like that
web3 node <network|customrpc> --infosomething along those lines, again this can fall lower on priorities!What's the reasons for this? I think alias are a must for allowing users to define their own commands, it gives flexibility, without the feature in git i would be repeating myself a million times. Lets maybe discuss this further, il be interested in why you don't like it? Making the user have to write shell scripts to sort it seems a bit annoying. If i wanted to make a command which checked the health of the node and then executed a command i would want to be able to quickly add it as alias in the CLI for quick executing.
Perfect
As long as its super flexible and can handle all RPC + custom RPC methods and custom RPC networks then fine with me π
Ok cool thinking the same things again but in a different command, perfecto π
yeah something along those lines, where they can check 1 interface or do wild cards to validate a few. In theory if they just wanted to validate the whole application if they supply us the ABI we can check anything which has
.methods.and grab theexampleAbiCall(function name) try to find it in ABI then validate params + output. We could also have a ignore like//web3:validation-ignore-lineif they ever call something else.methods... something like that would be cool.yeah i think we should follow the git and npm way they designed their CLI
web3 command actionπweb3 command:actionfeels unnatural and wrong in my eyes.Yeah ok as long as we agree that it comes under the same command that's fine. I like
walletas it goes hand in hand with the cryto space but again i'm easy.npm do something like this
npm init react-app ./my-react-appso we could have the same for fast entry if not they do
web3 initand you choose likenpmdoes. This can generate the web3.json metadata by them entering important info like version, name etc! Think after step 3 we stop as we want theweb3 initto be simple and quick to do.We should also have a command : web3 add web3-module-aragonThat's a great idea π
Ideas:
We can also allow you to be able to use web3 methods directly in the CLI like normal i.e.
web3 execute new web3.utils.isHex('0xc1912');orweb3 execute <file> [--network=mainnet]orweb3 execute web3.eth.getBlockNumber() [--network=mainnet]- defaults to mainnetAll of these will create a web3 instance for them and execute the command within the CLI, allowing them to combine commands together to see the result by just using the CLI or even just wanting to execute a util method for information. It will be quite nice, if you are quickly on the fly want to convert your number to a hex but your on another project without web3 installed, in your CLI you can quickly execute it as it's installed globally.