Does this library support React Native?
I'm trying to create Dash Wallet App with React Native but I'm getting following error
Error: Unable to resolve module fs from /Users/kryptomind/Desktop/Development/RN-Projects/DashWalletMobileApps-KM/node_modules/bls-signatures/blsjs.js: fs could not be found within the project or in these directories: node_modules
The only thing seems to causing error is "fs" module which is not supported in react-native.
Expected Behavior
It's not working correctly while generating mnemonic.
Current Behavior
Getting following error Error: Unable to resolve module fs from /Users/kryptomind/Desktop/Development/RN-Projects/DashWalletMobileApps-KM/node_modules/bls-signatures/blsjs.js: fs could not be found within the project or in these directories: node_modules
Possible Solution
Steps to Reproduce (for bugs)
- Create a react-native project ( npx react-native init AwesomeTSProject --template react-native-template-typescript )
- Install rn-nodefy in react-native project and hack the Node so you can use node core module ( https://www.npmjs.com/package/rn-nodeify )
- npm install dash
- Generate Mnemonic using following code import Dash from 'dash'; const client = new Dash.Client({ network: 'testnet', wallet: { mnemonic: null, }, }); const mnemonic = client.wallet?.exportWallet();
Context
I'm not able to use dash sdk since It was the main ingredient to create dash wallet and add functionalities like send/receive and get transactions.
Your Environment
- Version used: 3.21.2
- Environment name and version (e.g. Chrome 39, node.js 5.4): Node : v14.18.1, React-Native: 0.66.1
- Operating System and version (desktop, server, or mobile): Android/IOS
This comes from the WASM loader in the emscripten-generated WASM. The loader tries to understand whether the environment is nodejs or the browser, and tries to load WASM file through FS if run on nodejs or through fetch if run in the browser. I'm not familiar with options to load WASM in react-native, but I heard there indeed were some problems with it in react-native, so I don't know what would be the best way to solve this
Noted. Do i have use react-native specific WASM file in order to use this library?