chore: bump @metamask/core-backend and set up ApiPlatformClient#40262
chore: bump @metamask/core-backend and set up ApiPlatformClient#40262
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
| }; | ||
|
|
||
| export const queries = { | ||
| transactions: ( |
There was a problem hiding this comment.
I wonder if we should have a dedicated directory for TQ primitives outside of ui/helpers/ e.g. ui/queries/
There was a problem hiding this comment.
Next PR! Have follow ups to this file too
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
| queryKey, | ||
| queryFn: ({ pageParam, signal }) => { | ||
| const { queryFn: fetchPage } = | ||
| apiClient.accounts.getV4MultiAccountTransactionsQueryOptions( |
There was a problem hiding this comment.
- Replaced with apiClient which abstracts the API details
✨ Files requiring CODEOWNER review ✨👨🔧 @MetaMask/core-extension-ux (1 files, +28 -32)
📜 @MetaMask/policy-reviewers (12 files, +168 -8)
Tip Follow the policy review process outlined in the LavaMoat Policy Review Process doc before expecting an approval from Policy Reviewers. |
Builds ready [ce4be31]
UI Startup Metrics (1290 ± 89 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
| "@metamask/contract-metadata": "^2.5.0", | ||
| "@metamask/controller-utils": "^11.18.0", | ||
| "@metamask/core-backend": "^5.0.0", | ||
| "@metamask/core-backend": "^6.0.0", |
There was a problem hiding this comment.
Main point of interest
| * Cached API client instance. | ||
| */ | ||
| let apiClient: ApiPlatformClient | null = null; | ||
| let apiClient: AssetsControllerOptions['queryApiClient'] | null = null; |
There was a problem hiding this comment.
Interim since asset-controller needs a version bump of core-backend
MajorLift
left a comment
There was a problem hiding this comment.
Approving for @MetaMask/policy-reviewers
| "@metamask/core-backend>@tanstack/query-core": { | ||
| "globals": { | ||
| "AbortController": true, | ||
| "addEventListener": true, | ||
| "clearInterval": true, | ||
| "clearTimeout": true, | ||
| "console.error": true, | ||
| "document": true, | ||
| "removeEventListener": true, | ||
| "setInterval": true, | ||
| "setTimeout": true | ||
| }, |
There was a problem hiding this comment.
Overrides for @tanstack/query-core v5 already applied in main for all builds (search results):
"@metamask/core-backend>@tanstack/query-core": {
"globals": {
"document": false,
"document.visibilityState": true,
"addEventListener": false
}
},
| "@metamask/core-backend": { | ||
| "globals": { | ||
| "URL": true, | ||
| "fetch": true | ||
| }, |
There was a problem hiding this comment.
Safe:
- Internal packages.
- Required for key functionality as data service.
| "@metamask/assets-controller>@metamask/core-backend": { | ||
| "globals": { | ||
| "URL": true, | ||
| "WebSocket": true, | ||
| "clearTimeout": true, | ||
| "fetch": true, | ||
| "setTimeout": true | ||
| }, |
There was a problem hiding this comment.
Safe:
- Internal packages.
- Required for key functionality as data service.
Builds ready [8265865]
⚡ Performance Benchmarks (1603 ± 126 ms)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [870c57a]
⚡ Performance Benchmarks (1352 ± 103 ms)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
MajorLift
left a comment
There was a problem hiding this comment.
Could we edit the commit message (pr title) to something like
refactor: bump
@metamask/core-backendto^6.0.0and set upApiPlatformClientfor transactions query
and also fill out the pr description changelog as well? (with the package bump noted)
This should be helpful for the release engineer and for ppl creating core releases who might need to find the commit where the core-backend bump landed.
Otherwise lgtm!
Builds ready [6a5dd10]
⚡ Performance Benchmarks (1404 ± 110 ms)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
| return (method: string): Promise<T | undefined | string> => { | ||
| if (method === 'getBearerToken') { | ||
| return Promise.resolve('mock-bearer-token-for-tests'); | ||
| } |
There was a problem hiding this comment.
Hardcoded mock shadows custom getBearerToken in test requests
Low Severity
The hardcoded getBearerToken check in createMockImplementation takes precedence over the requests map. Any future test passing { getBearerToken: customValue } in the requests argument will have that value silently ignored. The intercept belongs after the requests lookup (as a fallback) rather than before it.
Builds ready [e998768]
⚡ Performance Benchmarks (1353 ± 87 ms)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|


Description
Start using the typed getV4MultiAccountTransactionsQueryOptions from core-backend
Part 1 of moving into using a shared query configuration
Part 2 needs an update on core-backend to handle RQ v4/v5 differences
Changelog
CHANGELOG entry: chore: bump @metamask/core-backend and set up ApiPlatformClient
Related issues
Fixes: N/A
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Changes the transaction activity data-fetching path and upgrades a core dependency, which could affect query keys/pagination and auth token handling despite being largely a refactor.
Overview
Upgrades
@metamask/core-backendto^6.0.0and shifts multiaccount transaction fetching to usecreateApiPlatformClient+ the typedgetV4MultiAccountTransactionsQueryOptionsrather than a hand-rolledfetchwrapper.This removes the shared
shared/lib/api-client.tsandshared/lib/multichain/queries.ts, adds UI-scopedui/helpers/api-client.tsandui/helpers/queries.ts, and updates the Activity v2 hooks to build CAIP-formatted account addresses and prefetch via the new query options.Updates
assets-controller-initto type/cast its cached API client asAssetsControllerOptions['queryApiClient'], adjusts integration test mocks to return a token forgetBearerToken, and tightens LavaMoat policies to attributecore-backendaccess through@metamask/assets-controller(plus MV3 allowances for@metamask/core-backend).Written by Cursor Bugbot for commit e998768. This will update automatically on new commits. Configure here.