You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Returns the actual root router. The root router can change and be in any chain, so getSignerOrProvider is a function that returns the appropriate provider or signer depending on the current chainId of the root router. See example below.
import{getActualRootRouter,DEFAULT_RPC_URLS}from'@mvts/resolver-js';import{JsonRpcProvider}from'@ethersproject/providers';functiongetSignerOrProvider(chainId){constrpcUrl=DEFAULT_RPC_URLS[chainId];if(!rpcUrl){thrownewError(`Missing provider for chain ${chainId}.`);}returnnewJsonRpcProvider(rpcUrl);}getActualRootRouter(getSignerOrProvider).then((rootRouter)=>console.log(`Address of the actual root router: ${rootRouter.address}`)).catch((error)=>console.log(`Failed to get the actual root router: ${error.message}`));