@metamask-previews/ramps-controller 20.0.0-preview-12019cffe → 20.0.0-preview-2f49d5c05

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
14
14
  - Request-only by default (`updateState` unset/false): does not mutate Buy `paymentMethods.data` / `.selected`.
15
15
  - Fans out per contributing provider, dedupes by canonical payment id, and merges collision metadata (conservative delay, best score, deterministic name/icon).
16
16
  - Returns a single provider's payment-method list unchanged; collision merging applies only to multi-provider fan-out.
17
+ - Normalizes stored region codes before stateful context writes while keeping missing-region checks fail-closed.
17
18
  - Partial provider failures still return methods from successful fetches.
18
19
  - Export `TERMINAL_ORDER_STATUSES` and `isTerminalOrderStatus()` so consuming clients can share the controller's terminal order status set instead of maintaining duplicate copies. ([#9679](https://github.com/MetaMask/core/pull/9679))
19
20
 
@@ -1039,7 +1039,8 @@ class RampsController extends base_controller_1.BaseController {
1039
1039
  if (providerIds.length === 0) {
1040
1040
  if (updateState) {
1041
1041
  this.update((state) => {
1042
- const regionMatches = state.userRegion?.regionCode === normalizedRegion;
1042
+ const regionMatches = state.userRegion?.regionCode?.trim().toLowerCase() ===
1043
+ normalizedRegion;
1043
1044
  const assetMatches = normalizeAssetIdForContext(state.tokens.selected?.assetId ?? '') === normalizedAssetContext;
1044
1045
  const providerMatches = (state.providers.selected?.id.trim() ?? '') ===
1045
1046
  providerIdForState;
@@ -1101,7 +1102,8 @@ class RampsController extends base_controller_1.BaseController {
1101
1102
  null;
1102
1103
  if (updateState) {
1103
1104
  this.update((state) => {
1104
- const regionMatches = state.userRegion?.regionCode === normalizedRegion;
1105
+ const regionMatches = state.userRegion?.regionCode?.trim().toLowerCase() ===
1106
+ normalizedRegion;
1105
1107
  const assetMatches = normalizeAssetIdForContext(state.tokens.selected?.assetId ?? '') ===
1106
1108
  normalizedAssetContext;
1107
1109
  const providerMatches = (state.providers.selected?.id.trim() ?? '') === providerIdForState;