@metamask-previews/bridge-controller 34.0.0-preview-92a09963 → 34.0.0-preview-9af90ce1

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,10 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ### Added
11
+
12
+ - Add an optional `isSingleSwapBridgeButtonEnabled` feature flag that indicates whether Swap and Bridge entrypoints should be combined ([#6078](https://github.com/MetaMask/core/pull/6078))
13
+
10
14
  ### Changed
11
15
 
12
16
  - **BREAKING:** Bump peer dependency `@metamask/assets-controllers` from `^69.0.0` to `^70.0.0` ([#6061](https://github.com/MetaMask/core/pull/6061))
13
17
  - **BREAKING:** Bump peer dependency `@metamask/snaps-controllers` from `^12.0.0` to `^14.0.0` ([#6035](https://github.com/MetaMask/core/pull/6035))
18
+ - **BREAKING** Remove `isSnapConfirmationEnabled` feature flag from `ChainConfigurationSchema` validation ([#6077](https://github.com/MetaMask/core/pull/6077))
14
19
  - Bump `@metamask/controller-utils` from `^11.10.0` to `^11.11.0` ([#6069](https://github.com/MetaMask/core/pull/6069))
15
20
  - Bump `@metamask/utils` from `^11.2.0` to `^11.4.2` ([#6054](https://github.com/MetaMask/core/pull/6054))
16
21
 
@@ -55,7 +55,7 @@ export declare const selectBridgeFeatureFlags: ((state: RemoteFeatureFlagControl
55
55
  refreshRate?: number | undefined;
56
56
  topAssets?: string[] | undefined;
57
57
  isUnifiedUIEnabled?: boolean | undefined;
58
- isSnapConfirmationEnabled?: boolean | undefined;
58
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
59
59
  }>;
60
60
  refreshRate: number;
61
61
  minimumVersion: string;
@@ -73,7 +73,7 @@ export declare const selectBridgeFeatureFlags: ((state: RemoteFeatureFlagControl
73
73
  refreshRate?: number | undefined;
74
74
  topAssets?: string[] | undefined;
75
75
  isUnifiedUIEnabled?: boolean | undefined;
76
- isSnapConfirmationEnabled?: boolean | undefined;
76
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
77
77
  }>;
78
78
  refreshRate: number;
79
79
  minimumVersion: string;
@@ -87,7 +87,7 @@ export declare const selectBridgeFeatureFlags: ((state: RemoteFeatureFlagControl
87
87
  refreshRate?: number | undefined;
88
88
  topAssets?: string[] | undefined;
89
89
  isUnifiedUIEnabled?: boolean | undefined;
90
- isSnapConfirmationEnabled?: boolean | undefined;
90
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
91
91
  }>;
92
92
  refreshRate: number;
93
93
  minimumVersion: string;
@@ -105,7 +105,7 @@ export declare const selectBridgeFeatureFlags: ((state: RemoteFeatureFlagControl
105
105
  refreshRate?: number | undefined;
106
106
  topAssets?: string[] | undefined;
107
107
  isUnifiedUIEnabled?: boolean | undefined;
108
- isSnapConfirmationEnabled?: boolean | undefined;
108
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
109
109
  }>;
110
110
  refreshRate: number;
111
111
  minimumVersion: string;
@@ -169,7 +169,7 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
169
169
  refreshRate?: number | undefined;
170
170
  topAssets?: string[] | undefined;
171
171
  isUnifiedUIEnabled?: boolean | undefined;
172
- isSnapConfirmationEnabled?: boolean | undefined;
172
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
173
173
  }>;
174
174
  refreshRate: number;
175
175
  minimumVersion: string;
@@ -183,7 +183,7 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
183
183
  refreshRate?: number | undefined;
184
184
  topAssets?: string[] | undefined;
185
185
  isUnifiedUIEnabled?: boolean | undefined;
186
- isSnapConfirmationEnabled?: boolean | undefined;
186
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
187
187
  }>;
188
188
  refreshRate: number;
189
189
  minimumVersion: string;
@@ -202,7 +202,7 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
202
202
  refreshRate?: number | undefined;
203
203
  topAssets?: string[] | undefined;
204
204
  isUnifiedUIEnabled?: boolean | undefined;
205
- isSnapConfirmationEnabled?: boolean | undefined;
205
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
206
206
  }>;
207
207
  refreshRate: number;
208
208
  minimumVersion: string;
@@ -220,7 +220,7 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
220
220
  refreshRate?: number | undefined;
221
221
  topAssets?: string[] | undefined;
222
222
  isUnifiedUIEnabled?: boolean | undefined;
223
- isSnapConfirmationEnabled?: boolean | undefined;
223
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
224
224
  }>;
225
225
  refreshRate: number;
226
226
  minimumVersion: string;
@@ -234,7 +234,7 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
234
234
  refreshRate?: number | undefined;
235
235
  topAssets?: string[] | undefined;
236
236
  isUnifiedUIEnabled?: boolean | undefined;
237
- isSnapConfirmationEnabled?: boolean | undefined;
237
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
238
238
  }>;
239
239
  refreshRate: number;
240
240
  minimumVersion: string;
@@ -252,7 +252,7 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
252
252
  refreshRate?: number | undefined;
253
253
  topAssets?: string[] | undefined;
254
254
  isUnifiedUIEnabled?: boolean | undefined;
255
- isSnapConfirmationEnabled?: boolean | undefined;
255
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
256
256
  }>;
257
257
  refreshRate: number;
258
258
  minimumVersion: string;
@@ -291,7 +291,7 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
291
291
  refreshRate?: number | undefined;
292
292
  topAssets?: string[] | undefined;
293
293
  isUnifiedUIEnabled?: boolean | undefined;
294
- isSnapConfirmationEnabled?: boolean | undefined;
294
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
295
295
  }>;
296
296
  refreshRate: number;
297
297
  minimumVersion: string;
@@ -305,7 +305,7 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
305
305
  refreshRate?: number | undefined;
306
306
  topAssets?: string[] | undefined;
307
307
  isUnifiedUIEnabled?: boolean | undefined;
308
- isSnapConfirmationEnabled?: boolean | undefined;
308
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
309
309
  }>;
310
310
  refreshRate: number;
311
311
  minimumVersion: string;
@@ -324,7 +324,7 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
324
324
  refreshRate?: number | undefined;
325
325
  topAssets?: string[] | undefined;
326
326
  isUnifiedUIEnabled?: boolean | undefined;
327
- isSnapConfirmationEnabled?: boolean | undefined;
327
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
328
328
  }>;
329
329
  refreshRate: number;
330
330
  minimumVersion: string;
@@ -342,7 +342,7 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
342
342
  refreshRate?: number | undefined;
343
343
  topAssets?: string[] | undefined;
344
344
  isUnifiedUIEnabled?: boolean | undefined;
345
- isSnapConfirmationEnabled?: boolean | undefined;
345
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
346
346
  }>;
347
347
  refreshRate: number;
348
348
  minimumVersion: string;
@@ -356,7 +356,7 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
356
356
  refreshRate?: number | undefined;
357
357
  topAssets?: string[] | undefined;
358
358
  isUnifiedUIEnabled?: boolean | undefined;
359
- isSnapConfirmationEnabled?: boolean | undefined;
359
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
360
360
  }>;
361
361
  refreshRate: number;
362
362
  minimumVersion: string;
@@ -374,7 +374,7 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
374
374
  refreshRate?: number | undefined;
375
375
  topAssets?: string[] | undefined;
376
376
  isUnifiedUIEnabled?: boolean | undefined;
377
- isSnapConfirmationEnabled?: boolean | undefined;
377
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
378
378
  }>;
379
379
  refreshRate: number;
380
380
  minimumVersion: string;
@@ -14501,7 +14501,7 @@ export declare const selectBridgeQuotes: ((state: BridgeControllerState & {
14501
14501
  refreshRate?: number | undefined;
14502
14502
  topAssets?: string[] | undefined;
14503
14503
  isUnifiedUIEnabled?: boolean | undefined;
14504
- isSnapConfirmationEnabled?: boolean | undefined;
14504
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
14505
14505
  }>;
14506
14506
  refreshRate: number;
14507
14507
  minimumVersion: string;
@@ -14515,7 +14515,7 @@ export declare const selectBridgeQuotes: ((state: BridgeControllerState & {
14515
14515
  refreshRate?: number | undefined;
14516
14516
  topAssets?: string[] | undefined;
14517
14517
  isUnifiedUIEnabled?: boolean | undefined;
14518
- isSnapConfirmationEnabled?: boolean | undefined;
14518
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
14519
14519
  }>;
14520
14520
  refreshRate: number;
14521
14521
  minimumVersion: string;
@@ -14534,7 +14534,7 @@ export declare const selectBridgeQuotes: ((state: BridgeControllerState & {
14534
14534
  refreshRate?: number | undefined;
14535
14535
  topAssets?: string[] | undefined;
14536
14536
  isUnifiedUIEnabled?: boolean | undefined;
14537
- isSnapConfirmationEnabled?: boolean | undefined;
14537
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
14538
14538
  }>;
14539
14539
  refreshRate: number;
14540
14540
  minimumVersion: string;
@@ -14552,7 +14552,7 @@ export declare const selectBridgeQuotes: ((state: BridgeControllerState & {
14552
14552
  refreshRate?: number | undefined;
14553
14553
  topAssets?: string[] | undefined;
14554
14554
  isUnifiedUIEnabled?: boolean | undefined;
14555
- isSnapConfirmationEnabled?: boolean | undefined;
14555
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
14556
14556
  }>;
14557
14557
  refreshRate: number;
14558
14558
  minimumVersion: string;
@@ -14566,7 +14566,7 @@ export declare const selectBridgeQuotes: ((state: BridgeControllerState & {
14566
14566
  refreshRate?: number | undefined;
14567
14567
  topAssets?: string[] | undefined;
14568
14568
  isUnifiedUIEnabled?: boolean | undefined;
14569
- isSnapConfirmationEnabled?: boolean | undefined;
14569
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
14570
14570
  }>;
14571
14571
  refreshRate: number;
14572
14572
  minimumVersion: string;
@@ -14584,7 +14584,7 @@ export declare const selectBridgeQuotes: ((state: BridgeControllerState & {
14584
14584
  refreshRate?: number | undefined;
14585
14585
  topAssets?: string[] | undefined;
14586
14586
  isUnifiedUIEnabled?: boolean | undefined;
14587
- isSnapConfirmationEnabled?: boolean | undefined;
14587
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
14588
14588
  }>;
14589
14589
  refreshRate: number;
14590
14590
  minimumVersion: string;
@@ -55,7 +55,7 @@ export declare const selectBridgeFeatureFlags: ((state: RemoteFeatureFlagControl
55
55
  refreshRate?: number | undefined;
56
56
  topAssets?: string[] | undefined;
57
57
  isUnifiedUIEnabled?: boolean | undefined;
58
- isSnapConfirmationEnabled?: boolean | undefined;
58
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
59
59
  }>;
60
60
  refreshRate: number;
61
61
  minimumVersion: string;
@@ -73,7 +73,7 @@ export declare const selectBridgeFeatureFlags: ((state: RemoteFeatureFlagControl
73
73
  refreshRate?: number | undefined;
74
74
  topAssets?: string[] | undefined;
75
75
  isUnifiedUIEnabled?: boolean | undefined;
76
- isSnapConfirmationEnabled?: boolean | undefined;
76
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
77
77
  }>;
78
78
  refreshRate: number;
79
79
  minimumVersion: string;
@@ -87,7 +87,7 @@ export declare const selectBridgeFeatureFlags: ((state: RemoteFeatureFlagControl
87
87
  refreshRate?: number | undefined;
88
88
  topAssets?: string[] | undefined;
89
89
  isUnifiedUIEnabled?: boolean | undefined;
90
- isSnapConfirmationEnabled?: boolean | undefined;
90
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
91
91
  }>;
92
92
  refreshRate: number;
93
93
  minimumVersion: string;
@@ -105,7 +105,7 @@ export declare const selectBridgeFeatureFlags: ((state: RemoteFeatureFlagControl
105
105
  refreshRate?: number | undefined;
106
106
  topAssets?: string[] | undefined;
107
107
  isUnifiedUIEnabled?: boolean | undefined;
108
- isSnapConfirmationEnabled?: boolean | undefined;
108
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
109
109
  }>;
110
110
  refreshRate: number;
111
111
  minimumVersion: string;
@@ -169,7 +169,7 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
169
169
  refreshRate?: number | undefined;
170
170
  topAssets?: string[] | undefined;
171
171
  isUnifiedUIEnabled?: boolean | undefined;
172
- isSnapConfirmationEnabled?: boolean | undefined;
172
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
173
173
  }>;
174
174
  refreshRate: number;
175
175
  minimumVersion: string;
@@ -183,7 +183,7 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
183
183
  refreshRate?: number | undefined;
184
184
  topAssets?: string[] | undefined;
185
185
  isUnifiedUIEnabled?: boolean | undefined;
186
- isSnapConfirmationEnabled?: boolean | undefined;
186
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
187
187
  }>;
188
188
  refreshRate: number;
189
189
  minimumVersion: string;
@@ -202,7 +202,7 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
202
202
  refreshRate?: number | undefined;
203
203
  topAssets?: string[] | undefined;
204
204
  isUnifiedUIEnabled?: boolean | undefined;
205
- isSnapConfirmationEnabled?: boolean | undefined;
205
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
206
206
  }>;
207
207
  refreshRate: number;
208
208
  minimumVersion: string;
@@ -220,7 +220,7 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
220
220
  refreshRate?: number | undefined;
221
221
  topAssets?: string[] | undefined;
222
222
  isUnifiedUIEnabled?: boolean | undefined;
223
- isSnapConfirmationEnabled?: boolean | undefined;
223
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
224
224
  }>;
225
225
  refreshRate: number;
226
226
  minimumVersion: string;
@@ -234,7 +234,7 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
234
234
  refreshRate?: number | undefined;
235
235
  topAssets?: string[] | undefined;
236
236
  isUnifiedUIEnabled?: boolean | undefined;
237
- isSnapConfirmationEnabled?: boolean | undefined;
237
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
238
238
  }>;
239
239
  refreshRate: number;
240
240
  minimumVersion: string;
@@ -252,7 +252,7 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
252
252
  refreshRate?: number | undefined;
253
253
  topAssets?: string[] | undefined;
254
254
  isUnifiedUIEnabled?: boolean | undefined;
255
- isSnapConfirmationEnabled?: boolean | undefined;
255
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
256
256
  }>;
257
257
  refreshRate: number;
258
258
  minimumVersion: string;
@@ -291,7 +291,7 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
291
291
  refreshRate?: number | undefined;
292
292
  topAssets?: string[] | undefined;
293
293
  isUnifiedUIEnabled?: boolean | undefined;
294
- isSnapConfirmationEnabled?: boolean | undefined;
294
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
295
295
  }>;
296
296
  refreshRate: number;
297
297
  minimumVersion: string;
@@ -305,7 +305,7 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
305
305
  refreshRate?: number | undefined;
306
306
  topAssets?: string[] | undefined;
307
307
  isUnifiedUIEnabled?: boolean | undefined;
308
- isSnapConfirmationEnabled?: boolean | undefined;
308
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
309
309
  }>;
310
310
  refreshRate: number;
311
311
  minimumVersion: string;
@@ -324,7 +324,7 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
324
324
  refreshRate?: number | undefined;
325
325
  topAssets?: string[] | undefined;
326
326
  isUnifiedUIEnabled?: boolean | undefined;
327
- isSnapConfirmationEnabled?: boolean | undefined;
327
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
328
328
  }>;
329
329
  refreshRate: number;
330
330
  minimumVersion: string;
@@ -342,7 +342,7 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
342
342
  refreshRate?: number | undefined;
343
343
  topAssets?: string[] | undefined;
344
344
  isUnifiedUIEnabled?: boolean | undefined;
345
- isSnapConfirmationEnabled?: boolean | undefined;
345
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
346
346
  }>;
347
347
  refreshRate: number;
348
348
  minimumVersion: string;
@@ -356,7 +356,7 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
356
356
  refreshRate?: number | undefined;
357
357
  topAssets?: string[] | undefined;
358
358
  isUnifiedUIEnabled?: boolean | undefined;
359
- isSnapConfirmationEnabled?: boolean | undefined;
359
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
360
360
  }>;
361
361
  refreshRate: number;
362
362
  minimumVersion: string;
@@ -374,7 +374,7 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
374
374
  refreshRate?: number | undefined;
375
375
  topAssets?: string[] | undefined;
376
376
  isUnifiedUIEnabled?: boolean | undefined;
377
- isSnapConfirmationEnabled?: boolean | undefined;
377
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
378
378
  }>;
379
379
  refreshRate: number;
380
380
  minimumVersion: string;
@@ -14501,7 +14501,7 @@ export declare const selectBridgeQuotes: ((state: BridgeControllerState & {
14501
14501
  refreshRate?: number | undefined;
14502
14502
  topAssets?: string[] | undefined;
14503
14503
  isUnifiedUIEnabled?: boolean | undefined;
14504
- isSnapConfirmationEnabled?: boolean | undefined;
14504
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
14505
14505
  }>;
14506
14506
  refreshRate: number;
14507
14507
  minimumVersion: string;
@@ -14515,7 +14515,7 @@ export declare const selectBridgeQuotes: ((state: BridgeControllerState & {
14515
14515
  refreshRate?: number | undefined;
14516
14516
  topAssets?: string[] | undefined;
14517
14517
  isUnifiedUIEnabled?: boolean | undefined;
14518
- isSnapConfirmationEnabled?: boolean | undefined;
14518
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
14519
14519
  }>;
14520
14520
  refreshRate: number;
14521
14521
  minimumVersion: string;
@@ -14534,7 +14534,7 @@ export declare const selectBridgeQuotes: ((state: BridgeControllerState & {
14534
14534
  refreshRate?: number | undefined;
14535
14535
  topAssets?: string[] | undefined;
14536
14536
  isUnifiedUIEnabled?: boolean | undefined;
14537
- isSnapConfirmationEnabled?: boolean | undefined;
14537
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
14538
14538
  }>;
14539
14539
  refreshRate: number;
14540
14540
  minimumVersion: string;
@@ -14552,7 +14552,7 @@ export declare const selectBridgeQuotes: ((state: BridgeControllerState & {
14552
14552
  refreshRate?: number | undefined;
14553
14553
  topAssets?: string[] | undefined;
14554
14554
  isUnifiedUIEnabled?: boolean | undefined;
14555
- isSnapConfirmationEnabled?: boolean | undefined;
14555
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
14556
14556
  }>;
14557
14557
  refreshRate: number;
14558
14558
  minimumVersion: string;
@@ -14566,7 +14566,7 @@ export declare const selectBridgeQuotes: ((state: BridgeControllerState & {
14566
14566
  refreshRate?: number | undefined;
14567
14567
  topAssets?: string[] | undefined;
14568
14568
  isUnifiedUIEnabled?: boolean | undefined;
14569
- isSnapConfirmationEnabled?: boolean | undefined;
14569
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
14570
14570
  }>;
14571
14571
  refreshRate: number;
14572
14572
  minimumVersion: string;
@@ -14584,7 +14584,7 @@ export declare const selectBridgeQuotes: ((state: BridgeControllerState & {
14584
14584
  refreshRate?: number | undefined;
14585
14585
  topAssets?: string[] | undefined;
14586
14586
  isUnifiedUIEnabled?: boolean | undefined;
14587
- isSnapConfirmationEnabled?: boolean | undefined;
14587
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
14588
14588
  }>;
14589
14589
  refreshRate: number;
14590
14590
  minimumVersion: string;
@@ -59,7 +59,7 @@ exports.ChainConfigurationSchema = (0, superstruct_1.type)({
59
59
  refreshRate: (0, superstruct_1.optional)((0, superstruct_1.number)()),
60
60
  topAssets: (0, superstruct_1.optional)((0, superstruct_1.array)((0, superstruct_1.string)())),
61
61
  isUnifiedUIEnabled: (0, superstruct_1.optional)((0, superstruct_1.boolean)()),
62
- isSnapConfirmationEnabled: (0, superstruct_1.optional)((0, superstruct_1.boolean)()),
62
+ isSingleSwapBridgeButtonEnabled: (0, superstruct_1.optional)((0, superstruct_1.boolean)()),
63
63
  });
64
64
  /**
65
65
  * This is the schema for the feature flags response from the RemoteFeatureFlagController
@@ -1 +1 @@
1
- {"version":3,"file":"validators.cjs","sourceRoot":"","sources":["../../src/utils/validators.ts"],"names":[],"mappings":";;;AAAA,iEAA+D;AAE/D,uDAgB+B;AAC/B,2CAAyE;AAEzE,IAAY,OAIX;AAJD,WAAY,OAAO;IACjB,oCAAyB,CAAA;IACzB,4BAAiB,CAAA;IACjB,2BAAgB,CAAA;AAClB,CAAC,EAJW,OAAO,uBAAP,OAAO,QAIlB;AAED,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,gCAAiB,CAAA;IACjB,4BAAa,CAAA;IACb,gCAAiB,CAAA;AACnB,CAAC,EAJW,WAAW,2BAAX,WAAW,QAItB;AAED,MAAM,gBAAgB,GAAG,IAAA,oBAAM,EAAS,YAAY,EAAE,CAAC,CAAU,EAAE,EAAE,CACnE,IAAA,oCAAiB,EAAC,CAAW,EAAE,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAC,CAC5D,CAAC;AAEF,MAAM,eAAe,GAAG,IAAA,oBAAM,EAAS,WAAW,EAAE,CAAC,CAAU,EAAE,EAAE,CACjE,IAAA,yBA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C,IAAA,oBAAM,GAAE,CAAC;QACpC,WAAW,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC;KAChC,CAAC,CACH;CACF,CAAC,CAAC;AAEU,QAAA,YAAY,GAAG,IAAA,kBAAI,EAAC;IAC/B,OAAO,EAAE,IAAA,oBAAM,GAAE;IACjB,EAAE,EAAE,gBAAgB;IACpB,IAAI,EAAE,gBAAgB;IACtB,KAAK,EAAE,eAAe;IACtB,IAAI,EAAE,eAAe;IACrB,QAAQ,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC;CAC7B,CAAC,CAAC;AAEU,QAAA,mBAAmB,GAAG,IAAA,kBAAI,EAAC;IACtC,KAAK,EAAE,mBAAW;IAClB,gCAAgC,EAAE,IAAA,oBAAM,GAAE;IAC1C,QAAQ,EAAE,IAAA,sBAAQ,EAAC,oBAAY,CAAC;IAChC,KAAK,EAAE,IAAA,mBAAK,EAAC,CAAC,oBAAY,EAAE,IAAA,oBAAM,GAAE,CAAC,CAAC;CACvC,CAAC,CAAC;AAEI,MAAM,qBAAqB,GAAG,CACnC,IAAa,EAC8B,EAAE;IAC7C,IAAA,oBAAM,EAAC,IAAI,EAAE,2BAAmB,CAAC,CAAC;IAClC,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AALW,QAAA,qBAAqB,yBAKhC","sourcesContent":["import { isValidHexAddress } from '@metamask/controller-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n string,\n boolean,\n number,\n type,\n is,\n record,\n array,\n nullable,\n optional,\n enums,\n define,\n union,\n assert,\n pattern,\n intersection,\n} from '@metamask/superstruct';\nimport { CaipAssetTypeStruct, isStrictHexString } from '@metamask/utils';\n\nexport enum FeeType {\n METABRIDGE = 'metabridge',\n REFUEL = 'refuel',\n TX_FEE = 'txFee',\n}\n\nexport enum ActionTypes {\n BRIDGE = 'bridge',\n SWAP = 'swap',\n REFUEL = 'refuel',\n}\n\nconst HexAddressSchema = define<string>('HexAddress', (v: unknown) =>\n isValidHexAddress(v as string, { allowNonPrefixed: false }),\n);\n\nconst HexStringSchema = define<string>('HexString', (v: unknown) =>\n isStrictHexString(v as string),\n);\n\nexport const truthyString = (s: string) => Boolean(s?.length);\nconst TruthyDigitStringSchema = pattern(string(), /^\\d+$/u);\n\nconst ChainIdSchema = number();\n\nexport const BridgeAssetSchema = type({\n /**\n * The chainId of the token\n */\n chainId: ChainIdSchema,\n /**\n * An address that the metaswap-api recognizes as the default token\n */\n address: string(),\n /**\n * The assetId of the token\n */\n assetId: CaipAssetTypeStruct,\n /**\n * The symbol of token object\n */\n symbol: string(),\n /**\n * The name for the network\n */\n name: string(),\n decimals: number(),\n /**\n * URL for token icon\n */\n icon: optional(nullable(string())),\n /**\n * URL for token icon\n */\n iconUrl: optional(nullable(string())),\n});\n\nexport const ChainConfigurationSchema = type({\n isActiveSrc: boolean(),\n isActiveDest: boolean(),\n refreshRate: optional(number()),\n topAssets: optional(array(string())),\n isUnifiedUIEnabled: optional(boolean()),\n isSnapConfirmationEnabled: optional(boolean()),\n});\n\n/**\n * This is the schema for the feature flags response from the RemoteFeatureFlagController\n */\nexport const PlatformConfigSchema = type({\n minimumVersion: string(),\n refreshRate: number(),\n maxRefreshCount: number(),\n support: boolean(),\n chains: record(string(), ChainConfigurationSchema),\n});\n\nexport const validateFeatureFlagsResponse = (\n data: unknown,\n): data is Infer<typeof PlatformConfigSchema> => {\n return is(data, PlatformConfigSchema);\n};\n\nexport const validateSwapsTokenObject = (\n data: unknown,\n): data is Infer<typeof BridgeAssetSchema> => {\n return is(data, BridgeAssetSchema);\n};\n\nexport const FeeDataSchema = type({\n amount: TruthyDigitStringSchema,\n asset: BridgeAssetSchema,\n});\n\nexport const ProtocolSchema = type({\n name: string(),\n displayName: optional(string()),\n icon: optional(string()),\n});\n\nexport const StepSchema = type({\n action: enums(Object.values(ActionTypes)),\n srcChainId: ChainIdSchema,\n destChainId: optional(ChainIdSchema),\n srcAsset: BridgeAssetSchema,\n destAsset: BridgeAssetSchema,\n srcAmount: string(),\n destAmount: string(),\n protocol: ProtocolSchema,\n});\n\nconst RefuelDataSchema = StepSchema;\n\nexport const QuoteSchema = type({\n requestId: string(),\n srcChainId: ChainIdSchema,\n srcAsset: BridgeAssetSchema,\n /**\n * The amount sent, in atomic amount: amount sent - fees\n * Some tokens have a fee of 0, so sometimes it's equal to amount sent\n */\n srcTokenAmount: string(),\n destChainId: ChainIdSchema,\n destAsset: BridgeAssetSchema,\n /**\n * The amount received, in atomic amount\n */\n destTokenAmount: string(),\n feeData: type({\n [FeeType.METABRIDGE]: FeeDataSchema,\n /**\n * This is the fee for the swap transaction taken from either the\n * src or dest token if the quote has gas fees included or \"gasless\"\n */\n [FeeType.TX_FEE]: optional(\n intersection([\n FeeDataSchema,\n type({\n maxFeePerGas: string(),\n maxPriorityFeePerGas: string(),\n }),\n ]),\n ),\n }),\n gasIncluded: optional(boolean()),\n bridgeId: string(),\n bridges: array(string()),\n steps: array(StepSchema),\n refuel: optional(RefuelDataSchema),\n priceData: optional(\n type({\n totalFromAmountUsd: optional(string()),\n totalToAmountUsd: optional(string()),\n priceImpact: optional(string()),\n }),\n ),\n});\n\nexport const TxDataSchema = type({\n chainId: number(),\n to: HexAddressSchema,\n from: HexAddressSchema,\n value: HexStringSchema,\n data: HexStringSchema,\n gasLimit: nullable(number()),\n});\n\nexport const QuoteResponseSchema = type({\n quote: QuoteSchema,\n estimatedProcessingTimeInSeconds: number(),\n approval: optional(TxDataSchema),\n trade: union([TxDataSchema, string()]),\n});\n\nexport const validateQuoteResponse = (\n data: unknown,\n): data is Infer<typeof QuoteResponseSchema> => {\n assert(data, QuoteResponseSchema);\n return true;\n};\n"]}
1
+ {"version":3,"file":"validators.cjs","sourceRoot":"","sources":["../../src/utils/validators.ts"],"names":[],"mappings":";;;AAAA,iEAA+D;AAE/D,uDAgB+B;AAC/B,2CAAyE;AAEzE,IAAY,OAIX;AAJD,WAAY,OAAO;IACjB,oCAAyB,CAAA;IAC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EAAE,2BAAmB,CAAC,CAAC;IAClC,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AALW,QAAA,qBAAqB,yBAKhC","sourcesContent":["import { isValidHexAddress } from '@metamask/controller-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n string,\n boolean,\n number,\n type,\n is,\n record,\n array,\n nullable,\n optional,\n enums,\n define,\n union,\n assert,\n pattern,\n intersection,\n} from '@metamask/superstruct';\nimport { CaipAssetTypeStruct, isStrictHexString } from '@metamask/utils';\n\nexport enum FeeType {\n METABRIDGE = 'metabridge',\n REFUEL = 'refuel',\n TX_FEE = 'txFee',\n}\n\nexport enum ActionTypes {\n BRIDGE = 'bridge',\n SWAP = 'swap',\n REFUEL = 'refuel',\n}\n\nconst HexAddressSchema = define<string>('HexAddress', (v: unknown) =>\n isValidHexAddress(v as string, { allowNonPrefixed: false }),\n);\n\nconst HexStringSchema = define<string>('HexString', (v: unknown) =>\n isStrictHexString(v as string),\n);\n\nexport const truthyString = (s: string) => Boolean(s?.length);\nconst TruthyDigitStringSchema = pattern(string(), /^\\d+$/u);\n\nconst ChainIdSchema = number();\n\nexport const BridgeAssetSchema = type({\n /**\n * The chainId of the token\n */\n chainId: ChainIdSchema,\n /**\n * An address that the metaswap-api recognizes as the default token\n */\n address: string(),\n /**\n * The assetId of the token\n */\n assetId: CaipAssetTypeStruct,\n /**\n * The symbol of token object\n */\n symbol: string(),\n /**\n * The name for the network\n */\n name: string(),\n decimals: number(),\n /**\n * URL for token icon\n */\n icon: optional(nullable(string())),\n /**\n * URL for token icon\n */\n iconUrl: optional(nullable(string())),\n});\n\nexport const ChainConfigurationSchema = type({\n isActiveSrc: boolean(),\n isActiveDest: boolean(),\n refreshRate: optional(number()),\n topAssets: optional(array(string())),\n isUnifiedUIEnabled: optional(boolean()),\n isSingleSwapBridgeButtonEnabled: optional(boolean()),\n});\n\n/**\n * This is the schema for the feature flags response from the RemoteFeatureFlagController\n */\nexport const PlatformConfigSchema = type({\n minimumVersion: string(),\n refreshRate: number(),\n maxRefreshCount: number(),\n support: boolean(),\n chains: record(string(), ChainConfigurationSchema),\n});\n\nexport const validateFeatureFlagsResponse = (\n data: unknown,\n): data is Infer<typeof PlatformConfigSchema> => {\n return is(data, PlatformConfigSchema);\n};\n\nexport const validateSwapsTokenObject = (\n data: unknown,\n): data is Infer<typeof BridgeAssetSchema> => {\n return is(data, BridgeAssetSchema);\n};\n\nexport const FeeDataSchema = type({\n amount: TruthyDigitStringSchema,\n asset: BridgeAssetSchema,\n});\n\nexport const ProtocolSchema = type({\n name: string(),\n displayName: optional(string()),\n icon: optional(string()),\n});\n\nexport const StepSchema = type({\n action: enums(Object.values(ActionTypes)),\n srcChainId: ChainIdSchema,\n destChainId: optional(ChainIdSchema),\n srcAsset: BridgeAssetSchema,\n destAsset: BridgeAssetSchema,\n srcAmount: string(),\n destAmount: string(),\n protocol: ProtocolSchema,\n});\n\nconst RefuelDataSchema = StepSchema;\n\nexport const QuoteSchema = type({\n requestId: string(),\n srcChainId: ChainIdSchema,\n srcAsset: BridgeAssetSchema,\n /**\n * The amount sent, in atomic amount: amount sent - fees\n * Some tokens have a fee of 0, so sometimes it's equal to amount sent\n */\n srcTokenAmount: string(),\n destChainId: ChainIdSchema,\n destAsset: BridgeAssetSchema,\n /**\n * The amount received, in atomic amount\n */\n destTokenAmount: string(),\n feeData: type({\n [FeeType.METABRIDGE]: FeeDataSchema,\n /**\n * This is the fee for the swap transaction taken from either the\n * src or dest token if the quote has gas fees included or \"gasless\"\n */\n [FeeType.TX_FEE]: optional(\n intersection([\n FeeDataSchema,\n type({\n maxFeePerGas: string(),\n maxPriorityFeePerGas: string(),\n }),\n ]),\n ),\n }),\n gasIncluded: optional(boolean()),\n bridgeId: string(),\n bridges: array(string()),\n steps: array(StepSchema),\n refuel: optional(RefuelDataSchema),\n priceData: optional(\n type({\n totalFromAmountUsd: optional(string()),\n totalToAmountUsd: optional(string()),\n priceImpact: optional(string()),\n }),\n ),\n});\n\nexport const TxDataSchema = type({\n chainId: number(),\n to: HexAddressSchema,\n from: HexAddressSchema,\n value: HexStringSchema,\n data: HexStringSchema,\n gasLimit: nullable(number()),\n});\n\nexport const QuoteResponseSchema = type({\n quote: QuoteSchema,\n estimatedProcessingTimeInSeconds: number(),\n approval: optional(TxDataSchema),\n trade: union([TxDataSchema, string()]),\n});\n\nexport const validateQuoteResponse = (\n data: unknown,\n): data is Infer<typeof QuoteResponseSchema> => {\n assert(data, QuoteResponseSchema);\n return true;\n};\n"]}
@@ -55,14 +55,14 @@ export declare const ChainConfigurationSchema: import("@metamask/superstruct").S
55
55
  refreshRate?: number | undefined;
56
56
  topAssets?: string[] | undefined;
57
57
  isUnifiedUIEnabled?: boolean | undefined;
58
- isSnapConfirmationEnabled?: boolean | undefined;
58
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
59
59
  }, {
60
60
  isActiveSrc: import("@metamask/superstruct").Struct<boolean, null>;
61
61
  isActiveDest: import("@metamask/superstruct").Struct<boolean, null>;
62
62
  refreshRate: import("@metamask/superstruct").Struct<number | undefined, null>;
63
63
  topAssets: import("@metamask/superstruct").Struct<string[] | undefined, import("@metamask/superstruct").Struct<string, null>>;
64
64
  isUnifiedUIEnabled: import("@metamask/superstruct").Struct<boolean | undefined, null>;
65
- isSnapConfirmationEnabled: import("@metamask/superstruct").Struct<boolean | undefined, null>;
65
+ isSingleSwapBridgeButtonEnabled: import("@metamask/superstruct").Struct<boolean | undefined, null>;
66
66
  }>;
67
67
  /**
68
68
  * This is the schema for the feature flags response from the RemoteFeatureFlagController
@@ -75,7 +75,7 @@ export declare const PlatformConfigSchema: import("@metamask/superstruct").Struc
75
75
  refreshRate?: number | undefined;
76
76
  topAssets?: string[] | undefined;
77
77
  isUnifiedUIEnabled?: boolean | undefined;
78
- isSnapConfirmationEnabled?: boolean | undefined;
78
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
79
79
  }>;
80
80
  refreshRate: number;
81
81
  minimumVersion: string;
@@ -91,7 +91,7 @@ export declare const PlatformConfigSchema: import("@metamask/superstruct").Struc
91
91
  refreshRate?: number | undefined;
92
92
  topAssets?: string[] | undefined;
93
93
  isUnifiedUIEnabled?: boolean | undefined;
94
- isSnapConfirmationEnabled?: boolean | undefined;
94
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
95
95
  }>, null>;
96
96
  }>;
97
97
  export declare const validateFeatureFlagsResponse: (data: unknown) => data is {
@@ -102,7 +102,7 @@ export declare const validateFeatureFlagsResponse: (data: unknown) => data is {
102
102
  refreshRate?: number | undefined;
103
103
  topAssets?: string[] | undefined;
104
104
  isUnifiedUIEnabled?: boolean | undefined;
105
- isSnapConfirmationEnabled?: boolean | undefined;
105
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
106
106
  }>;
107
107
  refreshRate: number;
108
108
  minimumVersion: string;
@@ -55,14 +55,14 @@ export declare const ChainConfigurationSchema: import("@metamask/superstruct").S
55
55
  refreshRate?: number | undefined;
56
56
  topAssets?: string[] | undefined;
57
57
  isUnifiedUIEnabled?: boolean | undefined;
58
- isSnapConfirmationEnabled?: boolean | undefined;
58
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
59
59
  }, {
60
60
  isActiveSrc: import("@metamask/superstruct").Struct<boolean, null>;
61
61
  isActiveDest: import("@metamask/superstruct").Struct<boolean, null>;
62
62
  refreshRate: import("@metamask/superstruct").Struct<number | undefined, null>;
63
63
  topAssets: import("@metamask/superstruct").Struct<string[] | undefined, import("@metamask/superstruct").Struct<string, null>>;
64
64
  isUnifiedUIEnabled: import("@metamask/superstruct").Struct<boolean | undefined, null>;
65
- isSnapConfirmationEnabled: import("@metamask/superstruct").Struct<boolean | undefined, null>;
65
+ isSingleSwapBridgeButtonEnabled: import("@metamask/superstruct").Struct<boolean | undefined, null>;
66
66
  }>;
67
67
  /**
68
68
  * This is the schema for the feature flags response from the RemoteFeatureFlagController
@@ -75,7 +75,7 @@ export declare const PlatformConfigSchema: import("@metamask/superstruct").Struc
75
75
  refreshRate?: number | undefined;
76
76
  topAssets?: string[] | undefined;
77
77
  isUnifiedUIEnabled?: boolean | undefined;
78
- isSnapConfirmationEnabled?: boolean | undefined;
78
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
79
79
  }>;
80
80
  refreshRate: number;
81
81
  minimumVersion: string;
@@ -91,7 +91,7 @@ export declare const PlatformConfigSchema: import("@metamask/superstruct").Struc
91
91
  refreshRate?: number | undefined;
92
92
  topAssets?: string[] | undefined;
93
93
  isUnifiedUIEnabled?: boolean | undefined;
94
- isSnapConfirmationEnabled?: boolean | undefined;
94
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
95
95
  }>, null>;
96
96
  }>;
97
97
  export declare const validateFeatureFlagsResponse: (data: unknown) => data is {
@@ -102,7 +102,7 @@ export declare const validateFeatureFlagsResponse: (data: unknown) => data is {
102
102
  refreshRate?: number | undefined;
103
103
  topAssets?: string[] | undefined;
104
104
  isUnifiedUIEnabled?: boolean | undefined;
105
- isSnapConfirmationEnabled?: boolean | undefined;
105
+ isSingleSwapBridgeButtonEnabled?: boolean | undefined;
106
106
  }>;
107
107
  refreshRate: number;
108
108
  minimumVersion: string;
@@ -55,7 +55,7 @@ export const ChainConfigurationSchema = type({
55
55
  refreshRate: optional(number()),
56
56
  topAssets: optional(array(string())),
57
57
  isUnifiedUIEnabled: optional(boolean()),
58
- isSnapConfirmationEnabled: optional(boolean()),
58
+ isSingleSwapBridgeButtonEnabled: optional(boolean()),
59
59
  });
60
60
  /**
61
61
  * This is the schema for the feature flags response from the RemoteFeatureFlagController
@@ -1 +1 @@
1
- {"version":3,"file":"validators.mjs","sourceRoot":"","sources":["../../src/utils/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,mCAAmC;AAE/D,OAAO,EACL,MAAM,EACN,OAAO,EACP,MAAM,EACN,IAAI,EACJ,EAAE,EACF,MAAM,EACN,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,MAAM,EACN,KA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AU,CAAC;IACxB,MAAM,EAAE,QAAQ,CAAC,gBAAgB,CAAC;IAClC,SAAS,EAAE,QAAQ,CACjB,IAAI,CAAC;QACH,kBAAkB,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;QACtC,gBAAgB,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;QACpC,WAAW,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;KAChC,CAAC,CACH;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC;IAC/B,OAAO,EAAE,MAAM,EAAE;IACjB,EAAE,EAAE,gBAAgB;IACpB,IAAI,EAAE,gBAAgB;IACtB,KAAK,EAAE,eAAe;IACtB,IAAI,EAAE,eAAe;IACrB,QAAQ,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;CAC7B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;IACtC,KAAK,EAAE,WAAW;IAClB,gCAAgC,EAAE,MAAM,EAAE;IAC1C,QAAQ,EAAE,QAAQ,CAAC,YAAY,CAAC;IAChC,KAAK,EAAE,KAAK,CAAC,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC,CAAC;CACvC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,IAAa,EAC8B,EAAE;IAC7C,MAAM,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;IAClC,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","sourcesContent":["import { isValidHexAddress } from '@metamask/controller-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n string,\n boolean,\n number,\n type,\n is,\n record,\n array,\n nullable,\n optional,\n enums,\n define,\n union,\n assert,\n pattern,\n intersection,\n} from '@metamask/superstruct';\nimport { CaipAssetTypeStruct, isStrictHexString } from '@metamask/utils';\n\nexport enum FeeType {\n METABRIDGE = 'metabridge',\n REFUEL = 'refuel',\n TX_FEE = 'txFee',\n}\n\nexport enum ActionTypes {\n BRIDGE = 'bridge',\n SWAP = 'swap',\n REFUEL = 'refuel',\n}\n\nconst HexAddressSchema = define<string>('HexAddress', (v: unknown) =>\n isValidHexAddress(v as string, { allowNonPrefixed: false }),\n);\n\nconst HexStringSchema = define<string>('HexString', (v: unknown) =>\n isStrictHexString(v as string),\n);\n\nexport const truthyString = (s: string) => Boolean(s?.length);\nconst TruthyDigitStringSchema = pattern(string(), /^\\d+$/u);\n\nconst ChainIdSchema = number();\n\nexport const BridgeAssetSchema = type({\n /**\n * The chainId of the token\n */\n chainId: ChainIdSchema,\n /**\n * An address that the metaswap-api recognizes as the default token\n */\n address: string(),\n /**\n * The assetId of the token\n */\n assetId: CaipAssetTypeStruct,\n /**\n * The symbol of token object\n */\n symbol: string(),\n /**\n * The name for the network\n */\n name: string(),\n decimals: number(),\n /**\n * URL for token icon\n */\n icon: optional(nullable(string())),\n /**\n * URL for token icon\n */\n iconUrl: optional(nullable(string())),\n});\n\nexport const ChainConfigurationSchema = type({\n isActiveSrc: boolean(),\n isActiveDest: boolean(),\n refreshRate: optional(number()),\n topAssets: optional(array(string())),\n isUnifiedUIEnabled: optional(boolean()),\n isSnapConfirmationEnabled: optional(boolean()),\n});\n\n/**\n * This is the schema for the feature flags response from the RemoteFeatureFlagController\n */\nexport const PlatformConfigSchema = type({\n minimumVersion: string(),\n refreshRate: number(),\n maxRefreshCount: number(),\n support: boolean(),\n chains: record(string(), ChainConfigurationSchema),\n});\n\nexport const validateFeatureFlagsResponse = (\n data: unknown,\n): data is Infer<typeof PlatformConfigSchema> => {\n return is(data, PlatformConfigSchema);\n};\n\nexport const validateSwapsTokenObject = (\n data: unknown,\n): data is Infer<typeof BridgeAssetSchema> => {\n return is(data, BridgeAssetSchema);\n};\n\nexport const FeeDataSchema = type({\n amount: TruthyDigitStringSchema,\n asset: BridgeAssetSchema,\n});\n\nexport const ProtocolSchema = type({\n name: string(),\n displayName: optional(string()),\n icon: optional(string()),\n});\n\nexport const StepSchema = type({\n action: enums(Object.values(ActionTypes)),\n srcChainId: ChainIdSchema,\n destChainId: optional(ChainIdSchema),\n srcAsset: BridgeAssetSchema,\n destAsset: BridgeAssetSchema,\n srcAmount: string(),\n destAmount: string(),\n protocol: ProtocolSchema,\n});\n\nconst RefuelDataSchema = StepSchema;\n\nexport const QuoteSchema = type({\n requestId: string(),\n srcChainId: ChainIdSchema,\n srcAsset: BridgeAssetSchema,\n /**\n * The amount sent, in atomic amount: amount sent - fees\n * Some tokens have a fee of 0, so sometimes it's equal to amount sent\n */\n srcTokenAmount: string(),\n destChainId: ChainIdSchema,\n destAsset: BridgeAssetSchema,\n /**\n * The amount received, in atomic amount\n */\n destTokenAmount: string(),\n feeData: type({\n [FeeType.METABRIDGE]: FeeDataSchema,\n /**\n * This is the fee for the swap transaction taken from either the\n * src or dest token if the quote has gas fees included or \"gasless\"\n */\n [FeeType.TX_FEE]: optional(\n intersection([\n FeeDataSchema,\n type({\n maxFeePerGas: string(),\n maxPriorityFeePerGas: string(),\n }),\n ]),\n ),\n }),\n gasIncluded: optional(boolean()),\n bridgeId: string(),\n bridges: array(string()),\n steps: array(StepSchema),\n refuel: optional(RefuelDataSchema),\n priceData: optional(\n type({\n totalFromAmountUsd: optional(string()),\n totalToAmountUsd: optional(string()),\n priceImpact: optional(string()),\n }),\n ),\n});\n\nexport const TxDataSchema = type({\n chainId: number(),\n to: HexAddressSchema,\n from: HexAddressSchema,\n value: HexStringSchema,\n data: HexStringSchema,\n gasLimit: nullable(number()),\n});\n\nexport const QuoteResponseSchema = type({\n quote: QuoteSchema,\n estimatedProcessingTimeInSeconds: number(),\n approval: optional(TxDataSchema),\n trade: union([TxDataSchema, string()]),\n});\n\nexport const validateQuoteResponse = (\n data: unknown,\n): data is Infer<typeof QuoteResponseSchema> => {\n assert(data, QuoteResponseSchema);\n return true;\n};\n"]}
1
+ {"version":3,"file":"validators.mjs","sourceRoot":"","sources":["../../src/utils/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,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AAC;IACF,WAAW,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC;IAChC,QAAQ,EAAE,MAAM,EAAE;IAClB,OAAO,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;IACxB,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC;IACxB,MAAM,EAAE,QAAQ,CAAC,gBAAgB,CAAC;IAClC,SAAS,EAAE,QAAQ,CACjB,IAAI,CAAC;QACH,kBAAkB,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;QACtC,gBAAgB,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;QACpC,WAAW,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;KAChC,CAAC,CACH;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC;IAC/B,OAAO,EAAE,MAAM,EAAE;IACjB,EAAE,EAAE,gBAAgB;IACpB,IAAI,EAAE,gBAAgB;IACtB,KAAK,EAAE,eAAe;IACtB,IAAI,EAAE,eAAe;IACrB,QAAQ,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;CAC7B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;IACtC,KAAK,EAAE,WAAW;IAClB,gCAAgC,EAAE,MAAM,EAAE;IAC1C,QAAQ,EAAE,QAAQ,CAAC,YAAY,CAAC;IAChC,KAAK,EAAE,KAAK,CAAC,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC,CAAC;CACvC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,IAAa,EAC8B,EAAE;IAC7C,MAAM,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;IAClC,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","sourcesContent":["import { isValidHexAddress } from '@metamask/controller-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n string,\n boolean,\n number,\n type,\n is,\n record,\n array,\n nullable,\n optional,\n enums,\n define,\n union,\n assert,\n pattern,\n intersection,\n} from '@metamask/superstruct';\nimport { CaipAssetTypeStruct, isStrictHexString } from '@metamask/utils';\n\nexport enum FeeType {\n METABRIDGE = 'metabridge',\n REFUEL = 'refuel',\n TX_FEE = 'txFee',\n}\n\nexport enum ActionTypes {\n BRIDGE = 'bridge',\n SWAP = 'swap',\n REFUEL = 'refuel',\n}\n\nconst HexAddressSchema = define<string>('HexAddress', (v: unknown) =>\n isValidHexAddress(v as string, { allowNonPrefixed: false }),\n);\n\nconst HexStringSchema = define<string>('HexString', (v: unknown) =>\n isStrictHexString(v as string),\n);\n\nexport const truthyString = (s: string) => Boolean(s?.length);\nconst TruthyDigitStringSchema = pattern(string(), /^\\d+$/u);\n\nconst ChainIdSchema = number();\n\nexport const BridgeAssetSchema = type({\n /**\n * The chainId of the token\n */\n chainId: ChainIdSchema,\n /**\n * An address that the metaswap-api recognizes as the default token\n */\n address: string(),\n /**\n * The assetId of the token\n */\n assetId: CaipAssetTypeStruct,\n /**\n * The symbol of token object\n */\n symbol: string(),\n /**\n * The name for the network\n */\n name: string(),\n decimals: number(),\n /**\n * URL for token icon\n */\n icon: optional(nullable(string())),\n /**\n * URL for token icon\n */\n iconUrl: optional(nullable(string())),\n});\n\nexport const ChainConfigurationSchema = type({\n isActiveSrc: boolean(),\n isActiveDest: boolean(),\n refreshRate: optional(number()),\n topAssets: optional(array(string())),\n isUnifiedUIEnabled: optional(boolean()),\n isSingleSwapBridgeButtonEnabled: optional(boolean()),\n});\n\n/**\n * This is the schema for the feature flags response from the RemoteFeatureFlagController\n */\nexport const PlatformConfigSchema = type({\n minimumVersion: string(),\n refreshRate: number(),\n maxRefreshCount: number(),\n support: boolean(),\n chains: record(string(), ChainConfigurationSchema),\n});\n\nexport const validateFeatureFlagsResponse = (\n data: unknown,\n): data is Infer<typeof PlatformConfigSchema> => {\n return is(data, PlatformConfigSchema);\n};\n\nexport const validateSwapsTokenObject = (\n data: unknown,\n): data is Infer<typeof BridgeAssetSchema> => {\n return is(data, BridgeAssetSchema);\n};\n\nexport const FeeDataSchema = type({\n amount: TruthyDigitStringSchema,\n asset: BridgeAssetSchema,\n});\n\nexport const ProtocolSchema = type({\n name: string(),\n displayName: optional(string()),\n icon: optional(string()),\n});\n\nexport const StepSchema = type({\n action: enums(Object.values(ActionTypes)),\n srcChainId: ChainIdSchema,\n destChainId: optional(ChainIdSchema),\n srcAsset: BridgeAssetSchema,\n destAsset: BridgeAssetSchema,\n srcAmount: string(),\n destAmount: string(),\n protocol: ProtocolSchema,\n});\n\nconst RefuelDataSchema = StepSchema;\n\nexport const QuoteSchema = type({\n requestId: string(),\n srcChainId: ChainIdSchema,\n srcAsset: BridgeAssetSchema,\n /**\n * The amount sent, in atomic amount: amount sent - fees\n * Some tokens have a fee of 0, so sometimes it's equal to amount sent\n */\n srcTokenAmount: string(),\n destChainId: ChainIdSchema,\n destAsset: BridgeAssetSchema,\n /**\n * The amount received, in atomic amount\n */\n destTokenAmount: string(),\n feeData: type({\n [FeeType.METABRIDGE]: FeeDataSchema,\n /**\n * This is the fee for the swap transaction taken from either the\n * src or dest token if the quote has gas fees included or \"gasless\"\n */\n [FeeType.TX_FEE]: optional(\n intersection([\n FeeDataSchema,\n type({\n maxFeePerGas: string(),\n maxPriorityFeePerGas: string(),\n }),\n ]),\n ),\n }),\n gasIncluded: optional(boolean()),\n bridgeId: string(),\n bridges: array(string()),\n steps: array(StepSchema),\n refuel: optional(RefuelDataSchema),\n priceData: optional(\n type({\n totalFromAmountUsd: optional(string()),\n totalToAmountUsd: optional(string()),\n priceImpact: optional(string()),\n }),\n ),\n});\n\nexport const TxDataSchema = type({\n chainId: number(),\n to: HexAddressSchema,\n from: HexAddressSchema,\n value: HexStringSchema,\n data: HexStringSchema,\n gasLimit: nullable(number()),\n});\n\nexport const QuoteResponseSchema = type({\n quote: QuoteSchema,\n estimatedProcessingTimeInSeconds: number(),\n approval: optional(TxDataSchema),\n trade: union([TxDataSchema, string()]),\n});\n\nexport const validateQuoteResponse = (\n data: unknown,\n): data is Infer<typeof QuoteResponseSchema> => {\n assert(data, QuoteResponseSchema);\n return true;\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/bridge-controller",
3
- "version": "34.0.0-preview-92a09963",
3
+ "version": "34.0.0-preview-9af90ce1",
4
4
  "description": "Manages bridge-related quote fetching functionality for MetaMask",
5
5
  "keywords": [
6
6
  "MetaMask",