PaulRBerg / hardhat-template

Hardhat-based template for developing Solidity smart contracts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

add example ts script

mshakeg opened this issue · comments

Custom scripts can be created in a hardhat project and executed using either node(or ts-node in a ts project) or hardhat.

Add a simple accounts.ts script located in ./scripts and add the following to the package.json scripts:

    "accounts:ts-node": "TS_NODE_FILES=true ts-node scripts/accounts.ts",
    "accounts:hh": "hardhat run scripts/accounts.ts",

This template already has a task that lists the accounts. I don't see the benefit in adding a script that offers the same feature.

I'd prefer this template to remain minimalistic (it is already more complex than I'd want it to be).

Thanks for taking the time to share your suggestion, though!

Fair enough, thought it might be helpful as I'm not sure you can have a persistent server running in a hardhat task. Also you're likely to use scripts if you want to have the option of a runtime(e.g. run a script in bun instead of node for the performance, though it would be great if hardhat itself transitioned to bun)