@compass-labs/widgets 0.1.32 → 0.1.33

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
@@ -436,60 +436,8 @@ interface EarnAccountProps {
436
436
  */
437
437
  declare function EarnAccount({ showHeader, showInterestRate, showTopUpButton, showTrustBadge, compact, title, onDeposit, onWithdraw, defaultMarketTab, allowedVariableMarkets, allowedFixedMarkets, chain: chainProp, }: EarnAccountProps): react_jsx_runtime.JSX.Element;
438
438
 
439
- type SwapLayout = 'compact' | 'full';
440
- interface SwapQuote {
441
- inputAmount: string;
442
- outputAmount: string;
443
- rate: string;
444
- }
445
- /** Default tokens available for swapping */
446
- declare const DEFAULT_SWAP_TOKENS: readonly ["USDC", "ETH", "WETH", "WBTC", "DAI", "USDT", "AUSD", "SBC"];
447
- /**
448
- * Props for the SwapWidget.
449
- *
450
- * Sensible defaults are applied automatically:
451
- * - Full layout for maximum usability
452
- * - ETH → USDC as default pair (most common swap)
453
- * - Reverse button enabled for easy direction switching
454
- * - Popular DeFi tokens pre-configured
455
- */
456
- interface SwapWidgetProps {
457
- /** Widget layout size @default 'full' */
458
- layout?: SwapLayout;
459
- /** Initial "from" token @default 'ETH' */
460
- defaultFromToken?: string;
461
- /** Initial "to" token @default 'USDC' */
462
- defaultToToken?: string;
463
- /** Tokens available for selection @default ['USDC', 'ETH', 'WETH', 'WBTC', 'DAI', 'USDT', 'AUSD', 'SBC'] */
464
- allowedTokens?: string[];
465
- /** Show swap direction button @default true */
466
- showReverseButton?: boolean;
467
- /** Show settings panel @default false */
468
- showSettings?: boolean;
469
- /** Callback after successful swap */
470
- onSwapSuccess?: (fromToken: string, toToken: string, fromAmount: string, toAmount: string, txHash: string) => void;
471
- /** Callback on swap error */
472
- onSwapError?: (error: Error) => void;
473
- }
474
-
475
- declare function SwapWidget({ layout, defaultFromToken, defaultToToken, allowedTokens, showReverseButton, showSettings, onSwapSuccess, onSwapError, }: SwapWidgetProps): react_jsx_runtime.JSX.Element;
476
-
477
- interface UseSwapQuoteOptions {
478
- fromToken: string;
479
- toToken: string;
480
- amount: string;
481
- enabled?: boolean;
482
- }
483
- declare function useSwapQuote({ fromToken, toToken, amount, enabled }: UseSwapQuoteOptions): {
484
- quote: SwapQuote | null | undefined;
485
- isLoading: boolean;
486
- isError: boolean;
487
- error: Error | null;
488
- refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<SwapQuote | null, Error>>;
489
- };
490
-
491
- type TabId = 'swap' | 'positions' | 'rebalance';
492
- type FeaturePreset = 'full' | 'swap-only';
439
+ type TabId = 'positions' | 'rebalance';
440
+ type FeaturePreset = 'full';
493
441
  interface TabConfig {
494
442
  id: TabId;
495
443
  label: string;
@@ -500,7 +448,6 @@ interface TabConfig {
500
448
  */
501
449
  interface CompassEarnWidgetProps {
502
450
  preset?: FeaturePreset;
503
- enableSwap?: boolean;
504
451
  enablePositions?: boolean;
505
452
  enableRebalance?: boolean;
506
453
  defaultTab?: TabId;
@@ -509,7 +456,7 @@ interface CompassEarnWidgetProps {
509
456
  onTabChange?: (tab: TabId) => void;
510
457
  }
511
458
 
512
- declare function CompassEarnWidget({ preset, enableSwap, enablePositions, enableRebalance, defaultTab, showHeader, showPnL, onTabChange, }: CompassEarnWidgetProps): react_jsx_runtime.JSX.Element;
459
+ declare function CompassEarnWidget({ preset, enablePositions, enableRebalance, defaultTab, showHeader, showPnL, onTabChange, }: CompassEarnWidgetProps): react_jsx_runtime.JSX.Element;
513
460
 
514
461
  type VenueType$1 = 'vault' | 'aave' | 'pendle_pt';
515
462
  interface PortfolioPosition {
@@ -618,6 +565,25 @@ declare function useRebalancingData(chainOverride?: string): {
618
565
  refetch: () => void;
619
566
  };
620
567
 
568
+ interface SwapQuote {
569
+ inputAmount: string;
570
+ outputAmount: string;
571
+ rate: string;
572
+ }
573
+ interface UseSwapQuoteOptions {
574
+ fromToken: string;
575
+ toToken: string;
576
+ amount: string;
577
+ enabled?: boolean;
578
+ }
579
+ declare function useSwapQuote({ fromToken, toToken, amount, enabled }: UseSwapQuoteOptions): {
580
+ quote: SwapQuote | null | undefined;
581
+ isLoading: boolean;
582
+ isError: boolean;
583
+ error: Error | null;
584
+ refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<SwapQuote | null, Error>>;
585
+ };
586
+
621
587
  /**
622
588
  * Theme Presets for Compass Embeddable Widgets
623
589
  *
@@ -847,7 +813,25 @@ interface AccountBalancesModalProps {
847
813
  isLoading?: boolean;
848
814
  earnAccountAddress?: string;
849
815
  }
850
- declare function AccountBalancesModal({ isOpen, onClose, balances, totalUsdValue, isLoading, earnAccountAddress, }: AccountBalancesModalProps): react_jsx_runtime.JSX.Element | null;
816
+ declare function AccountBalancesModal({ isOpen, onClose, balances, totalUsdValue, isLoading, }: AccountBalancesModalProps): react_jsx_runtime.JSX.Element;
817
+
818
+ interface SwapFormProps {
819
+ /** Tokens the user holds (shown in "from" dropdown) */
820
+ availableFromTokens: string[];
821
+ /** Extra tokens to include in "to" dropdown beyond from tokens */
822
+ availableToTokens?: string[];
823
+ /** Token balances keyed by symbol (human-readable amounts) */
824
+ balances?: Record<string, string>;
825
+ /** Initial "from" token */
826
+ defaultFromToken?: string;
827
+ /** Initial "to" token */
828
+ defaultToToken?: string;
829
+ /** Callback after successful swap */
830
+ onSwapSuccess?: (fromToken: string, toToken: string, amountIn: string, amountOut: string, txHash: string) => void;
831
+ /** Callback on swap error */
832
+ onSwapError?: (error: Error) => void;
833
+ }
834
+ declare function SwapForm({ availableFromTokens, availableToTokens, balances, defaultFromToken, defaultToToken, onSwapSuccess, onSwapError, }: SwapFormProps): react_jsx_runtime.JSX.Element;
851
835
 
852
836
  type SupportedChainId = 'ethereum' | 'base' | 'arbitrum';
853
837
  interface ChainConfig {
@@ -859,4 +843,4 @@ interface ChainConfig {
859
843
  }
860
844
  declare const CHAINS: Record<SupportedChainId, ChainConfig>;
861
845
 
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 };
846
+ export { AccountBalancesModal, type AccountBalancesModalProps, ActionModal, ApiProvider, CHAINS, type ChainConfig, ChainSwitcher, CompassEarnWidget, type CompassEarnWidgetProps, CompassProvider, type CompassProviderProps, type CompassTheme, 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, SwapForm, type SwapFormProps, type SwapQuote, 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 };
package/dist/index.d.ts CHANGED
@@ -436,60 +436,8 @@ interface EarnAccountProps {
436
436
  */
437
437
  declare function EarnAccount({ showHeader, showInterestRate, showTopUpButton, showTrustBadge, compact, title, onDeposit, onWithdraw, defaultMarketTab, allowedVariableMarkets, allowedFixedMarkets, chain: chainProp, }: EarnAccountProps): react_jsx_runtime.JSX.Element;
438
438
 
439
- type SwapLayout = 'compact' | 'full';
440
- interface SwapQuote {
441
- inputAmount: string;
442
- outputAmount: string;
443
- rate: string;
444
- }
445
- /** Default tokens available for swapping */
446
- declare const DEFAULT_SWAP_TOKENS: readonly ["USDC", "ETH", "WETH", "WBTC", "DAI", "USDT", "AUSD", "SBC"];
447
- /**
448
- * Props for the SwapWidget.
449
- *
450
- * Sensible defaults are applied automatically:
451
- * - Full layout for maximum usability
452
- * - ETH → USDC as default pair (most common swap)
453
- * - Reverse button enabled for easy direction switching
454
- * - Popular DeFi tokens pre-configured
455
- */
456
- interface SwapWidgetProps {
457
- /** Widget layout size @default 'full' */
458
- layout?: SwapLayout;
459
- /** Initial "from" token @default 'ETH' */
460
- defaultFromToken?: string;
461
- /** Initial "to" token @default 'USDC' */
462
- defaultToToken?: string;
463
- /** Tokens available for selection @default ['USDC', 'ETH', 'WETH', 'WBTC', 'DAI', 'USDT', 'AUSD', 'SBC'] */
464
- allowedTokens?: string[];
465
- /** Show swap direction button @default true */
466
- showReverseButton?: boolean;
467
- /** Show settings panel @default false */
468
- showSettings?: boolean;
469
- /** Callback after successful swap */
470
- onSwapSuccess?: (fromToken: string, toToken: string, fromAmount: string, toAmount: string, txHash: string) => void;
471
- /** Callback on swap error */
472
- onSwapError?: (error: Error) => void;
473
- }
474
-
475
- declare function SwapWidget({ layout, defaultFromToken, defaultToToken, allowedTokens, showReverseButton, showSettings, onSwapSuccess, onSwapError, }: SwapWidgetProps): react_jsx_runtime.JSX.Element;
476
-
477
- interface UseSwapQuoteOptions {
478
- fromToken: string;
479
- toToken: string;
480
- amount: string;
481
- enabled?: boolean;
482
- }
483
- declare function useSwapQuote({ fromToken, toToken, amount, enabled }: UseSwapQuoteOptions): {
484
- quote: SwapQuote | null | undefined;
485
- isLoading: boolean;
486
- isError: boolean;
487
- error: Error | null;
488
- refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<SwapQuote | null, Error>>;
489
- };
490
-
491
- type TabId = 'swap' | 'positions' | 'rebalance';
492
- type FeaturePreset = 'full' | 'swap-only';
439
+ type TabId = 'positions' | 'rebalance';
440
+ type FeaturePreset = 'full';
493
441
  interface TabConfig {
494
442
  id: TabId;
495
443
  label: string;
@@ -500,7 +448,6 @@ interface TabConfig {
500
448
  */
501
449
  interface CompassEarnWidgetProps {
502
450
  preset?: FeaturePreset;
503
- enableSwap?: boolean;
504
451
  enablePositions?: boolean;
505
452
  enableRebalance?: boolean;
506
453
  defaultTab?: TabId;
@@ -509,7 +456,7 @@ interface CompassEarnWidgetProps {
509
456
  onTabChange?: (tab: TabId) => void;
510
457
  }
511
458
 
512
- declare function CompassEarnWidget({ preset, enableSwap, enablePositions, enableRebalance, defaultTab, showHeader, showPnL, onTabChange, }: CompassEarnWidgetProps): react_jsx_runtime.JSX.Element;
459
+ declare function CompassEarnWidget({ preset, enablePositions, enableRebalance, defaultTab, showHeader, showPnL, onTabChange, }: CompassEarnWidgetProps): react_jsx_runtime.JSX.Element;
513
460
 
514
461
  type VenueType$1 = 'vault' | 'aave' | 'pendle_pt';
515
462
  interface PortfolioPosition {
@@ -618,6 +565,25 @@ declare function useRebalancingData(chainOverride?: string): {
618
565
  refetch: () => void;
619
566
  };
620
567
 
568
+ interface SwapQuote {
569
+ inputAmount: string;
570
+ outputAmount: string;
571
+ rate: string;
572
+ }
573
+ interface UseSwapQuoteOptions {
574
+ fromToken: string;
575
+ toToken: string;
576
+ amount: string;
577
+ enabled?: boolean;
578
+ }
579
+ declare function useSwapQuote({ fromToken, toToken, amount, enabled }: UseSwapQuoteOptions): {
580
+ quote: SwapQuote | null | undefined;
581
+ isLoading: boolean;
582
+ isError: boolean;
583
+ error: Error | null;
584
+ refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<SwapQuote | null, Error>>;
585
+ };
586
+
621
587
  /**
622
588
  * Theme Presets for Compass Embeddable Widgets
623
589
  *
@@ -847,7 +813,25 @@ interface AccountBalancesModalProps {
847
813
  isLoading?: boolean;
848
814
  earnAccountAddress?: string;
849
815
  }
850
- declare function AccountBalancesModal({ isOpen, onClose, balances, totalUsdValue, isLoading, earnAccountAddress, }: AccountBalancesModalProps): react_jsx_runtime.JSX.Element | null;
816
+ declare function AccountBalancesModal({ isOpen, onClose, balances, totalUsdValue, isLoading, }: AccountBalancesModalProps): react_jsx_runtime.JSX.Element;
817
+
818
+ interface SwapFormProps {
819
+ /** Tokens the user holds (shown in "from" dropdown) */
820
+ availableFromTokens: string[];
821
+ /** Extra tokens to include in "to" dropdown beyond from tokens */
822
+ availableToTokens?: string[];
823
+ /** Token balances keyed by symbol (human-readable amounts) */
824
+ balances?: Record<string, string>;
825
+ /** Initial "from" token */
826
+ defaultFromToken?: string;
827
+ /** Initial "to" token */
828
+ defaultToToken?: string;
829
+ /** Callback after successful swap */
830
+ onSwapSuccess?: (fromToken: string, toToken: string, amountIn: string, amountOut: string, txHash: string) => void;
831
+ /** Callback on swap error */
832
+ onSwapError?: (error: Error) => void;
833
+ }
834
+ declare function SwapForm({ availableFromTokens, availableToTokens, balances, defaultFromToken, defaultToToken, onSwapSuccess, onSwapError, }: SwapFormProps): react_jsx_runtime.JSX.Element;
851
835
 
852
836
  type SupportedChainId = 'ethereum' | 'base' | 'arbitrum';
853
837
  interface ChainConfig {
@@ -859,4 +843,4 @@ interface ChainConfig {
859
843
  }
860
844
  declare const CHAINS: Record<SupportedChainId, ChainConfig>;
861
845
 
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 };
846
+ export { AccountBalancesModal, type AccountBalancesModalProps, ActionModal, ApiProvider, CHAINS, type ChainConfig, ChainSwitcher, CompassEarnWidget, type CompassEarnWidgetProps, CompassProvider, type CompassProviderProps, type CompassTheme, 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, SwapForm, type SwapFormProps, type SwapQuote, 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 };