React-native, iOS, RELEASE
Hi, I got a crash on iOS platform only use release scheme.
function generatorBIP44() {
const mnemonic = bip39.generateMnemonic();
assert(bip39.validateMnemonic(mnemonic));
const seed = bip39.mnemonicToSeed(mnemonic);
const bitcoinNetwork = bitcoin.networks.bitcoin;
const master = bitcoin.HDNode.fromSeedBuffer(seed, bitcoinNetwork);
const derivePath = `m/44'/0'/0'/0/0`;
const node = master.derivePath(derivePath);
const keyPair = node.keyPair;
const privateKey = keyPair.toWIF();
const publicKeyBuffer = keyPair.getPublicKeyBuffer();
const publicKey = publicKeyBuffer.toString('hex');
const address = keyPair.getAddress();
return {
mnemonic,
address,
privateKey,
publicKey,
};
}
I found crash here
const master = bitcoin.HDNode.fromSeedBuffer(seed, bitcoinNetwork);
typeforce(types.tuple('ECPair', types.Buffer256bit), arguments)
If i remove typeforce check code, it's OK.
It's amazing when i run it OK on debug scheme, but always crash on release scheme.
Someone please help me?
Thx.
Read the README, please.
Add reserve rules to uglifyjs.
Thx, and I fixed this issue.
Modify node_modules/metro-bundler/src/JSTransformer/worker/minify.js
mangle: {
toplevel: true,
reserved: [
'Buffer',
'BigInteger',
'Point',
'ECPubKey',
'ECKey',
'sha512_asm',
'asm',
'ECPair',
'HDNode'
]
},
@dabura667 hopefully this is less of an issue in 4.0.0.
where the "README" talk about "uglifyjs"?
@JamesZhange Currently released version is 3.3.2
https://github.com/bitcoinjs/bitcoinjs-lib/blob/v3.3.2/README.md
NOTE: If you uglify the javascript, you must exclude the following variable names from being mangled: BigInteger, ECPair, Point. This is because of the function-name-duck-typing used in typeforce.
Example:
uglifyjs ... --mangle reserved=['BigInteger','ECPair','Point']NOTE: This library tracks Node LTS features, if you need strict ES5, use --transform babelify in conjunction with your browserify step (using an es2015 preset).
Most helpful comment
Thx, and I fixed this issue.
Modify node_modules/metro-bundler/src/JSTransformer/worker/minify.js