Repository navigation
feat(tron): classify swap, bridge, and send transactions in analytics - #434
Conversation
3d867df to
aa682db
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The unified TRC20 send path lacks a service-level regression test, and the changelog omits part of the shipped behavior.
2 open findings
What changed in this PR
Adds Tron analytics classification for swaps, bridges, TRC20 sends, and approvals.
Changes:
- Adds transaction classification using asset chains and TRC20 selectors.
- Propagates classifications through submission, confirmation, and finalization events.
- Extends request validation and analytics tests.
| File | Description |
|---|---|
packages/tron-wallet-snap/src/utils/transactionType.ts |
Adds transaction-type resolution. |
packages/tron-wallet-snap/src/utils/transactionType.test.ts |
Tests resolver classifications. |
packages/tron-wallet-snap/src/services/send/SendService.ts |
Classifies unified sends. |
packages/tron-wallet-snap/src/services/confirmation/ConfirmationHandler.ts |
Classifies keyring transactions. |
packages/tron-wallet-snap/src/services/confirmation/ConfirmationHandler.test.ts |
Tests dApp classifications. |
packages/tron-wallet-snap/src/handlers/cronjob/cronjob.test.tsx |
Tests finalized classification propagation. |
packages/tron-wallet-snap/src/handlers/clientRequest/validation.ts |
Accepts optional asset IDs. |
packages/tron-wallet-snap/src/handlers/clientRequest/clientRequest.ts |
Classifies swaps and bridges. |
packages/tron-wallet-snap/src/handlers/clientRequest/clientRequest.test.ts |
Tests submission classifications. |
packages/tron-wallet-snap/CHANGELOG.md |
Documents analytics changes. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
c78d685 to
f85e565
Compare
|
@metamaskbot publish-preview |
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
e065093 to
62e7473
Compare
Add resolveTransactionType, which classifies a transaction from the unified swap/bridge sourceAssetId/destAssetId options (cross-chain -> bridgeSend, same-chain -> swap) and otherwise falls back to the contract type and TRC20 call selector (transfer -> send, approve -> tokenApprove). Accept the optional sourceAssetId/destAssetId on signAndSendTransaction and use the resolver at the client request, keyring sign, and unified send emission sites so the classification is carried from submit through Transaction Finalized. This also fixes TRC20 sends, which previously reported unknown.
62e7473 to
0bc67e1
Compare
|
@metamaskbot publish-preview |
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
| return undefined; | ||
| } | ||
|
|
||
| return callData.slice(0, 8).toLowerCase(); |
There was a problem hiding this comment.
Are we sure the callData does not come with a 0x prefix ? Because if it does we won't get the right data selector, maybe we could strip it first to make sure ?
There was a problem hiding this comment.
Fixed with commit: d52c800 fix(tron): normalize contract data selectors
|
@metamaskbot publish-preview |
|
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
## **Description** This pull request updates several dependencies in the `package.json` file to use newer versions of key MetaMask Snap packages. These updates ensure compatibility with the latest features and bug fixes provided by those packages. It also refines how swap activity rows are displayed and tested, especially for incomplete swaps with zero source amounts. **Dependency updates:** * Upgraded `@metamask/solana-wallet-snap` from version `^7.0.0` to `^7.1.0`. * Upgraded `@metamask/tron-wallet-snap` from version `^4.0.0` to `^4.1.0`. **Swap Activity Row Display Logic:** - Updated `useActivityRowContent` to omit both primary and secondary amounts for incomplete swaps where the source amount is zero, preventing display of irrelevant or misleading values. [[1]](diffhunk://#diff-dddf8238e1e7d70a4fd19691e75735188b061ec306a5ca5cbea8542b5209a61dR146-R156) [[2]](diffhunk://#diff-dddf8238e1e7d70a4fd19691e75735188b061ec306a5ca5cbea8542b5209a61dL161-R177) **Testing Enhancements:** - Added tests to verify that amounts are omitted for incomplete swaps with a zero source amount, and that formatting functions are not called in this case. - Improved tests to check that formatted amounts are correctly used for complete swaps and that the correct props are passed to display components. [[1]](diffhunk://#diff-63782c2a8671e685cb2199df37dec9a477a6676a6fed4bae311c5135648766c8R137-R139) [[2]](diffhunk://#diff-63782c2a8671e685cb2199df37dec9a477a6676a6fed4bae311c5135648766c8R206-R207) [[3]](diffhunk://#diff-63782c2a8671e685cb2199df37dec9a477a6676a6fed4bae311c5135648766c8R216-R218) **E2E Test Adjustments:** - Refactored Solana swap E2E tests to use more accurate transaction status and amount checks, aligning with the new display logic. [[1]](diffhunk://#diff-0d5954dd42b101c8aec3ae96df7b8fc5d42ffc53efe35a8aaa061b9325f2b253L579-R580) [[2]](diffhunk://#diff-0d5954dd42b101c8aec3ae96df7b8fc5d42ffc53efe35a8aaa061b9325f2b253L626-R628) ## @metamask/solana-wallet-snap 7.1.0 ### Added - Emit `transaction_type` on the transaction lifecycle events. ([#401](MetaMask/internal-snaps#401)) ### Changed - `getAccountAssets` and `getAccountBalances` now fetch live assets and balances from the chain through the Snap's Solana RPC clients instead of returning persisted state. ([#432](MetaMask/internal-snaps#432)) - Classify `transaction_type` for the unified swap/bridge flow with the shared `resolveFlowTransactionType` utility and the new optional `sourceAssetId`/`destAssetId` request options, carried through to `Transaction Finalized`. ([#439](MetaMask/internal-snaps#439)) - Render the confirmation "Estimated changes" section with the shared `EstimatedChanges` component from `@metamask/snap-networks-utils` ([#384](MetaMask/internal-snaps#384)) - Estimated changes from the previous scan now stay visible while a confirmation re-scans, instead of showing a loading skeleton - Render the confirmation security alert banner with the shared `TransactionAlert` component from `@metamask/snap-networks-utils` ([#409](MetaMask/internal-snaps#409)) - A "Checking for security issues" banner is now shown while the transaction scan is in progress, instead of no banner - Render the confirmation network fee with the shared `Asset` component from `@metamask/snap-networks-utils` ([#427](MetaMask/internal-snaps#427)) - Render the confirmation title with the shared `ActionHeader` component from `@metamask/snap-networks-utils` ([#436](MetaMask/internal-snaps#436)) - The sign message and sign-in screens now have the same spacing below the title as the transaction request screen ## @metamask/tron-wallet-snap 4.1.0 ### Added - Emit `transaction_type` and `transaction_status` on the transaction lifecycle events, with `transaction_type` derived from the contract type (so a flow can be attributed by combining `origin` and `transaction_type`) and `transaction_status` reporting the on-chain outcome on `Transaction Finalized`. ([#399](MetaMask/internal-snaps#399), [#405](MetaMask/internal-snaps#405)) ### Changed - Classify `transaction_type` for the unified swap/bridge flow with the new optional `sourceAssetId`/`destAssetId` request options. Classify TRC20 smart-contract calls by function selector (so a `transfer` reports `send` and an `approve` reports `tokenApprove` instead of `unknown`) ([#434](MetaMask/internal-snaps#434)) - Change the last behaviours missing for the `AssetsController` migration to happen ([#424](MetaMask/internal-snaps#424)) - When the assets migration feature flag is active, the snap no longer fetches, persists, or publishes assets: the periodic sync cronjob and the synchronization triggered by selected account changes no longer touch assets or emit `AccountAssetListUpdated` and `AccountBalancesUpdated` events, leaving asset syncing to the `AssetsController` - When the live assets and balances are fetched by `getAccountAssets` and `getAccountBalances`, they are persisted to local state without emitting `AccountAssetListUpdated` and `AccountBalancesUpdated` events - Validate network and CAIP asset type values coming from untrusted boundaries (RPC request params, the Keyring API, the AssetsController) instead of force-casting them, so unsupported values fail fast with an `Invalid params` error ([#403](MetaMask/internal-snaps#403)) - Render the confirmation "Estimated changes" section with the shared `EstimatedChanges` component from `@metamask/snap-networks-utils` ([#396](MetaMask/internal-snaps#396)) - Estimated changes from the previous scan now stay visible while a confirmation re-scans, instead of showing a loading skeleton - Render the confirmation security alert banner with the shared `TransactionAlert` component from `@metamask/snap-networks-utils` ([#414](MetaMask/internal-snaps#414)) - A "Checking for security issues" banner is now shown while the transaction scan is in progress, instead of a loading skeleton - Render the confirmation fee asset rows with the shared `Asset` component from `@metamask/snap-networks-utils` ([#429](MetaMask/internal-snaps#429)) - Render the confirmation title with the shared `ActionHeader` component from `@metamask/snap-networks-utils` ([#438](MetaMask/internal-snaps#438)) - `listAccountAssets` and `getAccountBalances` now fetch live assets and balances from the chain through the Snap's TronGrid clients instead of returning persisted state. ([#388](MetaMask/internal-snaps#388)) ### Fixed - Show "Estimated changes are not available" instead of "No estimated changes" when the transaction scan returns an error result, such as for a malformed transaction ([#396](MetaMask/internal-snaps#396)) - Report the MetaMask origin as lowercase `metamask` instead of `MetaMask` for MetaMask-initiated operations, so the origin matches the value used by the other non-EVM snaps and granted to the keyring methods, and so transaction scan requests are attributed to `https://metamask.io`. The confirmation UI keeps displaying `MetaMask`. ([#392](MetaMask/internal-snaps#392)) ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: (feat): bump Tron, Solana and Bitcoin snaps ## **Related issues** Fixes: N/A ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Upgrades bridge and multichain snap packages with LavaMoat policy changes; activity amount display changes affect swap UX but are limited to an incomplete-swap edge case. > > **Overview** > Bumps **@metamask/solana-wallet-snap** (`^7.1.0`), **@metamask/tron-wallet-snap** (`^4.1.0`), **@metamask/bridge-controller** (`^82.0.2`), and **@metamask/bridge-status-controller** (`^76.4.0`), with **yarn resolutions** pinning `@metamask/bridge-controller@npm:^82.0.2` and `reselect@npm:^5.1.1`, plus matching **LavaMoat** policy entries that scope `@metamask/bridge-controller` under the bridge-status-controller dependency path across MV2/MV3 variants. > > **Activity list:** `useActivityRowContent` no longer shows primary/secondary amounts for **incomplete swaps** when the source token amount is `'0'` (no destination token), avoiding misleading zero/placeholder values—aligned with updated snap transaction typing for unified swap/bridge flows. > > **Tests:** unit coverage for that swap row behavior; Solana swap E2E flows now wait for **confirmed** status and use `checkTransactionAmount` instead of index-based amount checks. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0540fc2. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## **Description** This pull request updates several dependencies in the `package.json` file to use newer versions of key MetaMask Snap packages. These updates ensure compatibility with the latest features and bug fixes provided by those packages. It also refines how swap activity rows are displayed and tested, especially for incomplete swaps with zero source amounts. **Dependency updates:** * Upgraded `@metamask/solana-wallet-snap` from version `^7.0.0` to `^7.1.0`. * Upgraded `@metamask/tron-wallet-snap` from version `^4.0.0` to `^4.1.0`. **Swap Activity Row Display Logic:** - Updated `useActivityRowContent` to omit both primary and secondary amounts for incomplete swaps where the source amount is zero, preventing display of irrelevant or misleading values. [[1]](diffhunk://#diff-dddf8238e1e7d70a4fd19691e75735188b061ec306a5ca5cbea8542b5209a61dR146-R156) [[2]](diffhunk://#diff-dddf8238e1e7d70a4fd19691e75735188b061ec306a5ca5cbea8542b5209a61dL161-R177) **Testing Enhancements:** - Added tests to verify that amounts are omitted for incomplete swaps with a zero source amount, and that formatting functions are not called in this case. - Improved tests to check that formatted amounts are correctly used for complete swaps and that the correct props are passed to display components. [[1]](diffhunk://#diff-63782c2a8671e685cb2199df37dec9a477a6676a6fed4bae311c5135648766c8R137-R139) [[2]](diffhunk://#diff-63782c2a8671e685cb2199df37dec9a477a6676a6fed4bae311c5135648766c8R206-R207) [[3]](diffhunk://#diff-63782c2a8671e685cb2199df37dec9a477a6676a6fed4bae311c5135648766c8R216-R218) **E2E Test Adjustments:** - Refactored Solana swap E2E tests to use more accurate transaction status and amount checks, aligning with the new display logic. [[1]](diffhunk://#diff-0d5954dd42b101c8aec3ae96df7b8fc5d42ffc53efe35a8aaa061b9325f2b253L579-R580) [[2]](diffhunk://#diff-0d5954dd42b101c8aec3ae96df7b8fc5d42ffc53efe35a8aaa061b9325f2b253L626-R628) ## @metamask/solana-wallet-snap 7.1.0 ### Added - Emit `transaction_type` on the transaction lifecycle events. ([#401](MetaMask/internal-snaps#401)) ### Changed - `getAccountAssets` and `getAccountBalances` now fetch live assets and balances from the chain through the Snap's Solana RPC clients instead of returning persisted state. ([#432](MetaMask/internal-snaps#432)) - Classify `transaction_type` for the unified swap/bridge flow with the shared `resolveFlowTransactionType` utility and the new optional `sourceAssetId`/`destAssetId` request options, carried through to `Transaction Finalized`. ([#439](MetaMask/internal-snaps#439)) - Render the confirmation "Estimated changes" section with the shared `EstimatedChanges` component from `@metamask/snap-networks-utils` ([#384](MetaMask/internal-snaps#384)) - Estimated changes from the previous scan now stay visible while a confirmation re-scans, instead of showing a loading skeleton - Render the confirmation security alert banner with the shared `TransactionAlert` component from `@metamask/snap-networks-utils` ([#409](MetaMask/internal-snaps#409)) - A "Checking for security issues" banner is now shown while the transaction scan is in progress, instead of no banner - Render the confirmation network fee with the shared `Asset` component from `@metamask/snap-networks-utils` ([#427](MetaMask/internal-snaps#427)) - Render the confirmation title with the shared `ActionHeader` component from `@metamask/snap-networks-utils` ([#436](MetaMask/internal-snaps#436)) - The sign message and sign-in screens now have the same spacing below the title as the transaction request screen ## @metamask/tron-wallet-snap 4.1.0 ### Added - Emit `transaction_type` and `transaction_status` on the transaction lifecycle events, with `transaction_type` derived from the contract type (so a flow can be attributed by combining `origin` and `transaction_type`) and `transaction_status` reporting the on-chain outcome on `Transaction Finalized`. ([#399](MetaMask/internal-snaps#399), [#405](MetaMask/internal-snaps#405)) ### Changed - Classify `transaction_type` for the unified swap/bridge flow with the new optional `sourceAssetId`/`destAssetId` request options. Classify TRC20 smart-contract calls by function selector (so a `transfer` reports `send` and an `approve` reports `tokenApprove` instead of `unknown`) ([#434](MetaMask/internal-snaps#434)) - Change the last behaviours missing for the `AssetsController` migration to happen ([#424](MetaMask/internal-snaps#424)) - When the assets migration feature flag is active, the snap no longer fetches, persists, or publishes assets: the periodic sync cronjob and the synchronization triggered by selected account changes no longer touch assets or emit `AccountAssetListUpdated` and `AccountBalancesUpdated` events, leaving asset syncing to the `AssetsController` - When the live assets and balances are fetched by `getAccountAssets` and `getAccountBalances`, they are persisted to local state without emitting `AccountAssetListUpdated` and `AccountBalancesUpdated` events - Validate network and CAIP asset type values coming from untrusted boundaries (RPC request params, the Keyring API, the AssetsController) instead of force-casting them, so unsupported values fail fast with an `Invalid params` error ([#403](MetaMask/internal-snaps#403)) - Render the confirmation "Estimated changes" section with the shared `EstimatedChanges` component from `@metamask/snap-networks-utils` ([#396](MetaMask/internal-snaps#396)) - Estimated changes from the previous scan now stay visible while a confirmation re-scans, instead of showing a loading skeleton - Render the confirmation security alert banner with the shared `TransactionAlert` component from `@metamask/snap-networks-utils` ([#414](MetaMask/internal-snaps#414)) - A "Checking for security issues" banner is now shown while the transaction scan is in progress, instead of a loading skeleton - Render the confirmation fee asset rows with the shared `Asset` component from `@metamask/snap-networks-utils` ([#429](MetaMask/internal-snaps#429)) - Render the confirmation title with the shared `ActionHeader` component from `@metamask/snap-networks-utils` ([#438](MetaMask/internal-snaps#438)) - `listAccountAssets` and `getAccountBalances` now fetch live assets and balances from the chain through the Snap's TronGrid clients instead of returning persisted state. ([#388](MetaMask/internal-snaps#388)) ### Fixed - Show "Estimated changes are not available" instead of "No estimated changes" when the transaction scan returns an error result, such as for a malformed transaction ([#396](MetaMask/internal-snaps#396)) - Report the MetaMask origin as lowercase `metamask` instead of `MetaMask` for MetaMask-initiated operations, so the origin matches the value used by the other non-EVM snaps and granted to the keyring methods, and so transaction scan requests are attributed to `https://metamask.io`. The confirmation UI keeps displaying `MetaMask`. ([#392](MetaMask/internal-snaps#392)) ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: (feat): bump Tron, Solana and Bitcoin snaps ## **Related issues** Fixes: N/A ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Upgrades bridge and multichain snap packages with LavaMoat policy changes; activity amount display changes affect swap UX but are limited to an incomplete-swap edge case. > > **Overview** > Bumps **@metamask/solana-wallet-snap** (`^7.1.0`), **@metamask/tron-wallet-snap** (`^4.1.0`), **@metamask/bridge-controller** (`^82.0.2`), and **@metamask/bridge-status-controller** (`^76.4.0`), with **yarn resolutions** pinning `@metamask/bridge-controller@npm:^82.0.2` and `reselect@npm:^5.1.1`, plus matching **LavaMoat** policy entries that scope `@metamask/bridge-controller` under the bridge-status-controller dependency path across MV2/MV3 variants. > > **Activity list:** `useActivityRowContent` no longer shows primary/secondary amounts for **incomplete swaps** when the source token amount is `'0'` (no destination token), avoiding misleading zero/placeholder values—aligned with updated snap transaction typing for unified swap/bridge flows. > > **Tests:** unit coverage for that swap row behavior; Solana swap E2E flows now wait for **confirmed** status and use `checkTransactionAmount` instead of index-based amount checks. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0540fc2. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## **Description** This pull request updates several dependencies in the `package.json` file to use newer versions of key MetaMask Snap packages. These updates ensure compatibility with the latest features and bug fixes provided by those packages. It also refines how swap activity rows are displayed and tested, especially for incomplete swaps with zero source amounts. **Dependency updates:** * Upgraded `@metamask/solana-wallet-snap` from version `^7.0.0` to `^7.1.0`. * Upgraded `@metamask/tron-wallet-snap` from version `^4.0.0` to `^4.1.0`. **Swap Activity Row Display Logic:** - Updated `useActivityRowContent` to omit both primary and secondary amounts for incomplete swaps where the source amount is zero, preventing display of irrelevant or misleading values. [[1]](diffhunk://#diff-dddf8238e1e7d70a4fd19691e75735188b061ec306a5ca5cbea8542b5209a61dR146-R156) [[2]](diffhunk://#diff-dddf8238e1e7d70a4fd19691e75735188b061ec306a5ca5cbea8542b5209a61dL161-R177) **Testing Enhancements:** - Added tests to verify that amounts are omitted for incomplete swaps with a zero source amount, and that formatting functions are not called in this case. - Improved tests to check that formatted amounts are correctly used for complete swaps and that the correct props are passed to display components. [[1]](diffhunk://#diff-63782c2a8671e685cb2199df37dec9a477a6676a6fed4bae311c5135648766c8R137-R139) [[2]](diffhunk://#diff-63782c2a8671e685cb2199df37dec9a477a6676a6fed4bae311c5135648766c8R206-R207) [[3]](diffhunk://#diff-63782c2a8671e685cb2199df37dec9a477a6676a6fed4bae311c5135648766c8R216-R218) **E2E Test Adjustments:** - Refactored Solana swap E2E tests to use more accurate transaction status and amount checks, aligning with the new display logic. [[1]](diffhunk://#diff-0d5954dd42b101c8aec3ae96df7b8fc5d42ffc53efe35a8aaa061b9325f2b253L579-R580) [[2]](diffhunk://#diff-0d5954dd42b101c8aec3ae96df7b8fc5d42ffc53efe35a8aaa061b9325f2b253L626-R628) ## @metamask/solana-wallet-snap 7.1.0 ### Added - Emit `transaction_type` on the transaction lifecycle events. ([#401](MetaMask/internal-snaps#401)) ### Changed - `getAccountAssets` and `getAccountBalances` now fetch live assets and balances from the chain through the Snap's Solana RPC clients instead of returning persisted state. ([#432](MetaMask/internal-snaps#432)) - Classify `transaction_type` for the unified swap/bridge flow with the shared `resolveFlowTransactionType` utility and the new optional `sourceAssetId`/`destAssetId` request options, carried through to `Transaction Finalized`. ([#439](MetaMask/internal-snaps#439)) - Render the confirmation "Estimated changes" section with the shared `EstimatedChanges` component from `@metamask/snap-networks-utils` ([#384](MetaMask/internal-snaps#384)) - Estimated changes from the previous scan now stay visible while a confirmation re-scans, instead of showing a loading skeleton - Render the confirmation security alert banner with the shared `TransactionAlert` component from `@metamask/snap-networks-utils` ([#409](MetaMask/internal-snaps#409)) - A "Checking for security issues" banner is now shown while the transaction scan is in progress, instead of no banner - Render the confirmation network fee with the shared `Asset` component from `@metamask/snap-networks-utils` ([#427](MetaMask/internal-snaps#427)) - Render the confirmation title with the shared `ActionHeader` component from `@metamask/snap-networks-utils` ([#436](MetaMask/internal-snaps#436)) - The sign message and sign-in screens now have the same spacing below the title as the transaction request screen ## @metamask/tron-wallet-snap 4.1.0 ### Added - Emit `transaction_type` and `transaction_status` on the transaction lifecycle events, with `transaction_type` derived from the contract type (so a flow can be attributed by combining `origin` and `transaction_type`) and `transaction_status` reporting the on-chain outcome on `Transaction Finalized`. ([#399](MetaMask/internal-snaps#399), [#405](MetaMask/internal-snaps#405)) ### Changed - Classify `transaction_type` for the unified swap/bridge flow with the new optional `sourceAssetId`/`destAssetId` request options. Classify TRC20 smart-contract calls by function selector (so a `transfer` reports `send` and an `approve` reports `tokenApprove` instead of `unknown`) ([#434](MetaMask/internal-snaps#434)) - Change the last behaviours missing for the `AssetsController` migration to happen ([#424](MetaMask/internal-snaps#424)) - When the assets migration feature flag is active, the snap no longer fetches, persists, or publishes assets: the periodic sync cronjob and the synchronization triggered by selected account changes no longer touch assets or emit `AccountAssetListUpdated` and `AccountBalancesUpdated` events, leaving asset syncing to the `AssetsController` - When the live assets and balances are fetched by `getAccountAssets` and `getAccountBalances`, they are persisted to local state without emitting `AccountAssetListUpdated` and `AccountBalancesUpdated` events - Validate network and CAIP asset type values coming from untrusted boundaries (RPC request params, the Keyring API, the AssetsController) instead of force-casting them, so unsupported values fail fast with an `Invalid params` error ([#403](MetaMask/internal-snaps#403)) - Render the confirmation "Estimated changes" section with the shared `EstimatedChanges` component from `@metamask/snap-networks-utils` ([#396](MetaMask/internal-snaps#396)) - Estimated changes from the previous scan now stay visible while a confirmation re-scans, instead of showing a loading skeleton - Render the confirmation security alert banner with the shared `TransactionAlert` component from `@metamask/snap-networks-utils` ([#414](MetaMask/internal-snaps#414)) - A "Checking for security issues" banner is now shown while the transaction scan is in progress, instead of a loading skeleton - Render the confirmation fee asset rows with the shared `Asset` component from `@metamask/snap-networks-utils` ([#429](MetaMask/internal-snaps#429)) - Render the confirmation title with the shared `ActionHeader` component from `@metamask/snap-networks-utils` ([#438](MetaMask/internal-snaps#438)) - `listAccountAssets` and `getAccountBalances` now fetch live assets and balances from the chain through the Snap's TronGrid clients instead of returning persisted state. ([#388](MetaMask/internal-snaps#388)) ### Fixed - Show "Estimated changes are not available" instead of "No estimated changes" when the transaction scan returns an error result, such as for a malformed transaction ([#396](MetaMask/internal-snaps#396)) - Report the MetaMask origin as lowercase `metamask` instead of `MetaMask` for MetaMask-initiated operations, so the origin matches the value used by the other non-EVM snaps and granted to the keyring methods, and so transaction scan requests are attributed to `https://metamask.io`. The confirmation UI keeps displaying `MetaMask`. ([#392](MetaMask/internal-snaps#392)) ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: (feat): bump Tron, Solana and Bitcoin snaps ## **Related issues** Fixes: N/A ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Upgrades bridge and multichain snap packages with LavaMoat policy changes; activity amount display changes affect swap UX but are limited to an incomplete-swap edge case. > > **Overview** > Bumps **@metamask/solana-wallet-snap** (`^7.1.0`), **@metamask/tron-wallet-snap** (`^4.1.0`), **@metamask/bridge-controller** (`^82.0.2`), and **@metamask/bridge-status-controller** (`^76.4.0`), with **yarn resolutions** pinning `@metamask/bridge-controller@npm:^82.0.2` and `reselect@npm:^5.1.1`, plus matching **LavaMoat** policy entries that scope `@metamask/bridge-controller` under the bridge-status-controller dependency path across MV2/MV3 variants. > > **Activity list:** `useActivityRowContent` no longer shows primary/secondary amounts for **incomplete swaps** when the source token amount is `'0'` (no destination token), avoiding misleading zero/placeholder values—aligned with updated snap transaction typing for unified swap/bridge flows. > > **Tests:** unit coverage for that swap row behavior; Solana swap E2E flows now wait for **confirmed** status and use `checkTransactionAmount` instead of index-based amount checks. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0540fc2. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
- feat: bump Tron, Solana snaps (#47048) ## **Description** This pull request updates several dependencies in the `package.json` file to use newer versions of key MetaMask Snap packages. These updates ensure compatibility with the latest features and bug fixes provided by those packages. It also refines how swap activity rows are displayed and tested, especially for incomplete swaps with zero source amounts. **Dependency updates:** * Upgraded `@metamask/solana-wallet-snap` from version `^7.0.0` to `^7.1.0`. * Upgraded `@metamask/tron-wallet-snap` from version `^4.0.0` to `^4.1.0`. **Swap Activity Row Display Logic:** - Updated `useActivityRowContent` to omit both primary and secondary amounts for incomplete swaps where the source amount is zero, preventing display of irrelevant or misleading values. [[1]](diffhunk://#diff-dddf8238e1e7d70a4fd19691e75735188b061ec306a5ca5cbea8542b5209a61dR146-R156) [[2]](diffhunk://#diff-dddf8238e1e7d70a4fd19691e75735188b061ec306a5ca5cbea8542b5209a61dL161-R177) **Testing Enhancements:** - Added tests to verify that amounts are omitted for incomplete swaps with a zero source amount, and that formatting functions are not called in this case. - Improved tests to check that formatted amounts are correctly used for complete swaps and that the correct props are passed to display components. [[1]](diffhunk://#diff-63782c2a8671e685cb2199df37dec9a477a6676a6fed4bae311c5135648766c8R137-R139) [[2]](diffhunk://#diff-63782c2a8671e685cb2199df37dec9a477a6676a6fed4bae311c5135648766c8R206-R207) [[3]](diffhunk://#diff-63782c2a8671e685cb2199df37dec9a477a6676a6fed4bae311c5135648766c8R216-R218) **E2E Test Adjustments:** - Refactored Solana swap E2E tests to use more accurate transaction status and amount checks, aligning with the new display logic. [[1]](diffhunk://#diff-0d5954dd42b101c8aec3ae96df7b8fc5d42ffc53efe35a8aaa061b9325f2b253L579-R580) [[2]](diffhunk://#diff-0d5954dd42b101c8aec3ae96df7b8fc5d42ffc53efe35a8aaa061b9325f2b253L626-R628) ## @metamask/solana-wallet-snap 7.1.0 ### Added - Emit `transaction_type` on the transaction lifecycle events. ([#401](MetaMask/internal-snaps#401)) ### Changed - `getAccountAssets` and `getAccountBalances` now fetch live assets and balances from the chain through the Snap's Solana RPC clients instead of returning persisted state. ([#432](MetaMask/internal-snaps#432)) - Classify `transaction_type` for the unified swap/bridge flow with the shared `resolveFlowTransactionType` utility and the new optional `sourceAssetId`/`destAssetId` request options, carried through to `Transaction Finalized`. ([#439](MetaMask/internal-snaps#439)) - Render the confirmation "Estimated changes" section with the shared `EstimatedChanges` component from `@metamask/snap-networks-utils` ([#384](MetaMask/internal-snaps#384)) - Estimated changes from the previous scan now stay visible while a confirmation re-scans, instead of showing a loading skeleton - Render the confirmation security alert banner with the shared `TransactionAlert` component from `@metamask/snap-networks-utils` ([#409](MetaMask/internal-snaps#409)) - A "Checking for security issues" banner is now shown while the transaction scan is in progress, instead of no banner - Render the confirmation network fee with the shared `Asset` component from `@metamask/snap-networks-utils` ([#427](MetaMask/internal-snaps#427)) - Render the confirmation title with the shared `ActionHeader` component from `@metamask/snap-networks-utils` ([#436](MetaMask/internal-snaps#436)) - The sign message and sign-in screens now have the same spacing below the title as the transaction request screen ## @metamask/tron-wallet-snap 4.1.0 ### Added - Emit `transaction_type` and `transaction_status` on the transaction lifecycle events, with `transaction_type` derived from the contract type (so a flow can be attributed by combining `origin` and `transaction_type`) and `transaction_status` reporting the on-chain outcome on `Transaction Finalized`. ([#399](MetaMask/internal-snaps#399), [#405](MetaMask/internal-snaps#405)) ### Changed - Classify `transaction_type` for the unified swap/bridge flow with the new optional `sourceAssetId`/`destAssetId` request options. Classify TRC20 smart-contract calls by function selector (so a `transfer` reports `send` and an `approve` reports `tokenApprove` instead of `unknown`) ([#434](MetaMask/internal-snaps#434)) - Change the last behaviours missing for the `AssetsController` migration to happen ([#424](MetaMask/internal-snaps#424)) - When the assets migration feature flag is active, the snap no longer fetches, persists, or publishes assets: the periodic sync cronjob and the synchronization triggered by selected account changes no longer touch assets or emit `AccountAssetListUpdated` and `AccountBalancesUpdated` events, leaving asset syncing to the `AssetsController` - When the live assets and balances are fetched by `getAccountAssets` and `getAccountBalances`, they are persisted to local state without emitting `AccountAssetListUpdated` and `AccountBalancesUpdated` events - Validate network and CAIP asset type values coming from untrusted boundaries (RPC request params, the Keyring API, the AssetsController) instead of force-casting them, so unsupported values fail fast with an `Invalid params` error ([#403](MetaMask/internal-snaps#403)) - Render the confirmation "Estimated changes" section with the shared `EstimatedChanges` component from `@metamask/snap-networks-utils` ([#396](MetaMask/internal-snaps#396)) - Estimated changes from the previous scan now stay visible while a confirmation re-scans, instead of showing a loading skeleton - Render the confirmation security alert banner with the shared `TransactionAlert` component from `@metamask/snap-networks-utils` ([#414](MetaMask/internal-snaps#414)) - A "Checking for security issues" banner is now shown while the transaction scan is in progress, instead of a loading skeleton - Render the confirmation fee asset rows with the shared `Asset` component from `@metamask/snap-networks-utils` ([#429](MetaMask/internal-snaps#429)) - Render the confirmation title with the shared `ActionHeader` component from `@metamask/snap-networks-utils` ([#438](MetaMask/internal-snaps#438)) - `listAccountAssets` and `getAccountBalances` now fetch live assets and balances from the chain through the Snap's TronGrid clients instead of returning persisted state. ([#388](MetaMask/internal-snaps#388)) ### Fixed - Show "Estimated changes are not available" instead of "No estimated changes" when the transaction scan returns an error result, such as for a malformed transaction ([#396](MetaMask/internal-snaps#396)) - Report the MetaMask origin as lowercase `metamask` instead of `MetaMask` for MetaMask-initiated operations, so the origin matches the value used by the other non-EVM snaps and granted to the keyring methods, and so transaction scan requests are attributed to `https://metamask.io`. The confirmation UI keeps displaying `MetaMask`. ([#392](MetaMask/internal-snaps#392)) ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: (feat): bump Tron, Solana and Bitcoin snaps ## **Related issues** Fixes: N/A ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Upgrades bridge and multichain snap packages with LavaMoat policy changes; activity amount display changes affect swap UX but are limited to an incomplete-swap edge case. > > **Overview** > Bumps **@metamask/solana-wallet-snap** (`^7.1.0`), **@metamask/tron-wallet-snap** (`^4.1.0`), **@metamask/bridge-controller** (`^82.0.2`), and **@metamask/bridge-status-controller** (`^76.4.0`), with **yarn resolutions** pinning `@metamask/bridge-controller@npm:^82.0.2` and `reselect@npm:^5.1.1`, plus matching **LavaMoat** policy entries that scope `@metamask/bridge-controller` under the bridge-status-controller dependency path across MV2/MV3 variants. > > **Activity list:** `useActivityRowContent` no longer shows primary/secondary amounts for **incomplete swaps** when the source token amount is `'0'` (no destination token), avoiding misleading zero/placeholder values—aligned with updated snap transaction typing for unified swap/bridge flows. > > **Tests:** unit coverage for that swap row behavior; Solana swap E2E flows now wait for **confirmed** status and use `checkTransactionAmount` instead of index-based amount checks. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0540fc2. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> [bdbf80b](bdbf80b) --------- Co-authored-by: Battambang <frederic.heng@consensys.net> Co-authored-by: metamask-ci[bot] <271559518+metamask-ci[bot]@users.noreply.github.com>
## **Description** This pull request updates several dependencies in the `package.json` file to use newer versions of key MetaMask Snap packages. These updates ensure compatibility with the latest features and bug fixes provided by those packages. It also refines how swap activity rows are displayed and tested, especially for incomplete swaps with zero source amounts. **Dependency updates:** * Upgraded `@metamask/solana-wallet-snap` from version `^7.0.0` to `^7.1.0`. * Upgraded `@metamask/tron-wallet-snap` from version `^4.0.0` to `^4.1.0`. **Swap Activity Row Display Logic:** - Updated `useActivityRowContent` to omit both primary and secondary amounts for incomplete swaps where the source amount is zero, preventing display of irrelevant or misleading values. [[1]](diffhunk://#diff-dddf8238e1e7d70a4fd19691e75735188b061ec306a5ca5cbea8542b5209a61dR146-R156) [[2]](diffhunk://#diff-dddf8238e1e7d70a4fd19691e75735188b061ec306a5ca5cbea8542b5209a61dL161-R177) **Testing Enhancements:** - Added tests to verify that amounts are omitted for incomplete swaps with a zero source amount, and that formatting functions are not called in this case. - Improved tests to check that formatted amounts are correctly used for complete swaps and that the correct props are passed to display components. [[1]](diffhunk://#diff-63782c2a8671e685cb2199df37dec9a477a6676a6fed4bae311c5135648766c8R137-R139) [[2]](diffhunk://#diff-63782c2a8671e685cb2199df37dec9a477a6676a6fed4bae311c5135648766c8R206-R207) [[3]](diffhunk://#diff-63782c2a8671e685cb2199df37dec9a477a6676a6fed4bae311c5135648766c8R216-R218) **E2E Test Adjustments:** - Refactored Solana swap E2E tests to use more accurate transaction status and amount checks, aligning with the new display logic. [[1]](diffhunk://#diff-0d5954dd42b101c8aec3ae96df7b8fc5d42ffc53efe35a8aaa061b9325f2b253L579-R580) [[2]](diffhunk://#diff-0d5954dd42b101c8aec3ae96df7b8fc5d42ffc53efe35a8aaa061b9325f2b253L626-R628) ## @metamask/solana-wallet-snap 7.1.0 ### Added - Emit `transaction_type` on the transaction lifecycle events. ([MetaMask#401](MetaMask/internal-snaps#401)) ### Changed - `getAccountAssets` and `getAccountBalances` now fetch live assets and balances from the chain through the Snap's Solana RPC clients instead of returning persisted state. ([MetaMask#432](MetaMask/internal-snaps#432)) - Classify `transaction_type` for the unified swap/bridge flow with the shared `resolveFlowTransactionType` utility and the new optional `sourceAssetId`/`destAssetId` request options, carried through to `Transaction Finalized`. ([MetaMask#439](MetaMask/internal-snaps#439)) - Render the confirmation "Estimated changes" section with the shared `EstimatedChanges` component from `@metamask/snap-networks-utils` ([MetaMask#384](MetaMask/internal-snaps#384)) - Estimated changes from the previous scan now stay visible while a confirmation re-scans, instead of showing a loading skeleton - Render the confirmation security alert banner with the shared `TransactionAlert` component from `@metamask/snap-networks-utils` ([MetaMask#409](MetaMask/internal-snaps#409)) - A "Checking for security issues" banner is now shown while the transaction scan is in progress, instead of no banner - Render the confirmation network fee with the shared `Asset` component from `@metamask/snap-networks-utils` ([MetaMask#427](MetaMask/internal-snaps#427)) - Render the confirmation title with the shared `ActionHeader` component from `@metamask/snap-networks-utils` ([MetaMask#436](MetaMask/internal-snaps#436)) - The sign message and sign-in screens now have the same spacing below the title as the transaction request screen ## @metamask/tron-wallet-snap 4.1.0 ### Added - Emit `transaction_type` and `transaction_status` on the transaction lifecycle events, with `transaction_type` derived from the contract type (so a flow can be attributed by combining `origin` and `transaction_type`) and `transaction_status` reporting the on-chain outcome on `Transaction Finalized`. ([MetaMask#399](MetaMask/internal-snaps#399), [MetaMask#405](MetaMask/internal-snaps#405)) ### Changed - Classify `transaction_type` for the unified swap/bridge flow with the new optional `sourceAssetId`/`destAssetId` request options. Classify TRC20 smart-contract calls by function selector (so a `transfer` reports `send` and an `approve` reports `tokenApprove` instead of `unknown`) ([MetaMask#434](MetaMask/internal-snaps#434)) - Change the last behaviours missing for the `AssetsController` migration to happen ([MetaMask#424](MetaMask/internal-snaps#424)) - When the assets migration feature flag is active, the snap no longer fetches, persists, or publishes assets: the periodic sync cronjob and the synchronization triggered by selected account changes no longer touch assets or emit `AccountAssetListUpdated` and `AccountBalancesUpdated` events, leaving asset syncing to the `AssetsController` - When the live assets and balances are fetched by `getAccountAssets` and `getAccountBalances`, they are persisted to local state without emitting `AccountAssetListUpdated` and `AccountBalancesUpdated` events - Validate network and CAIP asset type values coming from untrusted boundaries (RPC request params, the Keyring API, the AssetsController) instead of force-casting them, so unsupported values fail fast with an `Invalid params` error ([MetaMask#403](MetaMask/internal-snaps#403)) - Render the confirmation "Estimated changes" section with the shared `EstimatedChanges` component from `@metamask/snap-networks-utils` ([MetaMask#396](MetaMask/internal-snaps#396)) - Estimated changes from the previous scan now stay visible while a confirmation re-scans, instead of showing a loading skeleton - Render the confirmation security alert banner with the shared `TransactionAlert` component from `@metamask/snap-networks-utils` ([MetaMask#414](MetaMask/internal-snaps#414)) - A "Checking for security issues" banner is now shown while the transaction scan is in progress, instead of a loading skeleton - Render the confirmation fee asset rows with the shared `Asset` component from `@metamask/snap-networks-utils` ([MetaMask#429](MetaMask/internal-snaps#429)) - Render the confirmation title with the shared `ActionHeader` component from `@metamask/snap-networks-utils` ([MetaMask#438](MetaMask/internal-snaps#438)) - `listAccountAssets` and `getAccountBalances` now fetch live assets and balances from the chain through the Snap's TronGrid clients instead of returning persisted state. ([MetaMask#388](MetaMask/internal-snaps#388)) ### Fixed - Show "Estimated changes are not available" instead of "No estimated changes" when the transaction scan returns an error result, such as for a malformed transaction ([MetaMask#396](MetaMask/internal-snaps#396)) - Report the MetaMask origin as lowercase `metamask` instead of `MetaMask` for MetaMask-initiated operations, so the origin matches the value used by the other non-EVM snaps and granted to the keyring methods, and so transaction scan requests are attributed to `https://metamask.io`. The confirmation UI keeps displaying `MetaMask`. ([MetaMask#392](MetaMask/internal-snaps#392)) ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: (feat): bump Tron, Solana and Bitcoin snaps ## **Related issues** Fixes: N/A ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Upgrades bridge and multichain snap packages with LavaMoat policy changes; activity amount display changes affect swap UX but are limited to an incomplete-swap edge case. > > **Overview** > Bumps **@metamask/solana-wallet-snap** (`^7.1.0`), **@metamask/tron-wallet-snap** (`^4.1.0`), **@metamask/bridge-controller** (`^82.0.2`), and **@metamask/bridge-status-controller** (`^76.4.0`), with **yarn resolutions** pinning `@metamask/bridge-controller@npm:^82.0.2` and `reselect@npm:^5.1.1`, plus matching **LavaMoat** policy entries that scope `@metamask/bridge-controller` under the bridge-status-controller dependency path across MV2/MV3 variants. > > **Activity list:** `useActivityRowContent` no longer shows primary/secondary amounts for **incomplete swaps** when the source token amount is `'0'` (no destination token), avoiding misleading zero/placeholder values—aligned with updated snap transaction typing for unified swap/bridge flows. > > **Tests:** unit coverage for that swap row behavior; Solana swap E2E flows now wait for **confirmed** status and use `checkTransactionAmount` instead of index-based amount checks. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0540fc2. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until this PR meets the canonical
Definition of Ready For Review in `docs/readme/ready-for-review.md`.
In short: the template must be materially complete (not just section
titles
present), all status checks must be currently passing, and the only
expected
follow-up commits must be reviewer-driven.
-->
<!--
mms-check directive vocabulary — read by
.github/scripts/shared/pr-template-checks.ts
at module load to build the validation plan. Directives are invisible in
rendered
markdown and must NOT be removed or edited without updating the
validator registry.
type=text Section must contain non-placeholder prose.
type=changelog Section must have a valid CHANGELOG entry: line.
type=issue-link Section must have a Fixes:/Closes:/Refs: line with a
value.
type=manual-testing Section must have real testing steps or an explicit
N/A.
type=screenshot Section must have evidence (image/URL) or an explicit
N/A.
type=checklist Section must have all checkboxes consciously checked.
required=true|false Whether a missing/invalid section runs the validator
at all.
blocking=true|false Whether a failure of this check fails the CI
workflow.
Default: false — failures are shown as warnings in the sticky
comment but do not block the PR.
Sections without a directive are checked for structural presence only.
-->
## **Description**
This pull request updates several dependencies in the `package.json`
file to bring in the latest versions of key MetaMask Snap packages.
These updates ensure compatibility with recent improvements and bug
fixes in the respective packages.
Dependency updates:
* Upgraded `@metamask/solana-wallet-snap` from version `7.0.0` to
`7.1.0`.
* Upgraded `@metamask/tron-wallet-snap` from version `4.0.0` to `4.1.0`.
## @metamask/solana-wallet-snap 7.1.0
### Added
- Emit `transaction_type` on the transaction lifecycle events.
([MetaMask#401](MetaMask/internal-snaps#401))
### Changed
- `getAccountAssets` and `getAccountBalances` now fetch live assets and
balances from the chain through the Snap's Solana RPC clients instead of
returning persisted state.
([MetaMask#432](MetaMask/internal-snaps#432))
- Classify `transaction_type` for the unified swap/bridge flow with the
shared `resolveFlowTransactionType` utility and the new optional
`sourceAssetId`/`destAssetId` request options, carried through to
`Transaction Finalized`.
([MetaMask#439](MetaMask/internal-snaps#439))
- Render the confirmation "Estimated changes" section with the shared
`EstimatedChanges` component from `@metamask/snap-networks-utils`
([MetaMask#384](MetaMask/internal-snaps#384))
- Estimated changes from the previous scan now stay visible while a
confirmation re-scans, instead of showing a loading skeleton
- Render the confirmation security alert banner with the shared
`TransactionAlert` component from `@metamask/snap-networks-utils`
([MetaMask#409](MetaMask/internal-snaps#409))
- A "Checking for security issues" banner is now shown while the
transaction scan is in progress, instead of no banner
- Render the confirmation network fee with the shared `Asset` component
from `@metamask/snap-networks-utils`
([MetaMask#427](MetaMask/internal-snaps#427))
- Render the confirmation title with the shared `ActionHeader` component
from `@metamask/snap-networks-utils`
([MetaMask#436](MetaMask/internal-snaps#436))
- The sign message and sign-in screens now have the same spacing below
the title as the transaction request screen
## @metamask/tron-wallet-snap 4.1.0
### Added
- Emit `transaction_type` and `transaction_status` on the transaction
lifecycle events, with `transaction_type` derived from the contract type
(so a flow can be attributed by combining `origin` and
`transaction_type`) and `transaction_status` reporting the on-chain
outcome on `Transaction Finalized`.
([MetaMask#399](MetaMask/internal-snaps#399),
[MetaMask#405](MetaMask/internal-snaps#405))
### Changed
- Classify `transaction_type` for the unified swap/bridge flow with the
new optional `sourceAssetId`/`destAssetId` request options. Classify
TRC20 smart-contract calls by function selector (so a `transfer` reports
`send` and an `approve` reports `tokenApprove` instead of `unknown`)
([MetaMask#434](MetaMask/internal-snaps#434))
- Change the last behaviours missing for the `AssetsController`
migration to happen
([MetaMask#424](MetaMask/internal-snaps#424))
- When the assets migration feature flag is active, the snap no longer
fetches, persists, or publishes assets: the periodic sync cronjob and
the synchronization triggered by selected account changes no longer
touch assets or emit `AccountAssetListUpdated` and
`AccountBalancesUpdated` events, leaving asset syncing to the
`AssetsController`
- When the live assets and balances are fetched by `getAccountAssets`
and `getAccountBalances`, they are persisted to local state without
emitting `AccountAssetListUpdated` and `AccountBalancesUpdated` events
- Validate network and CAIP asset type values coming from untrusted
boundaries (RPC request params, the Keyring API, the AssetsController)
instead of force-casting them, so unsupported values fail fast with an
`Invalid params` error
([MetaMask#403](MetaMask/internal-snaps#403))
- Render the confirmation "Estimated changes" section with the shared
`EstimatedChanges` component from `@metamask/snap-networks-utils`
([MetaMask#396](MetaMask/internal-snaps#396))
- Estimated changes from the previous scan now stay visible while a
confirmation re-scans, instead of showing a loading skeleton
- Render the confirmation security alert banner with the shared
`TransactionAlert` component from `@metamask/snap-networks-utils`
([MetaMask#414](MetaMask/internal-snaps#414))
- A "Checking for security issues" banner is now shown while the
transaction scan is in progress, instead of a loading skeleton
- Render the confirmation fee asset rows with the shared `Asset`
component from `@metamask/snap-networks-utils`
([MetaMask#429](MetaMask/internal-snaps#429))
- Render the confirmation title with the shared `ActionHeader` component
from `@metamask/snap-networks-utils`
([MetaMask#438](MetaMask/internal-snaps#438))
- `listAccountAssets` and `getAccountBalances` now fetch live assets and
balances from the chain through the Snap's TronGrid clients instead of
returning persisted state.
([MetaMask#388](MetaMask/internal-snaps#388))
### Fixed
- Show "Estimated changes are not available" instead of "No estimated
changes" when the transaction scan returns an error result, such as for
a malformed transaction
([MetaMask#396](MetaMask/internal-snaps#396))
- Report the MetaMask origin as lowercase `metamask` instead of
`MetaMask` for MetaMask-initiated operations, so the origin matches the
value used by the other non-EVM snaps and granted to the keyring
methods, and so transaction scan requests are attributed to
`https://metamask.io`. The confirmation UI keeps displaying `MetaMask`.
([MetaMask#392](MetaMask/internal-snaps#392))
<!-- mms-check: type=text required=true -->
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
## **Changelog**
<!-- mms-check: type=changelog required=true blocking=true -->
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry: feat: bump Tron, Solana and Bitcoin snaps
## **Related issues**
<!-- mms-check: type=issue-link required=true -->
Fixes: N/A
## **Manual testing steps**
<!-- mms-check: type=manual-testing required=true -->
```gherkin
Feature: Non-EVM network
Scenario: user send fund
Given having Tron, Solana and Bitcoin fund
When user sendsfund
Then the transaction and balance should succeed
```
## **Screenshots/Recordings**
<!-- mms-check: type=screenshot required=true -->
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
N/A
<!-- [screenshots/recordings] -->
### **After**
N/A
<!-- [screenshots/recordings] -->
## **Pre-merge author checklist**
<!-- mms-check: type=checklist required=true -->
<!--
Every checklist item must be consciously assessed before marking this PR
as
"Ready for review". A checked box means you deliberately considered that
responsibility, not that you literally performed every action listed.
Unchecked boxes are ambiguous: they are not an implicit "N/A" and they
are not
a silent "skip". See `docs/readme/ready-for-review.md` for the full
checklist
semantics.
-->
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
#### Performance checks (if applicable)
- [x] I've tested on Android
- Ideally on a mid-range device; emulator is acceptable
- [x] I've tested with a power user scenario
- Use these [power-user
SRPs](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/edit-v2/401401446401?draftShareId=9d77e1e1-4bdc-4be1-9ebb-ccd916988d93)
to import wallets with many accounts and tokens
- [x] I've instrumented key operations with Sentry traces for production
performance metrics
- See [`trace()`](/app/util/trace.ts) for usage and
[`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274)
for an example
For performance guidelines and tooling, see the [Performance
Guide](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/400085549067/Performance+Guide+for+Engineers).
## **Pre-merge reviewer checklist**
<!--
Reviewer checklist items follow the same semantics as the author
checklist: an
unchecked box is ambiguous, a checked box means the reviewer consciously
assessed that responsibility. See `docs/readme/ready-for-review.md`.
-->
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Wallet snap upgrades touch non-EVM send/swap confirmation and balance
behavior, and the recurring-tab feature ID rename affects analytics and
API attribution for that flow.
>
> **Overview**
> Bumps **Solana** (`7.1.0`) and **Tron** (`4.1.0`) wallet snaps plus
**bridge** packages (`@metamask/bridge-controller` `82.0.3`,
`@metamask/bridge-status-controller` `76.4.0`,
`@metamask/assets-controllers` `112.1.2`), with matching `yarn.lock`
updates.
>
> Aligns the mobile app with **bridge-controller** by mapping the Bridge
**Recurring** tab to `FeatureId.RECURRING_ORDER` (replacing
`RECURRING_BUY`) in `TAB_TO_FEATURE_ID`, and updates Bridge unit tests
that assert recurring-flow `feature_id` in analytics and token search
requests.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
1207793. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->





Explanation
Current state
The Tron Snap reports
transaction_typeon its transaction lifecycle analytics events, but the value is derived only from the raw Tron contract type. EveryTriggerSmartContract— which covers unified swap, unified bridge, and TRC20 token sends — therefore reportsunknown. As a result the three non-EVM user flows (unified swap/bridge, unified send, dApp send) cannot be told apart from the Snap payload alone.Solution
Add
resolveTransactionType, which classifies a transaction in two ways:options.sourceAssetIdandoptions.destAssetId, their CAIP-2 chains are compared: a cross-chain pair reportsbridgeSend, a same-chain pair reportsswap. This mirrors the Stellar Snap.transfer(0xa9059cbb) reportssend, TRC20approve(0x095ea7b3) reportstokenApprove, and anything else staysunknown.The optional
sourceAssetId/destAssetIdfields are added to thesignAndSendTransactionoptions struct, and the resolver is used at all three emission sites (client request, keyring sign, and unified send). The classification is resolved at submit time and already carried through theTrackTransactionbackground event, soTransaction Finalizedreports the same value.Non-obvious points
unknownand now reportssend.bridge-status-controlleronly starts sending the asset ids for Tron trades after this Snap ships, so this change must land first.References
Checklist