From 4637073ff9e339afb2fa0a2d793f829bf3c4ed9d Mon Sep 17 00:00:00 2001 From: antoncoding Date: Tue, 17 Mar 2026 23:53:58 +0800 Subject: [PATCH] fix: label --- AGENTS.md | 1 + src/components/shared/account-identity.tsx | 2 +- src/data-sources/morpho-api/vaults.ts | 9 +++++---- src/graphql/vault-queries.ts | 5 +++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index bbdeabbf..b06ad0b4 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -171,6 +171,7 @@ When touching transaction and position flows, validation MUST include all releva 35. **Monarch proxy boundary integrity**: server-side Monarch proxy routes must use server-only API key env vars and bounded `AbortController` timeouts on upstream fetches. Do not let Monarch GraphQL or metrics calls hang indefinitely, and do not reference `NEXT_PUBLIC_*` secrets in server authorization headers. 36. **Vault fallback and adapter-sentinel integrity**: treat `zeroAddress` as “no adapter” in all vault routing and transaction-critical paths, canonicalize vault query/cache identity by lowercase address plus chain, and when Monarch metadata is unavailable fail closed or return explicit unknown state instead of synthesizing empty vault data or assuming missing allocators/caps from absent indexed fields. 37. **Vault setup-state derivation integrity**: only infer “adapter missing”, “needs initialization”, or auto-advance setup states from resolved adapter/vault queries, never from undefined/loading/error values. When Monarch returns both active adapter addresses and adapter detail rows, merge the union by canonical address instead of letting one source replace the other. +38. **Morpho vault query schema integrity**: shared Morpho vault metadata/rate queries must only request fields confirmed on the live `Vault`/`VaultState` schema. Do not add speculative top-level fields to the registry query, and do not swallow schema errors in a way that turns the global vault registry into an empty success state. ### REQUIRED: Regression Rule Capture diff --git a/src/components/shared/account-identity.tsx b/src/components/shared/account-identity.tsx index d3688c04..fcbf603e 100644 --- a/src/components/shared/account-identity.tsx +++ b/src/components/shared/account-identity.tsx @@ -59,7 +59,7 @@ export function AccountIdentity({ const [mounted, setMounted] = useState(false); const toast = useStyledToast(); const { toggleAddressBookmark, isAddressBookmarked } = usePortfolioBookmarks(); - const { vaultName, shortAddress } = useAddressLabel(address); + const { vaultName, shortAddress } = useAddressLabel(address, chainId); const { data: ensName } = useEnsName({ address: address as `0x${string}`, chainId: 1, diff --git a/src/data-sources/morpho-api/vaults.ts b/src/data-sources/morpho-api/vaults.ts index 9e1573b6..acde72de 100644 --- a/src/data-sources/morpho-api/vaults.ts +++ b/src/data-sources/morpho-api/vaults.ts @@ -27,8 +27,8 @@ type ApiVault = { id: number; }; name: string; - avgApy?: number | null; state: { + apy?: number | null; totalAssets: string; }; asset: { @@ -49,7 +49,7 @@ type AllVaultsApiResponse = { type VaultApysApiResponse = { data?: { vaults?: { - items?: Pick[]; + items?: Pick[]; }; }; errors?: { message: string }[]; @@ -131,13 +131,14 @@ export const fetchMorphoVaultApys = async (vaults: VaultAddressByNetwork[]): Pro for (const vault of items) { const key = getVaultApyKey(vault.address, vault.chain.id); - if (vault.avgApy === null || vault.avgApy === undefined) { + const apy = vault.state.apy; + if (apy === null || apy === undefined) { continue; } if (!requestedKeys.has(key)) { continue; } - apys.set(key, vault.avgApy); + apys.set(key, apy); } return apys; diff --git a/src/graphql/vault-queries.ts b/src/graphql/vault-queries.ts index 084c99a4..ea07fc69 100644 --- a/src/graphql/vault-queries.ts +++ b/src/graphql/vault-queries.ts @@ -11,7 +11,6 @@ export const allVaultsQuery = ` id } name - avgApy state { totalAssets } @@ -29,10 +28,12 @@ export const vaultApysQuery = ` vaults(first: $first, where: $where) { items { address - avgApy chain { id } + state { + apy + } } } }