scrtlabs/secret.js

Cannot convert a BigInt value to a number

Opened this issue · 12 comments

Zss96 commented

Our react native app is using secretjs,but
import { SecretNetworkClient } from "secretjs"has a error ,"Cannot convert a BigInt value to a number"
We have version ^1.3.0-beta.1 installed,Node version is v16.15.0, react-native is 0.68

Hi, how are you compiling/bundling your app?

Zss96 commented

嗨,您如何编译/捆绑您的应用程序?

This is caused by the conversion from ES6 to Es5, because * * becomes math.pow(), but math.pow() does not support bigint type

Can you please try secretjs@1.3.0-beta.4?

encounter the same issue with secretjs@1.4.3
here is a repo for reproduction https://github.com/calvinkei/expo-secretjs

@assafmo I'm also facing the same issue right now with Reactjs. Currently using secretjs@1.4.4

Update:
Solved by adding this section in package.json:

"browserslist": {
    "production": [
      "chrome >= 67",
      "edge >= 79",
      "firefox >= 68",
      "opera >= 54",
      "safari >= 14"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }

I'm facing the same issue with Reactjs. Adding browserslist didn't work.
Is there any other solution ?

I'm facing the same issue with Reactjs. Adding browserslist didn't work. Is there any other solution?

Try Updating to secretjs@1.4.5 or the latest one.

Not working, can you please point me to any working example with react ?
https://github.com/scrtlabs/SecretJS-Templates/tree/master/6_wallets/reactjs_keplr this doesn't work

Not working, can you please point me to any working example with react ? https://github.com/scrtlabs/SecretJS-Templates/tree/master/6_wallets/reactjs_keplr this doesn't work

It's giving an error because the template's version is secret@^1.3.0-beta.7 More here.

Here's the complete documentation of secretjs. It's updated and works well.

And here's a working example. I'm using secretjs and reactjs.

I used the above example with latest secretjs, It seems this doesn't work with typescript. I used same config as here.
Only difference is typescript and javascript. Will check more.
Thanks for the help.

v1.5 now supports react-native, please check this out https://github.com/scrtlabs/react-native-secretjs