I am trying to create an app that has two contracts and one contract needs to get the approval from the user to spend ERC20 tokens to another contract. While trying to create a hardhat unit test for it, I got stuck at below step.
await token.connect(contractA).approve(contractB, spendAmount);
The token is the ERC20 token here and the contractA and contractB are the contract instances created along the way of test.
The contractA needs to approve contractB to spend the token. While I understand that contractA is not the type of Signer, I need to figure out how to get the signer for/from it. Also the error I get obviously is as this.
Error: invalid signer or provider (argument="signerOrProvider",...