@YosephKS : Thank you !!
yes, i was still developing under Web3js but now i want to migrate my scripts to ethersjs. I know I have to update my webpages scripts but iām stuck on only 1 point. If i use the alias of the new Moralis SDK (>= 1.0.7):
<script src="https://unpkg.com/moralis@latest/dist/moralis.js"></script>
i could not figure out how to change the code in my index main.js (itās for Clone-Rarible-24H) :
window.web3 = await Moralis.enableWeb3();
window.tokenContract = new web3.eth.Contract(tokenContractAbi, TOKEN_CONTRACT_ADDRESS);
window.marketplaceContract = new web3.eth.Contract(marketplaceContractAbi, MARKETPLACE_CONTRACT_ADDRESS);
i have tried tons of syntax combinations regarding some tricks found on this forum + reading the ethersjsā pages, as adviced by Erno : https://docs.ethers.io/v5/api/contract/example/
For the old web3js syntax:
new web3.eth.Contract(tokenContractAbi, TOKEN_CONTRACT_ADDRESS);
ā¦ the new syntax for ethers is:
new ethers.Contract(TOKEN_CONTRACT_ADDRESS, tokenContractAbi, providerOrSigner)
But i always finish with an error in browser console such as:
Uncaught (in promise) TypeError: ethers.Contract is not a constructor
If you could tell me how to translate the 3 first lines above, you will earn a lot of Karma points