@metamask-previews/ramps-controller 18.0.1-preview-beea66146 → 18.0.1-preview-0efc7ef01

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
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ### Changed
11
+
12
+ - **BREAKING:** Require a non-empty `chainId` on `addPrecreatedOrder`. Callers must seed the selected token's chain so precreated stubs (and pending flips before API enrichment) always carry a network. Empty or whitespace `chainId` is a no-op, matching empty `orderId` handling.
13
+
10
14
  ### Added
11
15
 
12
16
  - Add `setSelectedProviderForAsset(assetId, options?)` method and `RampsController:setSelectedProviderForAsset` messenger action ([#9759](https://github.com/MetaMask/core/pull/9759))
@@ -1294,7 +1294,7 @@ class RampsController extends base_controller_1.BaseController {
1294
1294
  * @param params.orderId - Full order ID (e.g. "/providers/paypal/orders/abc123") or order code.
1295
1295
  * @param params.providerCode - Canonical provider code (e.g. "paypal", "transak").
1296
1296
  * @param params.walletAddress - Wallet address for the order.
1297
- * @param params.chainId - Optional chain ID for the order.
1297
+ * @param params.chainId - Chain ID for the order (decimal, hex, or CAIP-2). Must be non-empty.
1298
1298
  */
1299
1299
  addPrecreatedOrder(params) {
1300
1300
  const { orderId, providerCode, walletAddress, chainId } = params;
@@ -1302,6 +1302,9 @@ class RampsController extends base_controller_1.BaseController {
1302
1302
  if (!orderCode?.trim()) {
1303
1303
  return;
1304
1304
  }
1305
+ if (!chainId.trim()) {
1306
+ return;
1307
+ }
1305
1308
  const stubOrder = {
1306
1309
  providerOrderId: orderCode,
1307
1310
  provider: {
@@ -1324,7 +1327,7 @@ class RampsController extends base_controller_1.BaseController {
1324
1327
  providerOrderLink: '',
1325
1328
  totalFeesFiat: 0,
1326
1329
  txHash: '',
1327
- network: chainId ? { chainId, name: '' } : { chainId: '', name: '' },
1330
+ network: { chainId, name: '' },
1328
1331
  canBeUpdated: true,
1329
1332
  idHasExpired: false,
1330
1333
  excludeFromPurchases: false,