Consensys / eth-lightwallet

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

Meteor 1.3 Integration #87

Closed retotrinkler closed 8 years ago

retotrinkler commented 8 years ago

hi i'm trying to use https://github.com/ConsenSys/eth-lightwallet w Meteor 1.3. Meteor install commands:

meteor create ethereum-app
cd ethereum-app
meteor npm install
meteor npm install --save eth-lightwallet

but when using eth-lightwallet from w/in meteor. Just copy the following line into main.js (for example):

import lightwallet from 'eth-lightwallet';

and starting the meteor app with:

meteor

i get:

Unable to resolve some modules:

  "build/Release/sha3" in
/home/reto/Development/ethereum-app/node_modules/eth-lightwallet/node_modules/ethereumjs-util/node_modules/keccakjs/node_modules/sha3/package.json
(web.browser)

does somebody have a idea on how to solve this?

pjworrall commented 8 years ago

I spent some time on this and hit the same problem. I also tried putting the .js libraries, async.min.js, hooked-web3-provider.min.js, lightwallet.min.js and web3.min.js into a lib so they loaded conventionally but that caused meteor to hang. I tried it with 1.2 and the meteor hung there in the same way (obviously 1.2 does not support imports). I am going to refer the hanging to the Meteor team.

I am now just exploring it in a conventional js webapp without Meteor.

retotrinkler commented 8 years ago

tried the conventional import as well, but same result - meteor hangs.. ok thanks. i'll have to stick w meteor.. i'm in too deep atm to reverse

coder5876 commented 8 years ago

Hi @retrotrinkler and @pjworrall, I have not worked with meteor but I know others had problems using lightwallet in meteor as well. Let me know if you are able to get it working and I'll be happy to merge a PR.

retotrinkler commented 8 years ago

Hey @christianlundkvist. Thanks for your response. If I find the solution, I will let you know

pjworrall commented 8 years ago

thanks @christianlundkvist . I have put Meteor to one side and am just working with a simple Javascript environment until I understand how things should work. Like @retrotrinkler I'll need to go back to Meteor afterwards and will share if I find a solution for it.

IstoraMandiri commented 8 years ago

Seems like this issue isn't specific to eth-lightwallet; it's originating from the ethereumjs-util -> keccakjs dependency.

If you really want to get it working with Meteor, a temporary fix that worked for me was to clone and rewire the dependancy tree, then hardcode:

kekkackjs/index.js

module.exports = require('browserify-sha3').SHA3Hash
retotrinkler commented 8 years ago

that works! very impressive. thanks very much chris

pjworrall commented 8 years ago

@hitchcott hi. How did you isolate the problem Meteor had when it hung. Is there a logging mode for Meteor's startup? Was it the Meteor console or some node trickery you used?

IstoraMandiri commented 8 years ago

@pjworrall No special tricks; I just saw that keccak was the dependancy that was causing the problem (see initial post):

/home/reto/Development/ethereum-app/node_modules/eth-lightwallet/node_modules/ethereumjs-util/node_modules/keccakjs/node_modules/sha3/package.json

Then I just tried poking around with that package locally until it worked.

IstoraMandiri commented 8 years ago

Btw, if you want to use it right now you can update your package.json:

    "eth-lightwallet": "git@github.com:hitchcott/eth-lightwallet.git#eee0141d9a140e269601f116ee565ede60fb248a"
pjworrall commented 8 years ago

ah! . My Meteor had just hung and never reported anything. I had to kill the processes. I hadn't read @retrotinkler log properly. I am all go now. So thanks.