Skip to content

feat: query client import migration#5501

Draft
therealemjy wants to merge 1 commit intomainfrom
feat/yield-plus-pr01-query-client
Draft

feat: query client import migration#5501
therealemjy wants to merge 1 commit intomainfrom
feat/yield-plus-pr01-query-client

Conversation

@therealemjy
Copy link
Copy Markdown
Member

Jira ticket(s)

VPD-634
VPD-632
VPD-629
VPD-640
VPD-633
VPD-638
VPD-637
VPD-643
VPD-635
VPD-639

Changes

  • switch app and test code to import the React Query client from the direct queryClient module\n- keep the migration isolated from Yield+ feature behavior

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 9, 2026

🦋 Changeset detected

Latest commit: 91ec505

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@venusprotocol/evm Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dapp-preview Ready Ready Preview Apr 10, 2026 9:05am
dapp-testnet Ready Ready Preview Apr 10, 2026 9:05am
venus.io Ready Ready Preview Apr 10, 2026 9:05am

Request Review

@github-actions
Copy link
Copy Markdown
Contributor

Coverage Report for ./apps/evm

Status Category Percentage Covered / Total
🔵 Lines 76.62% 38653 / 50442
🔵 Statements 76.62% 38653 / 50442
🔵 Functions 58.72% 606 / 1032
🔵 Branches 71.15% 4418 / 6209
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
apps/evm/src/App/index.tsx 0% 0% 0% 0% 1-73
apps/evm/src/clients/api/index.ts 0% 100% 100% 0% 2-248
apps/evm/src/clients/api/queryClient.ts 0% 0% 0% 0% 1-12
apps/evm/src/clients/api/mutations/useApproveToken/index.ts 96.87% 66.66% 100% 96.87% 1
apps/evm/src/clients/api/mutations/useBorrow/index.ts 98.97% 93.33% 100% 98.97% 1
apps/evm/src/clients/api/mutations/useBridgeXvs/index.ts 98.78% 66.66% 100% 98.78% 1
apps/evm/src/clients/api/mutations/useCancelProposal/index.ts 97.56% 66.66% 100% 97.56% 1
apps/evm/src/clients/api/mutations/useClaimPrimeToken/index.ts 97.22% 66.66% 100% 97.22% 1
apps/evm/src/clients/api/mutations/useClaimRewards/index.ts 98.75% 85.71% 100% 98.75% 1
apps/evm/src/clients/api/mutations/useCreateProposal/index.ts 97.5% 66.66% 100% 97.5% 1
apps/evm/src/clients/api/mutations/useEnterMarket/index.ts 96.42% 50% 100% 96.42% 2
apps/evm/src/clients/api/mutations/useExecuteProposal/index.ts 97.72% 85.71% 100% 97.72% 1
apps/evm/src/clients/api/mutations/useExecuteWithdrawalFromXvsVault/index.ts 99.09% 66.66% 100% 99.09% 1
apps/evm/src/clients/api/mutations/useExitMarket/index.ts 96.42% 50% 100% 96.42% 2
apps/evm/src/clients/api/mutations/useImportSupplyPosition/index.ts 96.81% 72.72% 100% 96.81% 1, 156-159
apps/evm/src/clients/api/mutations/useMintVai/index.ts 96.96% 66.66% 100% 96.96% 2
apps/evm/src/clients/api/mutations/useOpenLeveragedPosition/index.tsx 97.77% 80% 100% 97.77% 3
apps/evm/src/clients/api/mutations/useQueueProposal/index.ts 97.36% 66.66% 100% 97.36% 1
apps/evm/src/clients/api/mutations/useRepay/index.ts 90% 80.76% 100% 90% 1, 130, 207-219
apps/evm/src/clients/api/mutations/useRepayVai/index.ts 98.11% 66.66% 100% 98.11% 1
apps/evm/src/clients/api/mutations/useRepayWithCollateral/index.ts 90.9% 44.44% 100% 90.9% 3, 43, 46, 49, 52
apps/evm/src/clients/api/mutations/useRequestWithdrawalFromXvsVault/index.tsx 98.63% 66.66% 100% 98.63% 1
apps/evm/src/clients/api/mutations/useSetEModeGroup/index.ts 82.41% 88.88% 66.66% 82.41% 1, 50-64
apps/evm/src/clients/api/mutations/useSetVoteDelegate/index.ts 97.36% 66.66% 100% 97.36% 1
apps/evm/src/clients/api/mutations/useStakeInVaiVault/index.ts 98.9% 66.66% 100% 98.9% 2
apps/evm/src/clients/api/mutations/useStakeInXvsVault/index.ts 100% 100% 100% 100%
apps/evm/src/clients/api/mutations/useSupply/index.ts 91.02% 87.5% 100% 91.02% 2, 193-205
apps/evm/src/clients/api/mutations/useSwapTokens/index.ts 97.57% 93.1% 100% 97.57% 1, 192-195
apps/evm/src/clients/api/mutations/useSwapTokensAndRepay/index.ts 98.02% 84.21% 100% 98.02% 1, 141, 149
apps/evm/src/clients/api/mutations/useSwapTokensAndSupply/index.ts 89.85% 50% 100% 89.85% 1, 84-94, 112, 122
apps/evm/src/clients/api/mutations/useUpdatePoolDelegateStatus/index.ts 93.93% 33.33% 100% 93.93% 1, 39
apps/evm/src/clients/api/mutations/useVote/index.tsx 98.66% 80% 100% 98.66% 1
apps/evm/src/clients/api/mutations/useWithdraw/index.ts 97.77% 87.5% 100% 97.77% 1, 109-116
apps/evm/src/clients/api/mutations/useWithdrawFromVaiVault/index.ts 98.86% 66.66% 100% 98.86% 1
apps/evm/src/clients/api/queries/getSwapQuote/useGetSwapQuote.ts 0% 0% 0% 0% 1-61
apps/evm/src/clients/api/queries/getSwapQuote/formatSwapQuote/applySlippagePercentage/index.ts 90% 0% 100% 90% 1
apps/evm/src/clients/api/queries/getTokenUsdPrice/useGetTokenUsdPrice.ts 96.15% 57.14% 100% 96.15% 1, 69
apps/evm/src/clients/api/queries/getXvsBridgeFeeEstimation/useGetXvsBridgeFeeEstimation.ts 0% 0% 0% 0% 1-90
apps/evm/src/clients/api/queries/getXvsVaultPaused/useGetXvsVaultPaused.ts 0% 0% 0% 0% 1-43
apps/evm/src/clients/api/queries/useGetPrimeEstimation/index.ts 0% 100% 100% 0% 2-171
apps/evm/src/clients/api/queries/useGetVaults/useGetVestingVaults/useGetXvsVaultPoolBalances.ts 97.95% 60% 100% 97.95% 1
apps/evm/src/clients/api/queries/useGetVaults/useGetVestingVaults/useGetXvsVaultPools.ts 96.77% 72.72% 100% 96.77% 1, 104, 122
Generated in workflow #13162 for commit 91ec505 by the Vitest Coverage Report Action

@therealemjy
Copy link
Copy Markdown
Member Author

@greptile

@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Apr 10, 2026

Greptile Summary

This PR migrates ~77 files to import queryClient and other API symbols directly from their source modules (e.g. clients/api/queryClient, clients/api/queries/getBalanceOf) instead of the barrel clients/api, and changes queryClient.ts from a default export to a named export. It also includes a meaningful precision fix in applySlippagePercentage (avoids Number(bigint) coercion for large mantissas) and adds tests for it.

One item worth confirming: useGetSwapQuote.ts quietly switches the refetch interval from the default 9–15 s to 'fast' (3–6 s), which is a runtime behaviour change not described in the PR summary.

Confidence Score: 5/5

Safe to merge; all findings are P2 or lower and the import migration is mechanically consistent.

The bulk of the change is a straightforward import-path migration with no functional risk. The one P2 note (refetch interval speedup in useGetSwapQuote) does not block merge — it's likely intentional for Yield+ but should be confirmed. The applySlippagePercentage fix is a correctness improvement.

apps/evm/src/clients/api/queries/getSwapQuote/useGetSwapQuote.ts — verify that the 'fast' refetch interval is intentional

Important Files Changed

Filename Overview
apps/evm/src/clients/api/queryClient.ts Changed from default export to named export; correct and consistent with rest of migration
apps/evm/src/clients/api/index.ts Replaced default re-export of queryClient with wildcard re-export from ./queryClient; backward-compatible for consumers still importing from the barrel
apps/evm/src/setupTests.tsx Added hoisted vi.mock for clients/api/queryClient with invalidateQueries mock; correctly handles direct-import tests
apps/evm/src/clients/api/queries/getSwapQuote/formatSwapQuote/applySlippagePercentage/index.ts Fixed precision loss bug: replaces Number(bigint) coercion with BigNumber.toString() arithmetic to safely handle amounts larger than Number.MAX_SAFE_INTEGER
apps/evm/src/clients/api/queries/getSwapQuote/useGetSwapQuote.ts Import migrated to direct path; also silently changes refetch interval from 9–15 s to 3–6 s ('fast') — behaviour change not mentioned in PR description
apps/evm/src/clients/api/queries/useGetVaults/tests/index.spec.tsx Added explicit vi.mock() calls for direct-import modules; necessary now that those symbols no longer come through the clients/api barrel
apps/evm/src/clients/api/queries/useGetPrimeEstimation/index.ts Imports migrated to direct module paths; no functional change
apps/evm/src/clients/api/queries/useGetVaults/useGetVestingVaults/useGetXvsVaultPools.ts Four grouped imports from clients/api split into individual direct-path imports; no functional change

Reviews (1): Last reviewed commit: "feat: query client import migration" | Re-trigger Greptile

>;

const refetchInterval = generatePseudoRandomRefetchInterval();
const refetchInterval = generatePseudoRandomRefetchInterval('fast');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Behaviour change mixed into refactoring PR

generatePseudoRandomRefetchInterval('fast') changes the swap-quote polling interval from 9–15 s to 3–6 s. This is a runtime behaviour change unrelated to the stated goal of migrating query-client imports. If it is intentional (e.g., for a Yield+ leveraged-position feature), it should be called out in the changeset/description so reviewers know it's deliberate and not an accidental inclusion.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intentional, so that we keep the swap quote up to date,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant