@tomo-inc/wallet-connect-protocol 0.0.8 → 0.0.9
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/MIGRATION.md +101 -0
- package/README.md +605 -290
- package/dist/index.cjs +111 -528
- package/dist/index.d.cts +668 -148
- package/dist/index.d.ts +668 -148
- package/dist/index.js +746 -315
- package/package.json +5 -18
- package/VANILLA_JS.md +0 -491
- package/dist/chunk-32KOSJUW.js +0 -839
- package/dist/vanilla-2_OWCFEZ.d.cts +0 -705
- package/dist/vanilla-2_OWCFEZ.d.ts +0 -705
- package/dist/vanilla.cjs +0 -828
- package/dist/vanilla.d.cts +0 -1
- package/dist/vanilla.d.ts +0 -1
- package/dist/vanilla.js +0 -1
package/MIGRATION.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Migration Guide: Pure JavaScript Version
|
|
2
|
+
|
|
3
|
+
## 📝 Overview
|
|
4
|
+
|
|
5
|
+
`@tomo-inc/wallet-connect-protocol` has been refactored to be a **pure JavaScript / framework-agnostic** SDK. All React-specific code has been removed.
|
|
6
|
+
|
|
7
|
+
## 🔄 What Changed
|
|
8
|
+
|
|
9
|
+
### Removed
|
|
10
|
+
|
|
11
|
+
- ❌ React Context Provider (`WalletConnectProvider`)
|
|
12
|
+
- ❌ React Hooks (`useWalletConnect`, `useConnect`, `useQRCode`, `useSession`, `useSiwe`)
|
|
13
|
+
- ❌ React dependencies (`react`, `react-dom`)
|
|
14
|
+
- ❌ `/vanilla` export path
|
|
15
|
+
|
|
16
|
+
### Kept
|
|
17
|
+
|
|
18
|
+
- ✅ Core `WalletConnectClient` class
|
|
19
|
+
- ✅ All utility functions
|
|
20
|
+
- ✅ Multi-chain support
|
|
21
|
+
- ✅ SIWE authentication
|
|
22
|
+
- ✅ Wallet discovery API
|
|
23
|
+
- ✅ TypeScript types
|
|
24
|
+
|
|
25
|
+
## 📦 Import Changes
|
|
26
|
+
|
|
27
|
+
### Before (v0.0.7 and earlier)
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
// React version (OLD)
|
|
31
|
+
import {
|
|
32
|
+
WalletConnectProvider,
|
|
33
|
+
useWalletConnect,
|
|
34
|
+
} from "@tomo-inc/wallet-connect-protocol";
|
|
35
|
+
|
|
36
|
+
// Vanilla JS version (OLD)
|
|
37
|
+
import { WalletConnectClient } from "@tomo-inc/wallet-connect-protocol/vanilla";
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### After (v0.0.8+)
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
// Pure JavaScript (NEW - works everywhere)
|
|
44
|
+
import { WalletConnectClient } from "@tomo-inc/wallet-connect-protocol";
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## 🚀 Migration Steps
|
|
48
|
+
|
|
49
|
+
### If you were using React hooks
|
|
50
|
+
|
|
51
|
+
**Option 1: Use the core client directly**
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
// Before
|
|
55
|
+
const { connect, uri, generateQRCode } = useWalletConnect();
|
|
56
|
+
|
|
57
|
+
// After
|
|
58
|
+
const [client] = useState(() => new WalletConnectClient(config));
|
|
59
|
+
const [uri, setUri] = useState<string | null>(null);
|
|
60
|
+
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
client.initialize();
|
|
63
|
+
}, []);
|
|
64
|
+
|
|
65
|
+
const handleConnect = async () => {
|
|
66
|
+
const connectionUri = await client.connect();
|
|
67
|
+
setUri(connectionUri);
|
|
68
|
+
const qr = await client.generateQRCode(connectionUri);
|
|
69
|
+
// Use qr...
|
|
70
|
+
};
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Option 2: Build your own React wrapper**
|
|
74
|
+
|
|
75
|
+
Create your own hooks based on the core client (see examples in README).
|
|
76
|
+
|
|
77
|
+
### If you were using `/vanilla` export
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
// Before
|
|
81
|
+
import { WalletConnectClient } from "@tomo-inc/wallet-connect-protocol/vanilla";
|
|
82
|
+
|
|
83
|
+
// After (just remove /vanilla)
|
|
84
|
+
import { WalletConnectClient } from "@tomo-inc/wallet-connect-protocol";
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## 💡 Benefits
|
|
88
|
+
|
|
89
|
+
1. **Smaller bundle size** - No React dependencies
|
|
90
|
+
2. **Framework agnostic** - Works with any framework
|
|
91
|
+
3. **Simpler API** - One consistent API for all use cases
|
|
92
|
+
4. **Better tree-shaking** - Only import what you need
|
|
93
|
+
|
|
94
|
+
## 📚 Resources
|
|
95
|
+
|
|
96
|
+
- [README.md](./README.md) - Complete usage guide with examples for all frameworks
|
|
97
|
+
- [Examples](./README.md#-usage-examples) - Vanilla JS, Vue, Angular, Svelte, React examples
|
|
98
|
+
|
|
99
|
+
## 🤝 Support
|
|
100
|
+
|
|
101
|
+
If you need help migrating, please [open an issue](https://github.com/tomo-inc/tomo-wallet/issues).
|