@compass-labs/widgets 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,910 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+ import { Address } from 'viem';
4
+ import * as _tanstack_query_core from '@tanstack/query-core';
5
+ import { CompassApiSDK } from '@compass-labs/api-sdk';
6
+ import { Chain } from 'viem/chains';
7
+
8
+ /**
9
+ * Theme Type Definitions for Compass Embeddable Widgets
10
+ *
11
+ * This module provides comprehensive TypeScript types for the theming system,
12
+ * enabling full customization of widget appearance while maintaining type safety.
13
+ */
14
+ /**
15
+ * Recursively makes all properties of T optional.
16
+ * Useful for allowing partial theme overrides.
17
+ */
18
+ type DeepPartial<T> = {
19
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
20
+ };
21
+ /**
22
+ * Theme mode - light or dark appearance
23
+ */
24
+ type ThemeMode = 'light' | 'dark';
25
+ /**
26
+ * Available theme preset names
27
+ */
28
+ type ThemePresetName = 'compass-dark' | 'compass-light' | 'minimal-dark' | 'minimal-light' | 'high-contrast-dark' | 'high-contrast-light';
29
+ /**
30
+ * Background color tokens
31
+ */
32
+ interface ThemeBackgroundColors {
33
+ /** Main page/widget background */
34
+ background: string;
35
+ /** Elevated surface (cards, panels) */
36
+ surface: string;
37
+ /** Hover state for surfaces */
38
+ surfaceHover: string;
39
+ /** Overlay/modal backdrop */
40
+ overlay: string;
41
+ }
42
+ /**
43
+ * Brand color tokens
44
+ */
45
+ interface ThemeBrandColors {
46
+ /** Primary brand color (buttons, links, accents) */
47
+ primary: string;
48
+ /** Primary hover state */
49
+ primaryHover: string;
50
+ /** Text on primary color background */
51
+ primaryText: string;
52
+ /** Secondary brand color */
53
+ secondary: string;
54
+ /** Secondary hover state */
55
+ secondaryHover: string;
56
+ }
57
+ /**
58
+ * Text color tokens
59
+ */
60
+ interface ThemeTextColors {
61
+ /** Primary text color */
62
+ text: string;
63
+ /** Secondary/muted text */
64
+ textSecondary: string;
65
+ /** Tertiary/disabled text */
66
+ textTertiary: string;
67
+ }
68
+ /**
69
+ * Border color tokens
70
+ */
71
+ interface ThemeBorderColors {
72
+ /** Default border color */
73
+ border: string;
74
+ /** Border hover state */
75
+ borderHover: string;
76
+ /** Border focus state (inputs) */
77
+ borderFocus: string;
78
+ }
79
+ /**
80
+ * Semantic color with muted variant
81
+ */
82
+ interface SemanticColor {
83
+ /** Main semantic color */
84
+ DEFAULT: string;
85
+ /** Muted/background variant */
86
+ muted: string;
87
+ }
88
+ /**
89
+ * Semantic color tokens for status/feedback
90
+ */
91
+ interface ThemeSemanticColors {
92
+ /** Success states (confirmations, positive values) */
93
+ success: SemanticColor;
94
+ /** Warning states (cautions, pending) */
95
+ warning: SemanticColor;
96
+ /** Error states (failures, negative values) */
97
+ error: SemanticColor;
98
+ /** Info states (neutral information) */
99
+ info: SemanticColor;
100
+ }
101
+ /**
102
+ * Complete color palette for a theme
103
+ */
104
+ interface ThemeColors {
105
+ /** Background colors */
106
+ backgrounds: ThemeBackgroundColors;
107
+ /** Brand colors */
108
+ brand: ThemeBrandColors;
109
+ /** Text colors */
110
+ text: ThemeTextColors;
111
+ /** Border colors */
112
+ borders: ThemeBorderColors;
113
+ /** Semantic/status colors */
114
+ semantic: ThemeSemanticColors;
115
+ }
116
+ /**
117
+ * Typography scale entry
118
+ */
119
+ interface TypographyScale {
120
+ /** Font size (CSS value) */
121
+ fontSize: string;
122
+ /** Line height (CSS value or number) */
123
+ lineHeight: string | number;
124
+ /** Font weight */
125
+ fontWeight: number;
126
+ /** Optional letter spacing */
127
+ letterSpacing?: string;
128
+ }
129
+ /**
130
+ * Complete typography configuration
131
+ */
132
+ interface ThemeTypography {
133
+ /** Primary font family stack */
134
+ fontFamily: string;
135
+ /** Monospace font family stack (for code, numbers) */
136
+ fontFamilyMono: string;
137
+ /** Heading typography (h1, h2, etc.) */
138
+ heading: TypographyScale;
139
+ /** Subheading typography */
140
+ subheading: TypographyScale;
141
+ /** Body text typography */
142
+ body: TypographyScale;
143
+ /** Caption/small text typography */
144
+ caption: TypographyScale;
145
+ /** Label typography (form labels, badges) */
146
+ label: TypographyScale;
147
+ }
148
+ /**
149
+ * Spacing configuration
150
+ */
151
+ interface ThemeSpacing {
152
+ /** Base spacing unit (e.g., '4px', '0.25rem') */
153
+ unit: string;
154
+ /** Container padding */
155
+ containerPadding: string;
156
+ /** Card/panel padding */
157
+ cardPadding: string;
158
+ /** Input field padding */
159
+ inputPadding: string;
160
+ }
161
+ /**
162
+ * Border radius scale
163
+ */
164
+ interface ThemeBorderRadius {
165
+ /** No border radius */
166
+ none: string;
167
+ /** Small border radius */
168
+ sm: string;
169
+ /** Medium border radius (default) */
170
+ md: string;
171
+ /** Large border radius */
172
+ lg: string;
173
+ /** Extra large border radius */
174
+ xl: string;
175
+ /** Full/pill border radius */
176
+ full: string;
177
+ }
178
+ /**
179
+ * Shape configuration (borders and corners)
180
+ */
181
+ interface ThemeShape {
182
+ /** Border radius scale */
183
+ borderRadius: ThemeBorderRadius;
184
+ /** Default border width */
185
+ borderWidth: string;
186
+ }
187
+ /**
188
+ * Shadow scale
189
+ */
190
+ interface ThemeShadow {
191
+ /** Small shadow (subtle elevation) */
192
+ sm: string;
193
+ /** Medium shadow (cards, dropdowns) */
194
+ md: string;
195
+ /** Large shadow (modals, popovers) */
196
+ lg: string;
197
+ }
198
+ /**
199
+ * Visual effects configuration
200
+ */
201
+ interface ThemeEffects {
202
+ /** Box shadow scale */
203
+ shadow: ThemeShadow;
204
+ /** Backdrop blur values */
205
+ blur: {
206
+ /** Small blur */
207
+ sm: string;
208
+ /** Medium blur */
209
+ md: string;
210
+ /** Large blur */
211
+ lg: string;
212
+ };
213
+ /** Transition presets */
214
+ transition: {
215
+ /** Fast transition (hover states) */
216
+ fast: string;
217
+ /** Normal transition (most interactions) */
218
+ normal: string;
219
+ /** Slow transition (page transitions) */
220
+ slow: string;
221
+ };
222
+ }
223
+ /**
224
+ * Complete Compass theme configuration
225
+ */
226
+ interface CompassTheme {
227
+ /** Theme name identifier */
228
+ name: string;
229
+ /** Theme mode (light/dark) */
230
+ mode: ThemeMode;
231
+ /** Color palette */
232
+ colors: ThemeColors;
233
+ /** Typography configuration */
234
+ typography: ThemeTypography;
235
+ /** Spacing configuration */
236
+ spacing: ThemeSpacing;
237
+ /** Shape configuration */
238
+ shape: ThemeShape;
239
+ /** Visual effects */
240
+ effects: ThemeEffects;
241
+ }
242
+ /**
243
+ * Theme input options for widget configuration.
244
+ *
245
+ * Can be:
246
+ * - A preset name string (e.g., 'compass-dark')
247
+ * - An object with preset name and partial overrides
248
+ * - A complete custom theme object
249
+ */
250
+ type ThemeInput = ThemePresetName | {
251
+ preset: ThemePresetName;
252
+ overrides?: DeepPartial<CompassTheme>;
253
+ } | CompassTheme;
254
+
255
+ type SupportedChain = 'ethereum' | 'base' | 'arbitrum';
256
+ /**
257
+ * EIP-712 typed data structure for signing
258
+ */
259
+ interface TypedDataToSign {
260
+ domain: {
261
+ name?: string;
262
+ version?: string;
263
+ chainId?: number;
264
+ verifyingContract?: Address;
265
+ };
266
+ types: Record<string, Array<{
267
+ name: string;
268
+ type: string;
269
+ }>>;
270
+ primaryType: string;
271
+ message: Record<string, unknown>;
272
+ }
273
+ /**
274
+ * Wallet adapter interface for bringing your own wallet
275
+ *
276
+ * Implement this interface with your wallet library of choice
277
+ * (wagmi, viem, ethers, RainbowKit, Privy, etc.)
278
+ *
279
+ * @example Using wagmi/viem:
280
+ * ```tsx
281
+ * import { useAccount, useSignTypedData, useSwitchChain } from 'wagmi';
282
+ *
283
+ * const { address } = useAccount();
284
+ * const { signTypedDataAsync } = useSignTypedData();
285
+ * const { switchChainAsync } = useSwitchChain();
286
+ *
287
+ * <CompassProvider
288
+ * apiKey="your-key"
289
+ * wallet={{
290
+ * address: address ?? null,
291
+ * signTypedData: async (data) => signTypedDataAsync(data),
292
+ * switchChain: async (chainId) => { await switchChainAsync({ chainId }); },
293
+ * }}
294
+ * >
295
+ * ```
296
+ */
297
+ interface WalletAdapter {
298
+ /** Connected wallet address, or null if not connected */
299
+ address: Address | null;
300
+ /**
301
+ * Sign EIP-712 typed data
302
+ * Called when user initiates a deposit/withdraw transaction
303
+ */
304
+ signTypedData: (data: TypedDataToSign) => Promise<string>;
305
+ /**
306
+ * Switch to a different chain (optional)
307
+ * If not provided, user will see a message to switch manually
308
+ */
309
+ switchChain?: (chainId: number) => Promise<void>;
310
+ /**
311
+ * Trigger wallet connection (optional)
312
+ * If provided, widgets will show a "Connect Wallet" button
313
+ */
314
+ login?: () => void;
315
+ /**
316
+ * Disconnect wallet (optional)
317
+ * If provided, widgets will show a logout button when connected
318
+ */
319
+ logout?: () => Promise<void>;
320
+ }
321
+
322
+ interface CompassProviderProps {
323
+ children: ReactNode;
324
+ /** Compass API key - required for all API calls */
325
+ apiKey: string;
326
+ /** Default chain to use */
327
+ defaultChain?: SupportedChain;
328
+ /** Theme preset name, preset with overrides, or full theme object */
329
+ theme?: ThemeInput;
330
+ /**
331
+ * Wallet adapter for signing transactions
332
+ *
333
+ * Bring your own wallet by implementing the WalletAdapter interface
334
+ * with your wallet library of choice (wagmi, viem, ethers, etc.)
335
+ *
336
+ * @example
337
+ * ```tsx
338
+ * import { useAccount, useSignTypedData } from 'wagmi';
339
+ *
340
+ * const { address } = useAccount();
341
+ * const { signTypedDataAsync } = useSignTypedData();
342
+ *
343
+ * <CompassProvider
344
+ * apiKey="your-key"
345
+ * wallet={{
346
+ * address: address ?? null,
347
+ * signTypedData: signTypedDataAsync,
348
+ * }}
349
+ * >
350
+ * <VaultsList />
351
+ * </CompassProvider>
352
+ * ```
353
+ */
354
+ wallet?: WalletAdapter;
355
+ }
356
+ declare function CompassProvider({ children, apiKey, defaultChain, theme, wallet, }: CompassProviderProps): react_jsx_runtime.JSX.Element;
357
+
358
+ type ApyPeriod = '7d' | '30d' | '90d';
359
+ type SortOption$2 = 'apy_7d' | 'apy_30d' | 'apy_90d' | 'tvl';
360
+ type ActionMode$2 = 'modal' | 'inline';
361
+ interface VaultData {
362
+ vaultAddress: string;
363
+ name: string;
364
+ assetSymbol: string;
365
+ apy7d: string | null;
366
+ apy30d: string | null;
367
+ apy90d: string | null;
368
+ tvlUsd: string | null;
369
+ }
370
+ interface UserVaultPosition {
371
+ vaultAddress: string;
372
+ balance: string;
373
+ pnl?: {
374
+ unrealizedPnl: string;
375
+ realizedPnl: string;
376
+ totalPnl: string;
377
+ totalDeposited: string;
378
+ };
379
+ deposits?: Array<{
380
+ amount: string;
381
+ blockNumber: number;
382
+ txHash: string;
383
+ }>;
384
+ withdrawals?: Array<{
385
+ amount: string;
386
+ blockNumber: number;
387
+ txHash: string;
388
+ }>;
389
+ }
390
+ interface VaultsListProps {
391
+ /** Show APY metrics */
392
+ showApy?: boolean;
393
+ /** Which APY periods to display */
394
+ apyPeriods?: ApyPeriod[];
395
+ /** Show total value locked */
396
+ showTvl?: boolean;
397
+ /** Show user's current position */
398
+ showUserPosition?: boolean;
399
+ /** Show profit/loss summary */
400
+ showPnL?: boolean;
401
+ /** Show transaction history */
402
+ showHistory?: boolean;
403
+ /** Enable search functionality */
404
+ showSearch?: boolean;
405
+ /** Enable sorting options */
406
+ showSort?: boolean;
407
+ /** How to show deposit/withdraw form */
408
+ actionMode?: ActionMode$2;
409
+ /** Default sort option */
410
+ defaultSort?: SortOption$2;
411
+ /** Filter by asset symbols */
412
+ assetFilter?: string[];
413
+ /** Minimum APY filter */
414
+ minApy?: number;
415
+ /** Callback when vault is clicked */
416
+ onVaultSelect?: (vault: VaultData) => void;
417
+ /** Callback after successful deposit */
418
+ onDeposit?: (vault: VaultData, amount: string, txHash: string) => void;
419
+ /** Callback after successful withdraw */
420
+ onWithdraw?: (vault: VaultData, amount: string, txHash: string) => void;
421
+ }
422
+
423
+ /**
424
+ * VaultsList widget displays ERC-4626 yield vaults with APY, TVL, and user positions.
425
+ *
426
+ * @example
427
+ * ```tsx
428
+ * <VaultsList
429
+ * showApy={true}
430
+ * showTvl={true}
431
+ * showUserPosition={true}
432
+ * onVaultSelect={(vault) => console.log('Selected:', vault)}
433
+ * />
434
+ * ```
435
+ */
436
+ declare function VaultsList({ showApy, apyPeriods, showTvl, showUserPosition, showPnL, showHistory, showSearch, showSort, actionMode, defaultSort, assetFilter, minApy, onVaultSelect, onDeposit, onWithdraw, }: VaultsListProps): react_jsx_runtime.JSX.Element;
437
+
438
+ interface UseVaultsDataOptions {
439
+ sortBy?: SortOption$2;
440
+ assetFilter?: string[];
441
+ minApy?: number;
442
+ }
443
+ declare function useVaultsData(options?: UseVaultsDataOptions): {
444
+ vaults: {
445
+ userPosition: UserVaultPosition | undefined;
446
+ vaultAddress: string;
447
+ name: string;
448
+ assetSymbol: string;
449
+ apy7d: string | null;
450
+ apy30d: string | null;
451
+ apy90d: string | null;
452
+ tvlUsd: string | null;
453
+ }[];
454
+ isLoading: boolean;
455
+ isError: boolean;
456
+ error: Error | null;
457
+ refetch: () => void;
458
+ };
459
+
460
+ type SortOption$1 = 'supply_apy';
461
+ type ActionMode$1 = 'modal' | 'inline';
462
+ interface AaveMarketData {
463
+ marketAddress: string;
464
+ reserveSymbol: string;
465
+ underlyingSymbol: string;
466
+ supplyApy: string | null;
467
+ borrowApy: string | null;
468
+ tvlUsd: string | null;
469
+ }
470
+ interface TransactionEvent$1 {
471
+ amount: string;
472
+ blockNumber: number;
473
+ txHash: string;
474
+ }
475
+ interface UserAavePosition {
476
+ marketAddress: string;
477
+ reserveSymbol: string;
478
+ balance: string;
479
+ pnl?: {
480
+ unrealizedPnl: string;
481
+ realizedPnl: string;
482
+ totalPnl: string;
483
+ totalDeposited: string;
484
+ };
485
+ deposits?: TransactionEvent$1[];
486
+ withdrawals?: TransactionEvent$1[];
487
+ }
488
+ interface AaveMarketsListProps {
489
+ /** Show APY metrics */
490
+ showApy?: boolean;
491
+ /** Show total value locked (not available for Aave) */
492
+ showTvl?: boolean;
493
+ /** Show user's current position */
494
+ showUserPosition?: boolean;
495
+ /** Show profit/loss summary */
496
+ showPnL?: boolean;
497
+ /** Show transaction history */
498
+ showHistory?: boolean;
499
+ /** Enable search functionality */
500
+ showSearch?: boolean;
501
+ /** Enable sorting options */
502
+ showSort?: boolean;
503
+ /** How to show deposit/withdraw form */
504
+ actionMode?: ActionMode$1;
505
+ /** Default sort option */
506
+ defaultSort?: SortOption$1;
507
+ /** Filter by asset symbols */
508
+ assetFilter?: string[];
509
+ /** Callback when market is clicked */
510
+ onMarketSelect?: (market: AaveMarketData) => void;
511
+ /** Callback after successful supply */
512
+ onSupply?: (market: AaveMarketData, amount: string, txHash: string) => void;
513
+ /** Callback after successful withdraw */
514
+ onWithdraw?: (market: AaveMarketData, amount: string, txHash: string) => void;
515
+ }
516
+
517
+ /**
518
+ * AaveMarketsList widget displays Aave V3 lending markets with supply APY.
519
+ *
520
+ * @example
521
+ * ```tsx
522
+ * <AaveMarketsList
523
+ * showApy={true}
524
+ * showUserPosition={true}
525
+ * onMarketSelect={(market) => console.log('Selected:', market)}
526
+ * />
527
+ * ```
528
+ */
529
+ declare function AaveMarketsList({ showApy, showTvl, // Aave API doesn't provide TVL data
530
+ showUserPosition, showPnL, showHistory, showSearch, showSort, // Only one sort option (APY), so hide by default
531
+ actionMode, defaultSort, assetFilter, onMarketSelect, onSupply, onWithdraw, }: AaveMarketsListProps): react_jsx_runtime.JSX.Element;
532
+
533
+ interface UseAaveDataOptions {
534
+ sortBy?: SortOption$1;
535
+ assetFilter?: string[];
536
+ }
537
+ declare function useAaveData(options?: UseAaveDataOptions): {
538
+ markets: {
539
+ userPosition: UserAavePosition | undefined;
540
+ marketAddress: string;
541
+ reserveSymbol: string;
542
+ underlyingSymbol: string;
543
+ supplyApy: string | null;
544
+ borrowApy: string | null;
545
+ tvlUsd: string | null;
546
+ }[];
547
+ isLoading: boolean;
548
+ isError: boolean;
549
+ error: Error | null;
550
+ refetch: () => void;
551
+ };
552
+
553
+ type SortOption = 'fixed_apy' | 'tvl' | 'expiry';
554
+ type ActionMode = 'modal' | 'inline';
555
+ interface PendleMarketData {
556
+ marketAddress: string;
557
+ ptAddress: string;
558
+ name: string;
559
+ underlyingSymbol: string;
560
+ fixedApy: string | null;
561
+ impliedApy: string | null;
562
+ tvlUsd: string | null;
563
+ expiry: string;
564
+ }
565
+ interface TransactionEvent {
566
+ amount: string;
567
+ blockNumber: number;
568
+ txHash: string;
569
+ }
570
+ interface UserPendlePosition {
571
+ marketAddress: string;
572
+ balance: string;
573
+ pnl?: {
574
+ unrealizedPnl: string;
575
+ realizedPnl: string;
576
+ totalPnl: string;
577
+ totalDeposited: string;
578
+ };
579
+ deposits?: TransactionEvent[];
580
+ withdrawals?: TransactionEvent[];
581
+ }
582
+ interface PendleMarketsListProps {
583
+ /** Show APY metrics */
584
+ showApy?: boolean;
585
+ /** Show total value locked */
586
+ showTvl?: boolean;
587
+ /** Show expiry dates */
588
+ showExpiry?: boolean;
589
+ /** Show user's current position */
590
+ showUserPosition?: boolean;
591
+ /** Show profit/loss summary */
592
+ showPnL?: boolean;
593
+ /** Show transaction history */
594
+ showHistory?: boolean;
595
+ /** Enable search functionality */
596
+ showSearch?: boolean;
597
+ /** Enable sorting options */
598
+ showSort?: boolean;
599
+ /** How to show deposit/withdraw form */
600
+ actionMode?: ActionMode;
601
+ /** Default sort option */
602
+ defaultSort?: SortOption;
603
+ /** Filter by asset symbols */
604
+ assetFilter?: string[];
605
+ /** Callback when market is clicked */
606
+ onMarketSelect?: (market: PendleMarketData) => void;
607
+ /** Callback after successful deposit */
608
+ onDeposit?: (market: PendleMarketData, amount: string, txHash: string) => void;
609
+ /** Callback after successful withdraw */
610
+ onWithdraw?: (market: PendleMarketData, amount: string, txHash: string) => void;
611
+ }
612
+
613
+ /**
614
+ * PendleMarketsList widget displays Pendle fixed-yield markets.
615
+ *
616
+ * @example
617
+ * ```tsx
618
+ * <PendleMarketsList
619
+ * showApy={true}
620
+ * showExpiry={true}
621
+ * showTvl={true}
622
+ * onMarketSelect={(market) => console.log('Selected:', market)}
623
+ * />
624
+ * ```
625
+ */
626
+ declare function PendleMarketsList({ showApy, showTvl, showExpiry, showUserPosition, showPnL, showHistory, showSearch, showSort, actionMode, defaultSort, assetFilter, onMarketSelect, onDeposit, onWithdraw, }: PendleMarketsListProps): react_jsx_runtime.JSX.Element;
627
+
628
+ interface UsePendleDataOptions {
629
+ sortBy?: SortOption;
630
+ assetFilter?: string[];
631
+ }
632
+ declare function usePendleData(options?: UsePendleDataOptions): {
633
+ markets: {
634
+ userPosition: UserPendlePosition | undefined;
635
+ marketAddress: string;
636
+ ptAddress: string;
637
+ name: string;
638
+ underlyingSymbol: string;
639
+ fixedApy: string | null;
640
+ impliedApy: string | null;
641
+ tvlUsd: string | null;
642
+ expiry: string;
643
+ }[];
644
+ isLoading: boolean;
645
+ isError: boolean;
646
+ error: Error | null;
647
+ refetch: () => void;
648
+ };
649
+
650
+ type SwapLayout = 'compact' | 'full';
651
+ interface SwapQuote {
652
+ inputAmount: string;
653
+ outputAmount: string;
654
+ rate: string;
655
+ priceImpact: string;
656
+ fee: string;
657
+ }
658
+ interface SwapWidgetProps {
659
+ layout?: SwapLayout;
660
+ defaultFromToken?: string;
661
+ defaultToToken?: string;
662
+ allowedTokens?: string[];
663
+ showReverseButton?: boolean;
664
+ showSettings?: boolean;
665
+ showPriceImpact?: boolean;
666
+ onSwapSuccess?: (fromToken: string, toToken: string, fromAmount: string, toAmount: string, txHash: string) => void;
667
+ onSwapError?: (error: Error) => void;
668
+ }
669
+
670
+ declare function SwapWidget({ layout, defaultFromToken, defaultToToken, allowedTokens, showReverseButton, showSettings, showPriceImpact, onSwapSuccess, onSwapError, }: SwapWidgetProps): react_jsx_runtime.JSX.Element;
671
+
672
+ interface UseSwapQuoteOptions {
673
+ fromToken: string;
674
+ toToken: string;
675
+ amount: string;
676
+ enabled?: boolean;
677
+ }
678
+ declare function useSwapQuote({ fromToken, toToken, amount, enabled }: UseSwapQuoteOptions): {
679
+ quote: SwapQuote | null | undefined;
680
+ isLoading: boolean;
681
+ isError: boolean;
682
+ refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<SwapQuote | null, Error>>;
683
+ };
684
+
685
+ type TabId = 'vaults' | 'aave' | 'pendle' | 'swap';
686
+ type FeaturePreset = 'full' | 'earn-only' | 'swap-only' | 'vaults-only';
687
+ interface TabConfig {
688
+ id: TabId;
689
+ label: string;
690
+ enabled: boolean;
691
+ }
692
+ interface CompassEarnWidgetProps {
693
+ preset?: FeaturePreset;
694
+ enableVaults?: boolean;
695
+ enableAave?: boolean;
696
+ enablePendle?: boolean;
697
+ enableSwap?: boolean;
698
+ defaultTab?: TabId;
699
+ showHeader?: boolean;
700
+ onTabChange?: (tab: TabId) => void;
701
+ }
702
+
703
+ declare function CompassEarnWidget({ preset, enableVaults, enableAave, enablePendle, enableSwap, defaultTab, showHeader, onTabChange, }: CompassEarnWidgetProps): react_jsx_runtime.JSX.Element;
704
+
705
+ /**
706
+ * Theme Presets for Compass Embeddable Widgets
707
+ *
708
+ * This module provides 6 pre-configured theme presets covering various
709
+ * visual styles and accessibility needs:
710
+ *
711
+ * - compass-dark/light: Brand themes with indigo primary and glassmorphism
712
+ * - minimal-dark/light: Flat design with sharp corners and no shadows
713
+ * - high-contrast-dark/light: Accessible themes with bold colors and larger text
714
+ */
715
+
716
+ /**
717
+ * Map of all available theme presets by name
718
+ */
719
+ declare const themePresets: Record<ThemePresetName, CompassTheme>;
720
+
721
+ interface ThemeContextValue {
722
+ theme: CompassTheme;
723
+ setTheme: (input: ThemeInput) => void;
724
+ cssVariables: string;
725
+ }
726
+ interface ThemeProviderProps {
727
+ children: ReactNode;
728
+ theme?: ThemeInput;
729
+ }
730
+ declare function ThemeProvider({ children, theme: initialTheme }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
731
+ declare function useTheme(): ThemeContextValue;
732
+
733
+ /**
734
+ * Context value for the API context
735
+ */
736
+ interface ApiContextValue {
737
+ /** The API key used to authenticate with Compass API */
738
+ apiKey: string;
739
+ /** The Compass API SDK client instance */
740
+ client: CompassApiSDK;
741
+ }
742
+ interface ApiProviderProps {
743
+ children: ReactNode;
744
+ apiKey: string;
745
+ /** Optional API base URL override */
746
+ serverURL?: string;
747
+ }
748
+ /**
749
+ * Provider component that manages the Compass API client.
750
+ */
751
+ declare function ApiProvider({ children, apiKey, serverURL }: ApiProviderProps): react_jsx_runtime.JSX.Element;
752
+ /**
753
+ * Hook to access the Compass API client and API key.
754
+ */
755
+ declare function useCompassApi(): ApiContextValue;
756
+ declare const useEmbeddableApi: typeof useCompassApi;
757
+
758
+ interface ChainConfig$1 {
759
+ viemChain: Chain;
760
+ name: string;
761
+ icon: string;
762
+ }
763
+ interface ChainContextValue {
764
+ chainId: SupportedChain;
765
+ setChainId: (chain: SupportedChain) => void;
766
+ setChain: (chain: SupportedChain) => void;
767
+ chain: ChainConfig$1;
768
+ }
769
+ declare function useCompassChain(): ChainContextValue;
770
+ declare const useChain: typeof useCompassChain;
771
+
772
+ /**
773
+ * Wallet Context value interface
774
+ */
775
+ interface WalletContextValue {
776
+ /** Connected wallet address, or null if not connected */
777
+ address: Address | null;
778
+ /** Whether a wallet is connected */
779
+ isConnected: boolean;
780
+ /** Sign EIP-712 typed data - throws if wallet not connected */
781
+ signTypedData: (data: TypedDataToSign) => Promise<string>;
782
+ /** Switch chain - may not be available depending on wallet adapter */
783
+ switchChain: ((chainId: number) => Promise<void>) | null;
784
+ /** Trigger wallet connection - may not be available depending on wallet adapter */
785
+ login: (() => void) | null;
786
+ /** Disconnect wallet - may not be available depending on wallet adapter */
787
+ logout: (() => Promise<void>) | null;
788
+ }
789
+ /**
790
+ * Hook to access the wallet context
791
+ */
792
+ declare function useCompassWallet(): WalletContextValue;
793
+ declare const useEmbeddableWallet: typeof useCompassWallet;
794
+
795
+ interface EarnAccountContextValue {
796
+ /** The user's earn account address (Safe wallet) */
797
+ earnAccountAddress: Address | null;
798
+ /** Whether the earn account has been deployed on-chain */
799
+ isDeployed: boolean;
800
+ /** Whether we're checking the account status */
801
+ isChecking: boolean;
802
+ /** Whether we're creating the account */
803
+ isCreating: boolean;
804
+ /** Error from checking or creating */
805
+ error: Error | null;
806
+ /** Create the earn account (gas sponsored) */
807
+ createAccount: () => Promise<Address>;
808
+ /** Refresh account status */
809
+ refetch: () => void;
810
+ }
811
+ /**
812
+ * Hook to access earn account state and actions
813
+ */
814
+ declare function useEarnAccount(): EarnAccountContextValue;
815
+
816
+ declare function ChainSwitcher(): react_jsx_runtime.JSX.Element;
817
+
818
+ interface WalletStatusProps {
819
+ /** Show full address or truncated */
820
+ showFullAddress?: boolean;
821
+ /** Show logout button when connected */
822
+ showLogout?: boolean;
823
+ /** Compact mode - just icon and minimal text */
824
+ compact?: boolean;
825
+ /** Callback when user clicks connect (optional - for apps that handle their own wallet connection) */
826
+ onConnect?: () => void;
827
+ /** Callback when user clicks disconnect (optional - for apps that handle their own wallet connection) */
828
+ onDisconnect?: () => void;
829
+ }
830
+ /**
831
+ * Displays the connected wallet status with optional login/logout functionality.
832
+ *
833
+ * Uses login/logout from the WalletAdapter by default if provided.
834
+ * You can override with `onConnect` and `onDisconnect` props if your app
835
+ * handles wallet connection separately.
836
+ */
837
+ declare function WalletStatus({ showFullAddress, showLogout, compact, onConnect, onDisconnect, }: WalletStatusProps): react_jsx_runtime.JSX.Element;
838
+
839
+ interface ActionModalProps {
840
+ isOpen: boolean;
841
+ onClose: () => void;
842
+ title: string;
843
+ children: ReactNode;
844
+ }
845
+ declare function ActionModal({ isOpen, onClose, title, children }: ActionModalProps): react_jsx_runtime.JSX.Element | null;
846
+
847
+ interface PositionPnL {
848
+ unrealizedPnl: string;
849
+ realizedPnl: string;
850
+ totalPnl: string;
851
+ totalDeposited: string;
852
+ }
853
+ interface PnLSummaryProps {
854
+ pnl: PositionPnL | null | undefined;
855
+ tokenSymbol: string;
856
+ tokenPrice: number;
857
+ }
858
+ declare function PnLSummary({ pnl, tokenSymbol, tokenPrice }: PnLSummaryProps): react_jsx_runtime.JSX.Element | null;
859
+
860
+ type ActionType = 'deposit' | 'withdraw';
861
+ type VenueType = 'VAULT' | 'AAVE' | 'PENDLE_PT';
862
+ interface DepositWithdrawFormProps {
863
+ venueType: VenueType;
864
+ venueAddress: string;
865
+ tokenSymbol: string;
866
+ tokenDecimals: number;
867
+ positionBalance?: string;
868
+ onSuccess?: (action: ActionType, amount: string, txHash: string) => void;
869
+ onError?: (error: Error) => void;
870
+ }
871
+ declare function DepositWithdrawForm({ venueType, venueAddress, tokenSymbol, tokenDecimals, positionBalance, onSuccess, onError, }: DepositWithdrawFormProps): react_jsx_runtime.JSX.Element;
872
+
873
+ interface DepositEvent {
874
+ amount: string;
875
+ blockNumber: number;
876
+ txHash: string;
877
+ }
878
+ interface WithdrawalEvent {
879
+ amount: string;
880
+ blockNumber: number;
881
+ txHash: string;
882
+ }
883
+ interface TransactionHistoryProps {
884
+ deposits?: DepositEvent[];
885
+ withdrawals?: WithdrawalEvent[];
886
+ tokenSymbol: string;
887
+ }
888
+ declare function TransactionHistory({ deposits, withdrawals, tokenSymbol, }: TransactionHistoryProps): react_jsx_runtime.JSX.Element | null;
889
+
890
+ interface EarnAccountGuardProps {
891
+ children: ReactNode;
892
+ /** What to show while checking account status */
893
+ loadingComponent?: ReactNode;
894
+ /** Custom component to show when account needs creation */
895
+ createAccountComponent?: ReactNode;
896
+ }
897
+ declare function EarnAccountGuard({ children, loadingComponent, createAccountComponent, }: EarnAccountGuardProps): react_jsx_runtime.JSX.Element;
898
+
899
+ type SupportedChainId = 'ethereum' | 'base' | 'arbitrum';
900
+ interface ChainConfig {
901
+ id: SupportedChainId;
902
+ name: string;
903
+ viemChain: Chain;
904
+ icon: string;
905
+ rpcUrl?: string;
906
+ }
907
+ declare const CHAINS: Record<SupportedChainId, ChainConfig>;
908
+ declare const TOKEN_DECIMALS: Record<string, number>;
909
+
910
+ export { type AaveMarketData, AaveMarketsList, type AaveMarketsListProps, type SortOption$1 as AaveSortOption, ActionModal, type ActionMode$2 as ActionMode, ApiProvider, type ApyPeriod, CHAINS, type ChainConfig, ChainSwitcher, CompassEarnWidget, type CompassEarnWidgetProps, CompassProvider, type CompassProviderProps, type CompassTheme, DepositWithdrawForm, type EarnAccountContextValue, EarnAccountGuard, type FeaturePreset, type PendleMarketData, PendleMarketsList, type PendleMarketsListProps, type SortOption as PendleSortOption, PnLSummary, type SupportedChain, type SupportedChainId, type SwapLayout, type SwapQuote, SwapWidget, type SwapWidgetProps, TOKEN_DECIMALS, type TabConfig, type TabId, type ThemeInput, type ThemeMode, type ThemePresetName, ThemeProvider, TransactionHistory, type TypedDataToSign, type UserAavePosition, type UserPendlePosition, type UserVaultPosition, type VaultData, VaultsList, type VaultsListProps, type SortOption$2 as VaultsSortOption, type WalletAdapter, WalletStatus, themePresets, useAaveData, useChain, useCompassApi, useCompassChain, useCompassWallet, useEarnAccount, useEmbeddableApi, useEmbeddableWallet, usePendleData, useSwapQuote, useTheme, useVaultsData };