I'm trying to implement the pancakeswap router functions. I've forked the mainnet with hardhat and then tried to receive the addresses with typescript. I'm using the typescript for the first time and so, It feels difficult to understand. Well, after generating the typechain of the contract...

import type { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address";
import { artifacts, ethers, waffle } from "hardhat";
import type { Artifact } from "hardhat/types";
import { expect } from "chai";
import hre from 'hardhat';

import type { PancakeSwapping } from "../../typechain/contracts/Pancakeswap.sol/PancakeSwapping";
import { Signers } from "../types";

let Pancakeswap;
let pancakeswap;

beforeEach(async function(){
  Pancakeswap = await ethers.getContractFactory("PancakeSwapping");
  pancakeswap = Pancakeswap.deploy();
  console.log(`pancakeswap address>>>>${(await pancakeswap).address}`);

describe("Unit testing pancakeswap functions", (address: any)=>{ //getting error here


Actually, I've had no idea of how to use the addresses after forking mainnet, and so I took a guide from here After seeing it, I'm trying to receive the given addresses like below...

describe("Unit testing pancakeswap functions", (address: any)=>{ //getting error here

and the error says...

Argument of type '(address: any) => void' is not assignable to parameter of type '(this: Suite) => void'.ts(2345)

your help will literally help me to learn the mechanism of interacting with smartcontracts using typescript.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.