How to use the react-native-dotenv.EXCHANGE_URL.replace function in react-native-dotenv

To help you get started, we’ve selected a few react-native-dotenv examples, based on popular ways it is used in public projects.

github pillarwallet / pillarwallet / src / services / exchange.js View on Github external
connect(accessToken: string, shapeshiftAccessToken?: string) {
    this.stop();
    this.tokens = {
      accessToken,
      shapeshiftAccessToken,
    };
    try {
      this.apiConfig = buildAPIConfig(accessToken);
      if (!!shapeshiftAccessToken
        && shapeshiftAccessToken !== '') {
        this.apiConfig.headers = {
          ...this.apiConfig.headers,
          token: shapeshiftAccessToken,
        };
      }
      const wsUrl = EXCHANGE_URL
        .replace(/(https:\/\/)/gi, 'wss://')
        .replace(/(http:\/\/)/gi, 'ws://');
      this.io = new SocketIO(`${wsUrl}:443`, {
        transports: ['websocket'],
        query: {
          token: accessToken,
        },
      });

      this.io.on('disconnect', () => {
        this.setConnected(false);
      });
      this.io.on('error', () => {
        this.setConnected(false);
      });
      this.io.on('connect', () => {

react-native-dotenv

Load environment variables using import statements.

MIT
Latest version published 10 months ago

Package Health Score

81 / 100
Full package analysis

Similar packages