utils#DEFAULT_RPC_URLS TypeScript Examples

The following examples show how to use utils#DEFAULT_RPC_URLS. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AlchemyService.ts    From dxvote with GNU Affero General Public License v3.0 6 votes vote down vote up
getRpcUrls() {
    const alchemyAPIKey = this.context.configStore.getLocalConfig().alchemy;
    if (!alchemyAPIKey) return null;

    return ETH_NETWORKS_IDS.reduce((prevUrls, chainId) => {
      const networkUrl = ALCHEMY_NETWORK_URLS[chainId];

      let alchemyUrl: string = null;
      if (networkUrl) {
        alchemyUrl = `https://${networkUrl}/v2/${alchemyAPIKey}`;
      } else {
        alchemyUrl = DEFAULT_RPC_URLS[chainId];
      }

      prevUrls[chainId] = alchemyUrl;
      return prevUrls;
    }, {} as Record<number, string>);
  }
Example #2
Source File: InfuraService.ts    From dxvote with GNU Affero General Public License v3.0 6 votes vote down vote up
getRpcUrls() {
    const infuraAPIKey = this.context.configStore.getLocalConfig().infura;
    if (!infuraAPIKey) return null;

    return ETH_NETWORKS_IDS.reduce((prevUrls, chainId) => {
      const infuraNetworkName = INFURA_NETWORK_NAMES[chainId];

      let infuraUrl: string = null;
      if (infuraNetworkName) {
        infuraUrl = `https://${infuraNetworkName}.infura.io/v3/${infuraAPIKey}`;
      } else {
        infuraUrl = DEFAULT_RPC_URLS[chainId];
      }

      prevUrls[chainId] = infuraUrl;
      return prevUrls;
    }, {} as Record<number, string>);
  }
Example #3
Source File: PoktService.ts    From dxvote with GNU Affero General Public License v3.0 6 votes vote down vote up
getRpcUrls() {
    const poktAPIKey = this.context.configStore.getLocalConfig().pokt;
    if (!poktAPIKey) return null;

    return ETH_NETWORKS_IDS.reduce((prevUrls, chainId) => {
      const poktNetworkName = POKT_NETWORK_URLS[chainId];

      let poktUrl: string = null;
      if (poktNetworkName) {
        poktUrl = poktNetworkName;
      } else {
        poktUrl = DEFAULT_RPC_URLS[chainId];
      }

      prevUrls[chainId] = poktUrl;
      return prevUrls;
    }, {} as Record<number, string>);
  }