@compass-labs/widgets 0.1.25 → 0.1.27
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/dist/index.d.mts +122 -329
- package/dist/index.d.ts +122 -329
- package/dist/index.js +2447 -2126
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2450 -2125
- package/dist/index.mjs.map +1 -1
- package/dist/server/index.js +304 -0
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +304 -0
- package/dist/server/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as react from 'react';
|
|
2
3
|
import { ReactNode } from 'react';
|
|
3
4
|
import { Address } from 'viem';
|
|
4
5
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
@@ -366,209 +367,10 @@ interface CompassProviderProps {
|
|
|
366
367
|
}
|
|
367
368
|
declare function CompassProvider({ children, apiKey, defaultChain, theme, wallet, }: CompassProviderProps): react_jsx_runtime.JSX.Element;
|
|
368
369
|
|
|
369
|
-
type ApyPeriod = '7d' | '30d' | '90d';
|
|
370
|
-
type SortOption$1 = 'apy_7d' | 'apy_30d' | 'apy_90d' | 'tvl';
|
|
371
|
-
interface VaultData {
|
|
372
|
-
vaultAddress: string;
|
|
373
|
-
name: string;
|
|
374
|
-
assetSymbol: string;
|
|
375
|
-
apy7d: string | null;
|
|
376
|
-
apy30d: string | null;
|
|
377
|
-
apy90d: string | null;
|
|
378
|
-
tvlUsd: string | null;
|
|
379
|
-
}
|
|
380
|
-
interface UserVaultPosition {
|
|
381
|
-
vaultAddress: string;
|
|
382
|
-
balance: string;
|
|
383
|
-
pnl?: {
|
|
384
|
-
unrealizedPnl: string;
|
|
385
|
-
realizedPnl: string;
|
|
386
|
-
totalPnl: string;
|
|
387
|
-
totalDeposited: string;
|
|
388
|
-
};
|
|
389
|
-
deposits?: Array<{
|
|
390
|
-
amount: string;
|
|
391
|
-
blockNumber: number;
|
|
392
|
-
txHash: string;
|
|
393
|
-
}>;
|
|
394
|
-
withdrawals?: Array<{
|
|
395
|
-
amount: string;
|
|
396
|
-
blockNumber: number;
|
|
397
|
-
txHash: string;
|
|
398
|
-
}>;
|
|
399
|
-
}
|
|
400
|
-
/**
|
|
401
|
-
* Props for the VaultsList widget.
|
|
402
|
-
*
|
|
403
|
-
* Sensible defaults are applied automatically:
|
|
404
|
-
* - All display options enabled (APY, TVL, positions, P&L, history)
|
|
405
|
-
* - Search and sorting enabled
|
|
406
|
-
* - Sorted by 7-day APY (best recent performers first)
|
|
407
|
-
* - TVL filter available but no minimum set
|
|
408
|
-
*/
|
|
409
|
-
interface VaultsListProps {
|
|
410
|
-
/** Show APY metrics @default true */
|
|
411
|
-
showApy?: boolean;
|
|
412
|
-
/** Which APY periods to display @default ['7d', '30d', '90d'] */
|
|
413
|
-
apyPeriods?: ApyPeriod[];
|
|
414
|
-
/** Show total value locked @default true */
|
|
415
|
-
showTvl?: boolean;
|
|
416
|
-
/** Show user's current position @default true */
|
|
417
|
-
showUserPosition?: boolean;
|
|
418
|
-
/** Show profit/loss summary @default true */
|
|
419
|
-
showPnL?: boolean;
|
|
420
|
-
/** Show transaction history @default true */
|
|
421
|
-
showHistory?: boolean;
|
|
422
|
-
/** Enable search functionality @default true */
|
|
423
|
-
showSearch?: boolean;
|
|
424
|
-
/** Enable sorting options @default true */
|
|
425
|
-
showSort?: boolean;
|
|
426
|
-
/** Default sort option @default 'apy_7d' */
|
|
427
|
-
defaultSort?: SortOption$1;
|
|
428
|
-
/** Filter by asset symbols (e.g., ['USDC', 'ETH']) @default undefined (show all) */
|
|
429
|
-
assetFilter?: string[];
|
|
430
|
-
/** Minimum APY filter @default undefined (no minimum) */
|
|
431
|
-
minApy?: number;
|
|
432
|
-
/** Minimum TVL filter in USD @default undefined (no minimum) */
|
|
433
|
-
minTvl?: number;
|
|
434
|
-
/** Show TVL filter input @default true */
|
|
435
|
-
showTvlFilter?: boolean;
|
|
436
|
-
/** Callback when vault is clicked */
|
|
437
|
-
onVaultSelect?: (vault: VaultData) => void;
|
|
438
|
-
/** Callback after successful deposit */
|
|
439
|
-
onDeposit?: (vault: VaultData, amount: string, txHash: string) => void;
|
|
440
|
-
/** Callback after successful withdraw */
|
|
441
|
-
onWithdraw?: (vault: VaultData, amount: string, txHash: string) => void;
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
/**
|
|
445
|
-
* VaultsList widget displays ERC-4626 yield vaults with APY, TVL, and user positions.
|
|
446
|
-
*
|
|
447
|
-
* @example
|
|
448
|
-
* ```tsx
|
|
449
|
-
* <VaultsList
|
|
450
|
-
* showApy={true}
|
|
451
|
-
* showTvl={true}
|
|
452
|
-
* showUserPosition={true}
|
|
453
|
-
* onVaultSelect={(vault) => console.log('Selected:', vault)}
|
|
454
|
-
* />
|
|
455
|
-
* ```
|
|
456
|
-
*/
|
|
457
|
-
declare function VaultsList({ showApy, apyPeriods, showTvl, showUserPosition, showPnL, showHistory, showSearch, showSort, defaultSort, assetFilter, minApy, minTvl: initialMinTvl, showTvlFilter, onVaultSelect, onDeposit, onWithdraw, }: VaultsListProps): react_jsx_runtime.JSX.Element;
|
|
458
|
-
|
|
459
|
-
interface UseVaultsDataOptions {
|
|
460
|
-
sortBy?: SortOption$1;
|
|
461
|
-
assetFilter?: string[];
|
|
462
|
-
minApy?: number;
|
|
463
|
-
minTvl?: number;
|
|
464
|
-
}
|
|
465
|
-
declare function useVaultsData(options?: UseVaultsDataOptions): {
|
|
466
|
-
vaults: {
|
|
467
|
-
userPosition: UserVaultPosition | undefined;
|
|
468
|
-
vaultAddress: string;
|
|
469
|
-
name: string;
|
|
470
|
-
assetSymbol: string;
|
|
471
|
-
apy7d: string | null;
|
|
472
|
-
apy30d: string | null;
|
|
473
|
-
apy90d: string | null;
|
|
474
|
-
tvlUsd: string | null;
|
|
475
|
-
}[];
|
|
476
|
-
isLoading: boolean;
|
|
477
|
-
isError: boolean;
|
|
478
|
-
error: Error | null;
|
|
479
|
-
refetch: () => void;
|
|
480
|
-
};
|
|
481
|
-
|
|
482
|
-
interface AaveMarketData {
|
|
483
|
-
marketAddress: string;
|
|
484
|
-
reserveSymbol: string;
|
|
485
|
-
underlyingSymbol: string;
|
|
486
|
-
supplyApy: string | null;
|
|
487
|
-
borrowApy: string | null;
|
|
488
|
-
}
|
|
489
|
-
interface TransactionEvent$1 {
|
|
490
|
-
amount: string;
|
|
491
|
-
blockNumber: number;
|
|
492
|
-
txHash: string;
|
|
493
|
-
}
|
|
494
|
-
interface UserAavePosition {
|
|
495
|
-
marketAddress: string;
|
|
496
|
-
reserveSymbol: string;
|
|
497
|
-
balance: string;
|
|
498
|
-
pnl?: {
|
|
499
|
-
unrealizedPnl: string;
|
|
500
|
-
realizedPnl: string;
|
|
501
|
-
totalPnl: string;
|
|
502
|
-
totalDeposited: string;
|
|
503
|
-
};
|
|
504
|
-
deposits?: TransactionEvent$1[];
|
|
505
|
-
withdrawals?: TransactionEvent$1[];
|
|
506
|
-
}
|
|
507
|
-
/**
|
|
508
|
-
* Props for the AaveMarketsList widget.
|
|
509
|
-
*
|
|
510
|
-
* Sensible defaults are applied automatically:
|
|
511
|
-
* - All display options enabled (APY, positions, P&L, history)
|
|
512
|
-
* - Search enabled for quick market discovery
|
|
513
|
-
* - Shows supply APY (lending rates)
|
|
514
|
-
*/
|
|
515
|
-
interface AaveMarketsListProps {
|
|
516
|
-
/** Show APY metrics @default true */
|
|
517
|
-
showApy?: boolean;
|
|
518
|
-
/** Show user's current position @default true */
|
|
519
|
-
showUserPosition?: boolean;
|
|
520
|
-
/** Show profit/loss summary @default true */
|
|
521
|
-
showPnL?: boolean;
|
|
522
|
-
/** Show transaction history @default true */
|
|
523
|
-
showHistory?: boolean;
|
|
524
|
-
/** Enable search functionality @default true */
|
|
525
|
-
showSearch?: boolean;
|
|
526
|
-
/** Filter by asset symbols (e.g., ['USDC', 'ETH']) @default undefined (show all) */
|
|
527
|
-
assetFilter?: string[];
|
|
528
|
-
/** Callback when market is clicked */
|
|
529
|
-
onMarketSelect?: (market: AaveMarketData) => void;
|
|
530
|
-
/** Callback after successful supply */
|
|
531
|
-
onSupply?: (market: AaveMarketData, amount: string, txHash: string) => void;
|
|
532
|
-
/** Callback after successful withdraw */
|
|
533
|
-
onWithdraw?: (market: AaveMarketData, amount: string, txHash: string) => void;
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
/**
|
|
537
|
-
* AaveMarketsList widget displays Aave V3 lending markets with supply APY.
|
|
538
|
-
*
|
|
539
|
-
* @example
|
|
540
|
-
* ```tsx
|
|
541
|
-
* <AaveMarketsList
|
|
542
|
-
* showApy={true}
|
|
543
|
-
* showUserPosition={true}
|
|
544
|
-
* onMarketSelect={(market) => console.log('Selected:', market)}
|
|
545
|
-
* />
|
|
546
|
-
* ```
|
|
547
|
-
*/
|
|
548
|
-
declare function AaveMarketsList({ showApy, showUserPosition, showPnL, showHistory, showSearch, assetFilter, onMarketSelect, onSupply, onWithdraw, }: AaveMarketsListProps): react_jsx_runtime.JSX.Element;
|
|
549
|
-
|
|
550
|
-
interface UseAaveDataOptions {
|
|
551
|
-
assetFilter?: string[];
|
|
552
|
-
}
|
|
553
|
-
declare function useAaveData(options?: UseAaveDataOptions): {
|
|
554
|
-
markets: {
|
|
555
|
-
userPosition: UserAavePosition | undefined;
|
|
556
|
-
marketAddress: string;
|
|
557
|
-
reserveSymbol: string;
|
|
558
|
-
underlyingSymbol: string;
|
|
559
|
-
supplyApy: string | null;
|
|
560
|
-
borrowApy: string | null;
|
|
561
|
-
}[];
|
|
562
|
-
isLoading: boolean;
|
|
563
|
-
isError: boolean;
|
|
564
|
-
error: Error | null;
|
|
565
|
-
refetch: () => void;
|
|
566
|
-
};
|
|
567
|
-
|
|
568
370
|
type MarketType = 'aave' | 'pendle' | 'vaults';
|
|
569
371
|
/** UI tab type for the market selector */
|
|
570
372
|
type UIMarketTab = 'variable' | 'fixed';
|
|
571
|
-
interface MarketOption {
|
|
373
|
+
interface MarketOption$1 {
|
|
572
374
|
id: string;
|
|
573
375
|
name: string;
|
|
574
376
|
apy: number;
|
|
@@ -604,9 +406,9 @@ interface EarnAccountProps {
|
|
|
604
406
|
/** Custom title for the header @default "Savings Account" */
|
|
605
407
|
title?: string;
|
|
606
408
|
/** Callback after successful deposit */
|
|
607
|
-
onDeposit?: (market: MarketOption, amount: number, txHash: string) => void;
|
|
409
|
+
onDeposit?: (market: MarketOption$1, amount: number, txHash: string) => void;
|
|
608
410
|
/** Callback after successful withdraw */
|
|
609
|
-
onWithdraw?: (market: MarketOption, amount: number, txHash: string) => void;
|
|
411
|
+
onWithdraw?: (market: MarketOption$1, amount: number, txHash: string) => void;
|
|
610
412
|
/** Default market tab to show @default 'variable' */
|
|
611
413
|
defaultMarketTab?: UIMarketTab;
|
|
612
414
|
/**
|
|
@@ -634,114 +436,6 @@ interface EarnAccountProps {
|
|
|
634
436
|
*/
|
|
635
437
|
declare function EarnAccount({ showHeader, showInterestRate, showTopUpButton, showTrustBadge, compact, title, onDeposit, onWithdraw, defaultMarketTab, allowedVariableMarkets, allowedFixedMarkets, chain: chainProp, }: EarnAccountProps): react_jsx_runtime.JSX.Element;
|
|
636
438
|
|
|
637
|
-
type SortOption = 'fixed_apy' | 'tvl' | 'expiry';
|
|
638
|
-
interface PendleMarketData {
|
|
639
|
-
marketAddress: string;
|
|
640
|
-
ptAddress: string;
|
|
641
|
-
name: string;
|
|
642
|
-
underlyingSymbol: string;
|
|
643
|
-
fixedApy: string | null;
|
|
644
|
-
impliedApy: string | null;
|
|
645
|
-
tvlUsd: string | null;
|
|
646
|
-
expiry: string;
|
|
647
|
-
}
|
|
648
|
-
interface TransactionEvent {
|
|
649
|
-
amount: string;
|
|
650
|
-
blockNumber: number;
|
|
651
|
-
txHash: string;
|
|
652
|
-
}
|
|
653
|
-
interface UserPendlePosition {
|
|
654
|
-
marketAddress: string;
|
|
655
|
-
balance: string;
|
|
656
|
-
pnl?: {
|
|
657
|
-
unrealizedPnl: string;
|
|
658
|
-
realizedPnl: string;
|
|
659
|
-
totalPnl: string;
|
|
660
|
-
totalDeposited: string;
|
|
661
|
-
};
|
|
662
|
-
deposits?: TransactionEvent[];
|
|
663
|
-
withdrawals?: TransactionEvent[];
|
|
664
|
-
}
|
|
665
|
-
/**
|
|
666
|
-
* Props for the PendleMarketsList widget.
|
|
667
|
-
*
|
|
668
|
-
* Sensible defaults are applied automatically:
|
|
669
|
-
* - All display options enabled (APY, TVL, expiry, positions, P&L, history)
|
|
670
|
-
* - Search and sorting enabled
|
|
671
|
-
* - Sorted by fixed APY (best yields first)
|
|
672
|
-
* - Shows only non-expired markets
|
|
673
|
-
*/
|
|
674
|
-
interface PendleMarketsListProps {
|
|
675
|
-
/** Show APY metrics @default true */
|
|
676
|
-
showApy?: boolean;
|
|
677
|
-
/** Show total value locked @default true */
|
|
678
|
-
showTvl?: boolean;
|
|
679
|
-
/** Show expiry dates @default true */
|
|
680
|
-
showExpiry?: boolean;
|
|
681
|
-
/** Show user's current position @default true */
|
|
682
|
-
showUserPosition?: boolean;
|
|
683
|
-
/** Show profit/loss summary @default true */
|
|
684
|
-
showPnL?: boolean;
|
|
685
|
-
/** Show transaction history @default true */
|
|
686
|
-
showHistory?: boolean;
|
|
687
|
-
/** Enable search functionality @default true */
|
|
688
|
-
showSearch?: boolean;
|
|
689
|
-
/** Enable sorting options @default true */
|
|
690
|
-
showSort?: boolean;
|
|
691
|
-
/** Default sort option @default 'fixed_apy' */
|
|
692
|
-
defaultSort?: SortOption;
|
|
693
|
-
/** Filter by asset symbols (e.g., ['USDC', 'ETH']) @default undefined (show all) */
|
|
694
|
-
assetFilter?: string[];
|
|
695
|
-
/** Minimum TVL filter in USD @default undefined (no minimum) */
|
|
696
|
-
minTvl?: number;
|
|
697
|
-
/** Show TVL filter input @default true */
|
|
698
|
-
showTvlFilter?: boolean;
|
|
699
|
-
/** Callback when market is clicked */
|
|
700
|
-
onMarketSelect?: (market: PendleMarketData) => void;
|
|
701
|
-
/** Callback after successful deposit */
|
|
702
|
-
onDeposit?: (market: PendleMarketData, amount: string, txHash: string) => void;
|
|
703
|
-
/** Callback after successful withdraw */
|
|
704
|
-
onWithdraw?: (market: PendleMarketData, amount: string, txHash: string) => void;
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
/**
|
|
708
|
-
* PendleMarketsList widget displays Pendle fixed-yield markets.
|
|
709
|
-
*
|
|
710
|
-
* @example
|
|
711
|
-
* ```tsx
|
|
712
|
-
* <PendleMarketsList
|
|
713
|
-
* showApy={true}
|
|
714
|
-
* showExpiry={true}
|
|
715
|
-
* showTvl={true}
|
|
716
|
-
* onMarketSelect={(market) => console.log('Selected:', market)}
|
|
717
|
-
* />
|
|
718
|
-
* ```
|
|
719
|
-
*/
|
|
720
|
-
declare function PendleMarketsList({ showApy, showTvl, showExpiry, showUserPosition, showPnL, showHistory, showSearch, showSort, defaultSort, assetFilter, minTvl: initialMinTvl, showTvlFilter, onMarketSelect, onDeposit, onWithdraw, }: PendleMarketsListProps): react_jsx_runtime.JSX.Element;
|
|
721
|
-
|
|
722
|
-
interface UsePendleDataOptions {
|
|
723
|
-
sortBy?: SortOption;
|
|
724
|
-
assetFilter?: string[];
|
|
725
|
-
minTvl?: number;
|
|
726
|
-
}
|
|
727
|
-
declare function usePendleData(options?: UsePendleDataOptions): {
|
|
728
|
-
markets: {
|
|
729
|
-
userPosition: UserPendlePosition | undefined;
|
|
730
|
-
marketAddress: string;
|
|
731
|
-
ptAddress: string;
|
|
732
|
-
name: string;
|
|
733
|
-
underlyingSymbol: string;
|
|
734
|
-
fixedApy: string | null;
|
|
735
|
-
impliedApy: string | null;
|
|
736
|
-
tvlUsd: string | null;
|
|
737
|
-
expiry: string;
|
|
738
|
-
}[];
|
|
739
|
-
isLoading: boolean;
|
|
740
|
-
isError: boolean;
|
|
741
|
-
error: Error | null;
|
|
742
|
-
refetch: () => void;
|
|
743
|
-
};
|
|
744
|
-
|
|
745
439
|
type SwapLayout = 'compact' | 'full';
|
|
746
440
|
interface SwapQuote {
|
|
747
441
|
inputAmount: string;
|
|
@@ -794,8 +488,8 @@ declare function useSwapQuote({ fromToken, toToken, amount, enabled }: UseSwapQu
|
|
|
794
488
|
refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<SwapQuote | null, Error>>;
|
|
795
489
|
};
|
|
796
490
|
|
|
797
|
-
type TabId = '
|
|
798
|
-
type FeaturePreset = 'full' | '
|
|
491
|
+
type TabId = 'swap' | 'positions' | 'rebalance';
|
|
492
|
+
type FeaturePreset = 'full' | 'swap-only';
|
|
799
493
|
interface TabConfig {
|
|
800
494
|
id: TabId;
|
|
801
495
|
label: string;
|
|
@@ -803,32 +497,126 @@ interface TabConfig {
|
|
|
803
497
|
}
|
|
804
498
|
/**
|
|
805
499
|
* Props for the CompassEarnWidget (unified tabbed experience).
|
|
806
|
-
*
|
|
807
|
-
* Sensible defaults are applied automatically:
|
|
808
|
-
* - Starts on Vaults tab (highest yield opportunities)
|
|
809
|
-
* - All tabs enabled (Vaults, Aave, Pendle, Swap)
|
|
810
|
-
* - Full-featured experience out of the box
|
|
811
500
|
*/
|
|
812
501
|
interface CompassEarnWidgetProps {
|
|
813
502
|
preset?: FeaturePreset;
|
|
814
|
-
enableVaults?: boolean;
|
|
815
|
-
enableAave?: boolean;
|
|
816
|
-
enablePendle?: boolean;
|
|
817
503
|
enableSwap?: boolean;
|
|
818
504
|
enablePositions?: boolean;
|
|
505
|
+
enableRebalance?: boolean;
|
|
819
506
|
defaultTab?: TabId;
|
|
820
507
|
showHeader?: boolean;
|
|
821
|
-
showApy?: boolean;
|
|
822
|
-
showTvl?: boolean;
|
|
823
|
-
showExpiry?: boolean;
|
|
824
|
-
showUserPosition?: boolean;
|
|
825
508
|
showPnL?: boolean;
|
|
826
|
-
showSearch?: boolean;
|
|
827
|
-
showSort?: boolean;
|
|
828
509
|
onTabChange?: (tab: TabId) => void;
|
|
829
510
|
}
|
|
830
511
|
|
|
831
|
-
declare function CompassEarnWidget({ preset,
|
|
512
|
+
declare function CompassEarnWidget({ preset, enableSwap, enablePositions, enableRebalance, defaultTab, showHeader, showPnL, onTabChange, }: CompassEarnWidgetProps): react_jsx_runtime.JSX.Element;
|
|
513
|
+
|
|
514
|
+
type VenueType$1 = 'vault' | 'aave' | 'pendle_pt';
|
|
515
|
+
interface PortfolioPosition {
|
|
516
|
+
id: string;
|
|
517
|
+
venueType: VenueType$1;
|
|
518
|
+
venueName: string;
|
|
519
|
+
venueAddress: string;
|
|
520
|
+
token: string;
|
|
521
|
+
balance: number;
|
|
522
|
+
usdValue: number;
|
|
523
|
+
apy: number;
|
|
524
|
+
/** Computed: usdValue / totalUsd * 100 */
|
|
525
|
+
allocationPercent: number;
|
|
526
|
+
}
|
|
527
|
+
interface IdleBalance {
|
|
528
|
+
token: string;
|
|
529
|
+
balance: number;
|
|
530
|
+
usdValue: number;
|
|
531
|
+
}
|
|
532
|
+
interface PortfolioState {
|
|
533
|
+
positions: PortfolioPosition[];
|
|
534
|
+
idleBalances: IdleBalance[];
|
|
535
|
+
totalUsd: number;
|
|
536
|
+
totalIdleUsd: number;
|
|
537
|
+
}
|
|
538
|
+
interface TargetAllocation {
|
|
539
|
+
venueType: VenueType$1;
|
|
540
|
+
venueAddress: string;
|
|
541
|
+
venueName: string;
|
|
542
|
+
token: string;
|
|
543
|
+
targetPercent: number;
|
|
544
|
+
}
|
|
545
|
+
type RebalanceActionType = 'withdraw' | 'swap' | 'deposit';
|
|
546
|
+
interface RebalanceAction {
|
|
547
|
+
type: RebalanceActionType;
|
|
548
|
+
venueType?: VenueType$1;
|
|
549
|
+
venueAddress?: string;
|
|
550
|
+
token: string;
|
|
551
|
+
amount: number;
|
|
552
|
+
usdValue: number;
|
|
553
|
+
/** For swaps: output token */
|
|
554
|
+
tokenOut?: string;
|
|
555
|
+
/** For swaps: estimated output amount */
|
|
556
|
+
estimatedAmountOut?: number;
|
|
557
|
+
}
|
|
558
|
+
interface RebalancePlan {
|
|
559
|
+
actions: RebalanceAction[];
|
|
560
|
+
totalActions: number;
|
|
561
|
+
estimatedGasSavings: string;
|
|
562
|
+
warnings: string[];
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Props for the RebalancingWidget.
|
|
566
|
+
*
|
|
567
|
+
* Sensible defaults are applied automatically:
|
|
568
|
+
* - Chain switcher and wallet status shown
|
|
569
|
+
* - $1 minimum rebalance threshold (skips dust)
|
|
570
|
+
* - 0.5% default slippage for swaps
|
|
571
|
+
*/
|
|
572
|
+
interface RebalancingWidgetProps {
|
|
573
|
+
/** Show chain switcher in header @default true */
|
|
574
|
+
showChainSwitcher?: boolean;
|
|
575
|
+
/** Show wallet status in header @default true */
|
|
576
|
+
showWalletStatus?: boolean;
|
|
577
|
+
/** Minimum USD value to include in rebalance actions @default 1 */
|
|
578
|
+
minRebalanceThresholdUsd?: number;
|
|
579
|
+
/** Default slippage for swaps in percent @default 0.5 */
|
|
580
|
+
defaultSlippage?: number;
|
|
581
|
+
/** Lock to specific chain (hides chain switcher) */
|
|
582
|
+
chain?: string;
|
|
583
|
+
/** Callback after successful rebalance */
|
|
584
|
+
onRebalance?: (plan: RebalancePlan, txHash: string) => void;
|
|
585
|
+
/** Callback when rebalance fails */
|
|
586
|
+
onError?: (error: Error) => void;
|
|
587
|
+
/** Widget title displayed in the header. Default: "Portfolio Manager" */
|
|
588
|
+
title?: string;
|
|
589
|
+
/** Filter which venues appear in "Add Venue". If omitted, all available venues are shown. */
|
|
590
|
+
venues?: {
|
|
591
|
+
vaults?: string[];
|
|
592
|
+
aave?: string[];
|
|
593
|
+
pendle?: string[];
|
|
594
|
+
};
|
|
595
|
+
/** Whether to show the "Top Up" button in the balance card. Default: true */
|
|
596
|
+
showTopUp?: boolean;
|
|
597
|
+
/** Fixed height for the widget. Default: "600px" */
|
|
598
|
+
height?: string;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
declare function RebalancingWidget({ showChainSwitcher, showWalletStatus, minRebalanceThresholdUsd, defaultSlippage, chain, onRebalance, onError, title, venues, showTopUp, height, }: RebalancingWidgetProps): react_jsx_runtime.JSX.Element;
|
|
602
|
+
|
|
603
|
+
interface MarketOption {
|
|
604
|
+
venueType: VenueType$1;
|
|
605
|
+
venueAddress: string;
|
|
606
|
+
venueName: string;
|
|
607
|
+
token: string;
|
|
608
|
+
apy: number;
|
|
609
|
+
}
|
|
610
|
+
declare function useRebalancingData(chainOverride?: string): {
|
|
611
|
+
portfolio: PortfolioState | null;
|
|
612
|
+
availableVenues: MarketOption[];
|
|
613
|
+
earnAccountMarkets: MarketOption$1[];
|
|
614
|
+
isMarketsLoading: boolean;
|
|
615
|
+
isLoading: boolean;
|
|
616
|
+
isError: boolean;
|
|
617
|
+
error: Error | null;
|
|
618
|
+
refetch: () => void;
|
|
619
|
+
};
|
|
832
620
|
|
|
833
621
|
/**
|
|
834
622
|
* Theme Presets for Compass Embeddable Widgets
|
|
@@ -1036,10 +824,15 @@ type TransferAction = 'deposit' | 'withdraw';
|
|
|
1036
824
|
interface EarnAccountBalanceProps {
|
|
1037
825
|
/** Compact mode - just show total USD value */
|
|
1038
826
|
compact?: boolean;
|
|
827
|
+
/** Hide visual buttons, only render modals (for external trigger via ref) */
|
|
828
|
+
hideVisual?: boolean;
|
|
1039
829
|
/** Callback when transfer completes */
|
|
1040
830
|
onTransferComplete?: (action: TransferAction, token: string, amount: string, txHash: string) => void;
|
|
1041
831
|
}
|
|
1042
|
-
|
|
832
|
+
interface EarnAccountBalanceHandle {
|
|
833
|
+
openTransferModal: () => void;
|
|
834
|
+
}
|
|
835
|
+
declare const EarnAccountBalance: react.ForwardRefExoticComponent<EarnAccountBalanceProps & react.RefAttributes<EarnAccountBalanceHandle>>;
|
|
1043
836
|
|
|
1044
837
|
interface TokenBalance {
|
|
1045
838
|
symbol: string;
|
|
@@ -1066,4 +859,4 @@ interface ChainConfig {
|
|
|
1066
859
|
}
|
|
1067
860
|
declare const CHAINS: Record<SupportedChainId, ChainConfig>;
|
|
1068
861
|
|
|
1069
|
-
export {
|
|
862
|
+
export { AccountBalancesModal, type AccountBalancesModalProps, ActionModal, ApiProvider, CHAINS, type ChainConfig, ChainSwitcher, CompassEarnWidget, type CompassEarnWidgetProps, CompassProvider, type CompassProviderProps, type CompassTheme, DEFAULT_SWAP_TOKENS, DepositWithdrawForm, EarnAccount, EarnAccountBalance, type EarnAccountBalanceProps, type EarnAccountContextValue, EarnAccountGuard, type EarnAccountProps, type FeaturePreset, type IdleBalance, PnLSummary, type PortfolioPosition, type PortfolioState, type RebalanceAction, type RebalanceActionType, type RebalancePlan, RebalancingWidget, type RebalancingWidgetProps, type SupportedChain, type SupportedChainId, type SwapLayout, type SwapQuote, SwapWidget, type SwapWidgetProps, type TabConfig, type TabId, type TargetAllocation, type ThemeInput, type ThemeMode, type ThemePresetName, ThemeProvider, type TokenBalance, TransactionHistory, type TypedDataToSign, type VenueType$1 as VenueType, type WalletAdapter, WalletStatus, themePresets, useChain, useCompassApi, useCompassChain, useCompassWallet, useEarnAccount, useEmbeddableApi, useEmbeddableWallet, useRebalancingData, useSwapQuote, useTheme };
|