secret.js icon indicating copy to clipboard operation
secret.js copied to clipboard

Cannot convert a BigInt value to a number

Open Zss96 opened this issue 2 years ago • 12 comments

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

Zss96 avatar May 26 '22 02:05 Zss96

Hi, how are you compiling/bundling your app?

assafmo avatar May 29 '22 09:05 assafmo

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

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

Zss96 avatar May 31 '22 06:05 Zss96

Can you please try [email protected]?

assafmo avatar Jun 06 '22 07:06 assafmo

encounter the same issue with [email protected] here is a repo for reproduction https://github.com/calvinkei/expo-secretjs

calvinkei avatar Oct 08 '22 08:10 calvinkei

@assafmo I'm also facing the same issue right now with Reactjs. Currently using [email protected]

itsHaseebSaeed avatar Oct 20 '22 13:10 itsHaseebSaeed

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"
    ]
  }

itsHaseebSaeed avatar Oct 21 '22 01:10 itsHaseebSaeed

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

amityadav0 avatar Nov 01 '22 06:11 amityadav0

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

Try Updating to [email protected] or the latest one.

itsHaseebSaeed avatar Nov 01 '22 06:11 itsHaseebSaeed

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

amityadav0 avatar Nov 01 '22 08:11 amityadav0

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.

itsHaseebSaeed avatar Nov 01 '22 10:11 itsHaseebSaeed

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.

amityadav0 avatar Nov 02 '22 11:11 amityadav0

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

assafmo avatar Dec 18 '22 11:12 assafmo