Skip to content

feat(tron-wallet-snap): route asset reads through Core when migration is on - #145

Open
ulissesferreira wants to merge 16 commits into
WPN-1497-implement-core-assets-adapterfrom
WPN-1497-route-assets-logic-based-on-feature-flag
Open

feat(tron-wallet-snap): route asset reads through Core when migration is on#145
ulissesferreira wants to merge 16 commits into
WPN-1497-implement-core-assets-adapterfrom
WPN-1497-route-assets-logic-based-on-feature-flag

Conversation

@ulissesferreira

@ulissesferreira ulissesferreira commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Pass RemoteFeatureFlagsProvider into AssetsService and resolve the Tron assets migration flag via #shouldReturnAssetsFromCore
  • Route getAccountAssetByID, getAccountAssetsByIDs, getAccountAssets, fetchAssetsAndBalancesForAccount, and saveMany through Core when migration is active
  • When migration is on, fetch returns only snap-owned assets; save publishes them via keyring events without local persistence

Part of WPN-1497. Stack:

  1. refactor(tron-wallet-snap): extract shared asset utils and inject SnapAssetsAdapter #143
  2. feat(tron-wallet-snap): add CoreAssetsAdapter and mapControllerAsset #144
  3. feat(tron-wallet-snap): route asset reads through Core when migration is on #145 (this PR)

Replaces outdated #127 / #141.

Test plan

  • yarn workspace @metamask/tron-wallet-snap run build
  • yarn workspace @metamask/tron-wallet-snap run jest --no-coverage src/services/assets/AssetsService.test.ts
  • With migration flag off: asset reads/writes/fetch behave as Snap-only
  • With migration flag on: fungible reads come from AssetsController; fetch returns only snap-owned assets; saveMany emits only snap-owned assets and does not persist fungibles locally

…pAssetsAdapter

Move snap-owned extraction helpers into shared utils, wire SnapAssetsAdapter from
context into AssetsService, and rename getByKeyringAccountId to getAccountAssets.
…om CI

Apply oxfmt to extracted asset utils and set snap.manifest.json shasum to
the Linux CI build output so the build job's clean-working-tree check passes.
Satisfy import-x/consistent-type-specifier-style for CI eslint.
Introduce CoreAssetsAdapter with AssetsController reads and snap-owned
fetch/publish helpers. Wire it into AssetsService unused pending routing.
@ulissesferreira
ulissesferreira force-pushed the WPN-1497-implement-core-assets-adapter branch from 3550d24 to a42b752 Compare August 10, 2026 15:07
@ulissesferreira
ulissesferreira force-pushed the WPN-1497-route-assets-logic-based-on-feature-flag branch from 46681f7 to e73dd2e Compare August 10, 2026 15:35
@ulissesferreira
ulissesferreira force-pushed the WPN-1497-implement-core-assets-adapter branch from c043490 to 176828a Compare August 10, 2026 16:31
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