aptos-core
aptos-core copied to clipboard
[Bug] Can't find variable: BigInt
🐛 Bug
Error: Requiring module "src/libs/aptos/index.js", which threw an exception: ReferenceError: Can't find variable: BigInt
To reproduce
"react-native": "0.63.3"
"aptos": "^1.3.16",
Poform: Android
import {AptosAccount} from 'aptos/src/aptos_account';
Code snippet to reproduce
# import {AptosAccount} from 'aptos/src/aptos_account';
if (mnemonic) {
try {
wallet = AptosAccount.fromDerivePath("m/44'/637'/2'/0'/0'", mnemonic);
} catch (e) {
console.log(e);
}
} else {
const privateKeyObject = {privateKeyHex: privateKey};
wallet = AptosAccount.fromAptosAccountObject(privateKeyObject);
}
Stack trace/error message
ReferenceError: Can't find variable: BigInt
http://1:8081/index.bundle?platform=android&dev=true&minify=false:905780:26
loadModuleImplementation@http://:8081/index.bundle?platform=android&dev=true&minify=false:271:14
http://:8081/index.bundle?platform=android&dev=true&minify=false:905415:30
loadModuleImpleme
Expected Behavior
Is there a version that does not use bigInt, or is there a solution? At present, our RN version does not support it
??
If the browser version is low, this problem will also occur, you can refer to my previous solution to add polyfill. Add https://github.com/peterolson/BigInteger.js/blob/master/BigInteger.min.js to your html script. Then add
window.BigInt = window.BigInt && window.BigInt(1) ? window.BigInt : bigInt
Maybe it can help you
Instead of using the browser, we use the react-active
What version of RN are you using? Have you tried 0.70?
were you able to create new AptosAccount()? using the SDK? or is it happening only importing existing wallet keys?
closing out what looks like a stale issue