diff --git a/hardhat.config.ts b/hardhat.config.ts index d21bac1..b4e84dc 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -30,8 +30,8 @@ const config: HardhatUserConfig = { accounts: process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [], }, - matic: { - url: "https://rpc-mumbai.maticvigil.com", + mumbai: { + url: process.env.MUMBAI_URL || "https://rpc-mumbai.maticvigil.com", accounts: process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [], }, diff --git a/package.json b/package.json index 16d06bf..581c1f6 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "test": "hardhat test", "dev": "hardhat run --network localhost scripts/deploy.ts", "deploy-testnet": "hardhat run --network optimism_kovan scripts/deploy.ts", - "deploy-testnet-matic": "hardhat run --network matic scripts/deploy.ts", + "deploy-testnet-mumbai": "hardhat run --network mumbai scripts/deploy.ts", + "mint-testnet-mumbai": "hardhat run --network mumbai scripts/mintNFTs.ts", "npm:publish": "hardhat compile && npx tsc && npm publish" }, "files": [ diff --git a/scripts/mintNFTs.ts b/scripts/mintNFTs.ts new file mode 100644 index 0000000..9c18bf9 --- /dev/null +++ b/scripts/mintNFTs.ts @@ -0,0 +1,28 @@ +import { ethers } from "hardhat"; +import { DelegableToken__factory } from "../typechain"; + +async function main() { + const [owner] = await ethers.getSigners(); + + console.log("Minting with the account:", owner.address); + + console.log("Account balance:", (await owner.getBalance()).toString()); + + const token = DelegableToken__factory.connect( + "0x77515eA6bdf3d9244E8d47e7259e627709C74a42", + owner + ); + + const tx = await token.mint({ value: 10 }); + + const receipt = await tx.wait(); + + console.log({ hash: tx.hash, receipt: receipt.transactionHash }); +} + +// We recommend this pattern to be able to use async/await everywhere +// and properly handle errors. +main().catch((error) => { + console.error(error); + process.exitCode = 1; +});