Skip to content

Issue when running a built version #992

@speedtreammanga

Description

@speedtreammanga

Hey there,
I've been working on a small project using your library and everything is working top notch.

Today I tried to host the build version of my app but ran into an issue :(
I'd like to know if you know why this happens...

My project was created using the create-react-app npm package
and built using the build command available in a create-react-app project

After building the project everything js related is found in the
/service-worker.js and /static/js/main.645d2b1c.js files.

This is my code (keep in mind that I'm trying to create a bitcoin wallet):

const randomBytes = crypto.randomBytes(16);
const mnemonic = bip39.entropyToMnemonic(randomBytes.toString('hex'));

const seed = bip39.mnemonicToSeed(mnemonic);
const bitcoinNetwork = bitcoin.networks.bitcoin;
const hdMaster = bitcoin.HDNode.fromSeedBuffer(seed, bitcoinNetwork);

const key = hdMaster.derivePath("m/0");
const address = key.keyPair.getAddress();
const secret = key.keyPair.toWIF();

This is the error I get: "Expected property "0" of type ECPair, got r"
on this line: const hdMaster = bitcoin.HDNode.fromSeedBuffer(seed, bitcoinNetwork);

When everything gets compiled and minified the seed constant gets renamed to r

So I'm wondering if you would know why a built version would throw such error?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions