Skip to content

feat(engine): wire NeoBankService for Money Account onboarding - #35896

Merged
roz0n merged 32 commits into
mainfrom
feat/TRAM-3922-kyc-engine-wiring
Sep 17, 2026
Merged

roz0n merged 32 commits into
mainfrom
feat/TRAM-3922-kyc-engine-wiring

Conversation

@roz0n

@roz0n roz0n commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Description

Wires NeoBankService from @metamask/ramps-controller into the Mobile Engine, and moves the RampsController messenger onto the package-owned list of required controller actions.

Why: Money Account onboarding needs to reach the neo-bank API (autoramp lookup, MoonPay customer resolution, self-hosted wallet registration), and the RampsController onboarding stage lookup needs access to the controller actions the package declares it depends on. Neither was available on Mobile.

What changed:

  • NeoBankService is registered as a stateless service. A new neo-bank-service-init.ts constructs it the same way TransakService is — sharing getRampsEnvironment() / getRampsContext() and the global fetch. The service is added to the Engine init map and context, STATELESS_NON_CONTROLLER_NAMES, MESSENGER_FACTORIES, and the MessengerClients / MessengerClientsToInitialize types.
  • New getNeoBankServiceMessenger. Delegates AuthenticationController:getBearerToken so the service can authenticate its requests.
  • NeoBankServiceActions / NeoBankServiceEvents are now unioned into GlobalActions / GlobalEvents next to the other ramps entries, alongside the NeoBankService class import they belong to.
  • getRampsControllerMessenger spreads RAMPS_CONTROLLER_REQUIRED_CONTROLLER_ACTIONS in addition to the existing RAMPS_CONTROLLER_REQUIRED_SERVICE_ACTIONS. The hand-maintained RemoteFeatureFlagController:getState delegate is dropped because that action is already a member of the package-owned list — spreading it means the KYC/customer actions the onboarding stage lookup will need (from MetaMask/core#10116) arrive automatically on the next @metamask/ramps-controller bump instead of silently going missing.
  • Tests cover neoBankServiceInit, getNeoBankServiceMessenger, and pin that RemoteFeatureFlagController:getState remains delegated via the package-owned controller-actions list.

Scope note: this branch originally also carried the KYC controller wiring and the React Native SumSub launcher. Those have since landed on main via #35540 and #36081, so they no longer appear in this diff. What remains is the NeoBankService wiring and the ramps messenger permission change.

Follow-up: RAMPS_CONTROLLER_REQUIRED_CONTROLLER_ACTIONS in the currently resolved @metamask/ramps-controller@20.3.0 is ['AuthenticationController:getSessionProfile', 'KeyringController:signPersonalMessage', 'RemoteFeatureFlagController:getState']. The KYC-facing additions land with MetaMask/core#10116; no dependency bump is required for this PR to compile and behave correctly today.

Changelog

CHANGELOG entry: Added NeoBankService Engine wiring for Money Account onboarding

Related issues

Partially completes: https://consensyssoftware.atlassian.net/browse/TRAM-3900

Manual testing steps

Feature: NeoBankService wired into the Mobile Engine

  Scenario: Engine exposes the neo-bank service at startup
    Given the app has a persisted wallet
    When the app launches and Engine initializes
    Then Engine.context.NeoBankService is defined
    And no messenger delegation errors are logged during Engine init

  Scenario: Ramps quotes are unaffected by the messenger permission change
    Given a signed-in user on a build with the moneyHeadlessAllProviders feature flag enabled
    When the user opens Buy and requests quotes
    Then RampsController still reads the feature flag and widens quotes as before
    And no "Action missing from allow list: RemoteFeatureFlagController:getState" error is thrown

Screenshots/Recordings

Before

N/A — Engine wiring only, no UI surface in this PR.

After

N/A — Engine wiring only, no UI surface in this PR.

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
  • I've tested with a power user scenario
  • I've instrumented key operations with Sentry traces for production performance metrics

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.

Note

Medium Risk
Touches Engine startup and ramps messenger allow-lists used for buy/onboarding flows, including auth token delegation for external neo-bank APIs; regressions would surface as init or quote/onboarding failures rather than data loss.

Overview
Registers NeoBankService on the Mobile Engine so Money Account onboarding can call the neo-bank API. A new init module constructs the service like TransakService (shared ramps environment/context, global fetch), exposes it on Engine.context, and adds messenger wiring that delegates AuthenticationController:getBearerToken for authenticated API calls.

Updates RampsController messenger permissions by spreading RAMPS_CONTROLLER_REQUIRED_CONTROLLER_ACTIONS from @metamask/ramps-controller alongside the existing required service actions, replacing the hand-maintained RemoteFeatureFlagController:getState entry so package upgrades pick up new dependencies (including future onboarding/KYC actions) without silent gaps.

Tests cover service init, neo-bank messenger delegation, and that ramps-controller delegates all package-declared required actions without duplicates.

Reviewed by Cursor Bugbot for commit 53c66f8. Bugbot is set up for automated code reviews on this repo. Configure here.

roz0n and others added 6 commits September 1, 2026 11:46
Replace the client-side KYC API fetch in useKycDisclaimers with
KycController.loadDisclaimers so Iron/MoonPay vendor terms use a single
Engine source of truth. Wires preview @metamask/kyc-controller with
minimal KycService/KycController init for disclaimer loading only.

TRAM-3978

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Sébastien Van Eyck <sebastien.vaneyck@consensys.net>
@roz0n roz0n self-assigned this Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@github-actions github-actions Bot added size-L pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. labels Sep 8, 2026
@metamask-ci metamask-ci Bot added the team-money-movement issues related to Money Movement features label Sep 8, 2026
@socket-security

socket-security Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

No dependency changes detected. Learn more about Socket for GitHub.

👍 No dependency changes detected in pull request

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.22034% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.00%. Comparing base (1cce8cd) to head (c787d07).
⚠️ Report is 60 commits behind head on main.

Files with missing lines Patch % Lines
...iews/VirtualBankAccount/hooks/useKycDisclaimers.ts 92.85% 1 Missing and 1 partial ⚠️
...ngine/controllers/kyc/reactNativeSumSubLauncher.ts 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #35896      +/-   ##
==========================================
+ Coverage   85.96%   86.00%   +0.04%     
==========================================
  Files        6859     6886      +27     
  Lines      192237   192854     +617     
  Branches    47836    47991     +155     
==========================================
+ Hits       165265   165873     +608     
+ Misses      16261    16249      -12     
- Partials    10711    10732      +21     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot added size-M and removed size-XL labels Sep 15, 2026
@roz0n
roz0n marked this pull request as ready for review September 16, 2026 12:49
@roz0n
roz0n requested review from a team as code owners September 16, 2026 12:49
@github-actions github-actions Bot added the risk:medium AI analysis: medium risk label Sep 16, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 25cc449. Configure here.

...RAMPS_CONTROLLER_REQUIRED_SERVICE_ACTIONS,
// The onboarding stage lookup refreshes KYC and resolves the customer
// before reading wallet and autoramp status.
...RAMPS_CONTROLLER_REQUIRED_CONTROLLER_ACTIONS,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ramps messenger drops feature-flag action

High Severity

getRampsControllerMessenger no longer delegates RemoteFeatureFlagController:getState. RampsController still reads moneyHeadlessAllProviders through that action on each quote. Without the delegate, the check fails closed and quote widening stays native-only, so aggregator and WebView deposit providers stay hidden even when the flag is on.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 25cc449. Configure here.

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.

False positive — no production fix needed.

RemoteFeatureFlagController:getState is still delegated. This PR only removed the hand-maintained duplicate; the same action is already a member of RAMPS_CONTROLLER_REQUIRED_CONTROLLER_ACTIONS, which getRampsControllerMessenger now spreads.

Verified against the resolved @metamask/ramps-controller@20.3.0:

RAMPS_CONTROLLER_REQUIRED_CONTROLLER_ACTIONS = [
  'AuthenticationController:getSessionProfile',
  'KeyringController:signPersonalMessage',
  'RemoteFeatureFlagController:getState',
]

Pinned in ramps-controller-messenger.test.ts so a future package bump that drops the action from that list fails CI instead of silently breaking quote widening.

@roz0n roz0n changed the title feat(engine): wire KYC and NeoBank services feat(engine): wire NeoBankService for Money Account onboarding Sep 16, 2026
@roz0n roz0n removed the blocked label Sep 16, 2026
roz0n and others added 2 commits September 16, 2026 15:20
Pin RemoteFeatureFlagController:getState via the package-owned required
actions list, and add init/messenger tests matching the Transak pattern.

Co-authored-by: Cursor <cursoragent@cursor.com>
@roz0n roz0n removed the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label Sep 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeAccounts, SmokeConfirmations, SmokeNetworkAbstractions, SmokeNetworkExpansion, SmokeSwap, SmokeStake, SmokeWalletPlatform, SmokeMoney, SmokePerps, SmokeMultiChainAPI, SmokePredictions, SmokeSeedlessOnboarding, SmokeBrowser, SmokeSnaps, SmokeMMConnect
  • Selected Performance tags: @PerformanceMoney
  • Risk Level: high
  • AI Confidence: 100%
click to see 🤖 AI reasoning details

E2E Test Selection:
Hard rule (global-infrastructure-change): Global infrastructure changed: app/core/Engine/Engine.ts. Running all tests.

Performance Test Selection:
The NeoBankService is integrated into the Engine initialization pipeline and is specifically for Money Account (neo-bank) onboarding. The @PerformanceMoney tag covers Money Home balance and activity content loading. Since NeoBankService is now initialized as part of Engine startup, it could potentially impact Money Account loading performance. The ramps-controller-messenger changes also affect the RampsController's delegated actions which powers the Money Account flows. However, since this is an additive service initialization (stateless, no state management), the performance impact is expected to be minimal.

View GitHub Actions results

@roz0n
roz0n deployed to build-e2e September 16, 2026 13:43 — with GitHub Actions Active
@roz0n
roz0n removed this pull request from stack #35900 September 16, 2026 13:45
@sonarqubecloud

Copy link
Copy Markdown

@metamask-ci

metamask-ci Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

PR template — items to address before "Ready for review"

Warnings — informational, address before merging:

  • Related issues section is empty. Add Fixes: #123 / Closes: <URL> / Refs: <Jira key>, or write a short rationale after the colon.

See docs/readme/ready-for-review.md for the full Definition of Ready for Review.

@github-actions

Copy link
Copy Markdown
Contributor

⚡ Performance Test Results

ℹ️ Performance test results are currently non-blocking and will not block this PR.

✅ All tests passed · 2 tests · 1 device

📱 Devices tested (1)

Android: Google Pixel 8 Pro (v14.0)

✅ Passed Tests (2)
Test Platform Device Duration Team Recording
Money Home after importing SRP with funded balance Android Google Pixel 8 Pro (v14.0) 3.83s @mm-earn-team 📹 Watch
Money Home after fresh wallet creation with empty balance Android Google Pixel 8 Pro (v14.0) 19.96s @mm-earn-team 📹 Watch

Branch: feat/TRAM-3922-kyc-engine-wiring · Build: E2E · Commit: b9527d5 · View full run

@roz0n
roz0n added this pull request to the merge queue Sep 17, 2026
Merged via the queue into main with commit 176f448 Sep 17, 2026
121 checks passed
@roz0n
roz0n deleted the feat/TRAM-3922-kyc-engine-wiring branch September 17, 2026 07:48
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 17, 2026
@metamask-ci metamask-ci Bot added the release-8.13.0 Issue or pull request that will be included in release 8.13.0 label Sep 17, 2026

This branch was successfully deployed

1 active deployment
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-8.13.0 Issue or pull request that will be included in release 8.13.0 risk:medium AI analysis: medium risk size-M team-money-movement issues related to Money Movement features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants