@compass-labs/widgets 0.1.38 → 0.1.40

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
@@ -273,6 +273,30 @@ interface TypedDataToSign {
273
273
  primaryType: string;
274
274
  message: Record<string, unknown>;
275
275
  }
276
+ /**
277
+ * Parameters for the fiat on-ramp funding callback
278
+ */
279
+ interface FundWalletParams {
280
+ /** Destination address (e.g. earn/credit account Safe proxy) */
281
+ address: string;
282
+ /** Target chain ID (e.g. 1 for Ethereum, 8453 for Base) */
283
+ chainId: number;
284
+ /** Token symbol to purchase (e.g. 'USDC') */
285
+ asset: string;
286
+ /** Decimal amount string (e.g. '50') */
287
+ amount: string;
288
+ }
289
+ /**
290
+ * Parameters for sending a raw transaction from the wallet
291
+ */
292
+ interface SendTransactionParams {
293
+ /** Destination contract or EOA address */
294
+ to: string;
295
+ /** Encoded calldata (e.g. ERC-20 transfer) */
296
+ data?: string;
297
+ /** Value in wei (hex string) */
298
+ value?: string;
299
+ }
276
300
  /**
277
301
  * Wallet adapter interface for bringing your own wallet
278
302
  *
@@ -325,6 +349,24 @@ interface WalletAdapter {
325
349
  * If provided, widgets will show a logout button when connected
326
350
  */
327
351
  logout?: () => Promise<void>;
352
+ /**
353
+ * Buy crypto via fiat on-ramp (optional)
354
+ * When provided, widgets show a "Buy crypto" option in Add/Fund modals.
355
+ * Implement with your on-ramp provider (e.g. Privy's useFundWallet).
356
+ */
357
+ fundWallet?: (params: FundWalletParams) => Promise<void>;
358
+ /**
359
+ * Whether the user has an external wallet connected (optional)
360
+ * When false, widgets hide Deposit/Withdraw tabs (email/social login users
361
+ * only see the Buy crypto option). Defaults to true if not provided.
362
+ */
363
+ hasExternalWallet?: boolean;
364
+ /**
365
+ * Send a raw transaction from the wallet (optional)
366
+ * When provided, widgets show a "Send" tab for email users to transfer
367
+ * tokens from their embedded wallet to any address.
368
+ */
369
+ sendTransaction?: (params: SendTransactionParams) => Promise<string>;
328
370
  }
329
371
 
330
372
  interface CompassProviderProps {
@@ -700,6 +742,12 @@ interface WalletContextValue {
700
742
  login: (() => void) | null;
701
743
  /** Disconnect wallet - may not be available depending on wallet adapter */
702
744
  logout: (() => Promise<void>) | null;
745
+ /** Buy crypto via fiat on-ramp - may not be available depending on wallet adapter */
746
+ fundWallet: ((params: FundWalletParams) => Promise<void>) | null;
747
+ /** Whether the user has an external wallet (false = email/social login, show Buy only) */
748
+ hasExternalWallet: boolean;
749
+ /** Send a raw transaction from the wallet - may not be available depending on wallet adapter */
750
+ sendTransaction: ((params: SendTransactionParams) => Promise<string>) | null;
703
751
  }
704
752
  /**
705
753
  * Hook to access the wallet context
@@ -857,7 +905,7 @@ interface CreditAccountGuardProps {
857
905
  }
858
906
  declare function CreditAccountGuard({ children, loadingComponent, createAccountComponent, }: CreditAccountGuardProps): react_jsx_runtime.JSX.Element;
859
907
 
860
- type TransferAction = 'deposit' | 'withdraw';
908
+ type TransferAction = 'deposit' | 'withdraw' | 'buy' | 'send';
861
909
  interface EarnAccountBalanceProps {
862
910
  /** Compact mode - just show total USD value */
863
911
  compact?: boolean;
@@ -961,4 +1009,4 @@ interface ChainConfig {
961
1009
  }
962
1010
  declare const CHAINS: Record<SupportedChainId, ChainConfig>;
963
1011
 
964
- export { AccountBalancesModal, type AccountBalancesModalProps, type AccountSummary, ActionModal, ApiProvider, CHAINS, type ChainConfig, ChainSwitcher, type CollateralPosition, CompassEarnWidget, type CompassEarnWidgetProps, CompassProvider, type CompassProviderProps, type CompassTheme, CopyableAddress, type CopyableAddressProps, CreditAccount, type CreditAccountContextValue, CreditAccountGuard, type CreditAccountProps, type CreditPositionsResponse, type TokenBalance as CreditTokenBalance, type DebtPosition, 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$1 as TokenBalance, TransactionHistory, type TypedDataToSign, type VenueType$1 as VenueType, type WalletAdapter, WalletStatus, themePresets, useChain, useCompassApi, useCompassChain, useCompassWallet, useCreditAccount, useEarnAccount, useEmbeddableApi, useEmbeddableWallet, useRebalancingData, useSwapQuote, useTheme };
1012
+ export { AccountBalancesModal, type AccountBalancesModalProps, type AccountSummary, ActionModal, ApiProvider, CHAINS, type ChainConfig, ChainSwitcher, type CollateralPosition, CompassEarnWidget, type CompassEarnWidgetProps, CompassProvider, type CompassProviderProps, type CompassTheme, CopyableAddress, type CopyableAddressProps, CreditAccount, type CreditAccountContextValue, CreditAccountGuard, type CreditAccountProps, type CreditPositionsResponse, type TokenBalance as CreditTokenBalance, type DebtPosition, DepositWithdrawForm, EarnAccount, EarnAccountBalance, type EarnAccountBalanceProps, type EarnAccountContextValue, EarnAccountGuard, type EarnAccountProps, type FeaturePreset, type FundWalletParams, type IdleBalance, PnLSummary, type PortfolioPosition, type PortfolioState, type RebalanceAction, type RebalanceActionType, type RebalancePlan, RebalancingWidget, type RebalancingWidgetProps, type SendTransactionParams, type SupportedChain, type SupportedChainId, SwapForm, type SwapFormProps, type SwapQuote, type TabConfig, type TabId, type TargetAllocation, type ThemeInput, type ThemeMode, type ThemePresetName, ThemeProvider, type TokenBalance$1 as TokenBalance, TransactionHistory, type TypedDataToSign, type VenueType$1 as VenueType, type WalletAdapter, WalletStatus, themePresets, useChain, useCompassApi, useCompassChain, useCompassWallet, useCreditAccount, useEarnAccount, useEmbeddableApi, useEmbeddableWallet, useRebalancingData, useSwapQuote, useTheme };
package/dist/index.d.ts CHANGED
@@ -273,6 +273,30 @@ interface TypedDataToSign {
273
273
  primaryType: string;
274
274
  message: Record<string, unknown>;
275
275
  }
276
+ /**
277
+ * Parameters for the fiat on-ramp funding callback
278
+ */
279
+ interface FundWalletParams {
280
+ /** Destination address (e.g. earn/credit account Safe proxy) */
281
+ address: string;
282
+ /** Target chain ID (e.g. 1 for Ethereum, 8453 for Base) */
283
+ chainId: number;
284
+ /** Token symbol to purchase (e.g. 'USDC') */
285
+ asset: string;
286
+ /** Decimal amount string (e.g. '50') */
287
+ amount: string;
288
+ }
289
+ /**
290
+ * Parameters for sending a raw transaction from the wallet
291
+ */
292
+ interface SendTransactionParams {
293
+ /** Destination contract or EOA address */
294
+ to: string;
295
+ /** Encoded calldata (e.g. ERC-20 transfer) */
296
+ data?: string;
297
+ /** Value in wei (hex string) */
298
+ value?: string;
299
+ }
276
300
  /**
277
301
  * Wallet adapter interface for bringing your own wallet
278
302
  *
@@ -325,6 +349,24 @@ interface WalletAdapter {
325
349
  * If provided, widgets will show a logout button when connected
326
350
  */
327
351
  logout?: () => Promise<void>;
352
+ /**
353
+ * Buy crypto via fiat on-ramp (optional)
354
+ * When provided, widgets show a "Buy crypto" option in Add/Fund modals.
355
+ * Implement with your on-ramp provider (e.g. Privy's useFundWallet).
356
+ */
357
+ fundWallet?: (params: FundWalletParams) => Promise<void>;
358
+ /**
359
+ * Whether the user has an external wallet connected (optional)
360
+ * When false, widgets hide Deposit/Withdraw tabs (email/social login users
361
+ * only see the Buy crypto option). Defaults to true if not provided.
362
+ */
363
+ hasExternalWallet?: boolean;
364
+ /**
365
+ * Send a raw transaction from the wallet (optional)
366
+ * When provided, widgets show a "Send" tab for email users to transfer
367
+ * tokens from their embedded wallet to any address.
368
+ */
369
+ sendTransaction?: (params: SendTransactionParams) => Promise<string>;
328
370
  }
329
371
 
330
372
  interface CompassProviderProps {
@@ -700,6 +742,12 @@ interface WalletContextValue {
700
742
  login: (() => void) | null;
701
743
  /** Disconnect wallet - may not be available depending on wallet adapter */
702
744
  logout: (() => Promise<void>) | null;
745
+ /** Buy crypto via fiat on-ramp - may not be available depending on wallet adapter */
746
+ fundWallet: ((params: FundWalletParams) => Promise<void>) | null;
747
+ /** Whether the user has an external wallet (false = email/social login, show Buy only) */
748
+ hasExternalWallet: boolean;
749
+ /** Send a raw transaction from the wallet - may not be available depending on wallet adapter */
750
+ sendTransaction: ((params: SendTransactionParams) => Promise<string>) | null;
703
751
  }
704
752
  /**
705
753
  * Hook to access the wallet context
@@ -857,7 +905,7 @@ interface CreditAccountGuardProps {
857
905
  }
858
906
  declare function CreditAccountGuard({ children, loadingComponent, createAccountComponent, }: CreditAccountGuardProps): react_jsx_runtime.JSX.Element;
859
907
 
860
- type TransferAction = 'deposit' | 'withdraw';
908
+ type TransferAction = 'deposit' | 'withdraw' | 'buy' | 'send';
861
909
  interface EarnAccountBalanceProps {
862
910
  /** Compact mode - just show total USD value */
863
911
  compact?: boolean;
@@ -961,4 +1009,4 @@ interface ChainConfig {
961
1009
  }
962
1010
  declare const CHAINS: Record<SupportedChainId, ChainConfig>;
963
1011
 
964
- export { AccountBalancesModal, type AccountBalancesModalProps, type AccountSummary, ActionModal, ApiProvider, CHAINS, type ChainConfig, ChainSwitcher, type CollateralPosition, CompassEarnWidget, type CompassEarnWidgetProps, CompassProvider, type CompassProviderProps, type CompassTheme, CopyableAddress, type CopyableAddressProps, CreditAccount, type CreditAccountContextValue, CreditAccountGuard, type CreditAccountProps, type CreditPositionsResponse, type TokenBalance as CreditTokenBalance, type DebtPosition, 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$1 as TokenBalance, TransactionHistory, type TypedDataToSign, type VenueType$1 as VenueType, type WalletAdapter, WalletStatus, themePresets, useChain, useCompassApi, useCompassChain, useCompassWallet, useCreditAccount, useEarnAccount, useEmbeddableApi, useEmbeddableWallet, useRebalancingData, useSwapQuote, useTheme };
1012
+ export { AccountBalancesModal, type AccountBalancesModalProps, type AccountSummary, ActionModal, ApiProvider, CHAINS, type ChainConfig, ChainSwitcher, type CollateralPosition, CompassEarnWidget, type CompassEarnWidgetProps, CompassProvider, type CompassProviderProps, type CompassTheme, CopyableAddress, type CopyableAddressProps, CreditAccount, type CreditAccountContextValue, CreditAccountGuard, type CreditAccountProps, type CreditPositionsResponse, type TokenBalance as CreditTokenBalance, type DebtPosition, DepositWithdrawForm, EarnAccount, EarnAccountBalance, type EarnAccountBalanceProps, type EarnAccountContextValue, EarnAccountGuard, type EarnAccountProps, type FeaturePreset, type FundWalletParams, type IdleBalance, PnLSummary, type PortfolioPosition, type PortfolioState, type RebalanceAction, type RebalanceActionType, type RebalancePlan, RebalancingWidget, type RebalancingWidgetProps, type SendTransactionParams, type SupportedChain, type SupportedChainId, SwapForm, type SwapFormProps, type SwapQuote, type TabConfig, type TabId, type TargetAllocation, type ThemeInput, type ThemeMode, type ThemePresetName, ThemeProvider, type TokenBalance$1 as TokenBalance, TransactionHistory, type TypedDataToSign, type VenueType$1 as VenueType, type WalletAdapter, WalletStatus, themePresets, useChain, useCompassApi, useCompassChain, useCompassWallet, useCreditAccount, useEarnAccount, useEmbeddableApi, useEmbeddableWallet, useRebalancingData, useSwapQuote, useTheme };