(Found this from the public Alchemy discord, and wanted to ask the question here so it can get indexed online 💙)
I'm trying to instantiate contracts in my javascript code so that I can call ABI methods.
However, when I try to use the alchemy-sdk
object to create a new Contract
, I get an error.
This is how I'm setting it up:
const CompoundorContract = new ethers.Contract(
CONSTANTS.ADDRESSES.COMPOUNDER_CONTRACT_ADDRESS,
CONSTANTS.CONTRACTS.COMPOUNDOR_ABI,
alchemy.core
);
and this is the error I get:
Error: invalid signer or provider (argument="signerOrProvider", value={"config":{"apiKey":"my_key","network":"opt-mainnet","maxRetries":5}},code=INVALID_ARGUMENT,version=contracts/5.6.2
Does anyone know how to fix this?