/ ui / src / utils / rpc.ts
rpc.ts
 1  export const fetchChainInfo = async (netconfigURL: string) => {
 2    try {
 3      const response = await fetch(netconfigURL, {
 4        headers: { accept: 'application/json' },
 5      });
 6      const { rpcAddrs, chainName } = await response.json();
 7  
 8      return {
 9        rpc: rpcAddrs[Math.floor(Math.random() * rpcAddrs.length)],
10        chainName,
11      };
12    } catch (e) {
13      // @todo: placeholder due to CORS issue on local
14      return {
15        chainName: 'agoriclocal',
16        rpc: 'http://localhost:26657',
17      };
18    }
19  };