@compass-labs/widgets 0.1.32 → 0.1.34

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
  *
@@ -737,6 +703,18 @@ declare function useEarnAccount(): EarnAccountContextValue;
737
703
 
738
704
  declare function ChainSwitcher(): react_jsx_runtime.JSX.Element;
739
705
 
706
+ interface CopyableAddressProps {
707
+ /** The full address to copy */
708
+ address: string;
709
+ /** Label shown above the address (e.g., "Wallet", "Product Account") */
710
+ label?: string;
711
+ /** Show truncated address (default: true) */
712
+ truncate?: boolean;
713
+ /** Text size class (default: 'text-xs') */
714
+ textSize?: string;
715
+ }
716
+ declare function CopyableAddress({ address, label, truncate, textSize, }: CopyableAddressProps): react_jsx_runtime.JSX.Element;
717
+
740
718
  interface WalletStatusProps {
741
719
  /** Show full address or truncated */
742
720
  showFullAddress?: boolean;
@@ -846,8 +824,27 @@ interface AccountBalancesModalProps {
846
824
  totalUsdValue: string;
847
825
  isLoading?: boolean;
848
826
  earnAccountAddress?: string;
827
+ walletAddress?: string;
828
+ }
829
+ declare function AccountBalancesModal({ isOpen, onClose, balances, totalUsdValue, isLoading, earnAccountAddress, walletAddress, }: AccountBalancesModalProps): react_jsx_runtime.JSX.Element;
830
+
831
+ interface SwapFormProps {
832
+ /** Tokens the user holds (shown in "from" dropdown) */
833
+ availableFromTokens: string[];
834
+ /** Extra tokens to include in "to" dropdown beyond from tokens */
835
+ availableToTokens?: string[];
836
+ /** Token balances keyed by symbol (human-readable amounts) */
837
+ balances?: Record<string, string>;
838
+ /** Initial "from" token */
839
+ defaultFromToken?: string;
840
+ /** Initial "to" token */
841
+ defaultToToken?: string;
842
+ /** Callback after successful swap */
843
+ onSwapSuccess?: (fromToken: string, toToken: string, amountIn: string, amountOut: string, txHash: string) => void;
844
+ /** Callback on swap error */
845
+ onSwapError?: (error: Error) => void;
849
846
  }
850
- declare function AccountBalancesModal({ isOpen, onClose, balances, totalUsdValue, isLoading, earnAccountAddress, }: AccountBalancesModalProps): react_jsx_runtime.JSX.Element | null;
847
+ declare function SwapForm({ availableFromTokens, availableToTokens, balances, defaultFromToken, defaultToToken, onSwapSuccess, onSwapError, }: SwapFormProps): react_jsx_runtime.JSX.Element;
851
848
 
852
849
  type SupportedChainId = 'ethereum' | 'base' | 'arbitrum';
853
850
  interface ChainConfig {
@@ -859,4 +856,4 @@ interface ChainConfig {
859
856
  }
860
857
  declare const CHAINS: Record<SupportedChainId, ChainConfig>;
861
858
 
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 };
859
+ export { AccountBalancesModal, type AccountBalancesModalProps, ActionModal, ApiProvider, CHAINS, type ChainConfig, ChainSwitcher, CompassEarnWidget, type CompassEarnWidgetProps, CompassProvider, type CompassProviderProps, type CompassTheme, CopyableAddress, type CopyableAddressProps, 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
  *
@@ -737,6 +703,18 @@ declare function useEarnAccount(): EarnAccountContextValue;
737
703
 
738
704
  declare function ChainSwitcher(): react_jsx_runtime.JSX.Element;
739
705
 
706
+ interface CopyableAddressProps {
707
+ /** The full address to copy */
708
+ address: string;
709
+ /** Label shown above the address (e.g., "Wallet", "Product Account") */
710
+ label?: string;
711
+ /** Show truncated address (default: true) */
712
+ truncate?: boolean;
713
+ /** Text size class (default: 'text-xs') */
714
+ textSize?: string;
715
+ }
716
+ declare function CopyableAddress({ address, label, truncate, textSize, }: CopyableAddressProps): react_jsx_runtime.JSX.Element;
717
+
740
718
  interface WalletStatusProps {
741
719
  /** Show full address or truncated */
742
720
  showFullAddress?: boolean;
@@ -846,8 +824,27 @@ interface AccountBalancesModalProps {
846
824
  totalUsdValue: string;
847
825
  isLoading?: boolean;
848
826
  earnAccountAddress?: string;
827
+ walletAddress?: string;
828
+ }
829
+ declare function AccountBalancesModal({ isOpen, onClose, balances, totalUsdValue, isLoading, earnAccountAddress, walletAddress, }: AccountBalancesModalProps): react_jsx_runtime.JSX.Element;
830
+
831
+ interface SwapFormProps {
832
+ /** Tokens the user holds (shown in "from" dropdown) */
833
+ availableFromTokens: string[];
834
+ /** Extra tokens to include in "to" dropdown beyond from tokens */
835
+ availableToTokens?: string[];
836
+ /** Token balances keyed by symbol (human-readable amounts) */
837
+ balances?: Record<string, string>;
838
+ /** Initial "from" token */
839
+ defaultFromToken?: string;
840
+ /** Initial "to" token */
841
+ defaultToToken?: string;
842
+ /** Callback after successful swap */
843
+ onSwapSuccess?: (fromToken: string, toToken: string, amountIn: string, amountOut: string, txHash: string) => void;
844
+ /** Callback on swap error */
845
+ onSwapError?: (error: Error) => void;
849
846
  }
850
- declare function AccountBalancesModal({ isOpen, onClose, balances, totalUsdValue, isLoading, earnAccountAddress, }: AccountBalancesModalProps): react_jsx_runtime.JSX.Element | null;
847
+ declare function SwapForm({ availableFromTokens, availableToTokens, balances, defaultFromToken, defaultToToken, onSwapSuccess, onSwapError, }: SwapFormProps): react_jsx_runtime.JSX.Element;
851
848
 
852
849
  type SupportedChainId = 'ethereum' | 'base' | 'arbitrum';
853
850
  interface ChainConfig {
@@ -859,4 +856,4 @@ interface ChainConfig {
859
856
  }
860
857
  declare const CHAINS: Record<SupportedChainId, ChainConfig>;
861
858
 
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 };
859
+ export { AccountBalancesModal, type AccountBalancesModalProps, ActionModal, ApiProvider, CHAINS, type ChainConfig, ChainSwitcher, CompassEarnWidget, type CompassEarnWidgetProps, CompassProvider, type CompassProviderProps, type CompassTheme, CopyableAddress, type CopyableAddressProps, 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 };