dop-wallet-v6 1.2.13 → 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.
- package/ASYNCSTORAGE_FIX_SUMMARY.md +79 -0
- package/BUILD_SUCCESS_SUMMARY.md +103 -0
- package/DOP_WALLET_V6_WALLET_CREATION_GUIDE.md +305 -0
- package/REACT_NATIVE_FIXES_COMPLETE.md +162 -0
- package/REACT_NATIVE_INTEGRATION_FIXES.md +167 -0
- package/REACT_NATIVE_SETUP_QUICK_FIX.md +189 -0
- package/REACT_NATIVE_WALLET_HANGING_FIX.md +270 -0
- package/README.md +14 -1
- package/VERIFICATION_COMPLETE.md +138 -0
- package/WALLET_CREATION_MIGRATION_COMPLETE.md +80 -0
- package/dist/services/dop/core/react-native-init.d.ts +18 -0
- package/dist/services/dop/core/react-native-init.js +30 -24
- package/dist/services/dop/core/react-native-init.js.map +1 -1
- package/dist/services/dop/crypto/react-native-crypto-provider.d.ts +41 -0
- package/dist/services/dop/crypto/react-native-crypto-provider.js +146 -0
- package/dist/services/dop/crypto/react-native-crypto-provider.js.map +1 -0
- package/dist/services/dop/crypto/react-native-rapidsnark-prover.d.ts +49 -0
- package/dist/services/dop/crypto/react-native-rapidsnark-prover.js +202 -0
- package/dist/services/dop/crypto/react-native-rapidsnark-prover.js.map +1 -0
- package/dist/services/dop/util/runtime.d.ts +1 -0
- package/dist/services/dop/util/runtime.js +34 -2
- package/dist/services/dop/util/runtime.js.map +1 -1
- package/dist/services/dop/wallets/wallets.js +47 -46
- package/dist/services/dop/wallets/wallets.js.map +1 -1
- package/issuev3.md +50 -35
- package/metro.config.react-native.example.js +10 -8
- package/node-polyfills/fs-polyfill.js +54 -0
- package/node-polyfills/path-polyfill.js +36 -0
- package/node-polyfills/process-polyfill.js +61 -0
- package/node-polyfills/url-polyfill.js +32 -0
- package/node-polyfills/util-polyfill.js +76 -0
- package/package.json +14 -3
- package/problem.md +41 -0
- package/react-native-shims.js +27 -10
- package/react-native.js +12 -0
- package/WEB_WORKER_TROUBLESHOOTING.md +0 -180
- package/node-polyfills/package.json +0 -9
|
@@ -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
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "web-worker-polyfill",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "React Native polyfill for web-worker package",
|
|
5
|
-
"main": "web-worker-polyfill.js",
|
|
6
|
-
"keywords": ["react-native", "web-worker", "polyfill"],
|
|
7
|
-
"author": "DOP Wallet Team",
|
|
8
|
-
"license": "MIT"
|
|
9
|
-
}
|