@cookill/wallet-adapter 2.5.4 → 3.1.0
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 +275 -196
- package/dist/ErrorBoundary.cjs +53 -110
- package/dist/ErrorBoundary.cjs.map +1 -1
- package/dist/ErrorBoundary.d.cts +11 -7
- package/dist/ErrorBoundary.d.ts +11 -7
- package/dist/ErrorBoundary.js +50 -85
- package/dist/ErrorBoundary.js.map +1 -1
- package/dist/LoadingStates.cjs +134 -267
- package/dist/LoadingStates.cjs.map +1 -1
- package/dist/LoadingStates.d.cts +11 -15
- package/dist/LoadingStates.d.ts +11 -15
- package/dist/LoadingStates.js +129 -239
- package/dist/LoadingStates.js.map +1 -1
- package/dist/index.cjs +483 -161
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +330 -62
- package/dist/index.d.ts +330 -62
- package/dist/index.js +463 -127
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +438 -1024
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +1 -118
- package/dist/react.d.ts +1 -118
- package/dist/react.js +430 -969
- package/dist/react.js.map +1 -1
- package/dist/standard.cjs +127 -121
- package/dist/standard.cjs.map +1 -1
- package/dist/standard.d.cts +6 -44
- package/dist/standard.d.ts +6 -44
- package/dist/standard.js +118 -91
- package/dist/standard.js.map +1 -1
- package/package.json +42 -36
package/README.md
CHANGED
|
@@ -1,48 +1,27 @@
|
|
|
1
|
-
# @cookill/wallet-adapter
|
|
1
|
+
# @cookill/wallet-adapter v3.1.0
|
|
2
2
|
|
|
3
3
|
Official wallet adapter for **Sheep Wallet** on Rialo blockchain.
|
|
4
4
|
|
|
5
|
+
## 🚀 What's New in v3.1
|
|
6
|
+
|
|
7
|
+
- **REX (Rialo Extended Execution)**: Submit confidential transactions using TEE/MPC/FHE
|
|
8
|
+
- **SfS (Stake-for-Service)**: Gasless transactions — pay fees from staking yield
|
|
9
|
+
- **Scan-to-Connect**: Bidirectional QR code pairing across devices
|
|
10
|
+
- **Anti-freeze architecture**: All provider calls wrapped with timeouts
|
|
11
|
+
- **Silent auto-connect**: Uses `checkSession()` for session restoration
|
|
12
|
+
|
|
5
13
|
## Installation
|
|
6
14
|
|
|
7
15
|
```bash
|
|
8
16
|
npm install @cookill/wallet-adapter
|
|
17
|
+
# or
|
|
18
|
+
pnpm add @cookill/wallet-adapter
|
|
9
19
|
```
|
|
10
20
|
|
|
11
|
-
##
|
|
12
|
-
|
|
13
|
-
**If you're using Vite**, you MUST add React deduplication to prevent "stuck connection" issues:
|
|
14
|
-
|
|
15
|
-
```typescript
|
|
16
|
-
// vite.config.ts
|
|
17
|
-
import { defineConfig } from "vite";
|
|
18
|
-
import react from "@vitejs/plugin-react";
|
|
19
|
-
import path from "path";
|
|
20
|
-
|
|
21
|
-
export default defineConfig({
|
|
22
|
-
plugins: [react()],
|
|
23
|
-
resolve: {
|
|
24
|
-
alias: {
|
|
25
|
-
"@": path.resolve(__dirname, "./src"),
|
|
26
|
-
},
|
|
27
|
-
// CRITICAL: Prevent duplicate React instances
|
|
28
|
-
dedupe: ["react", "react-dom", "react/jsx-runtime"],
|
|
29
|
-
},
|
|
30
|
-
optimizeDeps: {
|
|
31
|
-
include: ["react", "react-dom"],
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
**Without this configuration**, the wallet modal may not open and connections will appear "stuck".
|
|
37
|
-
|
|
38
|
-
## Quick Start
|
|
21
|
+
## Quick Start (React)
|
|
39
22
|
|
|
40
23
|
```tsx
|
|
41
|
-
import {
|
|
42
|
-
WalletProvider,
|
|
43
|
-
ConnectButton,
|
|
44
|
-
WalletErrorBoundary,
|
|
45
|
-
} from '@cookill/wallet-adapter/react';
|
|
24
|
+
import { WalletProvider, ConnectButton, WalletErrorBoundary } from '@cookill/wallet-adapter/react';
|
|
46
25
|
|
|
47
26
|
function App() {
|
|
48
27
|
return (
|
|
@@ -60,112 +39,206 @@ function App() {
|
|
|
60
39
|
|
|
61
40
|
### useWallet
|
|
62
41
|
|
|
63
|
-
Main hook for wallet state and actions:
|
|
64
|
-
|
|
65
42
|
```tsx
|
|
66
43
|
import { useWallet } from '@cookill/wallet-adapter/react';
|
|
67
44
|
|
|
68
45
|
function MyComponent() {
|
|
69
46
|
const {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
balance, // string | null (in kelvins)
|
|
78
|
-
error, // Error | null
|
|
79
|
-
|
|
80
|
-
// Actions
|
|
81
|
-
connect, // () => Promise<WalletAccount[]>
|
|
82
|
-
disconnect, // () => Promise<void>
|
|
83
|
-
switchNetwork, // (network) => Promise<void>
|
|
84
|
-
refreshBalance, // () => Promise<void>
|
|
85
|
-
|
|
86
|
-
// Transactions
|
|
87
|
-
signMessage, // (message: string) => Promise<SignedMessage>
|
|
88
|
-
signTransaction, // (tx) => Promise<string>
|
|
89
|
-
sendTransaction, // (tx) => Promise<TransactionResult>
|
|
90
|
-
signAndSendTransaction, // (tx) => Promise<TransactionResult>
|
|
91
|
-
|
|
47
|
+
connected, connecting, activeAccount, state, chainId, isInstalled,
|
|
48
|
+
connect, disconnect, switchNetwork, refreshBalance,
|
|
49
|
+
signMessage, signTransaction, sendTransaction, signAndSendTransaction,
|
|
50
|
+
// REX
|
|
51
|
+
getREXCapabilities, submitREXTransaction,
|
|
52
|
+
// SfS (Gasless)
|
|
53
|
+
sendGaslessTransaction, getSfSPositions, createSfSPosition, getSfSCredits,
|
|
92
54
|
// Modal
|
|
93
|
-
|
|
94
|
-
openModal,
|
|
95
|
-
closeModal,
|
|
55
|
+
openModal, closeModal,
|
|
96
56
|
} = useWallet();
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Specialized Hooks
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
// Connection
|
|
64
|
+
const { connect, connecting, isInstalled, error } = useConnectWallet();
|
|
65
|
+
const { disconnect, connected } = useDisconnectWallet();
|
|
66
|
+
const connected = useIsConnected();
|
|
67
|
+
|
|
68
|
+
// Account & Balance
|
|
69
|
+
const account = useActiveAccount();
|
|
70
|
+
const accounts = useAccounts();
|
|
71
|
+
const { balance, refresh } = useBalance();
|
|
72
|
+
|
|
73
|
+
// Network
|
|
74
|
+
const { network, chainId } = useNetwork();
|
|
75
|
+
const { switchNetwork, network } = useSwitchNetwork();
|
|
76
|
+
|
|
77
|
+
// Transactions (now includes gasless)
|
|
78
|
+
const { sendTransaction, signAndSendTransaction, sendGaslessTransaction } = useSendTransaction();
|
|
79
|
+
const { signMessage } = useSignMessage();
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### useREX — Confidential Transactions
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
import { useREX } from '@cookill/wallet-adapter/react';
|
|
86
|
+
|
|
87
|
+
function ConfidentialTransfer() {
|
|
88
|
+
const { capabilities, supported, submitREXTransaction } = useREX();
|
|
89
|
+
|
|
90
|
+
const handleConfidentialSend = async () => {
|
|
91
|
+
const result = await submitREXTransaction({
|
|
92
|
+
to: 'RecipientAddress...',
|
|
93
|
+
value: '1000000000',
|
|
94
|
+
rex: {
|
|
95
|
+
confidential: true,
|
|
96
|
+
privacyMode: 'auto', // 'tee' | 'mpc' | 'fhe' | 'auto'
|
|
97
|
+
keepEncrypted: false, // true = output stays encrypted
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
console.log('TX hash:', result.hash);
|
|
102
|
+
console.log('Attestation:', result.attestation);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<div>
|
|
107
|
+
<p>REX supported: {supported ? 'Yes' : 'No'}</p>
|
|
108
|
+
{supported && (
|
|
109
|
+
<div>
|
|
110
|
+
<p>Privacy modes: {capabilities?.privacyModes.join(', ')}</p>
|
|
111
|
+
<button onClick={handleConfidentialSend}>
|
|
112
|
+
Send Confidential Transaction
|
|
113
|
+
</button>
|
|
114
|
+
</div>
|
|
115
|
+
)}
|
|
116
|
+
</div>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### useSfS — Gasless Transactions (Stake-for-Service)
|
|
122
|
+
|
|
123
|
+
```tsx
|
|
124
|
+
import { useSfS } from '@cookill/wallet-adapter/react';
|
|
125
|
+
|
|
126
|
+
function GaslessDemo() {
|
|
127
|
+
const { positions, credits, hasCredits, createPosition, sendGasless, refresh } = useSfS();
|
|
128
|
+
|
|
129
|
+
// Create an SfS position to generate service credits
|
|
130
|
+
const handleStake = async () => {
|
|
131
|
+
await createPosition({
|
|
132
|
+
amount: '10000000000', // 10 RLO in kelvins
|
|
133
|
+
validator: 'ValidatorAddr...',
|
|
134
|
+
routingFraction: 0.5, // Route 50% of yield to service credits
|
|
135
|
+
});
|
|
136
|
+
await refresh();
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// Send a gasless transaction (paid from SfS credits)
|
|
140
|
+
const handleGaslessSend = async () => {
|
|
141
|
+
const result = await sendGasless({
|
|
142
|
+
to: 'RecipientAddress...',
|
|
143
|
+
value: '1000000000', // 1 RLO
|
|
144
|
+
});
|
|
145
|
+
console.log('Gasless TX:', result.hash);
|
|
146
|
+
};
|
|
97
147
|
|
|
98
148
|
return (
|
|
99
149
|
<div>
|
|
100
|
-
|
|
101
|
-
|
|
150
|
+
<p>SfS Positions: {positions.length}</p>
|
|
151
|
+
<p>Available Credits: {credits?.available || '0'}</p>
|
|
152
|
+
<p>Credits/Epoch: {credits?.estimatedPerEpoch || '0'}</p>
|
|
153
|
+
|
|
154
|
+
{!hasCredits ? (
|
|
155
|
+
<button onClick={handleStake}>Stake for Gasless TX</button>
|
|
102
156
|
) : (
|
|
103
|
-
<button onClick={
|
|
157
|
+
<button onClick={handleGaslessSend}>Send (Gasless)</button>
|
|
104
158
|
)}
|
|
105
159
|
</div>
|
|
106
160
|
);
|
|
107
161
|
}
|
|
108
162
|
```
|
|
109
163
|
|
|
110
|
-
###
|
|
164
|
+
### useScanConnect — QR-based Cross-Device Pairing
|
|
111
165
|
|
|
112
166
|
```tsx
|
|
113
|
-
|
|
114
|
-
const connected = useIsConnected();
|
|
167
|
+
import { useScanConnect } from '@cookill/wallet-adapter/react';
|
|
115
168
|
|
|
116
|
-
|
|
117
|
-
const
|
|
169
|
+
function ScanConnectDemo() {
|
|
170
|
+
const { scanURI, status, generateQR, approveSession, rejectSession } = useScanConnect();
|
|
118
171
|
|
|
119
|
-
|
|
120
|
-
|
|
172
|
+
return (
|
|
173
|
+
<div>
|
|
174
|
+
<button onClick={generateQR}>Generate QR</button>
|
|
175
|
+
{scanURI && (
|
|
176
|
+
<div>
|
|
177
|
+
<p>Scan this URI: {scanURI.uri}</p>
|
|
178
|
+
<p>Status: {status}</p>
|
|
179
|
+
</div>
|
|
180
|
+
)}
|
|
181
|
+
</div>
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
```
|
|
121
185
|
|
|
122
|
-
|
|
123
|
-
const { balance, formatted, refresh } = useBalance();
|
|
124
|
-
// formatted: "1,234.5678 RLO"
|
|
186
|
+
## Vanilla JavaScript
|
|
125
187
|
|
|
126
|
-
|
|
127
|
-
|
|
188
|
+
```typescript
|
|
189
|
+
import { SheepWallet, isInstalled, formatBalance } from '@cookill/wallet-adapter';
|
|
128
190
|
|
|
129
|
-
|
|
130
|
-
const { switchNetwork, switching, error } = useSwitchNetwork();
|
|
191
|
+
const wallet = new SheepWallet();
|
|
131
192
|
|
|
132
|
-
//
|
|
133
|
-
const
|
|
193
|
+
// Standard connect
|
|
194
|
+
const accounts = await wallet.connect();
|
|
134
195
|
|
|
135
|
-
//
|
|
136
|
-
const
|
|
196
|
+
// REX — Confidential transaction
|
|
197
|
+
const rexResult = await wallet.submitREXTransaction({
|
|
198
|
+
to: 'RecipientAddress...',
|
|
199
|
+
value: '1000000000',
|
|
200
|
+
rex: { confidential: true, privacyMode: 'auto' },
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
// SfS — Create staking position for gasless TX
|
|
204
|
+
await wallet.createSfSPosition({
|
|
205
|
+
amount: '10000000000',
|
|
206
|
+
validator: 'ValidatorAddr...',
|
|
207
|
+
routingFraction: 0.5,
|
|
208
|
+
});
|
|
137
209
|
|
|
138
|
-
//
|
|
139
|
-
const
|
|
210
|
+
// SfS — Send gasless transaction
|
|
211
|
+
const result = await wallet.sendGaslessTransaction({
|
|
212
|
+
to: 'RecipientAddress...',
|
|
213
|
+
value: '1000000000',
|
|
214
|
+
});
|
|
140
215
|
|
|
141
|
-
//
|
|
142
|
-
const
|
|
216
|
+
// Scan-to-Connect — Generate session QR
|
|
217
|
+
const session = await wallet.createScanSession();
|
|
218
|
+
console.log('QR URI:', session.uri);
|
|
143
219
|
```
|
|
144
220
|
|
|
145
221
|
## Components
|
|
146
222
|
|
|
147
223
|
### ConnectButton
|
|
148
224
|
|
|
149
|
-
Pre-styled connect button:
|
|
150
|
-
|
|
151
225
|
```tsx
|
|
152
226
|
<ConnectButton
|
|
153
227
|
connectLabel="Connect Wallet"
|
|
154
228
|
disconnectLabel="Disconnect"
|
|
155
229
|
showAddress={true}
|
|
156
230
|
showBalance={false}
|
|
157
|
-
|
|
231
|
+
showFeatures={true} // Show REX/SfS badges
|
|
158
232
|
/>
|
|
159
233
|
```
|
|
160
234
|
|
|
161
235
|
### WalletProvider
|
|
162
236
|
|
|
163
|
-
Wrap your app to provide wallet context:
|
|
164
|
-
|
|
165
237
|
```tsx
|
|
166
238
|
<WalletProvider
|
|
167
239
|
network="devnet"
|
|
168
240
|
autoConnect={true}
|
|
241
|
+
scanConnectRelay="wss://relay.rialo.io"
|
|
169
242
|
onConnect={(accounts) => console.log('Connected', accounts)}
|
|
170
243
|
onDisconnect={() => console.log('Disconnected')}
|
|
171
244
|
onNetworkChange={(network) => console.log('Network:', network)}
|
|
@@ -175,150 +248,156 @@ Wrap your app to provide wallet context:
|
|
|
175
248
|
</WalletProvider>
|
|
176
249
|
```
|
|
177
250
|
|
|
178
|
-
|
|
251
|
+
The connect modal includes two tabs:
|
|
252
|
+
- **Extension**: Direct browser extension connection
|
|
253
|
+
- **Scan to Connect**: Bidirectional QR code (show QR or scan QR)
|
|
179
254
|
|
|
180
|
-
|
|
255
|
+
## Networks
|
|
181
256
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
</WalletErrorBoundary>
|
|
189
|
-
```
|
|
257
|
+
| Network | Chain ID | RPC URL | Symbol | REX | SfS |
|
|
258
|
+
|----------|-----------------|----------------------------------|--------|-----|-----|
|
|
259
|
+
| Mainnet | rialo:mainnet | https://mainnet.rialo.io:4101 | RLO | ✅ | ✅ |
|
|
260
|
+
| Testnet | rialo:testnet | https://testnet.rialo.io:4101 | tRLO | ✅ | ✅ |
|
|
261
|
+
| Devnet | rialo:devnet | https://devnet.rialo.io:4101 | dRLO | ✅ | ✅ |
|
|
262
|
+
| Localnet | rialo:localnet | http://localhost:4101 | lRLO | ❌ | ❌ |
|
|
190
263
|
|
|
191
|
-
##
|
|
264
|
+
## REX (Rialo Extended Execution)
|
|
192
265
|
|
|
193
|
-
|
|
194
|
-
|
|
266
|
+
REX enables privacy-preserving computation on Rialo using:
|
|
267
|
+
- **TEE** (Trusted Execution Environments) — fastest, hardware-isolated
|
|
268
|
+
- **MPC** (Multi-Party Computation) — distributed, no single trust point
|
|
269
|
+
- **FHE** (Fully Homomorphic Encryption) — compute on encrypted data
|
|
270
|
+
- **Auto** — protocol selects optimal privacy technology
|
|
195
271
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
272
|
+
### REX Transaction Flow
|
|
273
|
+
|
|
274
|
+
```
|
|
275
|
+
1. User encrypts inputs with network public key
|
|
276
|
+
2. Wallet submits encrypted TX to REX execution layer
|
|
277
|
+
3. Nodes execute confidentially (inputs never exposed)
|
|
278
|
+
4. Result is cryptographically attested
|
|
279
|
+
5. Only authorized parties can decrypt output
|
|
280
|
+
```
|
|
201
281
|
|
|
202
|
-
|
|
203
|
-
const wallet = new RialoWallet();
|
|
282
|
+
### REX Config Options
|
|
204
283
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
284
|
+
```typescript
|
|
285
|
+
interface REXConfig {
|
|
286
|
+
confidential: boolean; // Enable REX execution
|
|
287
|
+
privacyMode?: 'tee' | 'mpc' | 'fhe' | 'auto';
|
|
288
|
+
encryptedInputs?: string; // Pre-encrypted data (base64)
|
|
289
|
+
programId?: string; // REX program to execute
|
|
290
|
+
keepEncrypted?: boolean; // Keep output encrypted
|
|
291
|
+
accessPolicy?: {
|
|
292
|
+
allowedDecryptors: string[]; // Who can decrypt
|
|
293
|
+
expiresAt?: number; // Access expiry
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
```
|
|
208
297
|
|
|
209
|
-
|
|
210
|
-
const balance = await wallet.getBalance();
|
|
211
|
-
console.log('Balance:', formatBalance(balance), 'RLO');
|
|
298
|
+
## SfS (Stake-for-Service)
|
|
212
299
|
|
|
213
|
-
|
|
214
|
-
const signed = await wallet.signMessage('Hello!');
|
|
215
|
-
console.log('Signature:', signed.signature);
|
|
300
|
+
Stake-for-Service converts staking yield into service credits that pay for gas automatically.
|
|
216
301
|
|
|
217
|
-
|
|
218
|
-
const tx = await wallet.signAndSendTransaction({
|
|
219
|
-
to: 'RecipientAddress...',
|
|
220
|
-
value: '1000000000', // 1 RLO in kelvins
|
|
221
|
-
});
|
|
222
|
-
console.log('TX Hash:', tx.hash);
|
|
302
|
+
### How It Works
|
|
223
303
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
304
|
+
```
|
|
305
|
+
1. User stakes RLO with a validator
|
|
306
|
+
2. Sets routingFraction (0.0 - 1.0) of yield → service credits
|
|
307
|
+
3. ServicePaymaster mints credits from routed yield
|
|
308
|
+
4. Credits auto-pay gas for transactions
|
|
309
|
+
5. No more manual gas top-ups
|
|
228
310
|
```
|
|
229
311
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
Access `window.rialo` directly:
|
|
312
|
+
### SfS Types
|
|
233
313
|
|
|
234
314
|
```typescript
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
315
|
+
interface SfSPosition {
|
|
316
|
+
id: string;
|
|
317
|
+
principal: string; // Staked amount (kelvins)
|
|
318
|
+
validator: string; // Validator address
|
|
319
|
+
routingFraction: number; // 0.0 - 1.0
|
|
320
|
+
creditBalance: string; // Current credits
|
|
321
|
+
creditsPerEpoch: string; // Estimated yield
|
|
322
|
+
status: 'active' | 'pending' | 'closed';
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
interface SfSCreditBalance {
|
|
326
|
+
available: string;
|
|
327
|
+
usedThisEpoch: string;
|
|
328
|
+
totalEarned: string;
|
|
329
|
+
estimatedPerEpoch: string;
|
|
242
330
|
}
|
|
243
331
|
```
|
|
244
332
|
|
|
245
|
-
##
|
|
333
|
+
## Scan-to-Connect
|
|
334
|
+
|
|
335
|
+
Connect wallet on one device to dApp on another via QR code.
|
|
336
|
+
|
|
337
|
+
### Bidirectional Flow
|
|
246
338
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
339
|
+
**dApp → Wallet**: dApp shows QR, user scans with mobile Sheep Wallet
|
|
340
|
+
**Wallet → dApp**: Wallet shows QR (Settings → Show Connect QR), dApp scans
|
|
341
|
+
|
|
342
|
+
### URI Format
|
|
343
|
+
|
|
344
|
+
```
|
|
345
|
+
rialo-wc://{sessionId}?relay={relayUrl}&topic={topic}&networks=devnet
|
|
346
|
+
```
|
|
253
347
|
|
|
254
348
|
## Utilities
|
|
255
349
|
|
|
256
350
|
```typescript
|
|
257
|
-
import {
|
|
258
|
-
formatAddress,
|
|
259
|
-
formatBalance,
|
|
260
|
-
parseBalance,
|
|
261
|
-
isValidAddress,
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
isRialoInstalled, // () => boolean
|
|
265
|
-
getRialoProvider, // () => RialoProvider | undefined
|
|
266
|
-
waitForRialoProvider, // (timeout?) => Promise<RialoProvider>
|
|
267
|
-
NETWORKS, // Network configurations
|
|
351
|
+
import {
|
|
352
|
+
formatAddress, // (address, chars?) => "5YNm...VWr8"
|
|
353
|
+
formatBalance, // (kelvins, decimals?) => "1.0000"
|
|
354
|
+
parseBalance, // (rlo) => bigint (kelvins)
|
|
355
|
+
isValidAddress, // (address) => boolean
|
|
356
|
+
isInstalled, // () => boolean
|
|
357
|
+
NETWORKS, // Network configurations
|
|
268
358
|
} from '@cookill/wallet-adapter';
|
|
269
359
|
```
|
|
270
360
|
|
|
271
361
|
## TypeScript
|
|
272
362
|
|
|
273
|
-
Full TypeScript support with all types exported:
|
|
274
|
-
|
|
275
363
|
```typescript
|
|
276
364
|
import type {
|
|
277
|
-
WalletAccount,
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
RialoChain,
|
|
365
|
+
WalletAccount, TransactionRequest, TransactionResult,
|
|
366
|
+
SignedMessage, NetworkConfig, WalletInfo, RialoProvider,
|
|
367
|
+
RialoNetwork, RialoChainId,
|
|
368
|
+
// REX
|
|
369
|
+
REXConfig, REXCapabilities, REXTransactionResult, REXPrivacyMode,
|
|
370
|
+
// SfS
|
|
371
|
+
SfSPosition, SfSCreateParams, SfSUpdateParams, SfSCreditBalance,
|
|
372
|
+
// Scan-to-Connect
|
|
373
|
+
ScanConnectSession, ScanConnectURI, ScanConnectStatus,
|
|
287
374
|
} from '@cookill/wallet-adapter';
|
|
288
375
|
```
|
|
289
376
|
|
|
290
|
-
##
|
|
291
|
-
|
|
292
|
-
### Modal not opening / Connection stuck
|
|
377
|
+
## Migration from v3.0
|
|
293
378
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
379
|
+
```diff
|
|
380
|
+
// Imports unchanged
|
|
381
|
+
import { WalletProvider, ConnectButton } from '@cookill/wallet-adapter/react';
|
|
297
382
|
|
|
298
|
-
|
|
383
|
+
// Hook usage unchanged
|
|
384
|
+
const { connect, connected } = useWallet();
|
|
299
385
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
386
|
+
// New in v3.1:
|
|
387
|
+
+ import { useREX, useSfS, useScanConnect } from '@cookill/wallet-adapter/react';
|
|
388
|
+
+ const { submitREXTransaction } = useREX();
|
|
389
|
+
+ const { sendGasless, hasCredits } = useSfS();
|
|
390
|
+
+ const { generateQR, scanURI } = useScanConnect();
|
|
303
391
|
|
|
304
|
-
|
|
392
|
+
// WalletProvider now supports scanConnectRelay prop
|
|
393
|
+
+ <WalletProvider scanConnectRelay="wss://relay.rialo.io">
|
|
305
394
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
3. Verify recipient address is valid
|
|
395
|
+
// ConnectButton now shows feature badges
|
|
396
|
+
+ <ConnectButton showFeatures={true} />
|
|
309
397
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
### v2.5.0
|
|
313
|
-
- Fixed bundling to properly externalize React
|
|
314
|
-
- Added WalletErrorBoundary component
|
|
315
|
-
- Added loading states (ApprovalPending, ConnectionStatus)
|
|
316
|
-
- Improved modal with singleton pattern
|
|
317
|
-
- Updated Vite configuration requirements
|
|
318
|
-
|
|
319
|
-
### v2.4.x
|
|
320
|
-
- Initial public release
|
|
398
|
+
// Connect modal now has "Scan to Connect" tab built-in
|
|
399
|
+
```
|
|
321
400
|
|
|
322
401
|
## License
|
|
323
402
|
|
|
324
|
-
MIT
|
|
403
|
+
MIT
|