feat(tron-wallet-snap): route asset reads through Core when migration is on - #145
Conversation
714b17d to
3550d24
Compare
ba86a26 to
25080b8
Compare
3550d24 to
a42b752
Compare
46681f7 to
e73dd2e
Compare
69e150f to
cc94a88
Compare
c0bae22 to
084b8c7
Compare
e5c9702 to
6aa1f0a
Compare
818a716 to
4be4426
Compare
6aa1f0a to
32c46a3
Compare
8bfe50d to
681e0cb
Compare
5a9e4a0 to
4641aa1
Compare
4641aa1 to
ccfc1c6
Compare
a5cd442 to
89b4f7e
Compare
|
Reopening to re-trigger CI after amend |
783bc2f to
396c3af
Compare
396c3af to
05bd174
Compare
|
nit: the Changelog file is updated so seems to me that the PR label should not have the |
There was a problem hiding this comment.
Pull request overview
Adds feature-flagged routing between Snap-managed assets and Core’s AssetsController.
Changes:
- Adds migration-aware asset read, fetch, and save routing.
- Injects the remote feature-flags provider.
- Adds migration tests and release metadata updates.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
AssetsService.ts |
Implements feature-flagged adapter routing. |
AssetsService.test.ts |
Adds migration routing tests. |
context.ts |
Injects the feature-flags provider. |
snap.manifest.json |
Updates the bundle checksum. |
CHANGELOG.md |
Documents the migration behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| const result = | ||
| parseSnapsAssetsMigrationStage(flagValue) !== | ||
| SnapsAssetsMigrationStage.Off; |
There was a problem hiding this comment.
This is by design. We decided against having the extra fallback complexity so we just have a on or off type of situation
|
|
||
| describe('facade delegation', () => { | ||
| it('delegates repository reads and market helpers to SnapAssetsAdapter', async () => { | ||
| it('delegates static helpers and empty batch reads to SnapAssetsAdapter', async () => { |
There was a problem hiding this comment.
I though about adding some extra coverage but decided against it due to number of changes. Maybe I should 🤔. Thinking of maybe in a follow up PR?
There was a problem hiding this comment.
In that current case, that would upsize the PR without big enhancement.
This current state is acceptable.
Absolutely right. I noticed this, added the Changelog and then completely forgot to remove the label. Great catch! |
Summary
RemoteFeatureFlagsProviderintoAssetsServiceand resolve the Tron assets migration flag via#shouldReturnAssetsFromCoregetAccountAssetByID,getAccountAssetsByIDs,getAccountAssets,fetchAssetsAndBalancesForAccount, andsaveManythrough Core when migration is activePart of WPN-1497. Stack:
Replaces outdated #127 / #141.
Test plan
yarn workspace @metamask/tron-wallet-snap run buildyarn workspace @metamask/tron-wallet-snap run jest --no-coverage src/services/assets/AssetsService.test.tssaveManyemits only snap-owned assets and does not persist fungibles locally