Skip to content

Commit 838fbe0

Browse files
commit all work waiting for answers
1 parent ef7ecba commit 838fbe0

File tree

8 files changed

+200
-11
lines changed

8 files changed

+200
-11
lines changed
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
## `init`
2+
3+
Initializes a new project in a new directory which has the same name as the project. If a project name is not mentioned, a random one is chosen.
4+
5+
```sh
6+
dapp-launchpad init [PROJECT-NAME]
7+
```
8+
9+
### Options
10+
11+
| Option | Description |
12+
|:---------------------:|----------------------------------------|
13+
| -t, --template [NAME] | Name of the scaffold template to use; default: "javascript". To get list of available templates, run list scaffold-templates. (default: "javascript") |
14+
| -h, --help | display help for command |
15+
16+
### Help
17+
18+
```sh
19+
dapp-launchpad init -h
20+
```
21+
22+
## `dev`
23+
24+
Starts a local dev environment; a local blockchain (Hardhat) and a local front end (Next.js) server.
25+
26+
```sh
27+
dapp-launchpad dev [options]
28+
```
29+
30+
The `dev` command starts
31+
32+
### Options
33+
34+
| Option | Description |
35+
|--------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
36+
| -n, --fork-network-name [NAME] | Name of the network to fork; optional. By default, it starts a new chain from genesis block. (choices: "ethereum", "goerli", "polygonPos", "polygonMumbai", "polygonZkevm", "polygonZkevmTestnet") |
37+
| -b, --fork-block-num [number] | Block number to fork at. By default, it's the latest block. |
38+
| -r, --reset-on-change | Resets the entire local blockchain when any code is changed; for forked mode, it resets back to forked block number; NOT DEFAULT. |
39+
| --only-smart-contracts | Deploys only smart contracts (having started local test chain) and updates Smart contract configs for frontend; does not start frontend dev environment. |
40+
| --only-frontend | Deploys only frontend (having started local server); does not start local blockchain. Smart contracts data is read from pre-existing configs. To generate these manually, use generate smart-contracts-config. |
41+
| -e, --enable-explorer | Sets up a chain explorer for the local test blockchain started; NOT DEFAULT; sign up at https://app.tryethernal.com/. |
42+
| --ethernal-login-email [EMAIL] | Ethernal login email; needed only if --explorer is enabled. This overrides env variable ETHERNAL_EMAIL if present. |
43+
| --ethernal-login-password [PASSWORD] | Ethernal login password; needed only if --explorer is enabled. This overrides env variable ETHERNAL_PASSWORD if present. |
44+
| --ethernal-workspace [WORKSPACE] | Ethernal workspace name; needed only if --explorer is enabled. This overrides env variable ETHERNAL_WORKSPACE if present. |
45+
| -h, --help | Display help for command |
46+
47+
### Help
48+
49+
```sh
50+
dapp-launchpad dev -h
51+
```
52+
53+
## `deploy`
54+
55+
The deploy command deploys the smart contracts and frontend app to production.
56+
57+
```sh
58+
dapp-launchpad deploy -n CHAIN_NAME
59+
```
60+
61+
### Options
62+
63+
| Option | Description |
64+
|:----------------------:|:-------------------------------------------------------|
65+
| -n, --network-name | Name of the network to deploy smart contracts to. (choices: "ethereum", "goerli", "polygonPos", "polygonMumbai", "polygonZkevm", "polygonZkevmTestnet") |
66+
| --only-smart-contracts | Deploys only smart contracts and updates Smart contracts config for frontend. |
67+
| --only-frontend | Deploys only frontend; smart contracts data is read from Smart contracts config which must pre-exist. To generate these manually, use generate smart-contracts-config |
68+
| -h, --help | Display help for command |
69+
70+
### Help
71+
72+
```sh
73+
dapp-launchpad deploy -h
74+
```
75+
76+
## `list`
77+
78+
List options.
79+
80+
```sh
81+
dapp-launchpad list <WHAT TO LIST>
82+
```
83+
84+
### `scaffold-templates`
85+
86+
List the available scaffold template languages.
87+
88+
```sh
89+
dapp-launchpad list scaffold-templates
90+
```
91+
92+
## `generate`
93+
94+
Generate the specified.
95+
96+
```sh
97+
dapp-launchpad generate <WHAT TO GENERATE>
98+
```
99+
100+
### `smart-contracts-config`
101+
102+
Generate the smart contract configuration.
103+
104+
```sh
105+
dapp-launchpad generate smart-contracts-config
106+
```
107+
108+
### Options
109+
110+
| Option | Description |
111+
|:-----------------------:|:-----------------------------------------|
112+
| -e, --environment <ENV> | Environment where this config would be used (choices: "development", "production", default: "development") |
113+
| -n, --network-name | Name of the network to generate config for. (choices: "ethereum", "goerli", "polygonPos", "polygonMumbai", "polygonZkevm", "polygonZkevmTestnet") |
114+
| -h, --help | Display help for command |
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## MetaMask transactions fail with a nonce error in dev environment
2+
3+
Every time the dev environment starts, a new local test chain is started. Metamask maintains a cache of "latest block number" and "account transaction nonce". Since every run of `dev` creates a new chain, it never matches with this cache.
4+
5+
To know how to clear the cache, [read this](https://support.metamask.io/hc/en-us/articles/360015488891-How-to-clear-your-account-activity-reset-account).
6+
7+
## MetaMask transactions fail with a nonce error when using the **reset on change** option in dev environment
8+
9+
The reset on change option resets the blockchain on every code change.
10+
11+
MetaMask maintains a cache of *latest block number* and *account transaction nonce*. After resetting the chain, the latest block number and account transaction nonce should go back to the initial state as well, but MetaMask does not update this cache on its own.
12+
13+
To clear the cache, follow the [MetaMask documentation](https://support.metamask.io/hc/en-us/articles/360015488891-How-to-clear-your-account-activity-reset-account).
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
## Build from source
2+
3+
To build from source, clone the dApp Launchpad repository.
4+
5+
```sh
6+
git clone https://github.com/0xPolygon/dapp-launchpad.git
7+
cd dapp-launchpad
8+
```
9+
10+
Then build the CLI tool.
11+
12+
```sh
13+
npm run build
14+
```
15+
16+
This generates `cli.js` inside the `bin` directory, which can then be installed globally with:
17+
18+
```sh
19+
npm run install-global
20+
```
21+
22+
Now `dapp-launchpad` is available as a global command.
23+
24+
## Develop on local
25+
26+
To modify this tool, start a local dev environment by running:
27+
28+
```sh
29+
npm run dev
30+
```
31+
32+
This running process watches the source files, bundles up the CLI app on every change, and installs it globally.
33+
34+
This means that the app is continuously updating with changes to the code.
35+
36+
## Report a bugs/request a feature
37+
38+
Create an issue below on the repo:
39+
40+
https://github.com/0xPolygon/dapp-launchpad/issues
41+
42+
Please give as much detail about your issue or request as possible.

docs/tools/dApp-development/launchpad/frontend.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ To get started, modify the component file at `./frontend/src/pages/index`.
66

77
!!! info
88
If you're new to Next.js but know React.js, getting used to Next.js is trivial.
9-
To learn more about Next.js, [read their docs](https://nextjs.org/docs).
9+
To learn more about Next.js, [read the Next.js docs](https://nextjs.org/docs).
1010

1111
## Environment variables
1212

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
dApp Launchpad is an automated CLI tool for initializing, creating, and deploying a fully-integrated web3 dApp project.
22

3+
## Overview
4+
35
dApp projects are divided into two parts:
46

57
- [Frontend](frontend.md): The frontend runs on Next.js.
68
- [Smart contracts](smart-contracts.md): The smart contracts use a Hardhat environment.
79

8-
The tool automates basic activity such as auto-updating contract artifacts, (re)deploying contracts on code changes, and Hot Module Replacement (HMR) for frontend code changes, and more.
10+
The tool automates basic activity such as auto-updating contract artifacts, (re)deploying contracts on code changes, and Hot Module Replacement (HMR) for frontend code changes, and more.
11+
12+
## Repo
13+
14+
Find the code on the following git repo: https://github.com/0xPolygon/dapp-launchpad
15+
16+
!!! warning
17+
Please note the docs in the README are possibly not up-to-date.

docs/tools/dApp-development/launchpad/quickstart.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
- [Node](https://nodejs.org/en/download) version 18.x.x is recommended.
44
- Anything above Node version 16.14.x is supported.
5-
- We recommend [https://github.com/nvm-sh/nvm] for managing Node installations.
5+
- We recommend [https://github.com/nvm-sh/nvm](https://github.com/nvm-sh/nvm) for managing Node installations.
66

77
## Install the app
88

@@ -36,7 +36,7 @@ dapp-launchpad list scaffold-templates
3636

3737
## Set up environment variables
3838

39-
There are mandatory environment variables in both the frontend and smart contract directories.
39+
There are mandatory environment variables in both the `frontend` and `smart-contracts` directories.
4040

4141
1. `cd` into your project directory.
4242

@@ -81,11 +81,11 @@ There are mandatory environment variables in both the frontend and smart contrac
8181

8282
You will see the local test blockchain running with deployed contracts and some pre-funded wallets you can use.
8383

84-
[Local test environment running](../../../img/tools/launchpad/running-example.png)
84+
![Local test environment running](../../../img/tools/launchpad/running-example.png)
8585

8686
2. Open [http://localhost:3000](http://localhost:3000) in a browser.
8787

88-
[Web application running](../../../img/tools/launchpad/dev-startup.png)
88+
![Web application running](../../../img/tools/launchpad/dev-startup.png)
8989

9090
You now have a fully integrated dev environment including a local dev blockchain and a local frontend dev server. Any changes to the code automatically updates both the frontend and the smart contracts. No manual reload is necessary.
9191

@@ -97,13 +97,22 @@ You can start developing by forking an existing chain. To see the available opti
9797
dapp-launchpad dev -h
9898
```
9999

100+
The chain name options are in this section of the help output:
101+
102+
```sh
103+
-n, --fork-network-name [NAME] Name of the network to fork; optional.
104+
By default, it starts a new
105+
chain from genesis block. (choices: "ethereum", "goerli",
106+
"polygonPos", "polygonMumbai", "polygonZkevm", "polygonZkevmTestnet")
107+
```
108+
100109
To fork Polygon zkEVM, for example, run the following command:
101110

102111
```sh
103112
dapp-launchpad dev -n polygonZkevm
104113
```
105114

106-
To fork at a particular block number run the command with the following optional flag:
115+
To fork at a particular block number run the command including the optional flag `-b`:
107116

108117
```sh
109118
dapp-launchpad dev -n polygonZkevm -b [BLOCK_NUMBER_TO_FORK_AT]
@@ -135,10 +144,10 @@ dapp-launchpad deploy -n CHAIN_NAME --only-frontend
135144
```
136145

137146
!!! important
138-
The frontend deployment requires that smart contracts to have been deployed before, so if you are only deploying the frontend, make sure that you:
147+
The frontend deployment requires that smart contracts to have already been deployed, so if you are only deploying the frontend, make sure that you:
139148

140149
1. Have already run the smart contracts deploy command successfully.
141-
2. OR, run the following wizard:
150+
2. If not, run the following wizard command:
142151

143152
`generate smart-contracts-config -e production -n CHAIN_NAME`
144153

docs/tools/dApp-development/launchpad/smart-contracts.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ Make sure you have followed the [steps in the quickstart](quickstart.md#set-up-e
66

77
The smart contracts run on a [Hardhat](https://hardhat.org/) environment. They are written in [Solidity](https://docs.soliditylang.org/) and reside in the `smart-contracts` directory.
88

9-
Tests are written in JS/TS, and are in the `tests` directory. An example test is available.
9+
Tests are written in JavaScript and TypeScript, and are in the `tests` directory. An example test is available.
1010

11-
Scripts are also written in JS/TS, and reside in the `scripts` directory. Some mandatory scripts are already there to get started with.
11+
Scripts are also written in JavaScript and TypeScript, and reside in the `scripts` directory. Some mandatory scripts are already there to get started with.
1212

1313
## Deploying on local test chain
1414

mkdocs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,8 @@ nav:
429429
- Frontend: tools/dApp-development/launchpad/frontend.md
430430
- Smart contracts: tools/dApp-development/launchpad/smart-contracts.md
431431
- Commands: tools/dApp-development/launchpad/commands.md
432+
- Contributing: tools/dApp-development/launchpad/contributing.md
433+
- Common pitfalls: tools/dApp-development/launchpad/common-pitfalls.md
432434
- Smart contract development on PoS:
433435
- Alchemy: tools/dApp-development/pos/alchemy.md
434436
- ChainIDE: tools/dApp-development/pos/chainide.md

0 commit comments

Comments
 (0)