@compass-labs/widgets 0.1.5 → 0.1.7
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 +55 -9
- package/dist/index.d.ts +55 -9
- package/dist/index.js +2596 -667
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2597 -669
- package/dist/index.mjs.map +1 -1
- package/dist/server/index.js +69 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +69 -1
- package/dist/server/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -326,8 +326,12 @@ interface WalletAdapter {
|
|
|
326
326
|
|
|
327
327
|
interface CompassProviderProps {
|
|
328
328
|
children: ReactNode;
|
|
329
|
-
/**
|
|
330
|
-
|
|
329
|
+
/**
|
|
330
|
+
* Compass API key - optional when using server-side API routes.
|
|
331
|
+
* If not provided, all API calls will go through /api/compass/* routes.
|
|
332
|
+
* @deprecated Use server-side API routes instead for better security.
|
|
333
|
+
*/
|
|
334
|
+
apiKey?: string;
|
|
331
335
|
/** Default chain to use */
|
|
332
336
|
defaultChain?: SupportedChain;
|
|
333
337
|
/** Theme preset name, preset with overrides, or full theme object */
|
|
@@ -542,6 +546,26 @@ declare function useAaveData(options?: UseAaveDataOptions): {
|
|
|
542
546
|
refetch: () => void;
|
|
543
547
|
};
|
|
544
548
|
|
|
549
|
+
/**
|
|
550
|
+
* Props for EarnAccount - same as AaveMarketsListProps but without assetFilter
|
|
551
|
+
* since this widget is pre-configured to only show USDC markets.
|
|
552
|
+
*/
|
|
553
|
+
interface EarnAccountProps {
|
|
554
|
+
/** Show profit/loss summary */
|
|
555
|
+
showPnL?: boolean;
|
|
556
|
+
/** Show transaction history */
|
|
557
|
+
showHistory?: boolean;
|
|
558
|
+
/** Callback after successful supply */
|
|
559
|
+
onSupply?: (market: AaveMarketData, amount: string, txHash: string) => void;
|
|
560
|
+
/** Callback after successful withdraw */
|
|
561
|
+
onWithdraw?: (market: AaveMarketData, amount: string, txHash: string) => void;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* EarnAccount widget - A beautiful banking-style USDC savings account.
|
|
566
|
+
*/
|
|
567
|
+
declare function EarnAccount({ showPnL, showHistory, onSupply, onWithdraw, }: EarnAccountProps): react_jsx_runtime.JSX.Element;
|
|
568
|
+
|
|
545
569
|
type SortOption = 'fixed_apy' | 'tvl' | 'expiry';
|
|
546
570
|
interface PendleMarketData {
|
|
547
571
|
marketAddress: string;
|
|
@@ -675,14 +699,32 @@ declare function useSwapQuote({ fromToken, toToken, amount, enabled }: UseSwapQu
|
|
|
675
699
|
};
|
|
676
700
|
|
|
677
701
|
type TabId = 'vaults' | 'aave' | 'pendle' | 'swap' | 'positions';
|
|
702
|
+
type FeaturePreset = 'full' | 'earn-only' | 'swap-only' | 'vaults-only';
|
|
703
|
+
interface TabConfig {
|
|
704
|
+
id: TabId;
|
|
705
|
+
label: string;
|
|
706
|
+
enabled: boolean;
|
|
707
|
+
}
|
|
678
708
|
interface CompassEarnWidgetProps {
|
|
679
|
-
|
|
709
|
+
preset?: FeaturePreset;
|
|
710
|
+
enableVaults?: boolean;
|
|
711
|
+
enableAave?: boolean;
|
|
712
|
+
enablePendle?: boolean;
|
|
713
|
+
enableSwap?: boolean;
|
|
714
|
+
enablePositions?: boolean;
|
|
680
715
|
defaultTab?: TabId;
|
|
681
|
-
|
|
716
|
+
showHeader?: boolean;
|
|
717
|
+
showApy?: boolean;
|
|
718
|
+
showTvl?: boolean;
|
|
719
|
+
showExpiry?: boolean;
|
|
720
|
+
showUserPosition?: boolean;
|
|
721
|
+
showPnL?: boolean;
|
|
722
|
+
showSearch?: boolean;
|
|
723
|
+
showSort?: boolean;
|
|
682
724
|
onTabChange?: (tab: TabId) => void;
|
|
683
725
|
}
|
|
684
726
|
|
|
685
|
-
declare function CompassEarnWidget({ defaultTab, onTabChange, }: CompassEarnWidgetProps): react_jsx_runtime.JSX.Element;
|
|
727
|
+
declare function CompassEarnWidget({ preset, enableVaults, enableAave, enablePendle, enableSwap, enablePositions, defaultTab, showHeader, showApy, showTvl, showExpiry, showUserPosition, showPnL, showSearch, showSort, onTabChange, }: CompassEarnWidgetProps): react_jsx_runtime.JSX.Element;
|
|
686
728
|
|
|
687
729
|
/**
|
|
688
730
|
* Theme Presets for Compass Embeddable Widgets
|
|
@@ -716,23 +758,27 @@ declare function useTheme(): ThemeContextValue;
|
|
|
716
758
|
* Context value for the API context
|
|
717
759
|
*/
|
|
718
760
|
interface ApiContextValue {
|
|
719
|
-
/** The API key used to authenticate with Compass API */
|
|
761
|
+
/** The API key used to authenticate with Compass API (may be empty when using server-side routes) */
|
|
720
762
|
apiKey: string;
|
|
721
|
-
/** The Compass API SDK client instance */
|
|
763
|
+
/** The Compass API SDK client instance (may be a dummy when using server-side routes) */
|
|
722
764
|
client: CompassApiSDK;
|
|
723
765
|
}
|
|
724
766
|
interface ApiProviderProps {
|
|
725
767
|
children: ReactNode;
|
|
726
|
-
|
|
768
|
+
/** API key - optional when using server-side routes */
|
|
769
|
+
apiKey?: string;
|
|
727
770
|
/** Optional API base URL override */
|
|
728
771
|
serverURL?: string;
|
|
729
772
|
}
|
|
730
773
|
/**
|
|
731
774
|
* Provider component that manages the Compass API client.
|
|
775
|
+
* When apiKey is not provided, a minimal client is created but all
|
|
776
|
+
* data fetching should go through server-side /api/compass/* routes.
|
|
732
777
|
*/
|
|
733
778
|
declare function ApiProvider({ children, apiKey, serverURL }: ApiProviderProps): react_jsx_runtime.JSX.Element;
|
|
734
779
|
/**
|
|
735
780
|
* Hook to access the Compass API client and API key.
|
|
781
|
+
* @deprecated When using server-side routes, prefer using fetch to /api/compass/* instead.
|
|
736
782
|
*/
|
|
737
783
|
declare function useCompassApi(): ApiContextValue;
|
|
738
784
|
declare const useEmbeddableApi: typeof useCompassApi;
|
|
@@ -916,4 +962,4 @@ interface ChainConfig {
|
|
|
916
962
|
}
|
|
917
963
|
declare const CHAINS: Record<SupportedChainId, ChainConfig>;
|
|
918
964
|
|
|
919
|
-
export { type AaveMarketData, AaveMarketsList, type AaveMarketsListProps, 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$1 as VaultsSortOption, type WalletAdapter, WalletStatus, themePresets, useAaveData, useChain, useCompassApi, useCompassChain, useCompassWallet, useEarnAccount, useEmbeddableApi, useEmbeddableWallet, usePendleData, useSwapQuote, useTheme, useVaultsData };
|
|
965
|
+
export { type AaveMarketData, AaveMarketsList, type AaveMarketsListProps, AccountBalancesModal, type AccountBalancesModalProps, ActionModal, ApiProvider, type ApyPeriod, 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 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, type TokenBalance, TransactionHistory, type TypedDataToSign, type UserAavePosition, type UserPendlePosition, type UserVaultPosition, type VaultData, VaultsList, type VaultsListProps, type SortOption$1 as VaultsSortOption, type WalletAdapter, WalletStatus, themePresets, useAaveData, useChain, useCompassApi, useCompassChain, useCompassWallet, useEarnAccount, useEmbeddableApi, useEmbeddableWallet, usePendleData, useSwapQuote, useTheme, useVaultsData };
|
package/dist/index.d.ts
CHANGED
|
@@ -326,8 +326,12 @@ interface WalletAdapter {
|
|
|
326
326
|
|
|
327
327
|
interface CompassProviderProps {
|
|
328
328
|
children: ReactNode;
|
|
329
|
-
/**
|
|
330
|
-
|
|
329
|
+
/**
|
|
330
|
+
* Compass API key - optional when using server-side API routes.
|
|
331
|
+
* If not provided, all API calls will go through /api/compass/* routes.
|
|
332
|
+
* @deprecated Use server-side API routes instead for better security.
|
|
333
|
+
*/
|
|
334
|
+
apiKey?: string;
|
|
331
335
|
/** Default chain to use */
|
|
332
336
|
defaultChain?: SupportedChain;
|
|
333
337
|
/** Theme preset name, preset with overrides, or full theme object */
|
|
@@ -542,6 +546,26 @@ declare function useAaveData(options?: UseAaveDataOptions): {
|
|
|
542
546
|
refetch: () => void;
|
|
543
547
|
};
|
|
544
548
|
|
|
549
|
+
/**
|
|
550
|
+
* Props for EarnAccount - same as AaveMarketsListProps but without assetFilter
|
|
551
|
+
* since this widget is pre-configured to only show USDC markets.
|
|
552
|
+
*/
|
|
553
|
+
interface EarnAccountProps {
|
|
554
|
+
/** Show profit/loss summary */
|
|
555
|
+
showPnL?: boolean;
|
|
556
|
+
/** Show transaction history */
|
|
557
|
+
showHistory?: boolean;
|
|
558
|
+
/** Callback after successful supply */
|
|
559
|
+
onSupply?: (market: AaveMarketData, amount: string, txHash: string) => void;
|
|
560
|
+
/** Callback after successful withdraw */
|
|
561
|
+
onWithdraw?: (market: AaveMarketData, amount: string, txHash: string) => void;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* EarnAccount widget - A beautiful banking-style USDC savings account.
|
|
566
|
+
*/
|
|
567
|
+
declare function EarnAccount({ showPnL, showHistory, onSupply, onWithdraw, }: EarnAccountProps): react_jsx_runtime.JSX.Element;
|
|
568
|
+
|
|
545
569
|
type SortOption = 'fixed_apy' | 'tvl' | 'expiry';
|
|
546
570
|
interface PendleMarketData {
|
|
547
571
|
marketAddress: string;
|
|
@@ -675,14 +699,32 @@ declare function useSwapQuote({ fromToken, toToken, amount, enabled }: UseSwapQu
|
|
|
675
699
|
};
|
|
676
700
|
|
|
677
701
|
type TabId = 'vaults' | 'aave' | 'pendle' | 'swap' | 'positions';
|
|
702
|
+
type FeaturePreset = 'full' | 'earn-only' | 'swap-only' | 'vaults-only';
|
|
703
|
+
interface TabConfig {
|
|
704
|
+
id: TabId;
|
|
705
|
+
label: string;
|
|
706
|
+
enabled: boolean;
|
|
707
|
+
}
|
|
678
708
|
interface CompassEarnWidgetProps {
|
|
679
|
-
|
|
709
|
+
preset?: FeaturePreset;
|
|
710
|
+
enableVaults?: boolean;
|
|
711
|
+
enableAave?: boolean;
|
|
712
|
+
enablePendle?: boolean;
|
|
713
|
+
enableSwap?: boolean;
|
|
714
|
+
enablePositions?: boolean;
|
|
680
715
|
defaultTab?: TabId;
|
|
681
|
-
|
|
716
|
+
showHeader?: boolean;
|
|
717
|
+
showApy?: boolean;
|
|
718
|
+
showTvl?: boolean;
|
|
719
|
+
showExpiry?: boolean;
|
|
720
|
+
showUserPosition?: boolean;
|
|
721
|
+
showPnL?: boolean;
|
|
722
|
+
showSearch?: boolean;
|
|
723
|
+
showSort?: boolean;
|
|
682
724
|
onTabChange?: (tab: TabId) => void;
|
|
683
725
|
}
|
|
684
726
|
|
|
685
|
-
declare function CompassEarnWidget({ defaultTab, onTabChange, }: CompassEarnWidgetProps): react_jsx_runtime.JSX.Element;
|
|
727
|
+
declare function CompassEarnWidget({ preset, enableVaults, enableAave, enablePendle, enableSwap, enablePositions, defaultTab, showHeader, showApy, showTvl, showExpiry, showUserPosition, showPnL, showSearch, showSort, onTabChange, }: CompassEarnWidgetProps): react_jsx_runtime.JSX.Element;
|
|
686
728
|
|
|
687
729
|
/**
|
|
688
730
|
* Theme Presets for Compass Embeddable Widgets
|
|
@@ -716,23 +758,27 @@ declare function useTheme(): ThemeContextValue;
|
|
|
716
758
|
* Context value for the API context
|
|
717
759
|
*/
|
|
718
760
|
interface ApiContextValue {
|
|
719
|
-
/** The API key used to authenticate with Compass API */
|
|
761
|
+
/** The API key used to authenticate with Compass API (may be empty when using server-side routes) */
|
|
720
762
|
apiKey: string;
|
|
721
|
-
/** The Compass API SDK client instance */
|
|
763
|
+
/** The Compass API SDK client instance (may be a dummy when using server-side routes) */
|
|
722
764
|
client: CompassApiSDK;
|
|
723
765
|
}
|
|
724
766
|
interface ApiProviderProps {
|
|
725
767
|
children: ReactNode;
|
|
726
|
-
|
|
768
|
+
/** API key - optional when using server-side routes */
|
|
769
|
+
apiKey?: string;
|
|
727
770
|
/** Optional API base URL override */
|
|
728
771
|
serverURL?: string;
|
|
729
772
|
}
|
|
730
773
|
/**
|
|
731
774
|
* Provider component that manages the Compass API client.
|
|
775
|
+
* When apiKey is not provided, a minimal client is created but all
|
|
776
|
+
* data fetching should go through server-side /api/compass/* routes.
|
|
732
777
|
*/
|
|
733
778
|
declare function ApiProvider({ children, apiKey, serverURL }: ApiProviderProps): react_jsx_runtime.JSX.Element;
|
|
734
779
|
/**
|
|
735
780
|
* Hook to access the Compass API client and API key.
|
|
781
|
+
* @deprecated When using server-side routes, prefer using fetch to /api/compass/* instead.
|
|
736
782
|
*/
|
|
737
783
|
declare function useCompassApi(): ApiContextValue;
|
|
738
784
|
declare const useEmbeddableApi: typeof useCompassApi;
|
|
@@ -916,4 +962,4 @@ interface ChainConfig {
|
|
|
916
962
|
}
|
|
917
963
|
declare const CHAINS: Record<SupportedChainId, ChainConfig>;
|
|
918
964
|
|
|
919
|
-
export { type AaveMarketData, AaveMarketsList, type AaveMarketsListProps, 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$1 as VaultsSortOption, type WalletAdapter, WalletStatus, themePresets, useAaveData, useChain, useCompassApi, useCompassChain, useCompassWallet, useEarnAccount, useEmbeddableApi, useEmbeddableWallet, usePendleData, useSwapQuote, useTheme, useVaultsData };
|
|
965
|
+
export { type AaveMarketData, AaveMarketsList, type AaveMarketsListProps, AccountBalancesModal, type AccountBalancesModalProps, ActionModal, ApiProvider, type ApyPeriod, 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 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, type TokenBalance, TransactionHistory, type TypedDataToSign, type UserAavePosition, type UserPendlePosition, type UserVaultPosition, type VaultData, VaultsList, type VaultsListProps, type SortOption$1 as VaultsSortOption, type WalletAdapter, WalletStatus, themePresets, useAaveData, useChain, useCompassApi, useCompassChain, useCompassWallet, useEarnAccount, useEmbeddableApi, useEmbeddableWallet, usePendleData, useSwapQuote, useTheme, useVaultsData };
|