Skip to content

feat: remove provider ID normalization and update related functionality#9448

Merged
meltingice1337 merged 6 commits into
mainfrom
feat/TRAM-3560-non-prefix-providers
Jul 10, 2026
Merged

feat: remove provider ID normalization and update related functionality#9448
meltingice1337 merged 6 commits into
mainfrom
feat/TRAM-3560-non-prefix-providers

Conversation

@meltingice1337

@meltingice1337 meltingice1337 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Explanation

@metamask/ramps-controller normalized provider IDs by stripping a /providers/ prefix through a normalizeProviderCode helper. This normalization was applied in two places: across the getQuotes scope-aware selection logic (matching the providers list, each quote's provider, custom-action provider IDs, and the sort-order IDs) and when building a precreated stub order, where the provider code was re-wrapped as /providers/<code>. The Ramps backend now returns canonical, non-prefixed provider IDs, so this normalization is unnecessary and inconsistent with the new contract.

This PR removes provider-ID normalization entirely so IDs are compared and stored as-is (canonical). Concretely: the normalizeProviderCode function and its public export are removed; the six normalizeProviderCode(...) call sites in the getQuotes selection logic are dropped so the map keys and lookups use the raw provider IDs; and a precreated stub order's provider.id is now the canonical provider code passed to the create-order call rather than a /providers/-prefixed value. The dedicated normalizeProviderCode unit test is removed and the stub-order test now expects the canonical paypal ID.

One detail worth calling out for reviewers: the six removed call sites were added recently in #9353 (scope-aware in-app provider widening). Because normalization is removed uniformly from both sides of every map key and lookup, matching behavior is preserved for consistently-formatted IDs, and the existing getQuotes tests continue to pass unchanged (308 tests green).

This is a breaking change: normalizeProviderCode is no longer exported, and the precreated stub order's provider.id changes shape from /providers/<code> to <code>. Consumers must supply non-prefixed (canonical) provider IDs. The mobile consumer PR removes all normalizeProviderCode usages and the app-side normalization to adopt this.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Breaking API and state shape changes for buy/quote flows; wrong IDs from consumers that still pass /providers/-prefixed values could break quote selection or order polling until clients migrate.

Overview
Breaking change: @metamask/ramps-controller drops /providers/ prefix normalization so provider IDs are compared and stored as canonical codes (e.g. paypal, transak).

The normalizeProviderCode helper and its public export are removed. In getQuotes scope-aware selection, maps and lookups now use raw provider.id, quote provider, custom-action providerId, and sort-order IDs with no stripping. addPrecreatedOrder sets stub provider.id to the passed providerCode instead of /providers/<code>.

JSDoc and the changelog document the contract. Tests drop the normalizer suite, expect canonical paypal on stubs, and add coverage for plain-ID matching in scoped quote selection.

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

@meltingice1337 meltingice1337 requested review from a team as code owners July 9, 2026 13:47
…ion and removal of normalizeProviderCode export
The messenger-action-types:check CI step failed because RampsController-method-action-types.ts embeds the getBuyWidgetData method JSDoc, which changed when the providerCode param doc was updated to describe canonical (non-prefixed) provider codes. Regenerated via messenger-action-types --generate.
@meltingice1337 meltingice1337 force-pushed the feat/TRAM-3560-non-prefix-providers branch from 1bf463e to d67a44d Compare July 9, 2026 15:06
wenfix
wenfix previously approved these changes Jul 10, 2026
wenfix
wenfix previously approved these changes Jul 10, 2026
…efix-providers

# Conflicts:
#	packages/ramps-controller/CHANGELOG.md
@meltingice1337 meltingice1337 added this pull request to the merge queue Jul 10, 2026
Merged via the queue into main with commit aae70c3 Jul 10, 2026
421 checks passed
@meltingice1337 meltingice1337 deleted the feat/TRAM-3560-non-prefix-providers branch July 10, 2026 12:47
@amitabh94 amitabh94 mentioned this pull request Jul 11, 2026
3 tasks
@meltingice1337 meltingice1337 mentioned this pull request Jul 13, 2026
4 tasks
pull Bot pushed a commit to dmrazzy/core that referenced this pull request Jul 13, 2026
## Explanation

This is the release PR for **Release 1116.0.0** of the core monorepo. It
bumps the root monorepo version from 1115.0.0 to 1116.0.0 and publishes
new versions of two packages:

- **`@metamask/ramps-controller` 15.1.0 → 16.0.0 (major)**: Releases the
breaking change from MetaMask#9448, which removes normalization of provider IDs
(the `/providers/` prefix is no longer stripped).
`RampsController.getQuotes` now matches provider IDs from the providers
list, quotes, custom actions, and sort order as-is, and a precreated
stub order's `provider.id` is the canonical provider code passed to the
create-order call. Consumers must supply non-prefixed (canonical)
provider IDs. Also includes the MIT license text update from MetaMask#9472.
- **`@metamask/transaction-pay-controller` 24.0.2 → 24.0.3 (patch)**:
Bumps its `@metamask/ramps-controller` dependency to `^16.0.0` and
includes the MIT license text update from MetaMask#9472.

No source code changes are included in this PR itself; it only contains
version bumps, changelog updates, and the corresponding `yarn.lock`
update.

## References

- Includes MetaMask#9448 (breaking `ramps-controller` provider ID change)
- Includes MetaMask#9472 (MIT license text update)
- Previous release: MetaMask#9470 (Release 1115.0.0)

## Checklist

- [ ] I've updated the test suite for new or updated code as appropriate
- [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [x] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> The release surfaces a major breaking change in ramps provider ID
handling; downstream apps must adopt canonical IDs and stop using
`normalizeProviderCode`, though this PR itself only bumps versions.
> 
> **Overview**
> Release **1116.0.0** bumps the root monorepo and publishes two
packages with **no runtime code changes in this PR**—only versions,
changelogs, and `yarn.lock`.
> 
> **`@metamask/ramps-controller` 16.0.0** ships the breaking ramps
behavior from MetaMask#9448: provider IDs are no longer normalized (no
`/providers/` prefix stripping), `normalizeProviderCode` is removed, and
callers must use canonical provider IDs for quotes and create-order.
Changelog also records the MIT **LICENSE** text update (MetaMask#9472).
> 
> **`@metamask/transaction-pay-controller` 24.0.3** is a patch that
raises its **`@metamask/ramps-controller`** dependency to `^16.0.0`
(MetaMask#9481) and includes the same LICENSE changelog note (MetaMask#9472).
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
8fb0397. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Darius Costolas <10818970+meltingice1337@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants