dop-wallet-v6 1.2.15 → 1.2.16

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/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "dop-wallet-v6",
3
- "version": "1.2.15",
3
+ "version": "1.2.16",
4
4
  "description": "DOP Wallet SDK, compatible with mobile, browser and nodejs environments.",
5
5
  "main": "dist/index.js",
6
6
  "license": "MIT",
7
7
  "files": [
8
8
  "dist/**/*",
9
9
  "*.js",
10
- "*.md",
10
+ "README.md",
11
11
  "node-polyfills/**/*",
12
12
  "metro.config.react-native.example.js",
13
13
  "package-rn-integration.json"
@@ -30,7 +30,7 @@
30
30
  "eslint": "eslint src/**/* --ext .ts,.tsx --ignore-pattern **/*.graphql --fix",
31
31
  "lint": "npm run check-circular-deps && npm run eslint && npm run tsc && npm run tsc-test",
32
32
  "prepare": "npm run build",
33
- "postinstall": "node postinstall.js",
33
+ "postinstall": "patch-package && node postinstall.js",
34
34
  "verify-rn-compatibility": "node verify-react-native-compatibility.cjs"
35
35
  },
36
36
  "dependencies": {
@@ -60,6 +60,7 @@
60
60
  "events": "3.3.0",
61
61
  "graphql": "^16.6.0",
62
62
  "memdown": "^6.1.1",
63
+ "patch-package": "^8.0.1",
63
64
  "poseidon-lite": "^0.3.0",
64
65
  "stream-browserify": "3.0.0"
65
66
  },
@@ -1,79 +0,0 @@
1
- # AsyncStorage Fix Summary
2
-
3
- ## Problem
4
-
5
- When integrating the `new-dop-wallet-v3` SDK into React Native applications, users encountered the following error:
6
-
7
- ```
8
- Invariant Violation: AsyncStorage has been removed from react-native core. It can now be installed and imported from '@react-native-async-storage/async-storage' instead of 'react-native'
9
- ```
10
-
11
- ## Root Cause
12
-
13
- The issue was caused by the `@graphql-mesh/cache-localforage` dependency, which was trying to use the legacy React Native AsyncStorage API that was removed from React Native core starting from version 0.60+.
14
-
15
- The problematic imports were found in three GraphQL mesh configuration files:
16
- 1. `/src/services/dop/dop-txids/graphql/index.ts`
17
- 2. `/src/services/dop/quick-sync/V2/graphql/index.ts`
18
- 3. `/src/services/dop/quick-sync/V3/graphql/index.ts`
19
-
20
- ## Solution
21
-
22
- **Replaced the cache implementation with `undefined` to disable caching for React Native compatibility:**
23
-
24
- ### Files Modified:
25
-
26
- 1. **`/src/services/dop/dop-txids/graphql/index.ts`**
27
- - Commented out: `import MeshCache from "@graphql-mesh/cache-localforage";`
28
- - Replaced cache instantiation with: `const cache = undefined;`
29
-
30
- 2. **`/src/services/dop/quick-sync/V2/graphql/index.ts`**
31
- - Commented out: `import MeshCache from "@graphql-mesh/cache-localforage";`
32
- - Replaced cache instantiation with: `const cache = undefined;`
33
-
34
- 3. **`/src/services/dop/quick-sync/V3/graphql/index.ts`**
35
- - Commented out: `import MeshCache from '@graphql-mesh/cache-localforage';`
36
- - Replaced cache instantiation with: `const cache = undefined;`
37
-
38
- ### Changes Made:
39
-
40
- ```typescript
41
- // BEFORE:
42
- import MeshCache from "@graphql-mesh/cache-localforage";
43
-
44
- const cache = new (MeshCache as any)({
45
- ...({} as any),
46
- importFn,
47
- store: rootStore.child('cache'),
48
- pubsub,
49
- logger,
50
- } as any)
51
-
52
- // AFTER:
53
- // MODIFIED: Replaced cache-localforage with no cache for React Native compatibility
54
- // import MeshCache from "@graphql-mesh/cache-localforage";
55
-
56
- // MODIFIED: Replaced MeshCache with undefined to disable caching for React Native compatibility
57
- const cache = undefined;
58
- ```
59
-
60
- ## Impact
61
-
62
- - ✅ **Fixed**: React Native AsyncStorage compatibility issue
63
- - ✅ **No Breaking Changes**: The wallet functionality remains intact
64
- - ⚠️ **Performance**: GraphQL queries will not be cached, which may slightly impact performance
65
- - ✅ **Build**: All builds now pass successfully
66
-
67
- ## Alternative Solutions Considered
68
-
69
- 1. **Update `@graphql-mesh/cache-localforage`**: Not feasible as this package is maintained by GraphQL Mesh team
70
- 2. **Replace with `@react-native-async-storage/async-storage`**: Would require custom cache implementation
71
- 3. **Conditional caching**: More complex but could be implemented in future versions
72
-
73
- ## Recommendation
74
-
75
- This fix resolves the immediate compatibility issue. For production applications that require optimal performance, consider implementing a custom cache strategy using `@react-native-async-storage/async-storage` for React Native environments and keeping LocalForage for web environments.
76
-
77
- ## Version
78
-
79
- This fix was applied to version 1.2.10 of the `dop-wallet-v6` package.
@@ -1,103 +0,0 @@
1
- # Build Success Summary - React Native Integration
2
-
3
- ## ✅ Build Status: SUCCESSFUL
4
-
5
- The dop-wallet-v6 SDK now builds successfully with all React Native integration fixes applied.
6
-
7
- ## Key Fixes Applied:
8
-
9
- ### 1. **React Native Database Solution**
10
- - ✅ **Fixed**: Created `ReactNativeLevelDB` class in `/src/services/dop/core/react-native-init.ts`
11
- - ✅ **Fixed**: Uses memdown + AsyncStorage for persistent storage
12
- - ✅ **Fixed**: Provides AbstractLevelDOWN-compatible interface
13
- - ✅ **Fixed**: Handles AsyncStorage unavailability gracefully
14
-
15
- ### 2. **React Native Initialization**
16
- - ✅ **Fixed**: Added `startDopEngineReactNative()` function for React Native apps
17
- - ✅ **Fixed**: Configurable database name (uses AsyncStorage prefix)
18
- - ✅ **Fixed**: Automatic polyfill detection and graceful fallbacks
19
-
20
- ### 3. **Dependencies & Polyfills**
21
- - ✅ **Fixed**: Removed problematic Level-FS dependency
22
- - ✅ **Fixed**: Added memdown for in-memory LevelDB operations
23
- - ✅ **Fixed**: Documented all required polyfills in integration guide
24
- - ✅ **Fixed**: Updated react-native-shims.js with Buffer polyfill
25
-
26
- ### 4. **Build Configuration**
27
- - ✅ **Fixed**: All ESLint errors resolved with proper disable comments
28
- - ✅ **Fixed**: TypeScript compilation passes without errors
29
- - ✅ **Fixed**: No circular dependencies detected
30
-
31
- ### 5. **Documentation Updates**
32
- - ✅ **Fixed**: Updated React Native Integration Guide
33
- - ✅ **Fixed**: Added troubleshooting section
34
- - ✅ **Fixed**: Added verification scripts
35
- - ✅ **Fixed**: Updated integration test
36
-
37
- ## Current Build Results:
38
- - ✅ Circular dependency check: PASSED
39
- - ✅ ESLint check: PASSED (135 warnings, 0 errors)
40
- - ✅ TypeScript compilation: PASSED
41
- - ✅ Test TypeScript compilation: PASSED
42
-
43
- ## For React Native Developers:
44
-
45
- The SDK is now ready for React Native integration. Follow these steps:
46
-
47
- ### 1. Install Required Polyfills:
48
- ```bash
49
- npm install react-native-get-random-values react-native-url-polyfill buffer util stream-browserify crypto-browserify @react-native-async-storage/async-storage
50
- ```
51
-
52
- ### 2. Import Polyfills (BEFORE any DOP imports):
53
- ```typescript
54
- import 'react-native-get-random-values';
55
- import 'react-native-url-polyfill/auto';
56
- import { Buffer } from 'buffer';
57
- global.Buffer = Buffer;
58
- ```
59
-
60
- ### 3. Configure Metro (metro.config.js):
61
- ```javascript
62
- const { getDefaultConfig } = require('metro-config');
63
-
64
- module.exports = (async () => {
65
- const {
66
- resolver: { sourceExts, assetExts }
67
- } = await getDefaultConfig();
68
-
69
- return {
70
- resolver: {
71
- assetExts: assetExts.filter(ext => ext !== 'svg'),
72
- sourceExts: [...sourceExts, 'svg'],
73
- alias: {
74
- 'crypto': 'crypto-browserify',
75
- 'stream': 'stream-browserify',
76
- 'util': 'util',
77
- 'buffer': 'buffer'
78
- }
79
- }
80
- };
81
- })();
82
- ```
83
-
84
- ### 4. Initialize DOP Engine for React Native:
85
- ```typescript
86
- import { startDopEngineReactNative } from 'dop-wallet-v6/dist/src/services/dop/core/react-native-init';
87
- import { ArtifactStore } from 'dop-wallet-v6';
88
-
89
- await startDopEngineReactNative(
90
- 'your-app-name',
91
- true, // debug mode
92
- new ArtifactStore('/path/to/artifacts'),
93
- true, // use native artifacts
94
- false, // don't skip merkletree scans
95
- false, // no verbose scan logging
96
- 'dop-wallet-db' // database name
97
- );
98
- ```
99
-
100
- ## Next Steps:
101
- - The SDK is ready for publishing and React Native integration
102
- - All known React Native compatibility issues have been resolved
103
- - Comprehensive documentation and troubleshooting guides are in place