ethereum-attestation-service / eas-sdk

Ethereum Attestation Service - TypeScript/JavaScript SDK
MIT License
95 stars 47 forks source link

Error: getOffchain tips 'this.contract.getAddress is not a function' #55

Closed crazyyuan closed 1 year ago

crazyyuan commented 1 year ago

After I created EAS instance. Test getAttestation feature is normal. But when I try to getOffchain, some error comes. I printed the EAS instance, the contract has no getAddress function.

version "@ethereum-attestation-service/eas-sdk":"^1.1.0-beta.3"

image image

slavik0329 commented 1 year ago

@crazyyuan Can you please share the chain you're using and also if possible can you share your code repo so we can investigate?

lbeder commented 1 year ago

this.contract.getAddress is usually a result of using ethers v5. I'll move ethers v6 as a production dependency to reduce the cases when it happens

lbeder commented 1 year ago

Oh, it's already a production dependency, so something else might have been overriding it

crazyyuan commented 1 year ago

@crazyyuan Can you please share the chain you're using and also if possible can you share your code repo so we can investigate?

network: optimism-goerli

https://github.com/lxdao-official/fairsharing-frontend/blob/develop/src/app/project/%5Bid%5D/contribution/page.tsx line: 35

image click 'Test Prepare contribution' button will reproduce it.

crazyyuan commented 1 year ago

this.contract.getAddress is usually a result of using ethers v5. I'll move ethers v6 as a production dependency to reduce the cases when it happens

so which ethers version should I set to solve it?

lbeder commented 1 year ago

If you want to use SDK >1.0.0 then you have to use ethers v6

crazyyuan commented 1 year ago

If you want to use SDK >1.0.0 then you have to use ethers v6

thanks! I solved it with your suggestion.