refactor(tron-wallet-snap): aggressive AssetsService cleanup — handlers in service, snap-owned sync only - #98
Closed
ulissesferreira wants to merge 5 commits into
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
Align test file formatting with lint:misc:check expectations.
…s for snap-owned sync - AccountsService: mock syncSnapOwnedAssets instead of fetch/saveMany - AssetsService: rewrite tests for syncSnapOwnedAssets end-to-end flow - Remove native TRX/TRC20 fetch and enrichment test cases - Keep snap-owned extraction, persistence, and event emission coverage - Update facade delegation test (remove hasChanged, getAccountAssets) - Add CHANGELOG entry for AssetsService snap-owned sync refactor Co-authored-by: Ulisses Ferreira <ulisses@hey.com>
…ync snap-owned only AssetsService now owns metadata/conversion/market/historical-price logic. SnapAssetsAdapter fetches and persists only snap-owned assets. AccountsService.synchronizeAssets calls syncSnapOwnedAssets. Co-authored-by: Ulisses Ferreira <ulisses@hey.com>
Move extraneous-dependency suppressions with relocated imports, fix id-length and class-member spacing, and format updated tests. Co-authored-by: Ulisses Ferreira <ulisses@hey.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up cleanup on top of the SnapAssetsAdapter extraction (
WPN-1497-snap-adapter):getAssetsMetadata, conversions, market data, historical prices) back intoAssetsServiceso it no longer relies onSnapAssetsAdapterfor those pathsAssetsService.syncSnapOwnedAssets, which only syncs Snap-managed protocol assets (staking, resources, rewards)SnapAssetsAdapterto snap-owned fetch + persistence/events (fungibles are left alone during reconcile)AccountsService.synchronizeAssets/ cron path throughsyncSnapOwnedAssetsgetAccountAssets,getAll,hasChanged,fetchAssetsAndBalancesForAccount, publicsaveMany)SNAP_OWNED_ASSETS/isSnapOwnedAssethelpersTest plan
yarn workspace @metamask/tron-wallet-snap run jest --no-coverage src/services/assets/AssetsService.test.ts src/services/accounts/AccountsService.test.ts src/services/assets/snapOwnedAssets.test.ts(97 passed)yarn workspace @metamask/tron-wallet-snap run buildyarn lintyarn workspace @metamask/tron-wallet-snap run changelog:validateStacks on
WPN-1497-snap-adapter.