create-stylus 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/.github/issue_template.md +7 -0
  2. package/.github/pull_request_template.md +11 -0
  3. package/.github/workflows/release-alpha.yml +32 -0
  4. package/.github/workflows/release-manual.yml +26 -0
  5. package/.yarnrc.yml +1 -0
  6. package/CONTRIBUTING.md +42 -0
  7. package/README.md +66 -0
  8. package/bin/create-dapp-ss.js +4 -0
  9. package/package.json +46 -0
  10. package/rollup.config.js +22 -0
  11. package/src/cli.ts +14 -0
  12. package/src/extensions.json +14 -0
  13. package/src/main.ts +72 -0
  14. package/src/tasks/copy-extension-file.ts +227 -0
  15. package/src/tasks/copy-template-files.ts +252 -0
  16. package/src/tasks/create-first-git-commit.ts +35 -0
  17. package/src/tasks/create-project-directory.ts +34 -0
  18. package/src/tasks/index.ts +5 -0
  19. package/src/tasks/install-packages.ts +15 -0
  20. package/src/tasks/prettier-format.ts +17 -0
  21. package/src/types.ts +31 -0
  22. package/src/utils/consts.ts +1 -0
  23. package/src/utils/find-files-recursively.ts +19 -0
  24. package/src/utils/link.ts +44 -0
  25. package/src/utils/load-extensions.ts +10 -0
  26. package/src/utils/merge-package-json.ts +33 -0
  27. package/src/utils/parse-arguments-into-options.ts +38 -0
  28. package/src/utils/prompt-for-missing-options.ts +53 -0
  29. package/src/utils/render-intro-message.ts +11 -0
  30. package/src/utils/render-outro-message.ts +34 -0
  31. package/templates/base/.github/ISSUE_TEMPLATE/bug_report.yml +58 -0
  32. package/templates/base/.github/ISSUE_TEMPLATE/config.yml +8 -0
  33. package/templates/base/.github/pull_request_template.md +16 -0
  34. package/templates/base/.github/workflows/lint.yaml +300 -0
  35. package/templates/base/.gitignore.template.mjs +19 -0
  36. package/templates/base/.gitmodules +0 -0
  37. package/templates/base/.husky/pre-commit +4 -0
  38. package/templates/base/.lintstagedrc.js +21 -0
  39. package/templates/base/.vscode/settings.json +7 -0
  40. package/templates/base/.yarn/plugins/@yarnpkg/plugin-typescript.cjs +9 -0
  41. package/templates/base/.yarn/releases/yarn-3.2.3.cjs +783 -0
  42. package/templates/base/.yarnrc.yml +11 -0
  43. package/templates/base/CONTRIBUTING.md +86 -0
  44. package/templates/base/LICENCE +21 -0
  45. package/templates/base/dist/cli.js +683 -0
  46. package/templates/base/dist/cli.js.map +1 -0
  47. package/templates/base/nitro-devnode/LICENSE +201 -0
  48. package/templates/base/nitro-devnode/README.md +70 -0
  49. package/templates/base/nitro-devnode/run-dev-node.sh +132 -0
  50. package/templates/base/nitro-devnode/start-chain-with-cors.sh +150 -0
  51. package/templates/base/nitro-devnode/stylus-deployer-bytecode.txt +1 -0
  52. package/templates/base/nitro-devnode/stylus-dev/Dockerfile +10 -0
  53. package/templates/base/package.json +44 -0
  54. package/templates/base/packages/nextjs/.env.example +13 -0
  55. package/templates/base/packages/nextjs/.eslintignore +11 -0
  56. package/templates/base/packages/nextjs/.eslintrc.json +15 -0
  57. package/templates/base/packages/nextjs/.gitignore.template.mjs +42 -0
  58. package/templates/base/packages/nextjs/.prettierrc.js +9 -0
  59. package/templates/base/packages/nextjs/.prettierrc.json +8 -0
  60. package/templates/base/packages/nextjs/app/blockexplorer/_components/AddressCodeTab.tsx +27 -0
  61. package/templates/base/packages/nextjs/app/blockexplorer/_components/AddressComponent.tsx +36 -0
  62. package/templates/base/packages/nextjs/app/blockexplorer/_components/AddressLogsTab.tsx +21 -0
  63. package/templates/base/packages/nextjs/app/blockexplorer/_components/AddressStorageTab.tsx +61 -0
  64. package/templates/base/packages/nextjs/app/blockexplorer/_components/BackButton.tsx +12 -0
  65. package/templates/base/packages/nextjs/app/blockexplorer/_components/ContractTabs.tsx +102 -0
  66. package/templates/base/packages/nextjs/app/blockexplorer/_components/PaginationButton.tsx +39 -0
  67. package/templates/base/packages/nextjs/app/blockexplorer/_components/SearchBar.tsx +49 -0
  68. package/templates/base/packages/nextjs/app/blockexplorer/_components/TransactionHash.tsx +28 -0
  69. package/templates/base/packages/nextjs/app/blockexplorer/_components/TransactionsTable.tsx +71 -0
  70. package/templates/base/packages/nextjs/app/blockexplorer/_components/index.tsx +7 -0
  71. package/templates/base/packages/nextjs/app/blockexplorer/address/[address]/page.tsx +101 -0
  72. package/templates/base/packages/nextjs/app/blockexplorer/layout.tsx +12 -0
  73. package/templates/base/packages/nextjs/app/blockexplorer/page.tsx +83 -0
  74. package/templates/base/packages/nextjs/app/blockexplorer/transaction/[txHash]/page.tsx +23 -0
  75. package/templates/base/packages/nextjs/app/blockexplorer/transaction/_components/TransactionComp.tsx +152 -0
  76. package/templates/base/packages/nextjs/app/debug/_components/DebugContracts.tsx +73 -0
  77. package/templates/base/packages/nextjs/app/debug/_components/contract/ContractInput.tsx +84 -0
  78. package/templates/base/packages/nextjs/app/debug/_components/contract/ContractReadMethods.tsx +43 -0
  79. package/templates/base/packages/nextjs/app/debug/_components/contract/ContractUI.tsx +164 -0
  80. package/templates/base/packages/nextjs/app/debug/_components/contract/ContractVariables.tsx +50 -0
  81. package/templates/base/packages/nextjs/app/debug/_components/contract/ContractWriteMethods.tsx +49 -0
  82. package/templates/base/packages/nextjs/app/debug/_components/contract/DisplayVariable.tsx +85 -0
  83. package/templates/base/packages/nextjs/app/debug/_components/contract/InheritanceTooltip.tsx +14 -0
  84. package/templates/base/packages/nextjs/app/debug/_components/contract/ReadOnlyFunctionForm.tsx +102 -0
  85. package/templates/base/packages/nextjs/app/debug/_components/contract/Tuple.tsx +44 -0
  86. package/templates/base/packages/nextjs/app/debug/_components/contract/TupleArray.tsx +142 -0
  87. package/templates/base/packages/nextjs/app/debug/_components/contract/TxReceipt.tsx +42 -0
  88. package/templates/base/packages/nextjs/app/debug/_components/contract/WriteOnlyFunctionForm.tsx +144 -0
  89. package/templates/base/packages/nextjs/app/debug/_components/contract/index.tsx +8 -0
  90. package/templates/base/packages/nextjs/app/debug/_components/contract/utilsContract.tsx +166 -0
  91. package/templates/base/packages/nextjs/app/debug/_components/contract/utilsDisplay.tsx +114 -0
  92. package/templates/base/packages/nextjs/app/debug/page.tsx +14 -0
  93. package/templates/base/packages/nextjs/app/layout.tsx +67 -0
  94. package/templates/base/packages/nextjs/app/not-found.tsx +16 -0
  95. package/templates/base/packages/nextjs/app/page.tsx +94 -0
  96. package/templates/base/packages/nextjs/components/Background.tsx +37 -0
  97. package/templates/base/packages/nextjs/components/Card.tsx +40 -0
  98. package/templates/base/packages/nextjs/components/Footer.tsx +93 -0
  99. package/templates/base/packages/nextjs/components/Header.tsx +114 -0
  100. package/templates/base/packages/nextjs/components/ScaffoldEthAppWithProviders.tsx +77 -0
  101. package/templates/base/packages/nextjs/components/SwitchTheme.tsx +41 -0
  102. package/templates/base/packages/nextjs/components/ThemeProvider.tsx +13 -0
  103. package/templates/base/packages/nextjs/components/assets/BuidlGuidlLogo.tsx +18 -0
  104. package/templates/base/packages/nextjs/components/scaffold-eth/Address/Address.tsx +187 -0
  105. package/templates/base/packages/nextjs/components/scaffold-eth/Address/AddressCopyIcon.tsx +23 -0
  106. package/templates/base/packages/nextjs/components/scaffold-eth/Address/AddressLinkWrapper.tsx +29 -0
  107. package/templates/base/packages/nextjs/components/scaffold-eth/Balance.tsx +75 -0
  108. package/templates/base/packages/nextjs/components/scaffold-eth/BlockieAvatar.tsx +17 -0
  109. package/templates/base/packages/nextjs/components/scaffold-eth/Faucet.tsx +131 -0
  110. package/templates/base/packages/nextjs/components/scaffold-eth/FaucetButton.tsx +75 -0
  111. package/templates/base/packages/nextjs/components/scaffold-eth/Input/AddressInput.tsx +120 -0
  112. package/templates/base/packages/nextjs/components/scaffold-eth/Input/Bytes32Input.tsx +31 -0
  113. package/templates/base/packages/nextjs/components/scaffold-eth/Input/BytesInput.tsx +28 -0
  114. package/templates/base/packages/nextjs/components/scaffold-eth/Input/EtherInput.tsx +128 -0
  115. package/templates/base/packages/nextjs/components/scaffold-eth/Input/InputBase.tsx +66 -0
  116. package/templates/base/packages/nextjs/components/scaffold-eth/Input/IntegerInput.tsx +63 -0
  117. package/templates/base/packages/nextjs/components/scaffold-eth/Input/index.ts +9 -0
  118. package/templates/base/packages/nextjs/components/scaffold-eth/Input/utils.ts +109 -0
  119. package/templates/base/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/AddressInfoDropdown.tsx +121 -0
  120. package/templates/base/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/AddressQRCodeModal.tsx +33 -0
  121. package/templates/base/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/BurnerWalletModal.tsx +63 -0
  122. package/templates/base/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/NetworkOptions.tsx +48 -0
  123. package/templates/base/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/WrongNetworkDropdown.tsx +32 -0
  124. package/templates/base/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/index.tsx +89 -0
  125. package/templates/base/packages/nextjs/components/scaffold-eth/index.tsx +7 -0
  126. package/templates/base/packages/nextjs/contracts/deployedContracts.ts +9 -0
  127. package/templates/base/packages/nextjs/contracts/externalContracts.ts +16 -0
  128. package/templates/base/packages/nextjs/eslint.config.mjs +32 -0
  129. package/templates/base/packages/nextjs/hooks/scaffold-eth/index.ts +17 -0
  130. package/templates/base/packages/nextjs/hooks/scaffold-eth/useAnimationConfig.ts +20 -0
  131. package/templates/base/packages/nextjs/hooks/scaffold-eth/useContractLogs.ts +40 -0
  132. package/templates/base/packages/nextjs/hooks/scaffold-eth/useCopyToClipboard.ts +19 -0
  133. package/templates/base/packages/nextjs/hooks/scaffold-eth/useDeployedContractInfo.ts +86 -0
  134. package/templates/base/packages/nextjs/hooks/scaffold-eth/useDisplayUsdMode.ts +21 -0
  135. package/templates/base/packages/nextjs/hooks/scaffold-eth/useFetchBlocks.ts +133 -0
  136. package/templates/base/packages/nextjs/hooks/scaffold-eth/useInitializeNativeCurrencyPrice.ts +32 -0
  137. package/templates/base/packages/nextjs/hooks/scaffold-eth/useNativeCurrencyPrice.ts +34 -0
  138. package/templates/base/packages/nextjs/hooks/scaffold-eth/useNetworkColor.ts +22 -0
  139. package/templates/base/packages/nextjs/hooks/scaffold-eth/useOutsideClick.ts +23 -0
  140. package/templates/base/packages/nextjs/hooks/scaffold-eth/useScaffoldContract.ts +65 -0
  141. package/templates/base/packages/nextjs/hooks/scaffold-eth/useScaffoldEventHistory.ts +213 -0
  142. package/templates/base/packages/nextjs/hooks/scaffold-eth/useScaffoldReadContract.ts +80 -0
  143. package/templates/base/packages/nextjs/hooks/scaffold-eth/useScaffoldWatchContractEvent.ts +40 -0
  144. package/templates/base/packages/nextjs/hooks/scaffold-eth/useScaffoldWriteContract.ts +191 -0
  145. package/templates/base/packages/nextjs/hooks/scaffold-eth/useSelectedNetwork.ts +18 -0
  146. package/templates/base/packages/nextjs/hooks/scaffold-eth/useTargetNetwork.ts +23 -0
  147. package/templates/base/packages/nextjs/hooks/scaffold-eth/useTransactor.tsx +114 -0
  148. package/templates/base/packages/nextjs/hooks/scaffold-eth/useWatchBalance.ts +21 -0
  149. package/templates/base/packages/nextjs/icons/CompassIcon.tsx +39 -0
  150. package/templates/base/packages/nextjs/icons/DarkBugAntIcon.tsx +30 -0
  151. package/templates/base/packages/nextjs/icons/LightBugAntIcon.tsx +52 -0
  152. package/templates/base/packages/nextjs/next-env.d.ts +5 -0
  153. package/templates/base/packages/nextjs/next.config.js +19 -0
  154. package/templates/base/packages/nextjs/package.json +58 -0
  155. package/templates/base/packages/nextjs/postcss.config.js +6 -0
  156. package/templates/base/packages/nextjs/public/debug-image.png +0 -0
  157. package/templates/base/packages/nextjs/public/favicon.png +0 -0
  158. package/templates/base/packages/nextjs/public/logo.svg +8 -0
  159. package/templates/base/packages/nextjs/public/manifest.json +5 -0
  160. package/templates/base/packages/nextjs/public/thumbnail.jpg +0 -0
  161. package/templates/base/packages/nextjs/react-copy-to-clipboard.d.ts +44 -0
  162. package/templates/base/packages/nextjs/scaffold.config.ts +56 -0
  163. package/templates/base/packages/nextjs/services/store/store.ts +39 -0
  164. package/templates/base/packages/nextjs/services/web3/wagmiConfig.tsx +44 -0
  165. package/templates/base/packages/nextjs/services/web3/wagmiConnectors.tsx +51 -0
  166. package/templates/base/packages/nextjs/styles/globals.css +80 -0
  167. package/templates/base/packages/nextjs/tailwind.config.js +97 -0
  168. package/templates/base/packages/nextjs/tsconfig.json +28 -0
  169. package/templates/base/packages/nextjs/types/abitype/abi.d.ts +16 -0
  170. package/templates/base/packages/nextjs/types/utils.ts +3 -0
  171. package/templates/base/packages/nextjs/utils/scaffold-eth/block.ts +17 -0
  172. package/templates/base/packages/nextjs/utils/scaffold-eth/common.ts +8 -0
  173. package/templates/base/packages/nextjs/utils/scaffold-eth/contract.ts +352 -0
  174. package/templates/base/packages/nextjs/utils/scaffold-eth/contractsData.ts +11 -0
  175. package/templates/base/packages/nextjs/utils/scaffold-eth/decodeTxData.ts +65 -0
  176. package/templates/base/packages/nextjs/utils/scaffold-eth/fetchPriceFromUniswap.ts +72 -0
  177. package/templates/base/packages/nextjs/utils/scaffold-eth/getMetadata.ts +50 -0
  178. package/templates/base/packages/nextjs/utils/scaffold-eth/getParsedError.ts +35 -0
  179. package/templates/base/packages/nextjs/utils/scaffold-eth/index.ts +6 -0
  180. package/templates/base/packages/nextjs/utils/scaffold-eth/notification.tsx +90 -0
  181. package/templates/base/packages/nextjs/utils/scaffold-stylus/burner.ts +59 -0
  182. package/templates/base/packages/nextjs/utils/scaffold-stylus/chain.ts +42 -0
  183. package/templates/base/packages/nextjs/utils/scaffold-stylus/index.ts +3 -0
  184. package/templates/base/packages/nextjs/utils/scaffold-stylus/networks.ts +94 -0
  185. package/templates/base/packages/nextjs/vercel.json +3 -0
  186. package/templates/base/packages/stylus/.env.example +16 -0
  187. package/templates/base/packages/stylus/.eslintrc.js +23 -0
  188. package/templates/base/packages/stylus/.gitignore.template.mjs +7 -0
  189. package/templates/base/packages/stylus/jest.config.js +15 -0
  190. package/templates/base/packages/stylus/package.json +48 -0
  191. package/templates/base/packages/stylus/scripts/deploy.ts +46 -0
  192. package/templates/base/packages/stylus/scripts/deploy_contract.ts +84 -0
  193. package/templates/base/packages/stylus/scripts/deploy_wrapper.ts +39 -0
  194. package/templates/base/packages/stylus/scripts/export_abi.ts +87 -0
  195. package/templates/base/packages/stylus/scripts/index.ts +0 -0
  196. package/templates/base/packages/stylus/scripts/new_module.sh +35 -0
  197. package/templates/base/packages/stylus/scripts/test_network.ts +31 -0
  198. package/templates/base/packages/stylus/scripts/utils/command.ts +152 -0
  199. package/templates/base/packages/stylus/scripts/utils/contract.ts +228 -0
  200. package/templates/base/packages/stylus/scripts/utils/deployment.ts +260 -0
  201. package/templates/base/packages/stylus/scripts/utils/index.ts +6 -0
  202. package/templates/base/packages/stylus/scripts/utils/network.ts +132 -0
  203. package/templates/base/packages/stylus/scripts/utils/type.ts +51 -0
  204. package/templates/base/packages/stylus/scripts/utils.ts +3 -0
  205. package/templates/base/packages/stylus/tsconfig.json +41 -0
  206. package/templates/base/packages/stylus/your-contract/.cargo/config.toml +18 -0
  207. package/templates/base/packages/stylus/your-contract/Cargo.lock +5761 -0
  208. package/templates/base/packages/stylus/your-contract/Cargo.toml +48 -0
  209. package/templates/base/packages/stylus/your-contract/examples/counter.rs +78 -0
  210. package/templates/base/packages/stylus/your-contract/header.png +0 -0
  211. package/templates/base/packages/stylus/your-contract/licenses/Apache-2.0 +201 -0
  212. package/templates/base/packages/stylus/your-contract/licenses/COPYRIGHT.md +5 -0
  213. package/templates/base/packages/stylus/your-contract/licenses/DCO.txt +34 -0
  214. package/templates/base/packages/stylus/your-contract/licenses/MIT +21 -0
  215. package/templates/base/packages/stylus/your-contract/rust-toolchain.toml +2 -0
  216. package/templates/base/packages/stylus/your-contract/src/lib.rs +241 -0
  217. package/templates/base/packages/stylus/your-contract/src/main.rs +10 -0
  218. package/templates/base/readme.md +352 -0
  219. package/templates/base/yarn.lock +17859 -0
  220. package/tsconfig.json +13 -0
@@ -0,0 +1,352 @@
1
+ # 🏗 scaffold-stylus
2
+
3
+ <h4 align="center">
4
+ <a href="https://arb-stylus.github.io/scaffold-stylus-docs/">Documentation</a> |
5
+ <a href="https://www.scaffoldstylus.com/">Website</a>
6
+ </h4>
7
+
8
+ 🧪 An open-source, up-to-date toolkit for building decentralized applications (dapps) on the Arbitrum blockchain. It's designed to make it easier for developers to create and deploy smart contracts and build user interfaces that interact with those contracts.
9
+
10
+ ⚙️ Built using Rust, NextJS, RainbowKit, Stylus, Wagmi, Viem, and TypeScript.
11
+
12
+ - ✅ **Contract Hot Reload**: Your frontend auto-adapts to your smart contract as you edit it.
13
+ - 🪝 **[Custom hooks](https://arb-stylus.github.io/scaffold-stylus-docs/components)**: Collection of React hooks wrapped around [wagmi](https://wagmi.sh/) to simplify interactions with smart contracts with TypeScript autocompletion.
14
+ - 🧱 [**Components**](https://arb-stylus.github.io/scaffold-stylus-docs/hooks): Collection of common web3 components to quickly build your frontend.
15
+ - 🔥 **Burner Wallet & Local Faucet**: Quickly test your application with a burner wallet and local faucet.
16
+ - 🔐 **Integration with Wallet Providers**: Connect to different wallet providers and interact with the Arbitrum network.
17
+
18
+ ![Debug Contracts tab](./packages/nextjs/public/debug-image.png)
19
+
20
+ ## Requirements
21
+
22
+ Before you begin, you need to install the following tools:
23
+
24
+ - [Node (>= v18.17)](https://nodejs.org/en/download/)
25
+ - Yarn ([v1](https://classic.yarnpkg.com/en/docs/install/) or [v2+](https://yarnpkg.com/getting-started/install))
26
+ - [Git](https://git-scm.com/downloads)
27
+ - [Rust](https://www.rust-lang.org/tools/install)
28
+ - [Docker](https://docs.docker.com/engine/install/)
29
+ - [Foundry Cast](https://getfoundry.sh/)
30
+
31
+ ## Quickstart
32
+
33
+ To get started with Scaffold-Stylus, follow the steps below:
34
+
35
+ ### 1. Clone this repo & install dependencies
36
+
37
+ ```bash
38
+ git clone https://github.com/Arb-Stylus/scaffold-stylus.git
39
+ cd scaffold-stylus
40
+ yarn install
41
+ # Initialize submodules (required for Nitro dev node)
42
+ git submodule update --init --recursive
43
+ ```
44
+
45
+ ### 2. Install Stylus tools
46
+
47
+ Install [Rust](https://www.rust-lang.org/tools/install), and then install the Stylus CLI tool with Cargo:
48
+
49
+ ```bash
50
+ cargo install --force cargo-stylus cargo-stylus-check
51
+ ```
52
+
53
+ **Prerequisite:**
54
+
55
+ - `cargo-stylus` version `^0.6.1`
56
+ - `rustc` version match with `packages/stylus/your-contract/rust-toolchain.toml`
57
+
58
+ Set default `toolchain` match `rust-toolchain.toml` and add the `wasm32-unknown-unknown` build target to your Rust compiler:
59
+
60
+ ```bash
61
+ rustup default 1.87
62
+ rustup target add wasm32-unknown-unknown --toolchain 1.87
63
+ ```
64
+
65
+ You should now have it available as a Cargo subcommand:
66
+
67
+ ```bash
68
+ cargo stylus --help
69
+ ```
70
+
71
+ ### 3. Run a local network
72
+
73
+ In your first terminal:
74
+
75
+ ```bash
76
+ yarn chain
77
+ ```
78
+
79
+ This command starts a local Stylus-compatible network using the Nitro dev node script (`./nitro-devnode/run-dev-node.sh`). The network runs on your local machine and can be used for testing and development. You can customize the Nitro dev node configuration in the `nitro-devnode` submodule.
80
+
81
+ ### 4. Deploy the test contract
82
+
83
+ In your second terminal:
84
+
85
+ ```bash
86
+ yarn deploy
87
+ ```
88
+
89
+ This command deploys a test smart contract to the local network. The contract is located in `packages/stylus/your-contract/src` and can be modified to suit your needs. The `yarn deploy` command uses the deploy script located in `packages/stylus/scripts` to deploy the contract to the network. You can also customize the deploy script .
90
+
91
+ ### 5. Start your NextJS app
92
+
93
+ In your third terminal:
94
+
95
+ ```bash
96
+ yarn start
97
+ ```
98
+
99
+ Visit your app at: `http://localhost:3000`. You can interact with your smart contract using the **Debug Contracts** page, which provides a user-friendly interface for testing your contract's functions and viewing its state.
100
+
101
+ ### 6. Test your smart contract
102
+
103
+ ```bash
104
+ yarn stylus:test
105
+ ```
106
+
107
+ ## Development Workflow
108
+
109
+ - Edit your smart contract `lib.rs` in `packages/stylus/your-contract/src`
110
+ - Edit your frontend in `packages/nextjs/app`
111
+ - Edit your deployment scripts in `packages/stylus/scripts`
112
+
113
+ ## Create Your Own Contract
114
+
115
+ Scaffold-Stylus enables you to create and deploy multiple contracts within a single project. Follow the steps below to create and deploy your own contracts.
116
+
117
+ ### Step 1: Generate New Contract
118
+
119
+ Use the following command to create a new contract and customize it as needed:
120
+
121
+ ```bash
122
+ yarn new-module <contract-name>
123
+ ```
124
+
125
+ The generated contract will be located in `packages/stylus/<contract-name>`.
126
+
127
+ ### Step 2: Deploy Your Contract
128
+
129
+ ```bash
130
+ yarn deploy [...options]
131
+ ```
132
+
133
+ This command runs the `deploy.ts` script located in `packages/stylus/scripts`. You can customize this script with your deployment logic.
134
+
135
+ **Available Options:**
136
+
137
+ - `--network <network>`: Specify which network to deploy to
138
+ - `--estimate-gas`: Only perform gas estimation without deploying
139
+ - `--max-fee=<maxFee>`: Set maximum fee per gas in gwei
140
+
141
+ **Note:** Deployment information is automatically saved in `packages/stylus/deployments` by default.
142
+
143
+ ## Deploying to Other Networks
144
+
145
+ To deploy your contracts to other networks (other than the default local Nitro dev node), you'll need to configure your RPC endpoint and wallet credentials.
146
+
147
+ ### Prerequisites
148
+
149
+ 1. **Set the RPC URL**
150
+
151
+ Configure your target network's RPC endpoint using the proper `RPC_URL_<network>` environment variable. You can set this in your shell or create a `.env` file (see `.env.example` for reference):
152
+
153
+ ```env
154
+ RPC_URL_SEPOLIA=https://your-network-rpc-url
155
+ ```
156
+
157
+ **Note:** If RPC URL is not provided, system will use default public RPC URL from that network
158
+
159
+ 2. **Set the Private Key**
160
+
161
+ For real deployments, you must provide your own wallet's private key. Set the `PRIVATE_KEY_<network>` environment variable:
162
+
163
+ ```env
164
+ PRIVATE_KEY_SEPOLIA=your_private_key_here
165
+ ```
166
+
167
+ **Security Note:** A development key is used by default when running the Nitro dev node locally, but for external deployments, you must provide your own private key.
168
+
169
+ 3. **Set the Account Address**
170
+
171
+ Set the `ACCOUNT_ADDRESS_<network>`
172
+
173
+ ```env
174
+ ACCOUNT_ADDRESS_SEPOLIA=your_account_address_here
175
+ ```
176
+
177
+ 4. **Update Frontend Configuration**
178
+
179
+ Open `packages/nextjs/scaffold.config.ts` and update the `targetNetworks` array to include your target chain. This ensures your frontend connects to the correct network and generates the proper ABI in `deployedContracts.ts`:
180
+
181
+ ```ts
182
+ import * as chains from "viem/chains";
183
+ // ...
184
+ targetNetworks: [chains.arbitrumSepolia],
185
+ ```
186
+
187
+ ### Available Networks
188
+
189
+ This template supports Arbitrum networks only. You can test which networks are available and their RPC URLs:
190
+
191
+ ```bash
192
+ yarn test:networks
193
+ ```
194
+
195
+ This will show you all supported networks and their corresponding RPC endpoints.
196
+
197
+ ### Deploy to Other Network
198
+
199
+ Once configured, deploy to your target network:
200
+
201
+ ```bash
202
+ yarn deploy --network <network>
203
+ ```
204
+
205
+ **Important Security Notes:**
206
+
207
+ - The values in `.env.example` provide a template for required environment variables
208
+ - **Always keep your private key secure and never commit it to version control**
209
+ - Consider using environment variable management tools for production deployments
210
+
211
+ ## Verify your contract
212
+
213
+ #### Prerequisites
214
+
215
+ Your contract must meet Arbiscan's verification requirements:
216
+
217
+ - No external libraries
218
+ - No constructor arguments
219
+ - No custom optimization settings
220
+ - No specific compiler version requirements
221
+
222
+ ### Local Verification
223
+
224
+ Make sure your constructor does not contain any args
225
+
226
+ ```rs
227
+ pub fn constructor(&mut self)
228
+ ```
229
+
230
+ The scaffold includes built-in local verification to ensure your Stylus contract deployments are reproducible. To enable verification during deployment, set `verify: true` in your deployment script:
231
+
232
+ ```ts
233
+ await deployStylusContract({
234
+ contract: "your-contract",
235
+ verify: true,
236
+ ...deployOptions,
237
+ });
238
+ ```
239
+
240
+ This runs `cargo stylus verify` locally after deployment, which:
241
+
242
+ - Verifies that the deployed bytecode matches your source code
243
+ - Ensures reproducibility across different environments
244
+ - Validates the deployment transaction
245
+
246
+ ### Arbiscan Verification
247
+
248
+ For public verification on Arbiscan, follow these steps:
249
+
250
+ #### Steps
251
+
252
+ 1. **Create a dedicated repository** containing only your contract source code
253
+ 2. **Navigate to Arbiscan**:
254
+ - Go to [Arbiscan Verify Contract](https://arbiscan.io/verifyContract)
255
+ - Enter your deployed contract address
256
+ 3. **Follow the verification process**:
257
+ - Select "Solidity (Standard-Json-Input)" as the compiler type
258
+ - Enter your contract source code (github link)
259
+ - Provide any constructor arguments if applicable
260
+ - Submit for verification
261
+
262
+ Check official document for detail instructions: https://docs.arbitrum.io/stylus/how-tos/verifying-contracts-arbiscan
263
+
264
+ > **Note**: Arbiscan verification for Stylus contracts is still evolving. If you encounter issues, consider using the local verification method or check Arbiscan's latest documentation for Stylus-specific instructions.
265
+
266
+ ### 🛠️ Troubleshooting Common Issues
267
+
268
+ #### 1. `stylus` Not Recognized
269
+
270
+ If you encounter an error stating that `stylus` is not recognized as an external or internal command, run the following command in your terminal:
271
+
272
+ ```bash
273
+ sudo apt-get update && sudo apt-get install -y pkg-config libssl-dev
274
+ ```
275
+
276
+ After that, check if `stylus` is installed by running:
277
+
278
+ ```bash
279
+ cargo stylus --version
280
+ ```
281
+
282
+ If the version is displayed, `stylus` has been successfully installed and the path is correctly set.
283
+
284
+ #### 2. ABI Not Generated
285
+
286
+ If you face issues with the ABI not being generated, you can try one of the following solutions:
287
+
288
+ - **Restart Docker Node**: Pause and restart the Docker node and the local setup of the project. You can do this by deleting all ongoing running containers and then restarting the local terminal using:
289
+ ```bash
290
+ yarn run dev
291
+ ```
292
+ - **Modify the Script**: In the `run-dev-node.sh` script, replace the line:
293
+
294
+ ```bash
295
+ cargo stylus export-abi
296
+ ```
297
+
298
+ with:
299
+
300
+ ```bash
301
+ cargo run --manifest-path=Cargo.toml --features export-abi
302
+ ```
303
+
304
+ - **Access Denied Issue**: If you encounter an access denied permission error during ABI generation, run the following command and then execute the script again:
305
+ ```bash
306
+ sudo chown -R $USER:$USER target
307
+ ```
308
+
309
+ #### 3. 🚨 Fixing Line Endings and Running Shell Scripts in WSL
310
+
311
+ > ⚠️ This guide provides step-by-step instructions to resolve the Command not found error caused by CRLF line endings in shell scripts when running in a WSL environment.
312
+
313
+ Shell scripts created in Windows often have `CRLF` line endings, which cause issues in Unix-like environments such as WSL. To fix this:
314
+
315
+ **Using `dos2unix`:**
316
+
317
+ 1. Install `dos2unix` (if not already installed):
318
+
319
+ ```bash
320
+ sudo apt install dos2unix
321
+ ```
322
+
323
+ 2. Convert the script's line endings:
324
+
325
+ ```bash
326
+ dos2unix run-dev-node.sh
327
+ ```
328
+
329
+ 3. Make the Script Executable:
330
+
331
+ ```bash
332
+ chmod +x run-dev-node.sh
333
+ ```
334
+
335
+ 4. Run the Script in WSL:
336
+ ```bash
337
+ bash run-dev-node.sh
338
+ ```
339
+
340
+ ---
341
+
342
+ ## Documentation
343
+
344
+ Visit our [docs](https://arb-stylus.github.io/scaffold-stylus-docs/) to learn how to start building with Scaffold-Stylus.
345
+
346
+ To learn more about its features, check out our [website](https://www.scaffoldstylus.com/).
347
+
348
+ ## Contributing to Scaffold-Stylus
349
+
350
+ We welcome contributions to Scaffold-Stylus!
351
+
352
+ Please see [CONTRIBUTING.md](https://github.com/Arb-Stylus/scaffold-stylus/blob/main/CONTRIBUTING.md) for more information and guidelines for contributing to Scaffold-Stylus.