import { createClient } from "thirdweb";
import { privateKeyWallet } from "thirdweb/wallets/private-key";
const client = createClient({
secretKey: process.env.SECRET_KEY as string,
});
const contract = client.contract({
address: "0xBCfaB342b73E08858Ce927b1a3e3903Ddd203980",
chainId: 5,
});
const balance = await contract.read({
method: "function balanceOf(address) view returns (uint256)",
params: ["0x0890C23024089675D072E984f28A93bb391a35Ab"],
});
console.log("beginning balance", balance);
const wallet = privateKeyWallet(client);
await wallet.connect({ pkey: process.env.PKEY as string });
const tx = contract.transaction({
method: "function mintTo(address to, uint256 amount)",
params: [
"0x0890C23024089675D072E984f28A93bb391a35Ab",
BigInt(100) * BigInt(10) ** BigInt(18),
],
});
const receipt = await wallet.sendTransaction(tx);
console.log("tx hash", receipt.transactionHash);
const txReceipt = await receipt.wait();
console.log(txReceipt);
const newBalance = await contract.read({
method: "function balanceOf(address) view returns (uint256)",
params: ["0x0890C23024089675D072E984f28A93bb391a35Ab"],
});
console.log("ending balance", newBalance);