@compass-labs/widgets 0.1.47 → 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 +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.js +63 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +63 -26
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4347,6 +4347,27 @@ function WidgetFooter() {
|
|
|
4347
4347
|
}
|
|
4348
4348
|
);
|
|
4349
4349
|
}
|
|
4350
|
+
var CHAINS = {
|
|
4351
|
+
ethereum: {
|
|
4352
|
+
id: "ethereum",
|
|
4353
|
+
name: "Ethereum",
|
|
4354
|
+
viemChain: mainnet,
|
|
4355
|
+
icon: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/info/logo.png"
|
|
4356
|
+
},
|
|
4357
|
+
base: {
|
|
4358
|
+
id: "base",
|
|
4359
|
+
name: "Base",
|
|
4360
|
+
viemChain: base,
|
|
4361
|
+
icon: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/base/info/logo.png"
|
|
4362
|
+
},
|
|
4363
|
+
arbitrum: {
|
|
4364
|
+
id: "arbitrum",
|
|
4365
|
+
name: "Arbitrum",
|
|
4366
|
+
viemChain: arbitrum,
|
|
4367
|
+
icon: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/info/logo.png"
|
|
4368
|
+
}
|
|
4369
|
+
};
|
|
4370
|
+
var DEFAULT_MIN_TVL_USD = 1e6;
|
|
4350
4371
|
function getTypeLabel(type) {
|
|
4351
4372
|
switch (type) {
|
|
4352
4373
|
case "aave":
|
|
@@ -4374,7 +4395,7 @@ function MarketSelector({
|
|
|
4374
4395
|
}) {
|
|
4375
4396
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
4376
4397
|
const filteredMarkets = useMemo(() => {
|
|
4377
|
-
return markets.
|
|
4398
|
+
return [...markets].sort((a, b) => b.apy - a.apy);
|
|
4378
4399
|
}, [markets]);
|
|
4379
4400
|
const otherMarkets = selectedMarket ? filteredMarkets.filter((m) => m.id !== selectedMarket.id) : filteredMarkets;
|
|
4380
4401
|
if (isLoading) {
|
|
@@ -4962,7 +4983,8 @@ function EarnAccount({
|
|
|
4962
4983
|
allowedFixedMarkets,
|
|
4963
4984
|
tokenSymbols,
|
|
4964
4985
|
chain: chainProp,
|
|
4965
|
-
height = "600px"
|
|
4986
|
+
height = "600px",
|
|
4987
|
+
minTvlUsd = DEFAULT_MIN_TVL_USD
|
|
4966
4988
|
}) {
|
|
4967
4989
|
const { address, isConnected, login, logout, signTypedData, switchChain, walletChainId, fundWallet, hasExternalWallet, sendTransaction } = useEmbeddableWallet();
|
|
4968
4990
|
const { isDeployed, earnAccountAddress } = useEarnAccount();
|
|
@@ -5163,9 +5185,9 @@ function EarnAccount({
|
|
|
5163
5185
|
staleTime: 60 * 1e3
|
|
5164
5186
|
});
|
|
5165
5187
|
const vaultsQuery = useQuery({
|
|
5166
|
-
queryKey: ["morphoVaults", CHAIN_ID],
|
|
5188
|
+
queryKey: ["morphoVaults", CHAIN_ID, minTvlUsd],
|
|
5167
5189
|
queryFn: async () => {
|
|
5168
|
-
const response = await fetch(`/api/compass/vaults?chain=${CHAIN_ID}&limit=200&orderBy=apy_7d&direction=desc`);
|
|
5190
|
+
const response = await fetch(`/api/compass/vaults?chain=${CHAIN_ID}&limit=200&orderBy=apy_7d&direction=desc&minTvlUsd=${minTvlUsd}`);
|
|
5169
5191
|
if (!response.ok) {
|
|
5170
5192
|
console.warn("[EarnAccount] Morpho vaults fetch failed:", response.status, response.statusText);
|
|
5171
5193
|
return [];
|
|
@@ -10773,7 +10795,7 @@ function useRebalancingData(chainOverride) {
|
|
|
10773
10795
|
queryKey: ["rebalancing", "venues", chainId],
|
|
10774
10796
|
queryFn: async () => {
|
|
10775
10797
|
const [vaultsRes, aaveRes, pendleRes] = await Promise.all([
|
|
10776
|
-
fetch(`/api/compass/vaults?chain=${chainId}&orderBy=apy_7d&direction=desc&limit=200`),
|
|
10798
|
+
fetch(`/api/compass/vaults?chain=${chainId}&orderBy=apy_7d&direction=desc&limit=200&minTvlUsd=${DEFAULT_MIN_TVL_USD}`),
|
|
10777
10799
|
fetch(`/api/compass/aave/markets?chain=${chainId}`),
|
|
10778
10800
|
fetch(`/api/compass/pendle/markets?chain=${chainId}&orderBy=implied_apy&direction=desc&limit=200`)
|
|
10779
10801
|
]);
|
|
@@ -12586,27 +12608,42 @@ function CompassEarnWidget({
|
|
|
12586
12608
|
] })
|
|
12587
12609
|
] });
|
|
12588
12610
|
}
|
|
12589
|
-
var
|
|
12590
|
-
|
|
12591
|
-
|
|
12592
|
-
|
|
12593
|
-
|
|
12594
|
-
|
|
12595
|
-
|
|
12596
|
-
|
|
12597
|
-
|
|
12598
|
-
|
|
12599
|
-
|
|
12600
|
-
|
|
12601
|
-
|
|
12602
|
-
|
|
12603
|
-
|
|
12604
|
-
|
|
12605
|
-
|
|
12606
|
-
|
|
12607
|
-
|
|
12608
|
-
|
|
12611
|
+
var BALANCE_QUERY_KEYS = [
|
|
12612
|
+
["earnAccountBalances"],
|
|
12613
|
+
["eoaBalances"],
|
|
12614
|
+
["walletBalance"],
|
|
12615
|
+
["walletTokenBalance"],
|
|
12616
|
+
["creditBalances"],
|
|
12617
|
+
["earnAccountTokenBalance"],
|
|
12618
|
+
["embeddedWalletBalance"]
|
|
12619
|
+
];
|
|
12620
|
+
var POSITION_QUERY_KEYS = [
|
|
12621
|
+
["allEarnPositions"],
|
|
12622
|
+
["earnAccountAllPositions"],
|
|
12623
|
+
["creditPositions"],
|
|
12624
|
+
["rebalancing"]
|
|
12625
|
+
];
|
|
12626
|
+
var ALL_QUERY_KEYS = [...BALANCE_QUERY_KEYS, ...POSITION_QUERY_KEYS];
|
|
12627
|
+
function useRefreshBalances() {
|
|
12628
|
+
const queryClient = useQueryClient();
|
|
12629
|
+
const refreshBalances = useCallback(() => {
|
|
12630
|
+
for (const key of BALANCE_QUERY_KEYS) {
|
|
12631
|
+
queryClient.invalidateQueries({ queryKey: key });
|
|
12632
|
+
}
|
|
12633
|
+
}, [queryClient]);
|
|
12634
|
+
const refreshPositions = useCallback(() => {
|
|
12635
|
+
for (const key of POSITION_QUERY_KEYS) {
|
|
12636
|
+
queryClient.invalidateQueries({ queryKey: key });
|
|
12637
|
+
}
|
|
12638
|
+
}, [queryClient]);
|
|
12639
|
+
const refreshAll = useCallback(() => {
|
|
12640
|
+
for (const key of ALL_QUERY_KEYS) {
|
|
12641
|
+
queryClient.invalidateQueries({ queryKey: key });
|
|
12642
|
+
}
|
|
12643
|
+
}, [queryClient]);
|
|
12644
|
+
return { refreshBalances, refreshPositions, refreshAll };
|
|
12645
|
+
}
|
|
12609
12646
|
|
|
12610
|
-
export { AccountBalancesModal, ActionModal, ApiProvider, CHAINS, ChainSwitcher, CompassEarnWidget, CompassProvider, CopyableAddress, CreditAccount, CreditAccountGuard, DepositWithdrawForm, EarnAccount, EarnAccountBalance, EarnAccountGuard, PnLSummary, RebalancingWidget, SwapForm, ThemeProvider, TransactionHistory, WalletStatus, themePresets, useChain, useCompassApi, useCompassChain, useCompassWallet, useCreditAccount, useEarnAccount, useEmbeddableApi, useEmbeddableWallet, useRebalancingData, useSwapQuote, useTheme };
|
|
12647
|
+
export { AccountBalancesModal, ActionModal, ApiProvider, CHAINS, ChainSwitcher, CompassEarnWidget, CompassProvider, CopyableAddress, CreditAccount, CreditAccountGuard, DepositWithdrawForm, EarnAccount, EarnAccountBalance, EarnAccountGuard, PnLSummary, RebalancingWidget, SwapForm, ThemeProvider, TransactionHistory, WalletStatus, themePresets, useChain, useCompassApi, useCompassChain, useCompassWallet, useCreditAccount, useEarnAccount, useEmbeddableApi, useEmbeddableWallet, useRebalancingData, useRefreshBalances, useSwapQuote, useTheme };
|
|
12611
12648
|
//# sourceMappingURL=index.mjs.map
|
|
12612
12649
|
//# sourceMappingURL=index.mjs.map
|