0

I have looked at other threads which are about the same error, but none of them seemed to be helpful in my case.

I have a react app, it is a fork of this code: https://github.com/stellar/laboratory.

The change I am trying to make is I am adding another library from which I will be eventually calling some functions.

The errors are originating from the reducers file I added, below is the portion I added into it. The errors are related to the bcoin library and the create_wallet function.

var id, passphrase, witness, watchOnly, accountKey;
 witness = false;
 watchOnly = false;
 var {WalletClient} = require('../../bcoin/bclient.js');
 var {Network} = require('../../bcoin/bcoin.js');
 var network = Network.get('regtest');

 var walletOptions = {
     network: network.type,
     port: network.walletPort,
     apiKey: 'api-key'
   }
 var walletClient = new WalletClient(walletOptions);
 var options;

function operations(state = defaultOperations, action) {
  let targetOpIndex, newOps;
  switch (action.type) {
  case LOAD_STATE:
    if (action.slug === SLUG.UTXOTX) {
      return defaultOperations;
    }
    break;
  case 'ADD_OPERATION':
    return Array.prototype.concat(state, {
      id: action.opId,
      name: '',
      attributes: {},
    });
  case 'CREATE_WALLET':
     options = {
         passphrase: action.newAttributes.passphrase,
         witness: witness,
         watchOnly: watchOnly,
         accountKey: action.newAttributes.accountKey
     };
     id = action.newAttributes.walletId;
      (async() => {
          const result = await walletClient.createWallet(id, options);
          console.log(result);
        })();

When I try to run the app, there are no errors on the terminal, however nothing shows up on the UI. And in the developer console, an error shows up which says, "RegeneratorRuntine is not defined". And I am not using webpack or babel, even though they are added in the package.json file.

If more information is required, feel free to ask.

Synesso
  • 37,610
  • 35
  • 136
  • 207
Deb
  • 349
  • 1
  • 3
  • 11
  • Check if is a duplicate of this: https://stackoverflow.com/questions/33527653/babel-6-regeneratorruntime-is-not-defined Otherwise, the babel configuration is need. This is not a problem with your code itself. – Markus Mar 09 '19 at 00:42
  • I did check that, but didn't think it was relevant, as I did not have any .babelrc file. But it might as well be, and I don't know. However, there are multiple answers, which one do you think I should follow. – Deb Mar 09 '19 at 10:20
  • Not having a `.babelrc` file is probably your problem. Try the accepted one. – Markus Mar 09 '19 at 13:31
  • The app that I am modifying uses redux-thunk, is that an alternative to using babel. I just read an article that says, react does not support async/await, redux-thunk is one way to get around this. – Deb Mar 09 '19 at 18:23
  • If you use async/ await, you need to use Babel. Doesn't matter if you use redux think or react. – Markus Mar 10 '19 at 19:07

0 Answers0