Lets say I have a 00-mocks.ts
file inside a deploy folder(hardhat project) and the code looks ok:
const { ethers, newtwork } = require('hardhat')
module.exports = async function () {
try {
const accounts = await ethers.getSigners()
console.log(accounts);
const token = await ethers.getContractFactory("Token")
const instance = await token.deploy("testTokenName","testSymbol")
await instance.deployed()
} catch (error) {
console.log(error);
}
}
module.exports.tags = ["all", "Token"]
But the problem is when i run my node using yarn hardhat node
my token doesn't deploy, and i can't see my logs, but node runs and it gives me signers with first balance of ETH.
I've used exact same code in JS
and it works, but i don't know whats the problem with typeScript
.
Even i tried to use it as a script using this command: yarn hardhat run scripts/"filename".ts --network localhost
But still doesn't work.
npx hardhat run scripts/"filename".ts --network localhost
instead