You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To avoid issues when named arguments have typos, the `withDefaults` utility will also throw an error when an argument is passed with a name that wasn't expected by the template.
146
146
147
+
### Using global variables in args file content
148
+
149
+
You can use global variables in your argument values by defining your argument values as functions.
150
+
151
+
Instead of static values, export functions that receive global variables as parameters and return the desired content.
152
+
153
+
**Important:** The function's return type must match the default argument value type defined in the template.
154
+
155
+
Example:
156
+
157
+
```js
158
+
// Static value (basic approach)
159
+
exportconstdescription="Hello world";
160
+
161
+
// Dynamic value using global variables (advanced approach)
-`solidityFramework` - The selected Solidity framework (e.g., "hardhat", "foundry")
168
+
147
169
# Args files injection in Template files
148
170
149
171
For each Template file, we search on the extensions the user selected for the existence of Args files in the exact same relative path. If Args files are found, we combine them into an array.
@@ -11,7 +11,7 @@ This codebase contains Scaffold-ETH 2 (SE-2), everything you need to build dApps
11
11
12
12
It's a yarn monorepo that contains following packages:
13
13
14
-
${Boolean(solidityFramework[0]) ? `- ${solidityFramework[0].toUpperCase()} (\`packages/${solidityFramework[0]}\`): The solidity framework to write, test and deploy EVM Smart Contracts.` : ""}
14
+
${Boolean(solidityFramework[0]) ? `- ${upperCaseFirstLetter(solidityFramework[0])} (\`packages/${solidityFramework[0]}\`): The solidity framework to write, test and deploy EVM Smart Contracts.` : ""}
15
15
- NextJS (\`packages/nextjs\`): The UI framework extended with utilities to make interacting with Smart Contracts easy (using Next.js App Router, not Pages Router).
16
16
17
17
@@ -117,4 +117,4 @@ For fully customizable components, you can use the hooks from the \`@scaffold-ui
117
117
Find the relevant information from the documentation and the codebase. Think step by step before answering the question.`
This command starts a local Ethereum network using ${solidityFramework[0]}. The network runs on your local machine and can be used for testing and development. You can customize the network configuration in ${networkConfigPath[0]}.
29
+
This command starts a local Ethereum network using ${upperCaseFirstLetter(solidityFramework[0])}. The network runs on your local machine and can be used for testing and development. You can customize the network configuration in ${networkConfigPath[0]}.
30
30
31
31
3. On a second terminal, deploy the test contract:
32
32
@@ -84,7 +84,7 @@ const contents = ({
84
84
🧪 An open-source, up-to-date toolkit for building decentralized applications (dapps) on the Ethereum 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.
0 commit comments