@tbookdev/vault-react 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.
@@ -0,0 +1,748 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React, { ReactNode } from 'react';
3
+ import * as _tbookdev_vault_sdk from '@tbookdev/vault-sdk';
4
+ import { SolanaNetwork, TBookVault, VaultInfoResult, UserAccount, SharePriceData, VaultTransaction } from '@tbookdev/vault-sdk';
5
+ export { DepositEpochInfo, EpochStatus, RedeemEpochInfo, SharePriceData, SolanaNetwork, TransactionHistoryOptions, TransactionResult, UserAccount, VaultInfo, VaultInfoResult, VaultTransaction } from '@tbookdev/vault-sdk';
6
+ import * as _tanstack_react_query from '@tanstack/react-query';
7
+
8
+ /** Props for {@link TBookVaultProvider}. */
9
+ interface TBookVaultProviderProps {
10
+ /** Solana network. */
11
+ network: SolanaNetwork;
12
+ /** Optional TBook API key for higher rate limits. */
13
+ apiKey?: string;
14
+ /** Optional custom RPC URL (overrides the connection from wallet adapter). */
15
+ rpcUrl?: string;
16
+ children: ReactNode;
17
+ }
18
+ interface TBookVaultContextValue {
19
+ /** The SDK client instance. */
20
+ vault: TBookVault;
21
+ /** Current network. */
22
+ network: SolanaNetwork;
23
+ }
24
+ /**
25
+ * Provides a shared {@link TBookVault} instance to all descendant hooks.
26
+ *
27
+ * The client is memoized and only re-created when network or rpcUrl changes.
28
+ */
29
+ declare function TBookVaultProvider({ network, apiKey, rpcUrl, children, }: TBookVaultProviderProps): react_jsx_runtime.JSX.Element;
30
+ /**
31
+ * Access the TBook Vault SDK client from context.
32
+ *
33
+ * @throws Error if used outside a {@link TBookVaultProvider}
34
+ */
35
+ declare function useTBookVault(): TBookVaultContextValue;
36
+
37
+ /**
38
+ * Fetch vault state, current deposit epoch, and current redeem epoch.
39
+ *
40
+ * Query key: `["tbook", "vault", vaultId]`
41
+ *
42
+ * @param vaultId - Vault identifier (default: "rcUSDP")
43
+ */
44
+ declare function useVaultInfo(vaultId?: string): _tanstack_react_query.UseQueryResult<VaultInfoResult, Error>;
45
+ /** Convenience: vault data only. */
46
+ declare function useVault(vaultId?: string): {
47
+ error: Error;
48
+ isError: true;
49
+ isPending: false;
50
+ isLoading: false;
51
+ isLoadingError: false;
52
+ isRefetchError: true;
53
+ isSuccess: false;
54
+ isPlaceholderData: false;
55
+ status: "error";
56
+ dataUpdatedAt: number;
57
+ errorUpdatedAt: number;
58
+ failureCount: number;
59
+ failureReason: Error | null;
60
+ errorUpdateCount: number;
61
+ isFetched: boolean;
62
+ isFetchedAfterMount: boolean;
63
+ isFetching: boolean;
64
+ isInitialLoading: boolean;
65
+ isPaused: boolean;
66
+ isRefetching: boolean;
67
+ isStale: boolean;
68
+ isEnabled: boolean;
69
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<VaultInfoResult, Error>>;
70
+ fetchStatus: _tanstack_react_query.FetchStatus;
71
+ promise: Promise<VaultInfoResult>;
72
+ vault: _tbookdev_vault_sdk.VaultInfo | null;
73
+ } | {
74
+ error: null;
75
+ isError: false;
76
+ isPending: false;
77
+ isLoading: false;
78
+ isLoadingError: false;
79
+ isRefetchError: false;
80
+ isSuccess: true;
81
+ isPlaceholderData: false;
82
+ status: "success";
83
+ dataUpdatedAt: number;
84
+ errorUpdatedAt: number;
85
+ failureCount: number;
86
+ failureReason: Error | null;
87
+ errorUpdateCount: number;
88
+ isFetched: boolean;
89
+ isFetchedAfterMount: boolean;
90
+ isFetching: boolean;
91
+ isInitialLoading: boolean;
92
+ isPaused: boolean;
93
+ isRefetching: boolean;
94
+ isStale: boolean;
95
+ isEnabled: boolean;
96
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<VaultInfoResult, Error>>;
97
+ fetchStatus: _tanstack_react_query.FetchStatus;
98
+ promise: Promise<VaultInfoResult>;
99
+ vault: _tbookdev_vault_sdk.VaultInfo | null;
100
+ } | {
101
+ error: Error;
102
+ isError: true;
103
+ isPending: false;
104
+ isLoading: false;
105
+ isLoadingError: true;
106
+ isRefetchError: false;
107
+ isSuccess: false;
108
+ isPlaceholderData: false;
109
+ status: "error";
110
+ dataUpdatedAt: number;
111
+ errorUpdatedAt: number;
112
+ failureCount: number;
113
+ failureReason: Error | null;
114
+ errorUpdateCount: number;
115
+ isFetched: boolean;
116
+ isFetchedAfterMount: boolean;
117
+ isFetching: boolean;
118
+ isInitialLoading: boolean;
119
+ isPaused: boolean;
120
+ isRefetching: boolean;
121
+ isStale: boolean;
122
+ isEnabled: boolean;
123
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<VaultInfoResult, Error>>;
124
+ fetchStatus: _tanstack_react_query.FetchStatus;
125
+ promise: Promise<VaultInfoResult>;
126
+ vault: _tbookdev_vault_sdk.VaultInfo | null;
127
+ } | {
128
+ error: null;
129
+ isError: false;
130
+ isPending: true;
131
+ isLoading: true;
132
+ isLoadingError: false;
133
+ isRefetchError: false;
134
+ isSuccess: false;
135
+ isPlaceholderData: false;
136
+ status: "pending";
137
+ dataUpdatedAt: number;
138
+ errorUpdatedAt: number;
139
+ failureCount: number;
140
+ failureReason: Error | null;
141
+ errorUpdateCount: number;
142
+ isFetched: boolean;
143
+ isFetchedAfterMount: boolean;
144
+ isFetching: boolean;
145
+ isInitialLoading: boolean;
146
+ isPaused: boolean;
147
+ isRefetching: boolean;
148
+ isStale: boolean;
149
+ isEnabled: boolean;
150
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<VaultInfoResult, Error>>;
151
+ fetchStatus: _tanstack_react_query.FetchStatus;
152
+ promise: Promise<VaultInfoResult>;
153
+ vault: _tbookdev_vault_sdk.VaultInfo | null;
154
+ } | {
155
+ error: null;
156
+ isError: false;
157
+ isPending: true;
158
+ isLoadingError: false;
159
+ isRefetchError: false;
160
+ isSuccess: false;
161
+ isPlaceholderData: false;
162
+ status: "pending";
163
+ dataUpdatedAt: number;
164
+ errorUpdatedAt: number;
165
+ failureCount: number;
166
+ failureReason: Error | null;
167
+ errorUpdateCount: number;
168
+ isFetched: boolean;
169
+ isFetchedAfterMount: boolean;
170
+ isFetching: boolean;
171
+ isLoading: boolean;
172
+ isInitialLoading: boolean;
173
+ isPaused: boolean;
174
+ isRefetching: boolean;
175
+ isStale: boolean;
176
+ isEnabled: boolean;
177
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<VaultInfoResult, Error>>;
178
+ fetchStatus: _tanstack_react_query.FetchStatus;
179
+ promise: Promise<VaultInfoResult>;
180
+ vault: _tbookdev_vault_sdk.VaultInfo | null;
181
+ } | {
182
+ isError: false;
183
+ error: null;
184
+ isPending: false;
185
+ isLoading: false;
186
+ isLoadingError: false;
187
+ isRefetchError: false;
188
+ isSuccess: true;
189
+ isPlaceholderData: true;
190
+ status: "success";
191
+ dataUpdatedAt: number;
192
+ errorUpdatedAt: number;
193
+ failureCount: number;
194
+ failureReason: Error | null;
195
+ errorUpdateCount: number;
196
+ isFetched: boolean;
197
+ isFetchedAfterMount: boolean;
198
+ isFetching: boolean;
199
+ isInitialLoading: boolean;
200
+ isPaused: boolean;
201
+ isRefetching: boolean;
202
+ isStale: boolean;
203
+ isEnabled: boolean;
204
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<VaultInfoResult, Error>>;
205
+ fetchStatus: _tanstack_react_query.FetchStatus;
206
+ promise: Promise<VaultInfoResult>;
207
+ vault: _tbookdev_vault_sdk.VaultInfo | null;
208
+ };
209
+ /** Convenience: current deposit epoch only. */
210
+ declare function useCurrentDepositEpoch(vaultId?: string): {
211
+ error: Error;
212
+ isError: true;
213
+ isPending: false;
214
+ isLoading: false;
215
+ isLoadingError: false;
216
+ isRefetchError: true;
217
+ isSuccess: false;
218
+ isPlaceholderData: false;
219
+ status: "error";
220
+ dataUpdatedAt: number;
221
+ errorUpdatedAt: number;
222
+ failureCount: number;
223
+ failureReason: Error | null;
224
+ errorUpdateCount: number;
225
+ isFetched: boolean;
226
+ isFetchedAfterMount: boolean;
227
+ isFetching: boolean;
228
+ isInitialLoading: boolean;
229
+ isPaused: boolean;
230
+ isRefetching: boolean;
231
+ isStale: boolean;
232
+ isEnabled: boolean;
233
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<VaultInfoResult, Error>>;
234
+ fetchStatus: _tanstack_react_query.FetchStatus;
235
+ promise: Promise<VaultInfoResult>;
236
+ epoch: _tbookdev_vault_sdk.DepositEpochInfo | null;
237
+ } | {
238
+ error: null;
239
+ isError: false;
240
+ isPending: false;
241
+ isLoading: false;
242
+ isLoadingError: false;
243
+ isRefetchError: false;
244
+ isSuccess: true;
245
+ isPlaceholderData: false;
246
+ status: "success";
247
+ dataUpdatedAt: number;
248
+ errorUpdatedAt: number;
249
+ failureCount: number;
250
+ failureReason: Error | null;
251
+ errorUpdateCount: number;
252
+ isFetched: boolean;
253
+ isFetchedAfterMount: boolean;
254
+ isFetching: boolean;
255
+ isInitialLoading: boolean;
256
+ isPaused: boolean;
257
+ isRefetching: boolean;
258
+ isStale: boolean;
259
+ isEnabled: boolean;
260
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<VaultInfoResult, Error>>;
261
+ fetchStatus: _tanstack_react_query.FetchStatus;
262
+ promise: Promise<VaultInfoResult>;
263
+ epoch: _tbookdev_vault_sdk.DepositEpochInfo | null;
264
+ } | {
265
+ error: Error;
266
+ isError: true;
267
+ isPending: false;
268
+ isLoading: false;
269
+ isLoadingError: true;
270
+ isRefetchError: false;
271
+ isSuccess: false;
272
+ isPlaceholderData: false;
273
+ status: "error";
274
+ dataUpdatedAt: number;
275
+ errorUpdatedAt: number;
276
+ failureCount: number;
277
+ failureReason: Error | null;
278
+ errorUpdateCount: number;
279
+ isFetched: boolean;
280
+ isFetchedAfterMount: boolean;
281
+ isFetching: boolean;
282
+ isInitialLoading: boolean;
283
+ isPaused: boolean;
284
+ isRefetching: boolean;
285
+ isStale: boolean;
286
+ isEnabled: boolean;
287
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<VaultInfoResult, Error>>;
288
+ fetchStatus: _tanstack_react_query.FetchStatus;
289
+ promise: Promise<VaultInfoResult>;
290
+ epoch: _tbookdev_vault_sdk.DepositEpochInfo | null;
291
+ } | {
292
+ error: null;
293
+ isError: false;
294
+ isPending: true;
295
+ isLoading: true;
296
+ isLoadingError: false;
297
+ isRefetchError: false;
298
+ isSuccess: false;
299
+ isPlaceholderData: false;
300
+ status: "pending";
301
+ dataUpdatedAt: number;
302
+ errorUpdatedAt: number;
303
+ failureCount: number;
304
+ failureReason: Error | null;
305
+ errorUpdateCount: number;
306
+ isFetched: boolean;
307
+ isFetchedAfterMount: boolean;
308
+ isFetching: boolean;
309
+ isInitialLoading: boolean;
310
+ isPaused: boolean;
311
+ isRefetching: boolean;
312
+ isStale: boolean;
313
+ isEnabled: boolean;
314
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<VaultInfoResult, Error>>;
315
+ fetchStatus: _tanstack_react_query.FetchStatus;
316
+ promise: Promise<VaultInfoResult>;
317
+ epoch: _tbookdev_vault_sdk.DepositEpochInfo | null;
318
+ } | {
319
+ error: null;
320
+ isError: false;
321
+ isPending: true;
322
+ isLoadingError: false;
323
+ isRefetchError: false;
324
+ isSuccess: false;
325
+ isPlaceholderData: false;
326
+ status: "pending";
327
+ dataUpdatedAt: number;
328
+ errorUpdatedAt: number;
329
+ failureCount: number;
330
+ failureReason: Error | null;
331
+ errorUpdateCount: number;
332
+ isFetched: boolean;
333
+ isFetchedAfterMount: boolean;
334
+ isFetching: boolean;
335
+ isLoading: boolean;
336
+ isInitialLoading: boolean;
337
+ isPaused: boolean;
338
+ isRefetching: boolean;
339
+ isStale: boolean;
340
+ isEnabled: boolean;
341
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<VaultInfoResult, Error>>;
342
+ fetchStatus: _tanstack_react_query.FetchStatus;
343
+ promise: Promise<VaultInfoResult>;
344
+ epoch: _tbookdev_vault_sdk.DepositEpochInfo | null;
345
+ } | {
346
+ isError: false;
347
+ error: null;
348
+ isPending: false;
349
+ isLoading: false;
350
+ isLoadingError: false;
351
+ isRefetchError: false;
352
+ isSuccess: true;
353
+ isPlaceholderData: true;
354
+ status: "success";
355
+ dataUpdatedAt: number;
356
+ errorUpdatedAt: number;
357
+ failureCount: number;
358
+ failureReason: Error | null;
359
+ errorUpdateCount: number;
360
+ isFetched: boolean;
361
+ isFetchedAfterMount: boolean;
362
+ isFetching: boolean;
363
+ isInitialLoading: boolean;
364
+ isPaused: boolean;
365
+ isRefetching: boolean;
366
+ isStale: boolean;
367
+ isEnabled: boolean;
368
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<VaultInfoResult, Error>>;
369
+ fetchStatus: _tanstack_react_query.FetchStatus;
370
+ promise: Promise<VaultInfoResult>;
371
+ epoch: _tbookdev_vault_sdk.DepositEpochInfo | null;
372
+ };
373
+ /** Convenience: current redeem epoch only. */
374
+ declare function useCurrentRedeemEpoch(vaultId?: string): {
375
+ error: Error;
376
+ isError: true;
377
+ isPending: false;
378
+ isLoading: false;
379
+ isLoadingError: false;
380
+ isRefetchError: true;
381
+ isSuccess: false;
382
+ isPlaceholderData: false;
383
+ status: "error";
384
+ dataUpdatedAt: number;
385
+ errorUpdatedAt: number;
386
+ failureCount: number;
387
+ failureReason: Error | null;
388
+ errorUpdateCount: number;
389
+ isFetched: boolean;
390
+ isFetchedAfterMount: boolean;
391
+ isFetching: boolean;
392
+ isInitialLoading: boolean;
393
+ isPaused: boolean;
394
+ isRefetching: boolean;
395
+ isStale: boolean;
396
+ isEnabled: boolean;
397
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<VaultInfoResult, Error>>;
398
+ fetchStatus: _tanstack_react_query.FetchStatus;
399
+ promise: Promise<VaultInfoResult>;
400
+ epoch: _tbookdev_vault_sdk.RedeemEpochInfo | null;
401
+ } | {
402
+ error: null;
403
+ isError: false;
404
+ isPending: false;
405
+ isLoading: false;
406
+ isLoadingError: false;
407
+ isRefetchError: false;
408
+ isSuccess: true;
409
+ isPlaceholderData: false;
410
+ status: "success";
411
+ dataUpdatedAt: number;
412
+ errorUpdatedAt: number;
413
+ failureCount: number;
414
+ failureReason: Error | null;
415
+ errorUpdateCount: number;
416
+ isFetched: boolean;
417
+ isFetchedAfterMount: boolean;
418
+ isFetching: boolean;
419
+ isInitialLoading: boolean;
420
+ isPaused: boolean;
421
+ isRefetching: boolean;
422
+ isStale: boolean;
423
+ isEnabled: boolean;
424
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<VaultInfoResult, Error>>;
425
+ fetchStatus: _tanstack_react_query.FetchStatus;
426
+ promise: Promise<VaultInfoResult>;
427
+ epoch: _tbookdev_vault_sdk.RedeemEpochInfo | null;
428
+ } | {
429
+ error: Error;
430
+ isError: true;
431
+ isPending: false;
432
+ isLoading: false;
433
+ isLoadingError: true;
434
+ isRefetchError: false;
435
+ isSuccess: false;
436
+ isPlaceholderData: false;
437
+ status: "error";
438
+ dataUpdatedAt: number;
439
+ errorUpdatedAt: number;
440
+ failureCount: number;
441
+ failureReason: Error | null;
442
+ errorUpdateCount: number;
443
+ isFetched: boolean;
444
+ isFetchedAfterMount: boolean;
445
+ isFetching: boolean;
446
+ isInitialLoading: boolean;
447
+ isPaused: boolean;
448
+ isRefetching: boolean;
449
+ isStale: boolean;
450
+ isEnabled: boolean;
451
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<VaultInfoResult, Error>>;
452
+ fetchStatus: _tanstack_react_query.FetchStatus;
453
+ promise: Promise<VaultInfoResult>;
454
+ epoch: _tbookdev_vault_sdk.RedeemEpochInfo | null;
455
+ } | {
456
+ error: null;
457
+ isError: false;
458
+ isPending: true;
459
+ isLoading: true;
460
+ isLoadingError: false;
461
+ isRefetchError: false;
462
+ isSuccess: false;
463
+ isPlaceholderData: false;
464
+ status: "pending";
465
+ dataUpdatedAt: number;
466
+ errorUpdatedAt: number;
467
+ failureCount: number;
468
+ failureReason: Error | null;
469
+ errorUpdateCount: number;
470
+ isFetched: boolean;
471
+ isFetchedAfterMount: boolean;
472
+ isFetching: boolean;
473
+ isInitialLoading: boolean;
474
+ isPaused: boolean;
475
+ isRefetching: boolean;
476
+ isStale: boolean;
477
+ isEnabled: boolean;
478
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<VaultInfoResult, Error>>;
479
+ fetchStatus: _tanstack_react_query.FetchStatus;
480
+ promise: Promise<VaultInfoResult>;
481
+ epoch: _tbookdev_vault_sdk.RedeemEpochInfo | null;
482
+ } | {
483
+ error: null;
484
+ isError: false;
485
+ isPending: true;
486
+ isLoadingError: false;
487
+ isRefetchError: false;
488
+ isSuccess: false;
489
+ isPlaceholderData: false;
490
+ status: "pending";
491
+ dataUpdatedAt: number;
492
+ errorUpdatedAt: number;
493
+ failureCount: number;
494
+ failureReason: Error | null;
495
+ errorUpdateCount: number;
496
+ isFetched: boolean;
497
+ isFetchedAfterMount: boolean;
498
+ isFetching: boolean;
499
+ isLoading: boolean;
500
+ isInitialLoading: boolean;
501
+ isPaused: boolean;
502
+ isRefetching: boolean;
503
+ isStale: boolean;
504
+ isEnabled: boolean;
505
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<VaultInfoResult, Error>>;
506
+ fetchStatus: _tanstack_react_query.FetchStatus;
507
+ promise: Promise<VaultInfoResult>;
508
+ epoch: _tbookdev_vault_sdk.RedeemEpochInfo | null;
509
+ } | {
510
+ isError: false;
511
+ error: null;
512
+ isPending: false;
513
+ isLoading: false;
514
+ isLoadingError: false;
515
+ isRefetchError: false;
516
+ isSuccess: true;
517
+ isPlaceholderData: true;
518
+ status: "success";
519
+ dataUpdatedAt: number;
520
+ errorUpdatedAt: number;
521
+ failureCount: number;
522
+ failureReason: Error | null;
523
+ errorUpdateCount: number;
524
+ isFetched: boolean;
525
+ isFetchedAfterMount: boolean;
526
+ isFetching: boolean;
527
+ isInitialLoading: boolean;
528
+ isPaused: boolean;
529
+ isRefetching: boolean;
530
+ isStale: boolean;
531
+ isEnabled: boolean;
532
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<VaultInfoResult, Error>>;
533
+ fetchStatus: _tanstack_react_query.FetchStatus;
534
+ promise: Promise<VaultInfoResult>;
535
+ epoch: _tbookdev_vault_sdk.RedeemEpochInfo | null;
536
+ };
537
+
538
+ /**
539
+ * Fetch the connected user's vault account.
540
+ *
541
+ * Query key: `["tbook", "user", walletAddress, vaultId]`
542
+ * Only enabled when wallet is connected.
543
+ *
544
+ * @param vaultId - Vault identifier (default: "rcUSDP")
545
+ */
546
+ declare function useVaultUser(vaultId?: string): _tanstack_react_query.UseQueryResult<UserAccount | null, Error>;
547
+
548
+ /**
549
+ * Fetch current share price and APY.
550
+ *
551
+ * Query key: `["tbook", "share-price"]`
552
+ */
553
+ declare function useSharePrice(): _tanstack_react_query.UseQueryResult<SharePriceData, Error>;
554
+
555
+ /**
556
+ * React Query hook for the connected user's wallet USDC balance.
557
+ *
558
+ * Reads the SPL Associated Token Account for the vault's USDC mint.
559
+ * Only enabled when wallet is connected and vault info is available.
560
+ *
561
+ * @module hooks/use-usdc-balance
562
+ */
563
+ /**
564
+ * Fetch the connected user's wallet USDC balance.
565
+ *
566
+ * Query key: `["tbook", "usdc-balance", walletAddress]`
567
+ */
568
+ declare function useUsdcBalance(): _tanstack_react_query.UseQueryResult<number, Error>;
569
+
570
+ interface UseTransactionHistoryOptions {
571
+ /** Maximum transactions per page (default: 20). */
572
+ limit?: number;
573
+ /** Vault identifier (default: "rcUSDP"). */
574
+ vaultId?: string;
575
+ }
576
+ /**
577
+ * Fetch paginated vault transaction history for the connected wallet.
578
+ *
579
+ * Query key: `["tbook", "history", walletAddress, vaultId]`
580
+ *
581
+ * @param options - Pagination and vault options
582
+ * @returns Infinite query result with pages of VaultTransaction arrays
583
+ */
584
+ declare function useTransactionHistory(options?: UseTransactionHistoryOptions): _tanstack_react_query.UseInfiniteQueryResult<_tanstack_react_query.InfiniteData<VaultTransaction[], unknown>, Error>;
585
+
586
+ /**
587
+ * Transaction mutation hooks for vault operations.
588
+ *
589
+ * Each mutation:
590
+ * 1. Builds an unsigned transaction via vault-sdk
591
+ * 2. Sends it to the connected wallet for signing
592
+ * 3. Confirms with retry (exponential backoff, expiry detection)
593
+ * 4. Invalidates relevant queries on success
594
+ *
595
+ * All hooks require a connected wallet (via @solana/wallet-adapter-react).
596
+ *
597
+ * @module hooks/use-vault-actions
598
+ */
599
+ /**
600
+ * Deposit USDC into the vault.
601
+ *
602
+ * @param vaultId - Vault identifier (default: "rcUSDP")
603
+ *
604
+ * @example
605
+ * ```tsx
606
+ * const { mutate: deposit, isPending } = useDeposit();
607
+ * <button onClick={() => deposit(100)} disabled={isPending}>
608
+ * Deposit $100
609
+ * </button>
610
+ * ```
611
+ */
612
+ declare function useDeposit(vaultId?: string): _tanstack_react_query.UseMutationResult<string, Error, number, unknown>;
613
+ /**
614
+ * Request redemption of vault shares.
615
+ *
616
+ * @param vaultId - Vault identifier (default: "rcUSDP")
617
+ *
618
+ * @example
619
+ * ```tsx
620
+ * const { mutate: redeem, isPending } = useRedeem();
621
+ * <button onClick={() => redeem(50)}>Redeem 50 shares</button>
622
+ * ```
623
+ */
624
+ declare function useRedeem(vaultId?: string): _tanstack_react_query.UseMutationResult<string, Error, number, unknown>;
625
+ /**
626
+ * Claim settled USDC from the vault.
627
+ * Works even when the vault is paused.
628
+ *
629
+ * @param vaultId - Vault identifier (default: "rcUSDP")
630
+ */
631
+ declare function useClaim(vaultId?: string): _tanstack_react_query.UseMutationResult<string, Error, void, unknown>;
632
+ /**
633
+ * Cancel a pending deposit (returns USDC minus 0.1% fee).
634
+ *
635
+ * @param vaultId - Vault identifier (default: "rcUSDP")
636
+ */
637
+ declare function useCancelDeposit(vaultId?: string): _tanstack_react_query.UseMutationResult<string, Error, void, unknown>;
638
+
639
+ interface DepositWidgetProps {
640
+ /** Callback on successful deposit. */
641
+ onSuccess?: (signature: string) => void;
642
+ /** Callback on deposit error. */
643
+ onError?: (error: Error) => void;
644
+ /** Override minimum deposit (default from vault config). */
645
+ minAmount?: number;
646
+ /** Override maximum deposit. */
647
+ maxAmount?: number;
648
+ /** Vault ID (default: "rcUSDP"). */
649
+ vaultId?: string;
650
+ /** Custom class name. */
651
+ className?: string;
652
+ /** Custom inline styles. */
653
+ style?: React.CSSProperties;
654
+ }
655
+ declare function DepositWidget({ onSuccess, onError, minAmount, maxAmount, vaultId, className, style, }: DepositWidgetProps): react_jsx_runtime.JSX.Element;
656
+
657
+ interface PortfolioCardProps {
658
+ /** Show a Claim button when USDC is claimable. */
659
+ showClaim?: boolean;
660
+ /** Callback after successful claim. */
661
+ onClaim?: (signature: string) => void;
662
+ /** Vault ID (default: "rcUSDP"). */
663
+ vaultId?: string;
664
+ /** Custom class name. */
665
+ className?: string;
666
+ /** Custom inline styles. */
667
+ style?: React.CSSProperties;
668
+ }
669
+ declare function PortfolioCard({ showClaim, onClaim, vaultId, className, style }: PortfolioCardProps): react_jsx_runtime.JSX.Element;
670
+
671
+ interface YieldBadgeProps {
672
+ /** Show share price alongside APY. */
673
+ showPrice?: boolean;
674
+ /** Custom class name. */
675
+ className?: string;
676
+ /** Custom inline styles. */
677
+ style?: React.CSSProperties;
678
+ }
679
+ declare function YieldBadge({ showPrice, className, style }: YieldBadgeProps): react_jsx_runtime.JSX.Element;
680
+
681
+ interface EpochStatusBadgeProps {
682
+ /** Which epoch to display. */
683
+ type: "deposit" | "redeem";
684
+ /** Vault ID (default: "rcUSDP"). */
685
+ vaultId?: string;
686
+ /** Custom class name. */
687
+ className?: string;
688
+ /** Custom inline styles. */
689
+ style?: React.CSSProperties;
690
+ }
691
+ declare function EpochStatusBadge({ type, vaultId, className, style }: EpochStatusBadgeProps): react_jsx_runtime.JSX.Element | null;
692
+
693
+ /**
694
+ * VaultErrorBoundary — React Error Boundary for Vault SDK errors.
695
+ *
696
+ * Catches errors thrown by child components and displays a user-friendly
697
+ * fallback UI with categorized error messages and a built-in retry button.
698
+ *
699
+ * Usage:
700
+ * ```tsx
701
+ * <VaultErrorBoundary onError={(err) => logToSentry(err)}>
702
+ * <DepositWidget />
703
+ * </VaultErrorBoundary>
704
+ *
705
+ * // Custom fallback
706
+ * <VaultErrorBoundary fallback={(error, retry) => (
707
+ * <div>
708
+ * <p>{error.message}</p>
709
+ * <button onClick={retry}>Try again</button>
710
+ * </div>
711
+ * )}>
712
+ * <PortfolioCard />
713
+ * </VaultErrorBoundary>
714
+ * ```
715
+ */
716
+
717
+ interface VaultErrorBoundaryProps {
718
+ children: React.ReactNode;
719
+ /** Custom fallback UI. Can be a ReactNode or a render function receiving the error and a retry callback. */
720
+ fallback?: React.ReactNode | ((error: Error, retry: () => void) => React.ReactNode);
721
+ /** Called when an error is caught. */
722
+ onError?: (error: Error, errorInfo: React.ErrorInfo) => void;
723
+ }
724
+ interface VaultErrorBoundaryState {
725
+ error: Error | null;
726
+ }
727
+ declare class VaultErrorBoundary extends React.Component<VaultErrorBoundaryProps, VaultErrorBoundaryState> {
728
+ constructor(props: VaultErrorBoundaryProps);
729
+ static getDerivedStateFromError(error: Error): VaultErrorBoundaryState;
730
+ componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void;
731
+ /** Reset the error state so children are re-rendered. */
732
+ resetErrorBoundary: () => void;
733
+ render(): React.ReactNode;
734
+ }
735
+
736
+ interface TransactionHistoryProps {
737
+ /** Max transactions per page (default: 20). */
738
+ limit?: number;
739
+ /** Vault ID (default: "rcUSDP"). */
740
+ vaultId?: string;
741
+ /** Custom class name. */
742
+ className?: string;
743
+ /** Custom inline styles. */
744
+ style?: React.CSSProperties;
745
+ }
746
+ declare function TransactionHistory({ limit, vaultId, className, style, }: TransactionHistoryProps): react_jsx_runtime.JSX.Element;
747
+
748
+ export { DepositWidget, type DepositWidgetProps, EpochStatusBadge, type EpochStatusBadgeProps, PortfolioCard, type PortfolioCardProps, TBookVaultProvider, type TBookVaultProviderProps, TransactionHistory, type TransactionHistoryProps, type UseTransactionHistoryOptions, VaultErrorBoundary, type VaultErrorBoundaryProps, YieldBadge, type YieldBadgeProps, useCancelDeposit, useClaim, useCurrentDepositEpoch, useCurrentRedeemEpoch, useDeposit, useRedeem, useSharePrice, useTBookVault, useTransactionHistory, useUsdcBalance, useVault, useVaultInfo, useVaultUser };