I need some help with calling the retrieve function of a contract without making the user change the chain. scenario: the user is on chain with id= 111 , I want to call the retrieve function of a contract on the chain with id=123 , how do I do that? (without making the user's metamask switch to the other chain)
here is how it usually works(call a function of a contract on the same chain):
const providerx = new ethers.providers.Web3Provider(window.ethereum);
let signer = providerx.getSigner();
var contractx = new ethers.Contract(contract_address, abi, signer);
let val = await contractx.retrieve(defaultAccount);
and here is what I want :
var contractx = new ethers.Contract(contract_address, abi, chain_id);
let val = await contractx.retrieve(defaultAccount);