@cookill/wallet-adapter 3.1.6 → 3.1.8

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 CHANGED
@@ -23,9 +23,38 @@ function App() {
23
23
  }
24
24
  ```
25
25
 
26
- `WalletProvider` renders a built-in connect modal automatically. On desktop it opens centered; on mobile it slides up as a sheet.
26
+ `WalletProvider` renders a built-in connect modal automatically. On desktop it opens as a centered dialog; on mobile it slides up as a bottom sheet with swipe-to-dismiss.
27
27
 
28
- > **Note:** The built-in modal has known interaction issues (tab switching may close the modal, connect button may not trigger the extension). For production use, we recommend building a custom modal using the `connect()` function directly — see [Custom Modal](#custom-modal) below.
28
+ ## Built-in Modal
29
+
30
+ The built-in modal is rendered inside `WalletProvider` and includes:
31
+
32
+ - **Extension tab** — detects Sheep Wallet, shows install link if not found, triggers `window.rialo.connect()` on click
33
+ - **Scan to Connect tab** — generates a `rialo-wc://` QR code for cross-device pairing
34
+ - **Responsive layout** — centered dialog on desktop, slide-up sheet on mobile
35
+ - **Auto-close** — closes automatically after successful connection
36
+
37
+ Control it programmatically:
38
+
39
+ ```tsx
40
+ const { openModal, closeModal } = useWallet();
41
+
42
+ // Open the built-in modal
43
+ openModal();
44
+ ```
45
+
46
+ Or use `ConnectButton` which handles everything:
47
+
48
+ ```tsx
49
+ <ConnectButton
50
+ connectLabel="Connect Wallet"
51
+ disconnectLabel="Disconnect"
52
+ showAddress={true}
53
+ showBalance={false}
54
+ />
55
+ ```
56
+
57
+ > When the extension is installed, `ConnectButton` calls `connect()` directly without opening the modal. When not installed, it opens the modal with a download link.
29
58
 
30
59
  ## React Hooks
31
60
 
@@ -53,7 +82,7 @@ const {
53
82
  sendTransaction, // (tx) => Promise<TransactionResult>
54
83
  signAndSendTransaction, // (tx) => Promise<TransactionResult>
55
84
 
56
- // Built-in modal control (has known issues — see note above)
85
+ // Modal control
57
86
  openModal, // () => void
58
87
  closeModal, // () => void
59
88
  } = useWallet();
@@ -92,9 +121,9 @@ const { positions, credits, hasCredits, createPosition, sendGasless, refresh } =
92
121
  const { scanURI, status, generateQR, approveSession, rejectSession } = useScanConnect();
93
122
  ```
94
123
 
95
- ## Custom Modal
124
+ ## Custom Modal (Optional)
96
125
 
97
- The built-in modal rendered by `WalletProvider` has known issues with event propagation. For a reliable connection experience, build your own modal and call `connect()` directly:
126
+ If you need full control over the UI, build your own modal using the hooks:
98
127
 
99
128
  ```tsx
100
129
  import { useConnectWallet, useScanConnect, isInstalled } from '@cookill/wallet-adapter/react';
@@ -136,7 +165,7 @@ function MyConnectModal({ open, onClose }) {
136
165
  ```
137
166
 
138
167
  Key points:
139
- - Use `connect()` from `useConnectWallet()` — this calls `window.rialo.connect()` which triggers the extension's approval popup
168
+ - `connect()` calls `window.rialo.connect()` which triggers the extension's approval popup
140
169
  - The `connect()` call has a 20-second timeout to prevent dApp freezes
141
170
  - Use `isInstalled()` to check if the extension is present before connecting
142
171
 
@@ -163,20 +192,6 @@ await wallet.signAndSendTransaction({
163
192
  await wallet.disconnect();
164
193
  ```
165
194
 
166
- ## ConnectButton
167
-
168
- ```tsx
169
- <ConnectButton
170
- connectLabel="Connect Wallet"
171
- disconnectLabel="Disconnect"
172
- showAddress={true}
173
- showBalance={false}
174
- showFeatures={false}
175
- />
176
- ```
177
-
178
- > **Note:** When the extension is installed, `ConnectButton` calls `connect()` directly (no modal). When not installed, it opens the built-in modal with a download link.
179
-
180
195
  ## WalletProvider Props
181
196
 
182
197
  | Prop | Type | Default | Description |
@@ -246,14 +261,9 @@ import {
246
261
 
247
262
  - All provider calls have a 20-second timeout to prevent dApp freezes
248
263
  - `autoConnect` uses `checkSession()` — never triggers a user-facing popup
249
- - The built-in modal is rendered inside `WalletProvider` automatically
264
+ - The built-in modal uses a sibling DOM architecture (backdrop and content are separate elements) to prevent click events from interfering with tab switching or button interactions
250
265
  - `ConnectButton` bypasses the modal when the extension is installed
251
266
 
252
- ## Known Issues
253
-
254
- 1. **Built-in modal tab switching** — Clicking "Scan to Connect" tab may close the modal due to event propagation. Workaround: use a custom modal.
255
- 2. **Built-in modal connect button** — May not trigger the extension popup in some environments. Workaround: use `connect()` directly.
256
-
257
267
  ## License
258
268
 
259
269
  MIT