dop-wallet-v6 1.2.14 → 1.2.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/ASYNCSTORAGE_FIX_SUMMARY.md +79 -0
  2. package/BUILD_SUCCESS_SUMMARY.md +103 -0
  3. package/DOP_WALLET_V6_WALLET_CREATION_GUIDE.md +305 -0
  4. package/REACT_NATIVE_FIXES_COMPLETE.md +162 -0
  5. package/REACT_NATIVE_INTEGRATION_FIXES.md +167 -0
  6. package/REACT_NATIVE_SETUP_QUICK_FIX.md +189 -0
  7. package/REACT_NATIVE_WALLET_HANGING_FIX.md +270 -0
  8. package/README.md +14 -1
  9. package/VERIFICATION_COMPLETE.md +138 -0
  10. package/WALLET_CREATION_MIGRATION_COMPLETE.md +80 -0
  11. package/dist/services/dop/core/react-native-init.d.ts +18 -0
  12. package/dist/services/dop/core/react-native-init.js +30 -24
  13. package/dist/services/dop/core/react-native-init.js.map +1 -1
  14. package/dist/services/dop/crypto/react-native-crypto-provider.d.ts +41 -0
  15. package/dist/services/dop/crypto/react-native-crypto-provider.js +146 -0
  16. package/dist/services/dop/crypto/react-native-crypto-provider.js.map +1 -0
  17. package/dist/services/dop/crypto/react-native-rapidsnark-prover.d.ts +49 -0
  18. package/dist/services/dop/crypto/react-native-rapidsnark-prover.js +202 -0
  19. package/dist/services/dop/crypto/react-native-rapidsnark-prover.js.map +1 -0
  20. package/dist/services/dop/util/runtime.d.ts +1 -0
  21. package/dist/services/dop/util/runtime.js +34 -2
  22. package/dist/services/dop/util/runtime.js.map +1 -1
  23. package/dist/services/dop/wallets/wallets.js +47 -46
  24. package/dist/services/dop/wallets/wallets.js.map +1 -1
  25. package/issuev3.md +50 -35
  26. package/metro.config.react-native.example.js +10 -8
  27. package/node-polyfills/fs-polyfill.js +54 -0
  28. package/node-polyfills/path-polyfill.js +36 -0
  29. package/node-polyfills/process-polyfill.js +61 -0
  30. package/node-polyfills/url-polyfill.js +32 -0
  31. package/node-polyfills/util-polyfill.js +76 -0
  32. package/package.json +14 -3
  33. package/problem.md +41 -0
  34. package/react-native-shims.js +27 -10
  35. package/react-native.js +12 -0
  36. package/WEB_WORKER_TROUBLESHOOTING.md +0 -180
@@ -1,180 +0,0 @@
1
- # Web Worker Troubleshooting Guide for React Native
2
-
3
- ## The Issue
4
-
5
- If you're seeing this error:
6
- ```
7
- ERROR node_modules/web-worker/cjs/node.js: node_modules/web-worker/cjs/node.js:Invalid call at line 201: import(mod)
8
- ```
9
-
10
- This occurs because the `web-worker` package contains Node.js-specific code that uses dynamic imports (`import()`), which are not supported in React Native's Metro bundler.
11
-
12
- ## Root Cause
13
-
14
- The `web-worker` package is a dependency of `circomlibjs` (used by dop-wallet-v6 for cryptographic operations). Even though we provide polyfills, Metro is still trying to parse the original package files, causing the error.
15
-
16
- ## Solution Steps
17
-
18
- ### 1. Update Your Metro Configuration
19
-
20
- Ensure your `metro.config.js` includes the updated configuration with proper blocking:
21
-
22
- ```javascript
23
- const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
24
- const path = require('path');
25
-
26
- const defaultConfig = getDefaultConfig(__dirname);
27
-
28
- const config = {
29
- resolver: {
30
- // Node.js core module aliases - CRITICAL for fixing ffjavascript dependencies
31
- alias: {
32
- // Primary Node.js modules required by ffjavascript
33
- 'os': require.resolve('./node-polyfills/os-polyfill.js'),
34
- 'crypto': require.resolve('crypto-browserify'),
35
- 'stream': require.resolve('stream-browserify'),
36
- 'buffer': require.resolve('buffer'),
37
- 'events': require.resolve('events'),
38
- 'util': require.resolve('util'),
39
- 'assert': require.resolve('assert'),
40
- 'process': require.resolve('process/browser'),
41
-
42
- // Additional modules that might be needed
43
- 'path': require.resolve('path-browserify'),
44
- 'url': require.resolve('url'),
45
- 'querystring': require.resolve('querystring-es3'),
46
- 'http': require.resolve('stream-http'),
47
- 'https': require.resolve('https-browserify'),
48
- 'zlib': require.resolve('browserify-zlib'),
49
-
50
- // Web Worker compatibility - CRITICAL: Block the problematic package
51
- 'web-worker': require.resolve('./node-polyfills/web-worker-polyfill.js'),
52
- 'web-worker/cjs/node.js': require.resolve('./node-polyfills/web-worker-polyfill.js'),
53
- 'web-worker/cjs/node': require.resolve('./node-polyfills/web-worker-polyfill.js'),
54
-
55
- // Disable problematic WASM-related modules for React Native
56
- 'wasmcurves': require.resolve('./node-polyfills/wasm-fallback.js'),
57
- 'wasmbuilder': require.resolve('./node-polyfills/wasm-fallback.js'),
58
- },
59
-
60
- // Extra node modules for Metro resolver
61
- extraNodeModules: {
62
- 'os': require.resolve('./node-polyfills/os-polyfill.js'),
63
- 'crypto': require.resolve('crypto-browserify'),
64
- 'stream': require.resolve('stream-browserify'),
65
- 'buffer': require.resolve('buffer'),
66
- 'events': require.resolve('events'),
67
- 'util': require.resolve('util'),
68
- 'assert': require.resolve('assert'),
69
- 'process': require.resolve('process/browser'),
70
- 'path': require.resolve('path-browserify'),
71
- 'url': require.resolve('url'),
72
- 'querystring': require.resolve('querystring-es3'),
73
- 'http': require.resolve('stream-http'),
74
- 'https': require.resolve('https-browserify'),
75
- 'zlib': require.resolve('browserify-zlib'),
76
- 'web-worker': require.resolve('./node-polyfills/web-worker-polyfill.js'),
77
- 'wasmcurves': require.resolve('./node-polyfills/wasm-fallback.js'),
78
- 'wasmbuilder': require.resolve('./node-polyfills/wasm-fallback.js'),
79
- },
80
-
81
- // Platforms - ensure React Native takes precedence
82
- platforms: ['native', 'react-native', 'android', 'ios', 'web'],
83
-
84
- // Asset extensions - include WASM if needed (though we're disabling it)
85
- assetExts: [...defaultConfig.resolver.assetExts, 'wasm'],
86
-
87
- // Source extensions - ensure TypeScript and JavaScript are handled
88
- sourceExts: [...defaultConfig.resolver.sourceExts, 'cjs'],
89
-
90
- // Block problematic modules from being processed by Metro
91
- blockList: [
92
- // Block the original web-worker package to prevent dynamic import errors
93
- /node_modules\/web-worker\/cjs\/node\.js$/,
94
- /node_modules\/web-worker\/lib\/node\.js$/,
95
- // Block other potential problematic files
96
- /.*\/node_modules\/web-worker\/.*\.node$/,
97
- ],
98
- },
99
-
100
- transformer: {
101
- // Disable minification for debugging if needed
102
- minifierConfig: {
103
- keep_fnames: true,
104
- mangle: {
105
- keep_fnames: true,
106
- },
107
- },
108
- },
109
- };
110
-
111
- module.exports = mergeConfig(defaultConfig, config);
112
- ```
113
-
114
- ### 2. Copy Updated Polyfills
115
-
116
- Ensure you have copied the latest polyfill files from `new-dop-wallet-v3/node-polyfills/` to your React Native project root:
117
-
118
- - `os-polyfill.js`
119
- - `web-worker-polyfill.js` (updated version)
120
- - `wasm-fallback.js`
121
-
122
- ### 3. Clear Metro Cache
123
-
124
- After updating the configuration, clear Metro's cache:
125
-
126
- ```bash
127
- npx react-native start --reset-cache
128
- ```
129
-
130
- ### 4. Alternative Solution: Package Resolution Override
131
-
132
- If the above doesn't work, you can also try adding package resolution overrides to your `package.json`:
133
-
134
- ```json
135
- {
136
- "name": "your-react-native-app",
137
- "dependencies": {
138
- // ... your dependencies
139
- },
140
- "resolutions": {
141
- "web-worker": "file:./node-polyfills/web-worker-polyfill.js"
142
- },
143
- "overrides": {
144
- "web-worker": "file:./node-polyfills/web-worker-polyfill.js"
145
- }
146
- }
147
- ```
148
-
149
- ### 5. Verification
150
-
151
- To verify the fix is working:
152
-
153
- 1. Start Metro with cache reset: `npx react-native start --reset-cache`
154
- 2. Run your app: `npx react-native run-android` or `npx react-native run-ios`
155
- 3. Check that you see the polyfill warning instead of the error:
156
- ```
157
- Web Worker polyfill: Web Workers are not supported in React Native. Operations will run synchronously.
158
- ```
159
-
160
- ## Why This Happens
161
-
162
- 1. **Dynamic imports**: The `web-worker` package uses `import()` syntax which Metro cannot process
163
- 2. **Node.js specific code**: The package contains code designed for Node.js environments
164
- 3. **Dependency chain**: Even though you don't directly use web-worker, it's pulled in by circomlibjs
165
-
166
- ## Prevention
167
-
168
- - Always use the provided Metro configuration when integrating dop-wallet-v6
169
- - Copy all polyfill files, not just the ones you think you need
170
- - Test with cache reset after any configuration changes
171
-
172
- ## Still Having Issues?
173
-
174
- If you're still experiencing problems:
175
-
176
- 1. Check that your Metro configuration exactly matches the example
177
- 2. Verify all polyfill files are copied to the correct location
178
- 3. Ensure the paths in your Metro config point to the actual polyfill files
179
- 4. Try deleting `node_modules` and reinstalling
180
- 5. Check that you're not importing dop-wallet-v6 before the required shims