Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added mint script #24

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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] : [],
},
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
28 changes: 28 additions & 0 deletions scripts/mintNFTs.ts
Original file line number Diff line number Diff line change
@@ -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;
});