Skip to content

feat(tron-wallet-snap): add Core messenger plumbing - #95

Draft
ulissesferreira wants to merge 1 commit into
WPN-1497-snap-owned-helpersfrom
WPN-1497-messenger-plumbing
Draft

feat(tron-wallet-snap): add Core messenger plumbing#95
ulissesferreira wants to merge 1 commit into
WPN-1497-snap-owned-helpersfrom
WPN-1497-messenger-plumbing

Conversation

@ulissesferreira

Copy link
Copy Markdown
Contributor

Summary

  • Instantiate Core messenger via getMessenger and endow RemoteFeatureFlagController:getState
  • Resolve assets migration stage from remote feature flags on each account asset read
  • No routing decisions yet — all reads still delegate to SnapAssetsAdapter

Part 1 of 2 split from #94. Part 2: WPN-1497-core-adapter-routing.

Jira

Test plan

  • yarn workspace @metamask/tron-wallet-snap build
  • yarn workspace @metamask/tron-wallet-snap run jest --no-coverage (887 tests)

Stacks on #92 (WPN-1497-snap-owned-helpers).

@ulissesferreira
ulissesferreira requested review from a team as code owners July 31, 2026 22:08
@socket-security

socket-security Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​@​metamask/​remote-feature-flag-controller@​4.2.21001007694100

View full report

@socket-security

socket-security Bot commented Jul 31, 2026

Copy link
Copy Markdown

All alerts resolved. Learn more about Socket for GitHub.

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

Ignoring alerts on:

  • npm/@metamask/remote-feature-flag-controller@4.2.2

View full report

@ulissesferreira

Copy link
Copy Markdown
Contributor Author

@SocketSecurity ignore npm/@metamask/assets-controller@11.2.0
Direct dependency for Core AssetsController messenger action types; published snap dist does not bundle controller runtime.
Network/fetch is expected for MetaMask controller packages already used across MetaMask/core.

@ulissesferreira

Copy link
Copy Markdown
Contributor Author

@SocketSecurity ignore npm/@metamask/snaps-controllers@19.0.1
Transitive via @metamask/assets-controller (messenger action types only; controller runtime not in published dist).
First-party MetaMask controller package; obfuscation alert is compiled/transpiled controller bundle.

@ulissesferreira

Copy link
Copy Markdown
Contributor Author

@SocketSecurity ignore npm/@metamask/assets-controllers@110.1.0
Transitive via @metamask/assets-controller (types-only usage; controller runtime not shipped in published dist).
First-party MetaMask controller package; network access expected for RPC/API controllers in MetaMask/core.

@ulissesferreira

Copy link
Copy Markdown
Contributor Author

@SocketSecurity ignore npm/@metamask/config-registry-controller@2.0.0
Transitive via @metamask/assets-controller (types-only import path; controller runtime not in published dist).
First-party MetaMask controller package; network access expected and already used across MetaMask/core.

@ulissesferreira

Copy link
Copy Markdown
Contributor Author

@SocketSecurity ignore npm/@metamask/core-backend@7.0.0
Transitive via @metamask/assets-controller (types-only import path; controller runtime not in published dist).
First-party MetaMask controller package; network access expected and already used across MetaMask/core.

@ulissesferreira

Copy link
Copy Markdown
Contributor Author

@SocketSecurity ignore npm/@metamask/core-backend@8.1.0
Transitive via @metamask/assets-controller (types-only import path; controller runtime not in published dist).
First-party MetaMask controller package; network access expected and already used across MetaMask/core.

@ulissesferreira

Copy link
Copy Markdown
Contributor Author

@SocketSecurity ignore npm/@metamask/eth-json-rpc-infura@10.3.0
Transitive via @metamask/assets-controller. First-party MetaMask JSON-RPC client used by network controllers.
Publisher change gudahtt → metamaskbot is MetaMask org maintainers; package already in MetaMask/core.

@ulissesferreira

Copy link
Copy Markdown
Contributor Author

@SocketSecurity ignore npm/@metamask/geolocation-controller@1.0.0
Transitive via @metamask/assets-controller (types-only import path; controller runtime not in published dist).
First-party MetaMask controller package; network access expected and already used across MetaMask/core.

@ulissesferreira

Copy link
Copy Markdown
Contributor Author

@SocketSecurity ignore npm/@metamask/multichain-network-controller@3.2.2
Transitive via @metamask/assets-controller (types-only import path; controller runtime not in published dist).
First-party MetaMask controller package; network access expected and already used across MetaMask/core.

@ulissesferreira

Copy link
Copy Markdown
Contributor Author

@SocketSecurity ignore npm/@metamask/network-controller@34.0.0
Transitive via @metamask/assets-controller (types-only import path; controller runtime not in published dist).
First-party MetaMask controller package; network access expected and already used across MetaMask/core.

@ulissesferreira

Copy link
Copy Markdown
Contributor Author

@SocketSecurity ignore npm/@metamask/network-controller@35.0.0
Transitive via @metamask/assets-controller (types-only import path; controller runtime not in published dist).
First-party MetaMask controller package; network access expected and already used across MetaMask/core.

@ulissesferreira

Copy link
Copy Markdown
Contributor Author

@SocketSecurity ignore npm/@metamask/phishing-controller@17.3.1
Transitive via @metamask/assets-controller (types-only import path; controller runtime not in published dist).
First-party MetaMask controller package; network access expected and already used across MetaMask/core.

@ulissesferreira

Copy link
Copy Markdown
Contributor Author

@SocketSecurity ignore npm/@metamask/profile-sync-controller@28.3.0
Transitive via @metamask/assets-controller (types-only import path; controller runtime not in published dist).
First-party MetaMask controller package; network access expected and already used across MetaMask/core.

@ulissesferreira

Copy link
Copy Markdown
Contributor Author

@SocketSecurity ignore npm/@metamask/remote-feature-flag-controller@4.2.2
Transitive via @metamask/assets-controller (types-only import path; controller runtime not in published dist).
First-party MetaMask controller package; network access expected and already used across MetaMask/core.

@ulissesferreira

Copy link
Copy Markdown
Contributor Author

@SocketSecurity ignore npm/@metamask/remote-feature-flag-controller@5.0.0
Transitive via @metamask/assets-controller (types-only import path; controller runtime not in published dist).
First-party MetaMask controller package; network access expected and already used across MetaMask/core.

@ulissesferreira

Copy link
Copy Markdown
Contributor Author

@SocketSecurity ignore npm/@metamask/transaction-controller@69.4.0
Transitive via @metamask/assets-controller (types-only import path; controller runtime not in published dist).
First-party MetaMask controller package; network access expected and already used across MetaMask/core.
AI anomaly is benign signature-verification utility code.

@ulissesferreira

Copy link
Copy Markdown
Contributor Author

@SocketSecurity ignore npm/@ethersproject/providers@5.8.0
Transitive via @metamask/assets-controller. Standard ethers v5 JSON-RPC provider used by MetaMask controllers.
Not executed in @metamask/tron-wallet-snap published output; already present across MetaMask/core.

@ulissesferreira

Copy link
Copy Markdown
Contributor Author

@SocketSecurity ignore npm/@tanstack/query-core@5.101.4
Transitive via @metamask/assets-controller. Standard TanStack Query core used by MetaMask controllers for data fetching.
Not executed in @metamask/tron-wallet-snap published output; already present across MetaMask/core.

@ulissesferreira

Copy link
Copy Markdown
Contributor Author

@SocketSecurity ignore npm/keccak@3.0.4
Transitive via @metamask/assets-controller → ethereum crypto stack. Standard keccak native addon used across MetaMask/core for address/hash operations.
Native binaries alert is expected for this package.

@ulissesferreira

Copy link
Copy Markdown
Contributor Author

@SocketSecurity ignore npm/ethereumjs-wallet@1.0.2
Transitive via @metamask/assets-controller. Legacy ethereumjs-wallet used by MetaMask controller dependency tree.
Publisher change is ethereumjs org maintainer rotation; deprecated notice is upstream rename to @ethereumjs/wallet.

@ulissesferreira

Copy link
Copy Markdown
Contributor Author

@SocketSecurity ignore npm/rlp@2.2.7
Transitive via @metamask/assets-controller. Standard RLP encoding library in MetaMask/core dependency tree.
Publisher change holgerd77 → ralxz is ethereumjs org maintainer rotation.

@ulissesferreira

Copy link
Copy Markdown
Contributor Author

@SocketSecurity ignore npm/ulid@2.4.0
Transitive via @metamask/assets-controller. Standard ULID generator used by MetaMask controllers.
Publisher change alizain → perrymitchell is routine npm maintainer handoff on the ulid package.

@ulissesferreira
ulissesferreira marked this pull request as draft August 2, 2026 17:39
@ulissesferreira
ulissesferreira force-pushed the WPN-1497-snap-owned-helpers branch from b8e5fa7 to d5876a7 Compare August 2, 2026 20:48
@ulissesferreira
ulissesferreira force-pushed the WPN-1497-messenger-plumbing branch from e2a7495 to 64e6d11 Compare August 2, 2026 20:48
@ulissesferreira
ulissesferreira force-pushed the WPN-1497-snap-owned-helpers branch from d5876a7 to 81eb154 Compare August 2, 2026 23:20
@ulissesferreira
ulissesferreira force-pushed the WPN-1497-messenger-plumbing branch from b73d987 to 7302e9d Compare August 2, 2026 23:20
@ulissesferreira

Copy link
Copy Markdown
Contributor Author

@SocketSecurity ignore npm/@metamask/assets-controller@13.1.0
Direct devDependency for Core messenger/types wiring in this PR (not bundled into snap output).
First-party MetaMask controller; network access via fetch is expected and already used across MetaMask/core.

@SocketSecurity ignore npm/ws@8.18.0
Transitive via @metamask/assets-controller@13.1.0. Standard WebSocket library; AI anomaly is benign EventTarget mixin code.

* Typed messenger for Core controller actions available to this Snap via
* `endowment:messenger` / `getMessenger`.
*/
export type CoreMessenger = Messenger<string, CoreMessengerActions>;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Must be AsyncMessenger
  • string as namespace is too wide

@cursor
cursor Bot force-pushed the WPN-1497-snap-owned-helpers branch from 81eb154 to e49c38b Compare August 4, 2026 10:39
@ulissesferreira

Copy link
Copy Markdown
Contributor Author

@cursoragent task list:

  • rebase with latest base branch
  • use RemoteFeatureFlagProvider from the preview build @metamask-previews/snap-networks-utils@0.0.0-preview-a0892371
  • Core messenger type must be AsyncMessenger
  • Instantiate AssetsProvider from the preview build @metamask-previews/snap-networks-utils@0.0.0-preview-a0892371 as well
  • stop resolving stage of migration, only add the messenger plumbing and instantiation in context.ts and the other changes (manifest) required for it
  • change PR title and description to match the only adding plumbing

@cursor

cursor Bot commented Aug 4, 2026

Copy link
Copy Markdown

Completed the task list on WPN-1497-messenger-plumbing, rebased onto latest WPN-1497-snap-owned-helpers (#92).

What changed

  1. Rebased — Reset to origin/WPN-1497-snap-owned-helpers (clean history; force-pushed).

  2. Preview snap-networks-utils — Tron depends on @metamask-previews/snap-networks-utils@0.0.0-preview-a0892371 with a Yarn patch that exports RemoteFeatureFlagProvider from the package index (the preview build had it in dist/ but not in exports).

  3. AsyncMessenger + narrow namespacecore-messenger.ts uses TronWalletSnap instead of string, and CoreMessenger is AsyncMessenger<CoreMessengerMessenger>.

  4. Context plumbingcontext.ts wires getMessenger, RemoteFeatureFlagProvider, and AssetsProvider (exposed on SnapExecutionContext for Part 2).

  5. No migration stage resolutionAssetsService unchanged; no Core routing.

  6. Manifest — Added endowment:messenger with RFF + three AssetsController read actions.

  7. Monorepo alignment — Added RemoteFeatureFlagProvider to @metamask/snap-networks-utils so the workspace matches the preview API.

Verification

  • snap-networks-utils: build + tests pass
  • tron-wallet-snap: build + 896 tests pass

PR

  • Title updated to: feat(tron-wallet-snap): add Core messenger plumbing
  • PR description could not be auto-updated (not agent-managed). Suggested body:
## Summary
- Wire `endowment:messenger` with RFF + AssetsController account-asset read actions
- Instantiate `RemoteFeatureFlagProvider` and `AssetsProvider` from preview `@metamask-previews/snap-networks-utils@0.0.0-preview-a0892371`
- `AsyncMessenger` typing with `TronWalletSnap` namespace
- Plumbing only — no migration-stage resolution or Core routing yet

Part 1 of 2 from #94. Part 2: `WPN-1497-core-adapter-routing`.

PR: #95

Open in Web Open in Cursor 

@cursor
cursor Bot force-pushed the WPN-1497-messenger-plumbing branch from f5bde1f to f53d7bf Compare August 4, 2026 11:09
@cursor cursor Bot changed the title feat(tron-wallet-snap): wire core messenger and resolve migration stage on reads feat(tron-wallet-snap): add Core messenger plumbing Aug 4, 2026
@ulissesferreira
ulissesferreira force-pushed the WPN-1497-messenger-plumbing branch from f53d7bf to c9d4f0c Compare August 4, 2026 13:45
@ulissesferreira
ulissesferreira force-pushed the WPN-1497-snap-owned-helpers branch from 2242a06 to 8d95d05 Compare August 4, 2026 13:45
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.
@ulissesferreira
ulissesferreira force-pushed the WPN-1497-messenger-plumbing branch from c9d4f0c to d5a852a Compare August 4, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants