Eg, suppose I want to test the approve() functionality with hardhat. The function assumes the caller is the wallet owner - how can I call the function on behalf of another user?
Hi, welcome to the community!
I think Hardhat integrates ethers.js, so you can have a check in ethers.js documentation:
Token.connect(Alice).approve(to,amount), the type of
Alice should be a
in hardhat testing, you can use connect function in ether.js library.
In Hardhat you can deploy to your local hardhat node. Which also provides you with multiple test accounts (address and private key) to use for function calls that require different senders.