@rialo/frost 0.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/LICENSE +201 -0
- package/README.md +778 -0
- package/dist/index.cjs +1025 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +504 -0
- package/dist/index.d.ts +504 -0
- package/dist/index.js +998 -0
- package/dist/index.js.map +1 -0
- package/package.json +78 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
import { FrostConfig, WalletEntity, AccountEntity, RialoClientConfig, RialoClient, ConnectionStatus, ConnectResult, ConnectOptions, SignMessageResult, SignMessageOptions, SendTransactionResult, SignAndSendTransactionResult, SignTransactionResult, SendTransactionType, SignAndSendTransactionOptions, SignTransactionOptions } from '@rialo/frost-core';
|
|
2
|
+
export * from '@rialo/frost-core';
|
|
3
|
+
import { QueryClient, UseMutationResult } from '@tanstack/react-query';
|
|
4
|
+
import { ReactNode, CSSProperties } from 'react';
|
|
5
|
+
|
|
6
|
+
interface FrostProviderProps {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Frost configuration object created with `createConfig()`.
|
|
10
|
+
*
|
|
11
|
+
* **Important:** Create the config outside of React components to ensure
|
|
12
|
+
* it's only created once and remains stable across re-renders.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* // config.ts
|
|
17
|
+
* import { createConfig, getDefaultRialoClientConfig } from '@rialo/frost-core';
|
|
18
|
+
*
|
|
19
|
+
* export const config = createConfig({
|
|
20
|
+
* clientConfig: getDefaultRialoClientConfig('devnet'),
|
|
21
|
+
* });
|
|
22
|
+
*
|
|
23
|
+
* // App.tsx
|
|
24
|
+
* import { FrostProvider } from '@rialo/frost';
|
|
25
|
+
* import { config } from './config';
|
|
26
|
+
*
|
|
27
|
+
* function App() {
|
|
28
|
+
* return (
|
|
29
|
+
* <FrostProvider config={config}>
|
|
30
|
+
* <YourApp />
|
|
31
|
+
* </FrostProvider>
|
|
32
|
+
* );
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
config: FrostConfig;
|
|
37
|
+
/** Optional external QueryClient (for sharing with app) */
|
|
38
|
+
queryClient?: QueryClient;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Provider component for Frost.
|
|
42
|
+
* Initializes wallet discovery, event handling, and provides config to hooks.
|
|
43
|
+
*/
|
|
44
|
+
declare function FrostProvider({ children, config, queryClient: externalQueryClient, }: Readonly<FrostProviderProps>): ReactNode;
|
|
45
|
+
/**
|
|
46
|
+
* Hook to access the DappKit config.
|
|
47
|
+
* Must be used within a FrostProvider.
|
|
48
|
+
*/
|
|
49
|
+
declare function useFrostConfig(): FrostConfig;
|
|
50
|
+
|
|
51
|
+
/** biome-ignore-all lint/nursery/useExplicitType: <mouse events> */
|
|
52
|
+
|
|
53
|
+
interface ConnectButtonProps {
|
|
54
|
+
/** Label shown when disconnected */
|
|
55
|
+
label?: string;
|
|
56
|
+
/** Label shown while connecting */
|
|
57
|
+
connectingLabel?: string;
|
|
58
|
+
/** Label or formatter for connected state */
|
|
59
|
+
connectedLabel?: string | ((address: string, walletName: string) => string);
|
|
60
|
+
/** Callback when wallet successfully connects */
|
|
61
|
+
onConnect?: (walletName: string, address: string) => void;
|
|
62
|
+
/** Callback when wallet disconnects */
|
|
63
|
+
onDisconnect?: () => void;
|
|
64
|
+
/** Callback when connection fails */
|
|
65
|
+
onError?: (error: Error) => void;
|
|
66
|
+
/** Additional class name for the button */
|
|
67
|
+
className?: string;
|
|
68
|
+
/** Additional styles for the button */
|
|
69
|
+
style?: CSSProperties;
|
|
70
|
+
/** Whether the button is disabled */
|
|
71
|
+
disabled?: boolean;
|
|
72
|
+
/** Title for the wallet selection modal */
|
|
73
|
+
modalTitle?: string;
|
|
74
|
+
/** Whether to show the connected dropdown menu @default true */
|
|
75
|
+
showDropdown?: boolean;
|
|
76
|
+
/** Additional class for the dropdown menu */
|
|
77
|
+
dropdownClassName?: string;
|
|
78
|
+
}
|
|
79
|
+
declare function ConnectButton({ label, connectingLabel, connectedLabel, onConnect, onDisconnect, onError, className, style, disabled, modalTitle, showDropdown, dropdownClassName, }: ConnectButtonProps): ReactNode;
|
|
80
|
+
|
|
81
|
+
interface WalletModalProps {
|
|
82
|
+
/** Whether the modal is open */
|
|
83
|
+
open: boolean;
|
|
84
|
+
/** Callback when modal should close */
|
|
85
|
+
onClose: () => void;
|
|
86
|
+
/** Callback when wallet connection succeeds */
|
|
87
|
+
onConnect?: (walletName: string, address: string) => void;
|
|
88
|
+
/** Callback when wallet connection fails */
|
|
89
|
+
onError?: (error: Error, walletName: string) => void;
|
|
90
|
+
/** Modal title */
|
|
91
|
+
title?: string;
|
|
92
|
+
/** Additional class name for the modal overlay */
|
|
93
|
+
className?: string;
|
|
94
|
+
/** Additional class name for the modal content */
|
|
95
|
+
contentClassName?: string;
|
|
96
|
+
/** Custom styles for the modal */
|
|
97
|
+
style?: CSSProperties;
|
|
98
|
+
/** Render prop for custom wallet item rendering */
|
|
99
|
+
renderWallet?: (wallet: WalletEntity, connect: () => void, isConnecting: boolean) => ReactNode;
|
|
100
|
+
}
|
|
101
|
+
declare function WalletModal({ open, onClose, onConnect, onError, title, className, contentClassName, style, renderWallet, }: WalletModalProps): ReactNode;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Hook to get all known accounts.
|
|
105
|
+
*
|
|
106
|
+
* @returns Array of account entities (memoized)
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```tsx
|
|
110
|
+
* function AccountList() {
|
|
111
|
+
* const accounts = useAccounts();
|
|
112
|
+
*
|
|
113
|
+
* return (
|
|
114
|
+
* <ul>
|
|
115
|
+
* {accounts.map(acc => (
|
|
116
|
+
* <li key={acc.address}>{acc.address}</li>
|
|
117
|
+
* ))}
|
|
118
|
+
* </ul>
|
|
119
|
+
* );
|
|
120
|
+
* }
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
declare function useAccounts(): AccountEntity[];
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Hook to get the currently active account.
|
|
127
|
+
*
|
|
128
|
+
* @returns Active account or null if not connected
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```tsx
|
|
132
|
+
* function AccountInfo() {
|
|
133
|
+
* const account = useActiveAccount();
|
|
134
|
+
*
|
|
135
|
+
* if (!account) return <div>Not connected</div>;
|
|
136
|
+
* return <div>Address: {account.address}</div>;
|
|
137
|
+
* }
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
declare function useActiveAccount(): AccountEntity | null;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Hook to get the currently active wallet.
|
|
144
|
+
*
|
|
145
|
+
* @returns Active wallet or null if not connected
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```tsx
|
|
149
|
+
* function WalletInfo() {
|
|
150
|
+
* const wallet = useActiveWallet();
|
|
151
|
+
*
|
|
152
|
+
* if (!wallet) return <div>No wallet connected</div>;
|
|
153
|
+
* return <div>Connected to: {wallet.name}</div>;
|
|
154
|
+
* }
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
declare function useActiveWallet(): WalletEntity | null;
|
|
158
|
+
|
|
159
|
+
interface UseSwitchChainOptions {
|
|
160
|
+
onSuccess?: () => void;
|
|
161
|
+
onError?: (error: Error) => void;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Hook to switch to a different chain/network.
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```tsx
|
|
168
|
+
* import { getDefaultRialoClientConfig } from '@rialo/ts-cdk';
|
|
169
|
+
*
|
|
170
|
+
* function NetworkSwitcher() {
|
|
171
|
+
* const switchChain = useSwitchChain();
|
|
172
|
+
*
|
|
173
|
+
* return (
|
|
174
|
+
* <button
|
|
175
|
+
* onClick={() => switchChain(getDefaultRialoClientConfig('mainnet'))}
|
|
176
|
+
* >
|
|
177
|
+
* Switch to Mainnet
|
|
178
|
+
* </button>
|
|
179
|
+
* );
|
|
180
|
+
* }
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
declare function useSwitchChain(): (clientConfig: RialoClientConfig) => void;
|
|
184
|
+
/**
|
|
185
|
+
* Hook to get the current chain ID.
|
|
186
|
+
* Reactively updates when chain changes.
|
|
187
|
+
*
|
|
188
|
+
* The selector is stable (defined at module level) to prevent
|
|
189
|
+
* unnecessary re-subscriptions.
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* ```tsx
|
|
193
|
+
* function NetworkDisplay() {
|
|
194
|
+
* const chainId = useChainId();
|
|
195
|
+
* return <div>Connected to: {chainId}</div>;
|
|
196
|
+
* }
|
|
197
|
+
* ```
|
|
198
|
+
*/
|
|
199
|
+
declare function useChainId(): string;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Hook to access the RialoClient instance.
|
|
203
|
+
*
|
|
204
|
+
* The client can be used for blockchain queries and transactions:
|
|
205
|
+
* - Query balances and account info
|
|
206
|
+
* - Get transaction details
|
|
207
|
+
* - Send signed transactions directly
|
|
208
|
+
* - Request airdrops (devnet/testnet)
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* ```tsx
|
|
212
|
+
* function BalanceDisplay({ address }: { address: string }) {
|
|
213
|
+
* const client = useClient();
|
|
214
|
+
* const [balance, setBalance] = useState<bigint | null>(null);
|
|
215
|
+
*
|
|
216
|
+
* useEffect(() => {
|
|
217
|
+
* client.getBalance(PublicKey.fromString(address))
|
|
218
|
+
* .then(setBalance);
|
|
219
|
+
* }, [client, address]);
|
|
220
|
+
*
|
|
221
|
+
* return <div>Balance: {balance?.toString() ?? 'Loading...'}</div>;
|
|
222
|
+
* }
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
declare function useClient(): RialoClient;
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Hook to get the current connection status.
|
|
229
|
+
*
|
|
230
|
+
* @returns Connection status: "disconnected" | "connecting" | "connected" | "reconnecting"
|
|
231
|
+
*
|
|
232
|
+
* @example
|
|
233
|
+
* ```tsx
|
|
234
|
+
* function StatusIndicator() {
|
|
235
|
+
* const status = useConnectionStatus();
|
|
236
|
+
* return <div>Status: {status}</div>;
|
|
237
|
+
* }
|
|
238
|
+
* ```
|
|
239
|
+
*/
|
|
240
|
+
declare function useConnectionStatus(): ConnectionStatus;
|
|
241
|
+
/**
|
|
242
|
+
* Hook to check if currently connected.
|
|
243
|
+
*
|
|
244
|
+
* @returns True if a wallet is connected
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* ```tsx
|
|
248
|
+
* function App() {
|
|
249
|
+
* const isConnected = useIsConnected();
|
|
250
|
+
* return isConnected ? <Dashboard /> : <ConnectPrompt />;
|
|
251
|
+
* }
|
|
252
|
+
* ```
|
|
253
|
+
*/
|
|
254
|
+
declare function useIsConnected(): boolean;
|
|
255
|
+
|
|
256
|
+
interface UseConnectWalletOptions {
|
|
257
|
+
onSuccess?: (result: ConnectResult) => void;
|
|
258
|
+
onError?: (error: Error) => void;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Hook to connect to a wallet.
|
|
262
|
+
*
|
|
263
|
+
* @param options - Callbacks for success/error handling
|
|
264
|
+
* @returns Mutation to trigger wallet connection
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* ```tsx
|
|
268
|
+
* function ConnectButton() {
|
|
269
|
+
* const { mutate: connect, isPending } = useConnectWallet({
|
|
270
|
+
* onSuccess: () => console.log('Connected!'),
|
|
271
|
+
* });
|
|
272
|
+
*
|
|
273
|
+
* return (
|
|
274
|
+
* <button onClick={() => connect({ walletName: 'Rialo' })} disabled={isPending}>
|
|
275
|
+
* Connect
|
|
276
|
+
* </button>
|
|
277
|
+
* );
|
|
278
|
+
* }
|
|
279
|
+
* ```
|
|
280
|
+
*/
|
|
281
|
+
declare function useConnectWallet(options?: UseConnectWalletOptions): UseMutationResult<ConnectResult, Error, ConnectOptions>;
|
|
282
|
+
interface UseDisconnectWalletOptions {
|
|
283
|
+
onSuccess?: () => void;
|
|
284
|
+
onError?: (error: Error) => void;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Hook to disconnect the current wallet.
|
|
288
|
+
*
|
|
289
|
+
* @param options - Callbacks for success/error handling
|
|
290
|
+
* @returns Mutation to trigger wallet disconnection
|
|
291
|
+
*
|
|
292
|
+
* @example
|
|
293
|
+
* ```tsx
|
|
294
|
+
* function DisconnectButton() {
|
|
295
|
+
* const { mutate: disconnect } = useDisconnectWallet();
|
|
296
|
+
* return <button onClick={() => disconnect()}>Disconnect</button>;
|
|
297
|
+
* }
|
|
298
|
+
* ```
|
|
299
|
+
*/
|
|
300
|
+
declare function useDisconnectWallet(options?: UseDisconnectWalletOptions): UseMutationResult<void, Error, void>;
|
|
301
|
+
|
|
302
|
+
interface UseNativeBalanceOptions {
|
|
303
|
+
/**
|
|
304
|
+
* Address to query balance for.
|
|
305
|
+
* Defaults to the active account address if not provided.
|
|
306
|
+
*/
|
|
307
|
+
address?: string;
|
|
308
|
+
/**
|
|
309
|
+
* Number of decimal places for the native token.
|
|
310
|
+
* Used for formatting the balance.
|
|
311
|
+
* @default 9 (standard for Solana-based chains)
|
|
312
|
+
*/
|
|
313
|
+
decimals?: number;
|
|
314
|
+
}
|
|
315
|
+
interface UseNativeBalanceResult {
|
|
316
|
+
/** Raw balance in lamports/smallest unit */
|
|
317
|
+
balance: bigint | undefined;
|
|
318
|
+
/** Human-readable formatted balance (e.g., "1.5") */
|
|
319
|
+
formatted: string | undefined;
|
|
320
|
+
/** Whether the query is currently loading */
|
|
321
|
+
isLoading: boolean;
|
|
322
|
+
/** Whether the query is fetching (initial or refetch) */
|
|
323
|
+
isFetching: boolean;
|
|
324
|
+
/** Whether the query encountered an error */
|
|
325
|
+
isError: boolean;
|
|
326
|
+
/** Error object if query failed */
|
|
327
|
+
error: Error | null;
|
|
328
|
+
/** Manually trigger a refetch */
|
|
329
|
+
refetch: () => void;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Hook to query the native token balance for an address.
|
|
333
|
+
*
|
|
334
|
+
* @example
|
|
335
|
+
* ```tsx
|
|
336
|
+
* function MyBalance() {
|
|
337
|
+
* const { balance, formatted, isLoading } = useNativeBalance();
|
|
338
|
+
* if (isLoading) return <div>Loading...</div>;
|
|
339
|
+
* return <div>Balance: {formatted} RIA</div>;
|
|
340
|
+
* }
|
|
341
|
+
* ```
|
|
342
|
+
*/
|
|
343
|
+
declare function useNativeBalance(options?: UseNativeBalanceOptions): UseNativeBalanceResult;
|
|
344
|
+
|
|
345
|
+
interface UseSignMessageOptions {
|
|
346
|
+
onSuccess?: (result: SignMessageResult) => void;
|
|
347
|
+
onError?: (error: Error) => void;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Hook to sign an arbitrary message.
|
|
351
|
+
*
|
|
352
|
+
* @param options - Callbacks for success/error handling
|
|
353
|
+
* @returns Mutation to trigger message signing
|
|
354
|
+
*
|
|
355
|
+
* @example
|
|
356
|
+
* ```tsx
|
|
357
|
+
* function SignButton() {
|
|
358
|
+
* const { mutate: sign, isPending } = useSignMessage({
|
|
359
|
+
* onSuccess: (result) => console.log('Signature:', result.signature),
|
|
360
|
+
* });
|
|
361
|
+
*
|
|
362
|
+
* return (
|
|
363
|
+
* <button onClick={() => sign({ message: 'Hello World' })} disabled={isPending}>
|
|
364
|
+
* Sign Message
|
|
365
|
+
* </button>
|
|
366
|
+
* );
|
|
367
|
+
* }
|
|
368
|
+
* ```
|
|
369
|
+
*/
|
|
370
|
+
declare function useSignMessage(options?: UseSignMessageOptions): UseMutationResult<SignMessageResult, Error, SignMessageOptions>;
|
|
371
|
+
|
|
372
|
+
interface UseSignTransactionOptions {
|
|
373
|
+
onSuccess?: (result: SignTransactionResult) => void;
|
|
374
|
+
onError?: (error: Error) => void;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Hook to sign a transaction without sending.
|
|
378
|
+
*
|
|
379
|
+
* @param options - Callbacks for success/error handling
|
|
380
|
+
* @returns Mutation to trigger transaction signing
|
|
381
|
+
*
|
|
382
|
+
* @example
|
|
383
|
+
* ```tsx
|
|
384
|
+
* function SignTxButton({ transaction }: { transaction: Uint8Array }) {
|
|
385
|
+
* const { mutate: sign, isPending } = useSignTransaction();
|
|
386
|
+
*
|
|
387
|
+
* return (
|
|
388
|
+
* <button onClick={() => sign({ transaction })} disabled={isPending}>
|
|
389
|
+
* Sign Transaction
|
|
390
|
+
* </button>
|
|
391
|
+
* );
|
|
392
|
+
* }
|
|
393
|
+
* ```
|
|
394
|
+
*/
|
|
395
|
+
declare function useSignTransaction(options?: UseSignTransactionOptions): UseMutationResult<SignTransactionResult, Error, SignTransactionOptions>;
|
|
396
|
+
interface UseSendTransactionOptions {
|
|
397
|
+
onSuccess?: (result: SendTransactionResult) => void;
|
|
398
|
+
onError?: (error: Error) => void;
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Hook to sign and send a transaction using the wallet's built-in send feature.
|
|
402
|
+
*
|
|
403
|
+
* @param options - Callbacks for success/error handling
|
|
404
|
+
* @returns Mutation to trigger transaction signing and sending
|
|
405
|
+
*
|
|
406
|
+
* @example
|
|
407
|
+
* ```tsx
|
|
408
|
+
* function SendTxButton({ transaction }: { transaction: Uint8Array }) {
|
|
409
|
+
* const { mutate: send, isPending } = useSendTransaction();
|
|
410
|
+
*
|
|
411
|
+
* return (
|
|
412
|
+
* <button onClick={() => send({ transaction })} disabled={isPending}>
|
|
413
|
+
* Send Transaction
|
|
414
|
+
* </button>
|
|
415
|
+
* );
|
|
416
|
+
* }
|
|
417
|
+
* ```
|
|
418
|
+
*/
|
|
419
|
+
declare function useSendTransaction(options?: UseSendTransactionOptions): UseMutationResult<SendTransactionResult, Error, SendTransactionType>;
|
|
420
|
+
interface UseSignAndSendTransactionOptions {
|
|
421
|
+
onSuccess?: (result: SignAndSendTransactionResult) => void;
|
|
422
|
+
onError?: (error: Error) => void;
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Hook to sign a transaction with the wallet, send it via Frost's RPC client,
|
|
426
|
+
* and wait for confirmation.
|
|
427
|
+
*
|
|
428
|
+
* This provides more control over transaction submission compared to useSendTransaction,
|
|
429
|
+
* as it uses Frost's own RPC client instead of the wallet's built-in send.
|
|
430
|
+
* This is useful when you want to:
|
|
431
|
+
* - Use a custom RPC URL (configured via ChainDefinition.rpcUrl)
|
|
432
|
+
* - Have more control over retry logic and confirmation
|
|
433
|
+
* - Not rely on the wallet's send implementation
|
|
434
|
+
*
|
|
435
|
+
* @returns Mutation that resolves with confirmed transaction details (signature, executed)
|
|
436
|
+
* @throws {TransactionFailedError} If the transaction is confirmed but execution failed on-chain
|
|
437
|
+
*
|
|
438
|
+
* @example
|
|
439
|
+
* ```tsx
|
|
440
|
+
* function SendButton() {
|
|
441
|
+
* const { mutate: signAndSend, isPending } = useSignAndSendTransaction({
|
|
442
|
+
* onSuccess: (result) => {
|
|
443
|
+
* console.log('Confirmed and executed:', result.signature);
|
|
444
|
+
* },
|
|
445
|
+
* onError: (error) => {
|
|
446
|
+
* if (error instanceof TransactionFailedError) {
|
|
447
|
+
* console.error('Transaction failed on-chain:', error.reason);
|
|
448
|
+
* }
|
|
449
|
+
* },
|
|
450
|
+
* });
|
|
451
|
+
*
|
|
452
|
+
* const handleSend = () => {
|
|
453
|
+
* signAndSend({
|
|
454
|
+
* transaction: myTransaction,
|
|
455
|
+
* sendOptions: { skipPreflight: false, maxRetries: 3 },
|
|
456
|
+
* });
|
|
457
|
+
* };
|
|
458
|
+
*
|
|
459
|
+
* return <button onClick={handleSend} disabled={isPending}>Send</button>;
|
|
460
|
+
* }
|
|
461
|
+
* ```
|
|
462
|
+
*/
|
|
463
|
+
declare function useSignAndSendTransaction(options?: UseSignAndSendTransactionOptions): UseMutationResult<SignAndSendTransactionResult, Error, SignAndSendTransactionOptions>;
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* Hook to get sorted wallets list.
|
|
467
|
+
* Wallets are sorted by priority (higher first) then by last connected time.
|
|
468
|
+
*
|
|
469
|
+
* @returns Sorted array of wallet entities (memoized)
|
|
470
|
+
*
|
|
471
|
+
* @example
|
|
472
|
+
* ```tsx
|
|
473
|
+
* function WalletList() {
|
|
474
|
+
* const wallets = useWallets();
|
|
475
|
+
*
|
|
476
|
+
* return (
|
|
477
|
+
* <ul>
|
|
478
|
+
* {wallets.map(w => (
|
|
479
|
+
* <li key={w.name}>{w.name}</li>
|
|
480
|
+
* ))}
|
|
481
|
+
* </ul>
|
|
482
|
+
* );
|
|
483
|
+
* }
|
|
484
|
+
* ```
|
|
485
|
+
*/
|
|
486
|
+
declare function useWallets(): WalletEntity[];
|
|
487
|
+
/**
|
|
488
|
+
* Hook to check if wallets have been discovered.
|
|
489
|
+
*
|
|
490
|
+
* @returns True if at least one wallet has been discovered
|
|
491
|
+
*
|
|
492
|
+
* @example
|
|
493
|
+
* ```tsx
|
|
494
|
+
* function ConnectButton() {
|
|
495
|
+
* const walletsReady = useWalletsReady();
|
|
496
|
+
*
|
|
497
|
+
* if (!walletsReady) return <div>Searching for wallets...</div>;
|
|
498
|
+
* return <button>Connect Wallet</button>;
|
|
499
|
+
* }
|
|
500
|
+
* ```
|
|
501
|
+
*/
|
|
502
|
+
declare function useWalletsReady(): boolean;
|
|
503
|
+
|
|
504
|
+
export { ConnectButton, type ConnectButtonProps, FrostProvider, type FrostProviderProps, type UseConnectWalletOptions, type UseDisconnectWalletOptions, type UseNativeBalanceOptions, type UseNativeBalanceResult, type UseSendTransactionOptions, type UseSignAndSendTransactionOptions, type UseSignMessageOptions, type UseSignTransactionOptions, type UseSwitchChainOptions, WalletModal, type WalletModalProps, useAccounts, useActiveAccount, useActiveWallet, useChainId, useClient, useConnectWallet, useConnectionStatus, useDisconnectWallet, useFrostConfig, useIsConnected, useNativeBalance, useSendTransaction, useSignAndSendTransaction, useSignMessage, useSignTransaction, useSwitchChain, useWallets, useWalletsReady };
|