Repository navigation
feat: record Money Account previous address retirements - #11879
Merged
Merged
Conversation
…irements Expose CHOMP's monitoring retirement of each previous Money Account address, so clients can show when an SFA address migrated and when monitoring of it retires (MUSD-1602). - chomp-api-service: parse `address.retirement` from the identity by address endpoint (null when absent or of an unknown state) - money-account-lifecycle-controller: record retirements per previous address in persisted `addressRetirements` state, refreshed on every identity fetch, and include them in `getMoneyAccountIdentity` - money-account-upgrade-controller: set `retirement` in test fixtures Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
🛑 Files requiring codeowner reviewTo merge this PR, you'll need to get approvals from the following owner groups. (Note: For files with multiple owners, approval from one owner is sufficient.) @MetaMask/delegation or @MetaMask/earn (8 files)
@MetaMask/earn (9 files)
ℹ️ Files co-owned by
|
shane-t
marked this pull request as ready for review
December 2, 2026 14:36
shane-t
temporarily deployed
to
default-branch
December 2, 2026 14:36 — with
GitHub Actions
Inactive
Take both the registration status and the retirement of each address from a single ChompApiService:getDerivedIdentityByAddress call, instead of calling MoneyAccountUpgradeController:getRegistrationStatus and then looking up previous addresses again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MoMannn
previously approved these changes
Dec 3, 2026
| if (retirement) { | ||
| state.addressRetirements[addressKey] = retirement; | ||
| } else { | ||
| delete state.addressRetirements[addressKey]; |
Member
There was a problem hiding this comment.
This deletes from state only if something changes via API call.
Is there a scenario that an address can get "stuck" so never deleted because of a specific scenario? 🤔
…ses no longer previous An address that stops being a previous address of the Money Account identity is never looked up again, so its recorded retirement would stay in state. Remove it on the next lookup, and discard any lookup still in flight for an address that is no longer looked up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MoMannn
previously approved these changes
Dec 3, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Dec 3, 2026
Resolve conflicts with the binding migrations (#11782): keep both the addressRetirements and bindingMigrations state, and both changelog sets. The address lookups now also go through getDerivedIdentityByAddress, which the migration polls, so the binding migration tests count the checks made while waiting from the point the migration starts waiting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ffmcgee725
approved these changes
Dec 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
When a Money Account migrates from SFA to MFA, CHOMP keeps monitoring the old (SFA) address for a while: funds that arrive there before the retention window ends are still moved to the new address. CHOMP now reports this window per address on
GET /v1/money-account/identities/address/:address, asaddress.retirement. Clients need it so MFA users can keep seeing their SFA activity and know how long the old address is still monitored. Until now, nothing in core exposed it.This PR makes the following changes:
@metamask/chomp-api-servicegetDerivedIdentityByAddressnow parsesaddress.retirement. It has astate(SCHEDULED,RETIREDorRESTORED) plus themigratedAt,retiresAt,retiredAtandrestoredAttimestamps.null. The service therefore still works against a CHOMP that doesn't send the field yet, and won't fail when CHOMP adds a new state later.@metamask/money-account-lifecycle-controlleraddressRetirementsstate, keyed by lowercased address.ChompApiService:getDerivedIdentityByAddress, and takes both the registration status and the retirement from that response. Before, it calledMoneyAccountUpgradeController:getRegistrationStatus, which wraps the same endpoint. In the common case the money account is itself the previous address, so a separate retirement lookup would have hit the same URL twice. It was only deduplicated if the two requests happened to overlap in flight.clearStatediscards lookups still in flightcaptureExceptionand keep the last recorded valuesgetMoneyAccountIdentity()now returnsretirements: the recorded retirement of each previous address.@metamask/money-account-upgrade-controllerAddressIdentityResponsenow requiresretirement.These changes are breaking at the type level. Under the breaking changes guidelines, adding a required property to an object type is breaking, and that applies to
AddressIdentityResponse['address'],MoneyAccountIdentityandMoneyAccountLifecycleControllerState.MoneyAccountLifecycleControllerMessengeralso no longer allowsMoneyAccountUpgradeController:getRegistrationStatus, so clients must stop delegating it. At runtime nothing breaks: persisted state withoutaddressRetirementsis merged over the defaults. If reviewers would rather avoid the major bump, the new properties could be made optional instead.References
selectMoneyAccountIdentityselector. It is implemented locally and will follow once this is released.retirementto the identity response. It is merged and deployed to dev.Manual testing
I linked this build into MetaMask Mobile (iOS simulator, dev CHOMP) on an account that has migrated to MFA:
retirement,getMoneyAccountIdentity()returned the identity withretirements: {}, which confirms the field being absent is handled.addressRetirementsasSCHEDULED, withretiresAt90 days aftermigratedAt.getMoneyAccountIdentity().retirementsreturns the same value, as does the mobile selector built on it.addressRegistrationsis unchanged. Counting the service's queries during onerefresh()shows onegetDerivedIdentityByAddressper address: two in total, down from three.Checklist
🤖 Generated with Claude Code
Note
Medium Risk
Type-level breaking changes and new persisted Money Account lifecycle state, though parsing is defensive and old persisted state merges safely.
Overview
This PR wires CHOMP's
address.retirementfield through core so clients can see how long migrated (predecessor) addresses stay monitored for incoming funds.In
@metamask/chomp-api-service,getDerivedIdentityByAddressnow parses a requiredretirementonAddressIdentityResponse.address(SCHEDULED/RETIRED/RESTOREDplus timestamps). Missingretirement, omitted field, or unknownstatebecomenullinstead of failing the whole response; malformed known retirements (e.g. missingretiresAt) still throw.In
@metamask/money-account-lifecycle-controller, each identity sync looks up every previous address and stores results in persisted, UI-visibleaddressRetirements, with the same in-flight / stale-response / error-handling pattern as registration lookups.getMoneyAccountIdentity()now returnsretirementskeyed by lowercased previous address.clearStateclears retirement lookups too.Breaking (types only): required
retirementon address identity responses,addressRetirementson controller state, andretirementsonMoneyAccountIdentity; test fixtures in upgrade packages were updated accordingly.Reviewed by Cursor Bugbot for commit 366d4b2. Configure here.