@sudobility/contracts 1.17.31 → 1.17.32
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/README.md +63 -1
- package/package.json +21 -1
package/README.md
CHANGED
|
@@ -34,6 +34,67 @@ npm install @johnqh/mail_box_contracts
|
|
|
34
34
|
yarn add @johnqh/mail_box_contracts
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
+
## 📱 Platform Support
|
|
38
|
+
|
|
39
|
+
The package automatically detects your platform and loads the appropriate implementation:
|
|
40
|
+
|
|
41
|
+
| Environment | Import | Resolves to |
|
|
42
|
+
|-------------|--------|-------------|
|
|
43
|
+
| React Native (Metro) | `@sudobility/contracts` | React Native build |
|
|
44
|
+
| Browser (webpack/vite) | `@sudobility/contracts` | Web build |
|
|
45
|
+
| Node.js | `@sudobility/contracts` | Web build |
|
|
46
|
+
|
|
47
|
+
### Auto-Detection (Recommended)
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
// Works everywhere - auto-detects platform
|
|
51
|
+
import { OnchainMailerClient } from '@sudobility/contracts';
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Explicit Imports
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
// Force specific platform
|
|
58
|
+
import { OnchainMailerClient } from '@sudobility/contracts/web';
|
|
59
|
+
import { OnchainMailerClient } from '@sudobility/contracts/react-native';
|
|
60
|
+
|
|
61
|
+
// Chain-specific imports
|
|
62
|
+
import { EVMMailerClient } from '@sudobility/contracts/evm';
|
|
63
|
+
import { SolanaMailerClient } from '@sudobility/contracts/solana';
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### React Native Setup
|
|
67
|
+
|
|
68
|
+
React Native requires polyfills to be imported first in your app entry point:
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
// index.js (MUST be the first import)
|
|
72
|
+
import '@sudobility/contracts/react-native/polyfills';
|
|
73
|
+
|
|
74
|
+
import { AppRegistry } from 'react-native';
|
|
75
|
+
import App from './App';
|
|
76
|
+
AppRegistry.registerComponent('YourApp', () => App);
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Then use the client normally in your app:
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
// App.tsx - auto-detected as React Native
|
|
83
|
+
import { OnchainMailerClient, verifyPolyfills } from '@sudobility/contracts';
|
|
84
|
+
|
|
85
|
+
// Optional: verify polyfills loaded correctly
|
|
86
|
+
const { success, missing } = verifyPolyfills();
|
|
87
|
+
if (!success) console.error('Missing polyfills:', missing);
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Required React Native dependencies:**
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
npm install react-native-get-random-values buffer react-native-url-polyfill text-encoding
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
See [`docs/REACT_NATIVE.md`](./docs/REACT_NATIVE.md) for complete React Native setup guide.
|
|
97
|
+
|
|
37
98
|
## 🚀 Quick Start - Unified Multi-Chain Client
|
|
38
99
|
|
|
39
100
|
### Option 1: Using ChainConfig with RpcHelpers (Recommended)
|
|
@@ -174,6 +235,7 @@ mail_box_contracts/
|
|
|
174
235
|
│ ├── evm/ # EVM-specific clients
|
|
175
236
|
│ ├── solana/ # Solana-specific clients
|
|
176
237
|
│ ├── unified/ # Cross-chain unified client
|
|
238
|
+
│ ├── react-native/ # React Native entry point & polyfills
|
|
177
239
|
│ └── utils/ # Shared utilities & validation
|
|
178
240
|
├── test/ # Comprehensive test suites (116 tests)
|
|
179
241
|
│ ├── evm/ # EVM contract tests (75 tests)
|
|
@@ -367,4 +429,4 @@ MIT License - see LICENSE file for details.
|
|
|
367
429
|
|
|
368
430
|
---
|
|
369
431
|
|
|
370
|
-
**Built with**: Hardhat, TypeScript, Solidity ^0.8.24, Ethers v6
|
|
432
|
+
**Built with**: Hardhat, TypeScript, Solidity ^0.8.24, Ethers v6, React Native
|
package/package.json
CHANGED
|
@@ -1,11 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sudobility/contracts",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.32",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/unified/src/unified/index.js",
|
|
6
6
|
"types": "dist/unified/src/unified/index.d.ts",
|
|
7
|
+
"browser": "dist/unified/src/unified/index.js",
|
|
8
|
+
"react-native": "dist/react-native/src/react-native/index.js",
|
|
7
9
|
"exports": {
|
|
8
10
|
".": {
|
|
11
|
+
"react-native": {
|
|
12
|
+
"types": "./dist/react-native/src/react-native/index.d.ts",
|
|
13
|
+
"default": "./dist/react-native/src/react-native/index.js"
|
|
14
|
+
},
|
|
15
|
+
"browser": {
|
|
16
|
+
"types": "./dist/unified/src/unified/index.d.ts",
|
|
17
|
+
"default": "./dist/unified/src/unified/index.js"
|
|
18
|
+
},
|
|
19
|
+
"node": {
|
|
20
|
+
"types": "./dist/unified/src/unified/index.d.ts",
|
|
21
|
+
"default": "./dist/unified/src/unified/index.js"
|
|
22
|
+
},
|
|
23
|
+
"default": {
|
|
24
|
+
"types": "./dist/unified/src/unified/index.d.ts",
|
|
25
|
+
"default": "./dist/unified/src/unified/index.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"./web": {
|
|
9
29
|
"types": "./dist/unified/src/unified/index.d.ts",
|
|
10
30
|
"default": "./dist/unified/src/unified/index.js"
|
|
11
31
|
},
|