@compass-labs/widgets 0.1.48 → 0.1.49

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
@@ -478,12 +478,14 @@ interface EarnAccountProps {
478
478
  chain?: string;
479
479
  /** Fixed height for the widget container @default '600px' */
480
480
  height?: string;
481
+ /** Minimum TVL in USD for vault filtering (server-side). @default 1_000_000 */
482
+ minTvlUsd?: number;
481
483
  }
482
484
 
483
485
  /**
484
486
  * EarnAccount widget - A beautiful banking-style USDC savings account.
485
487
  */
486
- declare function EarnAccount({ showHeader, showInterestRate, showTopUpButton, compact, title, onDeposit, onWithdraw, defaultMarketTab, allowedVariableMarkets, allowedFixedMarkets, tokenSymbols, chain: chainProp, height, }: EarnAccountProps): react_jsx_runtime.JSX.Element;
488
+ declare function EarnAccount({ showHeader, showInterestRate, showTopUpButton, compact, title, onDeposit, onWithdraw, defaultMarketTab, allowedVariableMarkets, allowedFixedMarkets, tokenSymbols, chain: chainProp, height, minTvlUsd, }: EarnAccountProps): react_jsx_runtime.JSX.Element;
487
489
 
488
490
  interface CreditAccountProps {
489
491
  /** Custom title for the header @default "Credit Account" */
package/dist/index.d.ts CHANGED
@@ -478,12 +478,14 @@ interface EarnAccountProps {
478
478
  chain?: string;
479
479
  /** Fixed height for the widget container @default '600px' */
480
480
  height?: string;
481
+ /** Minimum TVL in USD for vault filtering (server-side). @default 1_000_000 */
482
+ minTvlUsd?: number;
481
483
  }
482
484
 
483
485
  /**
484
486
  * EarnAccount widget - A beautiful banking-style USDC savings account.
485
487
  */
486
- declare function EarnAccount({ showHeader, showInterestRate, showTopUpButton, compact, title, onDeposit, onWithdraw, defaultMarketTab, allowedVariableMarkets, allowedFixedMarkets, tokenSymbols, chain: chainProp, height, }: EarnAccountProps): react_jsx_runtime.JSX.Element;
488
+ declare function EarnAccount({ showHeader, showInterestRate, showTopUpButton, compact, title, onDeposit, onWithdraw, defaultMarketTab, allowedVariableMarkets, allowedFixedMarkets, tokenSymbols, chain: chainProp, height, minTvlUsd, }: EarnAccountProps): react_jsx_runtime.JSX.Element;
487
489
 
488
490
  interface CreditAccountProps {
489
491
  /** Custom title for the header @default "Credit Account" */
package/dist/index.js CHANGED
@@ -4349,6 +4349,27 @@ function WidgetFooter() {
4349
4349
  }
4350
4350
  );
4351
4351
  }
4352
+ var CHAINS = {
4353
+ ethereum: {
4354
+ id: "ethereum",
4355
+ name: "Ethereum",
4356
+ viemChain: chains.mainnet,
4357
+ icon: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/info/logo.png"
4358
+ },
4359
+ base: {
4360
+ id: "base",
4361
+ name: "Base",
4362
+ viemChain: chains.base,
4363
+ icon: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/base/info/logo.png"
4364
+ },
4365
+ arbitrum: {
4366
+ id: "arbitrum",
4367
+ name: "Arbitrum",
4368
+ viemChain: chains.arbitrum,
4369
+ icon: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/info/logo.png"
4370
+ }
4371
+ };
4372
+ var DEFAULT_MIN_TVL_USD = 1e6;
4352
4373
  function getTypeLabel(type) {
4353
4374
  switch (type) {
4354
4375
  case "aave":
@@ -4376,7 +4397,7 @@ function MarketSelector({
4376
4397
  }) {
4377
4398
  const [isExpanded, setIsExpanded] = react.useState(false);
4378
4399
  const filteredMarkets = react.useMemo(() => {
4379
- return markets.filter((m) => m.type === "aave" || m.type === "pendle" || m.tvl >= 1e3).sort((a, b) => b.apy - a.apy);
4400
+ return [...markets].sort((a, b) => b.apy - a.apy);
4380
4401
  }, [markets]);
4381
4402
  const otherMarkets = selectedMarket ? filteredMarkets.filter((m) => m.id !== selectedMarket.id) : filteredMarkets;
4382
4403
  if (isLoading) {
@@ -4964,7 +4985,8 @@ function EarnAccount({
4964
4985
  allowedFixedMarkets,
4965
4986
  tokenSymbols,
4966
4987
  chain: chainProp,
4967
- height = "600px"
4988
+ height = "600px",
4989
+ minTvlUsd = DEFAULT_MIN_TVL_USD
4968
4990
  }) {
4969
4991
  const { address, isConnected, login, logout, signTypedData, switchChain, walletChainId, fundWallet, hasExternalWallet, sendTransaction } = useEmbeddableWallet();
4970
4992
  const { isDeployed, earnAccountAddress } = useEarnAccount();
@@ -5165,9 +5187,9 @@ function EarnAccount({
5165
5187
  staleTime: 60 * 1e3
5166
5188
  });
5167
5189
  const vaultsQuery = reactQuery.useQuery({
5168
- queryKey: ["morphoVaults", CHAIN_ID],
5190
+ queryKey: ["morphoVaults", CHAIN_ID, minTvlUsd],
5169
5191
  queryFn: async () => {
5170
- const response = await fetch(`/api/compass/vaults?chain=${CHAIN_ID}&limit=200&orderBy=apy_7d&direction=desc`);
5192
+ const response = await fetch(`/api/compass/vaults?chain=${CHAIN_ID}&limit=200&orderBy=apy_7d&direction=desc&minTvlUsd=${minTvlUsd}`);
5171
5193
  if (!response.ok) {
5172
5194
  console.warn("[EarnAccount] Morpho vaults fetch failed:", response.status, response.statusText);
5173
5195
  return [];
@@ -10775,7 +10797,7 @@ function useRebalancingData(chainOverride) {
10775
10797
  queryKey: ["rebalancing", "venues", chainId],
10776
10798
  queryFn: async () => {
10777
10799
  const [vaultsRes, aaveRes, pendleRes] = await Promise.all([
10778
- fetch(`/api/compass/vaults?chain=${chainId}&orderBy=apy_7d&direction=desc&limit=200`),
10800
+ fetch(`/api/compass/vaults?chain=${chainId}&orderBy=apy_7d&direction=desc&limit=200&minTvlUsd=${DEFAULT_MIN_TVL_USD}`),
10779
10801
  fetch(`/api/compass/aave/markets?chain=${chainId}`),
10780
10802
  fetch(`/api/compass/pendle/markets?chain=${chainId}&orderBy=implied_apy&direction=desc&limit=200`)
10781
10803
  ]);
@@ -12623,26 +12645,6 @@ function useRefreshBalances() {
12623
12645
  }, [queryClient]);
12624
12646
  return { refreshBalances, refreshPositions, refreshAll };
12625
12647
  }
12626
- var CHAINS = {
12627
- ethereum: {
12628
- id: "ethereum",
12629
- name: "Ethereum",
12630
- viemChain: chains.mainnet,
12631
- icon: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/info/logo.png"
12632
- },
12633
- base: {
12634
- id: "base",
12635
- name: "Base",
12636
- viemChain: chains.base,
12637
- icon: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/base/info/logo.png"
12638
- },
12639
- arbitrum: {
12640
- id: "arbitrum",
12641
- name: "Arbitrum",
12642
- viemChain: chains.arbitrum,
12643
- icon: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/info/logo.png"
12644
- }
12645
- };
12646
12648
 
12647
12649
  exports.AccountBalancesModal = AccountBalancesModal;
12648
12650
  exports.ActionModal = ActionModal;