Skip to content

Commit 0f6c0f1

Browse files
committed
update guide language
1 parent 2c34fcd commit 0f6c0f1

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

docs/src/content/ignition/docs/guides/scripts.md

+16-10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Advanced deployment with Hardhat scripts
1+
# Deploying within Hardhat scripts
22

33
Hardhat Ignition is a powerful deployment engine, but you may find there are some programming concepts that are not allowed within an Ignition module. Conditional logic, `async/await`, and `console.log` of deployment variables are some examples of operations that cannot be performed within an Ignition module. However, this guide will show you how you can perform all of these operations by pairing Ignition with Hardhat scripts.
44

55
:::tip
66

7-
This guide will be using the contracts and Ignition module from the [quick start guide](/ignition/docs/getting-started#quick-start), but you can follow along in your own project if you prefer.
7+
This guide will be using the contracts and Ignition module from the [quick start guide](/ignition/docs/getting-started#quick-start).
88

99
:::
1010

@@ -22,7 +22,7 @@ import ApolloModule from "../ignition/modules/Apollo";
2222
async function main() {
2323
const { apollo } = await hre.ignition.deploy(ApolloModule);
2424

25-
console.log(`Apollo deployed to: ${apollo.target}`);
25+
console.log(`Apollo deployed to: ${await apollo.getAddress()}`);
2626
}
2727

2828
main().catch(console.error);
@@ -38,7 +38,7 @@ const ApolloModule = require("../ignition/modules/Apollo");
3838
async function main() {
3939
const { apollo } = await hre.ignition.deploy(ApolloModule);
4040

41-
console.log(`Apollo deployed to: ${apollo.target}`);
41+
console.log(`Apollo deployed to: ${await apollo.getAddress()}`);
4242
}
4343

4444
main().catch(console.error);
@@ -78,7 +78,7 @@ For this example, let's say we want to dynamically change the name of the `Rocke
7878

7979
:::tab{value="TypeScript"}
8080

81-
```typescript
81+
```typescript{4}
8282
import { buildModule } from "@nomicfoundation/hardhat-ignition/modules";
8383
8484
export default buildModule("Apollo", (m) => {
@@ -95,7 +95,7 @@ export default buildModule("Apollo", (m) => {
9595

9696
:::tab{value="JavaScript"}
9797

98-
```javascript
98+
```javascript{4}
9999
const { buildModule } = require("@nomicfoundation/hardhat-ignition/modules");
100100
101101
module.exports = buildModule("Apollo", (m) => {
@@ -168,7 +168,13 @@ main().catch(console.error);
168168

169169
::::
170170

171-
In this script, we've added a new function called `getRocketNameFromAPI`, which simulates an asynchronous API call. We then call this function to retrieve the rocket name and pass it as a parameter to the Ignition module when deploying the `Apollo` module. You can run this script using the same command as before.
171+
In this script, we've added a new function called `getRocketNameFromAPI`, which simulates an asynchronous API call. We then call this function to retrieve the rocket name and pass it as a parameter under the named Ignition module when deploying the `Apollo` module. You can run this script using the same command as before.
172+
173+
:::tip
174+
175+
You can read more about defining and using parameters in Ignition modules in the [deployment guide](/ignition/docs/guides/deploy#defining-parameters-during-deployment).
176+
177+
:::
172178

173179
## Conditional logic
174180

@@ -194,7 +200,7 @@ async function main() {
194200
parameters: { Apollo: { rocketName } },
195201
});
196202

197-
console.log(`Apollo deployed to: ${apollo.target}`);
203+
console.log(`Apollo deployed to: ${await apollo.getAddress()}`);
198204
} else {
199205
console.log("No name given for Rocket contract, skipping deployment");
200206
}
@@ -223,7 +229,7 @@ async function main() {
223229
parameters: { Apollo: { rocketName } },
224230
});
225231

226-
console.log(`Apollo deployed to: ${apollo.target}`);
232+
console.log(`Apollo deployed to: ${await apollo.getAddress()}`);
227233
} else {
228234
console.log("No name given for Rocket contract, skipping deployment");
229235
}
@@ -238,4 +244,4 @@ main().catch(console.error);
238244

239245
In this script, we've added an `if` statement to check if the `rocketName` is not `undefined`. If it is not `undefined`, we proceed with deploying the `Apollo` module; otherwise, we log a message to the console indicating that the deployment has been skipped. You can run this script using the same command as before.
240246

241-
By combining Ignition with Hardhat scripts, you can perform advanced deployment operations that are not possible within an Ignition module alone. These are just a few examples of what you can achieve with this powerful combination. Feel free to experiment further and explore the possibilities!
247+
By combining Hardhat Ignition with Hardhat scripts, you can perform advanced deployment operations that are not possible within an Ignition module alone. These are just a few examples of what you can achieve with this powerful combination. Feel free to experiment further and explore the possibilities!

0 commit comments

Comments
 (0)