Skip to content

Commit 22f4e5f

Browse files
committed
Add "Using scripts" section
1 parent c9dbf30 commit 22f4e5f

1 file changed

Lines changed: 27 additions & 2 deletions

File tree

src/content/hardhat3-alpha/learn-more/getting-started.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,33 @@ You can write any TypeScript code you want in your tests, as they are normal Typ
356356

357357
## Using scripts
358358

359-
- What scripts are
360-
- Example script
359+
A script in Hardhat is just a TypeScript or JavaScript file with access to your contracts, configuration, and any other functionality that Hardhat provides. You can use them to run custom logic or to automate workflows.
360+
361+
By convention, scripts are located in the `scripts/` directory. You can name them however you like and use either `.ts` or `.js` extensions.
362+
363+
The sample project includes two example scripts. One of them, `scripts/send-op-tx.ts`, shows how you can simulate a local Optimism-like network and send a transaction on it.
364+
365+
To run a script, you can use the `run` task:
366+
367+
::::tabsgroup{options=npm,pnpm}
368+
369+
:::tab{value=npm}
370+
371+
```bash
372+
npx hardhat run scripts/send-op-tx.ts
373+
```
374+
375+
:::
376+
377+
:::tab{value=pnpm}
378+
379+
```bash
380+
pnpm hardhat run scripts/send-op-tx.ts
381+
```
382+
383+
:::
384+
385+
::::
361386

362387
## Deploying contracts
363388

0 commit comments

Comments
 (0)