feat(tron-wallet-snap): route fungible reads through Core AssetsController - #96
feat(tron-wallet-snap): route fungible reads through Core AssetsController#96ulissesferreira wants to merge 3 commits into
Conversation
2339dbc to
1413a43
Compare
3e08eaa to
c278782
Compare
e6ff082 to
7e28dbf
Compare
e2a7495 to
64e6d11
Compare
01f94f8 to
aec97ce
Compare
b73d987 to
7302e9d
Compare
6f74385 to
1ad0e7a
Compare
| ): Promise<AssetEntity | null> { | ||
| if (isSnapOwnedAsset(assetId)) { | ||
| return this.#snapAdapter.getAccountAssetByID(accountId, assetId); | ||
| } |
There was a problem hiding this comment.
This shouldn't exist
| return ASSETS_MIGRATION_STAGE; | ||
| } | ||
|
|
||
| async #getProviderAccountAssetByID( |
There was a problem hiding this comment.
Unnecessary indirection
| return mapControllerAsset(accountId, asset); | ||
| } | ||
|
|
||
| async #getProviderAccountAssetsByIDs( |
There was a problem hiding this comment.
Unnecessary indirection
| ); | ||
| } | ||
|
|
||
| async #getProviderAccountAssetsByScope( |
There was a problem hiding this comment.
Unnecessary indirection
| } | ||
|
|
||
| return this.#getProviderAccountAssetByID(accountId, assetId); | ||
| } |
There was a problem hiding this comment.
We don't need the fallback thing. Just an if with an early return and everything else
f5bde1f to
f53d7bf
Compare
f53d7bf to
c9d4f0c
Compare
1a63feb to
3dc547d
Compare
c9d4f0c to
d5a852a
Compare
3dc547d to
d387059
Compare
Instantiate Core messenger via getMessenger and endow RemoteFeatureFlagController:getState plus AssetsController read actions. Wire RemoteFeatureFlagsProvider and AssetsProvider from @metamask/snap-networks-utils@1.0.0. No assets migration stage resolution or Core routing yet. Co-authored-by: Ulisses Ferreira <ulisses@hey.com>
d5a852a to
053386c
Compare
Co-authored-by: Ulisses Ferreira <ulisses@hey.com>
053386c to
c4d7646
Compare
|
@cursoragent rebase with latest base. remove unnecessary indirection due to the private methods: getProviderAccountAssetsByScope, getProviderAccountAssetByID, etc. also Snap owned assets, although they will still be synced by the snap, are now read the same way as other assets. Meaning the only routing the AssetsService reads should have is a simple if: check against the migration stage and either read from Snap adapter or Core adapter |
|
Addressed the review feedback: rebased onto the latest base and simplified RebaseReset onto
|
Rebase onto latest WPN-1497-messenger-plumbing and simplify asset read routing per review feedback: - Remove private provider indirection helpers; inline AssetsProvider calls - Route all asset reads (including snap-owned) by migration stage only - Use early return: Off → SnapAssetsAdapter, otherwise → AssetsProvider - Drop ReadAssetsControllerWithFallback try/catch fallback paths - Update tests to match unified controller read path Co-authored-by: Ulisses Ferreira <ulisses@hey.com>
d387059 to
ea6cdf4
Compare
91b9f68 to
b24a871
Compare
## Explanation This PR continues the “transaction scan” work by centralizing Stellar operation type string literals into a shared enum and updating transaction-related code to use it, while also adding a small utility for working with record-of-arrays state. **Changes:** - Add `StellarOperationType` (and `TransactionOrder`) enums and replace several hard-coded operation type strings with enum references across transaction parsing/mapping/simulation and XDR validation. - Add `pushToRecordArray` helper plus unit tests. - Introduce small type aliases (`KeyringAccountId`, `TransactionId`) to clarify intent in state and API typing. <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> ## Checklist - [ ] I've updated the test suite for new or updated code as appropriate - [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [ ] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md) - [ ] I've introduced [breaking changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md) in this PR and have prepared draft pull requests for clients and consumer packages to resolve them


Summary
CoreAssetsAdapterandmapControllerAssetfor CoreAssetsControllerreadsSnapAssetsAdapter; narrow sync/saveManyto snap-owned when Core stage is activeAssetsController:getAssetandAssetsController:getAssetsPart 2 of 2 split from #94. Part 1:
WPN-1497-messenger-plumbing.Jira
Test plan
yarn workspace @metamask/tron-wallet-snap buildyarn workspace @metamask/tron-wallet-snap run jest --no-coverage(898 tests)Stacks on PR 1 (
WPN-1497-messenger-plumbing), which stacks on #92.Supersedes #94.