From fb8e5a8a27459d7851464c0745ec55e16620b061 Mon Sep 17 00:00:00 2001 From: Denis Fadeev Date: Fri, 8 Nov 2024 12:12:20 +0300 Subject: [PATCH] types --- examples/token/tasks/connectedSetCounterparty.ts | 10 +++++----- examples/token/tasks/mint.ts | 8 +++++--- examples/token/tasks/universalSetCounterparty.ts | 8 +++++--- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/examples/token/tasks/connectedSetCounterparty.ts b/examples/token/tasks/connectedSetCounterparty.ts index d9bec15b..3535d52e 100644 --- a/examples/token/tasks/connectedSetCounterparty.ts +++ b/examples/token/tasks/connectedSetCounterparty.ts @@ -1,6 +1,6 @@ import { task } from "hardhat/config"; import { HardhatRuntimeEnvironment } from "hardhat/types"; -import { ethers } from "ethers"; +import { Connected } from "../typechain-types"; const main = async (args: any, hre: HardhatRuntimeEnvironment) => { const [signer] = await hre.ethers.getSigners(); @@ -10,10 +10,12 @@ 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(); if (args.json) { console.log( @@ -26,7 +28,6 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { } else { console.log(`🚀 Successfully set the universal contract. 📜 Contract address: ${args.contract} -🔗 Universal contract address: ${args.universalContract} 🔗 Transaction hash: ${tx.hash}`); } }; @@ -34,5 +35,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/token/tasks/mint.ts b/examples/token/tasks/mint.ts index 4a8d8dd0..3276974e 100644 --- a/examples/token/tasks/mint.ts +++ b/examples/token/tasks/mint.ts @@ -1,6 +1,5 @@ import { task } from "hardhat/config"; import { HardhatRuntimeEnvironment } from "hardhat/types"; -import { ethers } from "ethers"; const main = async (args: any, hre: HardhatRuntimeEnvironment) => { const [signer] = await hre.ethers.getSigners(); @@ -10,7 +9,10 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { ); } - const contract = await hre.ethers.getContractAt(args.name, args.contract); + const contract: any = await hre.ethers.getContractAt( + args.name, + args.contract + ); const recipient = args.to || signer.address; @@ -18,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/token/tasks/universalSetCounterparty.ts b/examples/token/tasks/universalSetCounterparty.ts index 6a3ff107..50d3c2ef 100644 --- a/examples/token/tasks/universalSetCounterparty.ts +++ b/examples/token/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");