This document is totally personal, so it won't be really useful to you, random user. Sorry.
OpenZeppelin Doc OpenZeppelin Wizard
const ethers = require("ethers");
const { abi } = require("./ABI");
(async () => {
const rpc = await new ethers.providers.JsonRpcProvider(
"https://api.avax.network/ext/bc/C/rpc"
);
const wallet = new ethers.Wallet(
"PRIVATE_KEY",
rpc
);
const contract = new ethers.Contract(
"CONTRACT_ADDRESS",
abi,
wallet
);
contract.on("Transfer", async (from, to, value) => {
if (from === "0x0000000000000000000000000000000000000000") {
console.log('New mint, tokenId: ', value.toNumber());
}
});
})();
ABI looks like that
const ABI = [...];
module.exports = { abi };
Go the snowtrace or etherscan on the contract address, go to #code and scroll down, export ABI -> JSON.
networks: {
mainnet: {
url: "https://api.avax.network/ext/bc/C/rpc",
gasPrice: 225000000000,
chainId: 43114,
accounts: [],
},
},
npx hardhat run --network mainnet scripts/XX.js