@compass-labs/widgets 0.1.1 → 0.1.2

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 CHANGED
@@ -297,6 +297,11 @@ interface TypedDataToSign {
297
297
  interface WalletAdapter {
298
298
  /** Connected wallet address, or null if not connected */
299
299
  address: Address | null;
300
+ /**
301
+ * Current chain ID the wallet is connected to (optional)
302
+ * If provided, widgets will verify the wallet is on the correct chain before signing
303
+ */
304
+ chainId?: number;
300
305
  /**
301
306
  * Sign EIP-712 typed data
302
307
  * Called when user initiates a deposit/withdraw transaction
@@ -409,6 +414,10 @@ interface VaultsListProps {
409
414
  assetFilter?: string[];
410
415
  /** Minimum APY filter */
411
416
  minApy?: number;
417
+ /** Minimum TVL filter (in USD) */
418
+ minTvl?: number;
419
+ /** Show TVL filter input */
420
+ showTvlFilter?: boolean;
412
421
  /** Callback when vault is clicked */
413
422
  onVaultSelect?: (vault: VaultData) => void;
414
423
  /** Callback after successful deposit */
@@ -430,12 +439,13 @@ interface VaultsListProps {
430
439
  * />
431
440
  * ```
432
441
  */
433
- declare function VaultsList({ showApy, apyPeriods, showTvl, showUserPosition, showPnL, showHistory, showSearch, showSort, defaultSort, assetFilter, minApy, onVaultSelect, onDeposit, onWithdraw, }: VaultsListProps): react_jsx_runtime.JSX.Element;
442
+ 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;
434
443
 
435
444
  interface UseVaultsDataOptions {
436
445
  sortBy?: SortOption$2;
437
446
  assetFilter?: string[];
438
447
  minApy?: number;
448
+ minTvl?: number;
439
449
  }
440
450
  declare function useVaultsData(options?: UseVaultsDataOptions): {
441
451
  vaults: {
@@ -593,6 +603,10 @@ interface PendleMarketsListProps {
593
603
  defaultSort?: SortOption;
594
604
  /** Filter by asset symbols */
595
605
  assetFilter?: string[];
606
+ /** Minimum TVL filter (in USD) */
607
+ minTvl?: number;
608
+ /** Show TVL filter input */
609
+ showTvlFilter?: boolean;
596
610
  /** Callback when market is clicked */
597
611
  onMarketSelect?: (market: PendleMarketData) => void;
598
612
  /** Callback after successful deposit */
@@ -614,11 +628,12 @@ interface PendleMarketsListProps {
614
628
  * />
615
629
  * ```
616
630
  */
617
- declare function PendleMarketsList({ showApy, showTvl, showExpiry, showUserPosition, showPnL, showHistory, showSearch, showSort, defaultSort, assetFilter, onMarketSelect, onDeposit, onWithdraw, }: PendleMarketsListProps): react_jsx_runtime.JSX.Element;
631
+ 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;
618
632
 
619
633
  interface UsePendleDataOptions {
620
634
  sortBy?: SortOption;
621
635
  assetFilter?: string[];
636
+ minTvl?: number;
622
637
  }
623
638
  declare function usePendleData(options?: UsePendleDataOptions): {
624
639
  markets: {
@@ -643,8 +658,6 @@ interface SwapQuote {
643
658
  inputAmount: string;
644
659
  outputAmount: string;
645
660
  rate: string;
646
- priceImpact: string;
647
- fee: string;
648
661
  }
649
662
  interface SwapWidgetProps {
650
663
  layout?: SwapLayout;
@@ -653,12 +666,11 @@ interface SwapWidgetProps {
653
666
  allowedTokens?: string[];
654
667
  showReverseButton?: boolean;
655
668
  showSettings?: boolean;
656
- showPriceImpact?: boolean;
657
669
  onSwapSuccess?: (fromToken: string, toToken: string, fromAmount: string, toAmount: string, txHash: string) => void;
658
670
  onSwapError?: (error: Error) => void;
659
671
  }
660
672
 
661
- declare function SwapWidget({ layout, defaultFromToken, defaultToToken, allowedTokens, showReverseButton, showSettings, showPriceImpact, onSwapSuccess, onSwapError, }: SwapWidgetProps): react_jsx_runtime.JSX.Element;
673
+ declare function SwapWidget({ layout, defaultFromToken, defaultToToken, allowedTokens, showReverseButton, showSettings, onSwapSuccess, onSwapError, }: SwapWidgetProps): react_jsx_runtime.JSX.Element;
662
674
 
663
675
  interface UseSwapQuoteOptions {
664
676
  fromToken: string;
@@ -670,28 +682,19 @@ declare function useSwapQuote({ fromToken, toToken, amount, enabled }: UseSwapQu
670
682
  quote: SwapQuote | null | undefined;
671
683
  isLoading: boolean;
672
684
  isError: boolean;
685
+ error: Error | null;
673
686
  refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<SwapQuote | null, Error>>;
674
687
  };
675
688
 
676
- type TabId = 'vaults' | 'aave' | 'pendle' | 'swap';
677
- type FeaturePreset = 'full' | 'earn-only' | 'swap-only' | 'vaults-only';
678
- interface TabConfig {
679
- id: TabId;
680
- label: string;
681
- enabled: boolean;
682
- }
689
+ type TabId = 'vaults' | 'aave' | 'pendle' | 'swap' | 'positions';
683
690
  interface CompassEarnWidgetProps {
684
- preset?: FeaturePreset;
685
- enableVaults?: boolean;
686
- enableAave?: boolean;
687
- enablePendle?: boolean;
688
- enableSwap?: boolean;
691
+ /** Starting tab (defaults to 'vaults') */
689
692
  defaultTab?: TabId;
690
- showHeader?: boolean;
693
+ /** Called when user switches tabs */
691
694
  onTabChange?: (tab: TabId) => void;
692
695
  }
693
696
 
694
- declare function CompassEarnWidget({ preset, enableVaults, enableAave, enablePendle, enableSwap, defaultTab, showHeader, onTabChange, }: CompassEarnWidgetProps): react_jsx_runtime.JSX.Element;
697
+ declare function CompassEarnWidget({ defaultTab, onTabChange, }: CompassEarnWidgetProps): react_jsx_runtime.JSX.Element;
695
698
 
696
699
  /**
697
700
  * Theme Presets for Compass Embeddable Widgets
@@ -768,6 +771,8 @@ interface WalletContextValue {
768
771
  address: Address | null;
769
772
  /** Whether a wallet is connected */
770
773
  isConnected: boolean;
774
+ /** Current chain ID the wallet is connected to */
775
+ walletChainId: number | undefined;
771
776
  /** Sign EIP-712 typed data - throws if wallet not connected */
772
777
  signTypedData: (data: TypedDataToSign) => Promise<string>;
773
778
  /** Switch chain - may not be available depending on wallet adapter */
@@ -891,14 +896,27 @@ declare function EarnAccountGuard({ children, loadingComponent, createAccountCom
891
896
 
892
897
  type TransferAction = 'deposit' | 'withdraw';
893
898
  interface EarnAccountBalanceProps {
894
- /** Tokens to show/allow transfers for */
895
- tokens?: string[];
896
899
  /** Compact mode - just show total USD value */
897
900
  compact?: boolean;
898
901
  /** Callback when transfer completes */
899
902
  onTransferComplete?: (action: TransferAction, token: string, amount: string, txHash: string) => void;
900
903
  }
901
- declare function EarnAccountBalance({ tokens, compact, onTransferComplete, }: EarnAccountBalanceProps): react_jsx_runtime.JSX.Element | null;
904
+ declare function EarnAccountBalance({ compact, onTransferComplete, }: EarnAccountBalanceProps): react_jsx_runtime.JSX.Element | null;
905
+
906
+ interface TokenBalance {
907
+ symbol: string;
908
+ balance: string;
909
+ usdValue: string;
910
+ }
911
+ interface AccountBalancesModalProps {
912
+ isOpen: boolean;
913
+ onClose: () => void;
914
+ balances: TokenBalance[];
915
+ totalUsdValue: string;
916
+ isLoading?: boolean;
917
+ earnAccountAddress?: string;
918
+ }
919
+ declare function AccountBalancesModal({ isOpen, onClose, balances, totalUsdValue, isLoading, earnAccountAddress, }: AccountBalancesModalProps): react_jsx_runtime.JSX.Element | null;
902
920
 
903
921
  type SupportedChainId = 'ethereum' | 'base' | 'arbitrum';
904
922
  interface ChainConfig {
@@ -910,4 +928,4 @@ interface ChainConfig {
910
928
  }
911
929
  declare const CHAINS: Record<SupportedChainId, ChainConfig>;
912
930
 
913
- export { type AaveMarketData, AaveMarketsList, type AaveMarketsListProps, type SortOption$1 as AaveSortOption, ActionModal, ApiProvider, type ApyPeriod, CHAINS, type ChainConfig, ChainSwitcher, CompassEarnWidget, type CompassEarnWidgetProps, CompassProvider, type CompassProviderProps, type CompassTheme, DepositWithdrawForm, EarnAccountBalance, type EarnAccountBalanceProps, 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, 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 };
931
+ export { type AaveMarketData, AaveMarketsList, type AaveMarketsListProps, type SortOption$1 as AaveSortOption, AccountBalancesModal, type AccountBalancesModalProps, ActionModal, ApiProvider, type ApyPeriod, CHAINS, type ChainConfig, ChainSwitcher, CompassEarnWidget, type CompassEarnWidgetProps, CompassProvider, type CompassProviderProps, type CompassTheme, DepositWithdrawForm, EarnAccountBalance, type EarnAccountBalanceProps, type EarnAccountContextValue, EarnAccountGuard, type PendleMarketData, PendleMarketsList, type PendleMarketsListProps, type SortOption as PendleSortOption, PnLSummary, type SupportedChain, type SupportedChainId, type SwapLayout, type SwapQuote, SwapWidget, type SwapWidgetProps, type TabId, type ThemeInput, type ThemeMode, type ThemePresetName, ThemeProvider, type TokenBalance, 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 };
package/dist/index.d.ts CHANGED
@@ -297,6 +297,11 @@ interface TypedDataToSign {
297
297
  interface WalletAdapter {
298
298
  /** Connected wallet address, or null if not connected */
299
299
  address: Address | null;
300
+ /**
301
+ * Current chain ID the wallet is connected to (optional)
302
+ * If provided, widgets will verify the wallet is on the correct chain before signing
303
+ */
304
+ chainId?: number;
300
305
  /**
301
306
  * Sign EIP-712 typed data
302
307
  * Called when user initiates a deposit/withdraw transaction
@@ -409,6 +414,10 @@ interface VaultsListProps {
409
414
  assetFilter?: string[];
410
415
  /** Minimum APY filter */
411
416
  minApy?: number;
417
+ /** Minimum TVL filter (in USD) */
418
+ minTvl?: number;
419
+ /** Show TVL filter input */
420
+ showTvlFilter?: boolean;
412
421
  /** Callback when vault is clicked */
413
422
  onVaultSelect?: (vault: VaultData) => void;
414
423
  /** Callback after successful deposit */
@@ -430,12 +439,13 @@ interface VaultsListProps {
430
439
  * />
431
440
  * ```
432
441
  */
433
- declare function VaultsList({ showApy, apyPeriods, showTvl, showUserPosition, showPnL, showHistory, showSearch, showSort, defaultSort, assetFilter, minApy, onVaultSelect, onDeposit, onWithdraw, }: VaultsListProps): react_jsx_runtime.JSX.Element;
442
+ 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;
434
443
 
435
444
  interface UseVaultsDataOptions {
436
445
  sortBy?: SortOption$2;
437
446
  assetFilter?: string[];
438
447
  minApy?: number;
448
+ minTvl?: number;
439
449
  }
440
450
  declare function useVaultsData(options?: UseVaultsDataOptions): {
441
451
  vaults: {
@@ -593,6 +603,10 @@ interface PendleMarketsListProps {
593
603
  defaultSort?: SortOption;
594
604
  /** Filter by asset symbols */
595
605
  assetFilter?: string[];
606
+ /** Minimum TVL filter (in USD) */
607
+ minTvl?: number;
608
+ /** Show TVL filter input */
609
+ showTvlFilter?: boolean;
596
610
  /** Callback when market is clicked */
597
611
  onMarketSelect?: (market: PendleMarketData) => void;
598
612
  /** Callback after successful deposit */
@@ -614,11 +628,12 @@ interface PendleMarketsListProps {
614
628
  * />
615
629
  * ```
616
630
  */
617
- declare function PendleMarketsList({ showApy, showTvl, showExpiry, showUserPosition, showPnL, showHistory, showSearch, showSort, defaultSort, assetFilter, onMarketSelect, onDeposit, onWithdraw, }: PendleMarketsListProps): react_jsx_runtime.JSX.Element;
631
+ 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;
618
632
 
619
633
  interface UsePendleDataOptions {
620
634
  sortBy?: SortOption;
621
635
  assetFilter?: string[];
636
+ minTvl?: number;
622
637
  }
623
638
  declare function usePendleData(options?: UsePendleDataOptions): {
624
639
  markets: {
@@ -643,8 +658,6 @@ interface SwapQuote {
643
658
  inputAmount: string;
644
659
  outputAmount: string;
645
660
  rate: string;
646
- priceImpact: string;
647
- fee: string;
648
661
  }
649
662
  interface SwapWidgetProps {
650
663
  layout?: SwapLayout;
@@ -653,12 +666,11 @@ interface SwapWidgetProps {
653
666
  allowedTokens?: string[];
654
667
  showReverseButton?: boolean;
655
668
  showSettings?: boolean;
656
- showPriceImpact?: boolean;
657
669
  onSwapSuccess?: (fromToken: string, toToken: string, fromAmount: string, toAmount: string, txHash: string) => void;
658
670
  onSwapError?: (error: Error) => void;
659
671
  }
660
672
 
661
- declare function SwapWidget({ layout, defaultFromToken, defaultToToken, allowedTokens, showReverseButton, showSettings, showPriceImpact, onSwapSuccess, onSwapError, }: SwapWidgetProps): react_jsx_runtime.JSX.Element;
673
+ declare function SwapWidget({ layout, defaultFromToken, defaultToToken, allowedTokens, showReverseButton, showSettings, onSwapSuccess, onSwapError, }: SwapWidgetProps): react_jsx_runtime.JSX.Element;
662
674
 
663
675
  interface UseSwapQuoteOptions {
664
676
  fromToken: string;
@@ -670,28 +682,19 @@ declare function useSwapQuote({ fromToken, toToken, amount, enabled }: UseSwapQu
670
682
  quote: SwapQuote | null | undefined;
671
683
  isLoading: boolean;
672
684
  isError: boolean;
685
+ error: Error | null;
673
686
  refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<SwapQuote | null, Error>>;
674
687
  };
675
688
 
676
- type TabId = 'vaults' | 'aave' | 'pendle' | 'swap';
677
- type FeaturePreset = 'full' | 'earn-only' | 'swap-only' | 'vaults-only';
678
- interface TabConfig {
679
- id: TabId;
680
- label: string;
681
- enabled: boolean;
682
- }
689
+ type TabId = 'vaults' | 'aave' | 'pendle' | 'swap' | 'positions';
683
690
  interface CompassEarnWidgetProps {
684
- preset?: FeaturePreset;
685
- enableVaults?: boolean;
686
- enableAave?: boolean;
687
- enablePendle?: boolean;
688
- enableSwap?: boolean;
691
+ /** Starting tab (defaults to 'vaults') */
689
692
  defaultTab?: TabId;
690
- showHeader?: boolean;
693
+ /** Called when user switches tabs */
691
694
  onTabChange?: (tab: TabId) => void;
692
695
  }
693
696
 
694
- declare function CompassEarnWidget({ preset, enableVaults, enableAave, enablePendle, enableSwap, defaultTab, showHeader, onTabChange, }: CompassEarnWidgetProps): react_jsx_runtime.JSX.Element;
697
+ declare function CompassEarnWidget({ defaultTab, onTabChange, }: CompassEarnWidgetProps): react_jsx_runtime.JSX.Element;
695
698
 
696
699
  /**
697
700
  * Theme Presets for Compass Embeddable Widgets
@@ -768,6 +771,8 @@ interface WalletContextValue {
768
771
  address: Address | null;
769
772
  /** Whether a wallet is connected */
770
773
  isConnected: boolean;
774
+ /** Current chain ID the wallet is connected to */
775
+ walletChainId: number | undefined;
771
776
  /** Sign EIP-712 typed data - throws if wallet not connected */
772
777
  signTypedData: (data: TypedDataToSign) => Promise<string>;
773
778
  /** Switch chain - may not be available depending on wallet adapter */
@@ -891,14 +896,27 @@ declare function EarnAccountGuard({ children, loadingComponent, createAccountCom
891
896
 
892
897
  type TransferAction = 'deposit' | 'withdraw';
893
898
  interface EarnAccountBalanceProps {
894
- /** Tokens to show/allow transfers for */
895
- tokens?: string[];
896
899
  /** Compact mode - just show total USD value */
897
900
  compact?: boolean;
898
901
  /** Callback when transfer completes */
899
902
  onTransferComplete?: (action: TransferAction, token: string, amount: string, txHash: string) => void;
900
903
  }
901
- declare function EarnAccountBalance({ tokens, compact, onTransferComplete, }: EarnAccountBalanceProps): react_jsx_runtime.JSX.Element | null;
904
+ declare function EarnAccountBalance({ compact, onTransferComplete, }: EarnAccountBalanceProps): react_jsx_runtime.JSX.Element | null;
905
+
906
+ interface TokenBalance {
907
+ symbol: string;
908
+ balance: string;
909
+ usdValue: string;
910
+ }
911
+ interface AccountBalancesModalProps {
912
+ isOpen: boolean;
913
+ onClose: () => void;
914
+ balances: TokenBalance[];
915
+ totalUsdValue: string;
916
+ isLoading?: boolean;
917
+ earnAccountAddress?: string;
918
+ }
919
+ declare function AccountBalancesModal({ isOpen, onClose, balances, totalUsdValue, isLoading, earnAccountAddress, }: AccountBalancesModalProps): react_jsx_runtime.JSX.Element | null;
902
920
 
903
921
  type SupportedChainId = 'ethereum' | 'base' | 'arbitrum';
904
922
  interface ChainConfig {
@@ -910,4 +928,4 @@ interface ChainConfig {
910
928
  }
911
929
  declare const CHAINS: Record<SupportedChainId, ChainConfig>;
912
930
 
913
- export { type AaveMarketData, AaveMarketsList, type AaveMarketsListProps, type SortOption$1 as AaveSortOption, ActionModal, ApiProvider, type ApyPeriod, CHAINS, type ChainConfig, ChainSwitcher, CompassEarnWidget, type CompassEarnWidgetProps, CompassProvider, type CompassProviderProps, type CompassTheme, DepositWithdrawForm, EarnAccountBalance, type EarnAccountBalanceProps, 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, 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 };
931
+ export { type AaveMarketData, AaveMarketsList, type AaveMarketsListProps, type SortOption$1 as AaveSortOption, AccountBalancesModal, type AccountBalancesModalProps, ActionModal, ApiProvider, type ApyPeriod, CHAINS, type ChainConfig, ChainSwitcher, CompassEarnWidget, type CompassEarnWidgetProps, CompassProvider, type CompassProviderProps, type CompassTheme, DepositWithdrawForm, EarnAccountBalance, type EarnAccountBalanceProps, type EarnAccountContextValue, EarnAccountGuard, type PendleMarketData, PendleMarketsList, type PendleMarketsListProps, type SortOption as PendleSortOption, PnLSummary, type SupportedChain, type SupportedChainId, type SwapLayout, type SwapQuote, SwapWidget, type SwapWidgetProps, type TabId, type ThemeInput, type ThemeMode, type ThemePresetName, ThemeProvider, type TokenBalance, 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 };