I’m attempting to call a contract on Next.js (14.2.0) using ethers.js (v6) and @openzeppelin/defender-sdk (1.13.4), following the instructions from the URL below.
However, I’m encountering two issues:
const erc20 = new ethers.Contract(ERC20_ADDRESS, ERC20_ABI, signer);
I get an error saying: Argument of type 'Promise<DefenderRelaySigner | DefenderRelaySignerV5>' is not assignable to parameter of type 'ContractRunner'.
When I try to compile, I receive an error: Module not found: Can't resolve '@aws-sdk/client-lambda'.
Hi! For backwards compatibility between ethers v5 and ethers v6 we "promisified" the getSigner API, now if you want to use the Relayer as signer, you need to instantiate it as follows (default ethers version is v5 but you can optionally add the v6 flag):
About the second issue: @aws-sdk/client-lambda is a peer dependency we use for Actions package, installing that dependency should fix the issue. But in case you just need relayer signer SDK APIs, you could just install @openzeppelin/defender-sdk-relay-signer-client instead of the whole SDK