diff --git a/examples/nft/tasks/connectedSetCounterparty.ts b/examples/nft/tasks/connectedSetCounterparty.ts index 4bf28e91..92281b4d 100644 --- a/examples/nft/tasks/connectedSetCounterparty.ts +++ b/examples/nft/tasks/connectedSetCounterparty.ts @@ -1,5 +1,6 @@ import { task } from "hardhat/config"; import { HardhatRuntimeEnvironment } from "hardhat/types"; +import { Connected } from "@/typechain-types"; const main = async (args: any, hre: HardhatRuntimeEnvironment) => { const [signer] = await hre.ethers.getSigners(); @@ -9,7 +10,10 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { ); } - const contract = await hre.ethers.getContractAt(args.name, args.contract); + const contract: Connected = await hre.ethers.getContractAt( + "Connected", + args.contract + ); const tx = await contract.setCounterparty(args.counterparty); const receipt = await tx.wait(); @@ -33,5 +37,4 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { task("connected-set-counterparty", "Sets the universal contract address", main) .addParam("contract", "The address of the deployed contract") .addParam("counterparty", "The address of the universal contract to set") - .addOptionalParam("name", "The contract name to interact with", "Connected") .addFlag("json", "Output the result in JSON format"); diff --git a/examples/nft/tasks/deploy.ts b/examples/nft/tasks/deploy.ts index 72cbc67b..4a33dff5 100644 --- a/examples/nft/tasks/deploy.ts +++ b/examples/nft/tasks/deploy.ts @@ -11,7 +11,7 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { ); } - const factory = await hre.ethers.getContractFactory(args.name); + const factory: any = await hre.ethers.getContractFactory(args.name); const contract = await factory.deploy( args.gateway, signer.address, diff --git a/examples/nft/tasks/mint.ts b/examples/nft/tasks/mint.ts index 30458166..7806e3d4 100644 --- a/examples/nft/tasks/mint.ts +++ b/examples/nft/tasks/mint.ts @@ -9,7 +9,10 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { ); } - const contract = await hre.ethers.getContractAt(args.name, args.contract); + const contract = await hre.ethers.getContractAt( + args.name as "Universal" | "Connected", + args.contract + ); const recipient = args.to || signer.address; @@ -17,7 +20,7 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { const receipt = await tx.wait(); const transferEvent = receipt.events?.find( - (event) => event.event === "Transfer" + (event: any) => event.event === "Transfer" ); const tokenId = transferEvent?.args?.tokenId; diff --git a/examples/nft/tasks/universalSetCounterparty.ts b/examples/nft/tasks/universalSetCounterparty.ts index 6a3ff107..9fd2e13e 100644 --- a/examples/nft/tasks/universalSetCounterparty.ts +++ b/examples/nft/tasks/universalSetCounterparty.ts @@ -1,5 +1,6 @@ import { task } from "hardhat/config"; import { HardhatRuntimeEnvironment } from "hardhat/types"; +import { Universal } from "@/typechain-types"; const main = async (args: any, hre: HardhatRuntimeEnvironment) => { const [signer] = await hre.ethers.getSigners(); @@ -9,10 +10,12 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { ); } - const contract = await hre.ethers.getContractAt(args.name, args.contract); + const contract: Universal = await hre.ethers.getContractAt( + "Universal", + args.contract + ); const tx = await contract.setCounterparty(args.zrc20, args.counterparty); - const receipt = await tx.wait(); if (args.json) { console.log( @@ -36,5 +39,4 @@ task("universal-set-counterparty", "Sets the connected contract address", main) .addParam("contract", "The address of the deployed contract") .addParam("zrc20", "The ZRC20 address to link to the connected contract") .addParam("counterparty", "The address of the connected contract to set") - .addOptionalParam("name", "The contract name to interact with", "Universal") .addFlag("json", "Output the result in JSON format"); diff --git a/examples/nft/tsconfig.json b/examples/nft/tsconfig.json index fb0567b3..705790bf 100644 --- a/examples/nft/tsconfig.json +++ b/examples/nft/tsconfig.json @@ -1,5 +1,9 @@ { "compilerOptions": { + "baseUrl": ".", + "paths": { + "@/*": ["./*"] + }, "module": "nodenext", "moduleResolution": "nodenext", "esModuleInterop": true,