I think Iām getting a better understanding of that. Thanks, Glad.
Would you be able to assist me with the loading of contracts using ethers.js and web3auth?
Iām trying here using signer but Iām still not able to do so.
export const start = async () => {
try {
let ethereum;
ethereum = window.ethereum;
if (!window.ethereum) return;
if (!window.ethereum && window.web3) {
ethereum = window.web3.currentProvider;
loadContracts(ethereum);
}
await requestAccount();
const provider = new ethers.providers.Web3Provider(
window.Web3auth.provider ? window.Web3auth.provider : ethereum,
'any'
);
console.log('provider: ', window.Web3auth.provider);
loadContracts(provider);
verifyNetwork(provider);
} catch (e) {
alert(e);
}
};
const loadContracts = async (provider: any) => {
let signer = provider.getSigner();
console.log('provider: ', provider);
console.log('signer: ', signer);
if (!ITEM_MARKETPLACE_FACET_ADDRESS || !ITEM_FACET_ADDRESS || !ITEM_STORAGE_ADDRESS) {
return console.error('Error loading contracts.');
}
let Contract: any = {};
Contract.marketplace = new ethers.Contract(ITEM_MARKETPLACE_FACET_ADDRESS, itemMarketPlaceFacet, signer);
Contract.item = new ethers.Contract(ITEM_FACET_ADDRESS, itemFacet, signer);
Contract.storage = new ethers.Contract(ITEM_STORAGE_ADDRESS, itemStorage, signer);
window.Provider = provider;
window.Contract = Contract;
};