Consensys / eth-lightwallet

Lightweight JS Wallet for Node and the browser
MIT License
1.47k stars 503 forks source link

Why is the keystore not on the required object #162

Closed bj97301 closed 7 years ago

bj97301 commented 7 years ago

When I console log the required object it shows this: {"txutils":{},"encryption":{},"signing":{},"upgrade":{}}

After looking at the index.js file I would expect there to be a keystore object as well:

module.exports = {
  txutils: require('./lib/txutils.js'),
  encryption: require('./lib/encryption.js'),
  signing: require('./lib/signing.js'),
  keystore: require('./lib/keystore.js'),
  upgrade: require('./lib/upgrade.js'),
};
bj97301 commented 7 years ago

Seems as though browserify didnt like something in the file. Will have to figure out what...

bj97301 commented 7 years ago

Looks like the exported KeyStore var is null in keystore.js. Any idea why it would be null?

bj97301 commented 7 years ago

I am using browserify version 14.4.0 on a mac. This is the command I use to generate the browserifyed file: browserify main.js -o build.js -d

This is my package.json file

{
  "name": "name",
  "version": "0.0.1",
  "main": "main.js",
  "dependencies": {
    "eth-lightwallet": "^2.5.6"
  },
  "devDependencies": {}
}

This is my main.js file:

var lightWallet = require('eth-lightwallet');
global.doStuffs = function() {
  return JSON.stringify(lightWallet);
}

This is the return value of the doStuffs function:

{"txutils":{},"encryption":{},"signing":{},"upgrade":{}}

Ive been stuck on this for a couple of days now and could really use some input. Any help is much appreciated.

bj97301 commented 7 years ago

I think I figured it out. The stringify method seems to be ignoring the keystore object but its actually there.