utils#POKT_NETWORK_URLS TypeScript Examples

The following examples show how to use utils#POKT_NETWORK_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: PoktService.ts    From dxvote with GNU Affero General Public License v3.0 6 votes vote down vote up
async isAuthenticated() {
    const poktAPIKey = this.context.configStore.getLocalConfig().pokt;

    if (poktAPIKey && poktAPIKey.length > 0) {
      try {
        const auth = await axios({
          method: 'POST',
          url: POKT_NETWORK_URLS[1],
          data: {
            jsonrpc: '2.0',
            method: 'eth_blockNumber',
            params: [],
            id: 1,
          },
        });
        this.auth = auth.status === 200;
      } catch (e) {
        this.auth = false;
      }
    } else {
      this.auth = false;
    }
  }
Example #2
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>);
  }