@metamask/bridge-controller 64.6.0 → 64.7.0

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.
@@ -68,10 +68,6 @@ export declare const selectBridgeFeatureFlags: ((state: RemoteFeatureFlagControl
68
68
  other: Record<string, string>;
69
69
  } | undefined;
70
70
  }>;
71
- chainRanking: {
72
- chainId: `${string}:${string}`;
73
- name: string;
74
- }[];
75
71
  priceImpactThreshold?: {
76
72
  gasless: number;
77
73
  normal: number;
@@ -89,6 +85,10 @@ export declare const selectBridgeFeatureFlags: ((state: RemoteFeatureFlagControl
89
85
  minimumVersion: string;
90
86
  enabled: boolean;
91
87
  } | undefined;
88
+ chainRanking?: {
89
+ chainId: `${string}:${string}`;
90
+ name: string;
91
+ }[] | undefined;
92
92
  }) & {
93
93
  clearCache: () => void;
94
94
  resultsCount: () => number;
@@ -114,10 +114,6 @@ export declare const selectBridgeFeatureFlags: ((state: RemoteFeatureFlagControl
114
114
  other: Record<string, string>;
115
115
  } | undefined;
116
116
  }>;
117
- chainRanking: {
118
- chainId: `${string}:${string}`;
119
- name: string;
120
- }[];
121
117
  priceImpactThreshold?: {
122
118
  gasless: number;
123
119
  normal: number;
@@ -135,6 +131,10 @@ export declare const selectBridgeFeatureFlags: ((state: RemoteFeatureFlagControl
135
131
  minimumVersion: string;
136
132
  enabled: boolean;
137
133
  } | undefined;
134
+ chainRanking?: {
135
+ chainId: `${string}:${string}`;
136
+ name: string;
137
+ }[] | undefined;
138
138
  };
139
139
  memoizedResultFunc: ((resultFuncArgs_0: any) => {
140
140
  refreshRate: number;
@@ -156,10 +156,6 @@ export declare const selectBridgeFeatureFlags: ((state: RemoteFeatureFlagControl
156
156
  other: Record<string, string>;
157
157
  } | undefined;
158
158
  }>;
159
- chainRanking: {
160
- chainId: `${string}:${string}`;
161
- name: string;
162
- }[];
163
159
  priceImpactThreshold?: {
164
160
  gasless: number;
165
161
  normal: number;
@@ -177,6 +173,10 @@ export declare const selectBridgeFeatureFlags: ((state: RemoteFeatureFlagControl
177
173
  minimumVersion: string;
178
174
  enabled: boolean;
179
175
  } | undefined;
176
+ chainRanking?: {
177
+ chainId: `${string}:${string}`;
178
+ name: string;
179
+ }[] | undefined;
180
180
  }) & {
181
181
  clearCache: () => void;
182
182
  resultsCount: () => number;
@@ -202,10 +202,6 @@ export declare const selectBridgeFeatureFlags: ((state: RemoteFeatureFlagControl
202
202
  other: Record<string, string>;
203
203
  } | undefined;
204
204
  }>;
205
- chainRanking: {
206
- chainId: `${string}:${string}`;
207
- name: string;
208
- }[];
209
205
  priceImpactThreshold?: {
210
206
  gasless: number;
211
207
  normal: number;
@@ -223,6 +219,10 @@ export declare const selectBridgeFeatureFlags: ((state: RemoteFeatureFlagControl
223
219
  minimumVersion: string;
224
220
  enabled: boolean;
225
221
  } | undefined;
222
+ chainRanking?: {
223
+ chainId: `${string}:${string}`;
224
+ name: string;
225
+ }[] | undefined;
226
226
  };
227
227
  dependencies: [(state: RemoteFeatureFlagControllerState) => unknown];
228
228
  recomputations: () => number;
@@ -294,10 +294,6 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
294
294
  other: Record<string, string>;
295
295
  } | undefined;
296
296
  }>;
297
- chainRanking: {
298
- chainId: `${string}:${string}`;
299
- name: string;
300
- }[];
301
297
  priceImpactThreshold?: {
302
298
  gasless: number;
303
299
  normal: number;
@@ -315,6 +311,10 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
315
311
  minimumVersion: string;
316
312
  enabled: boolean;
317
313
  } | undefined;
314
+ chainRanking?: {
315
+ chainId: `${string}:${string}`;
316
+ name: string;
317
+ }[] | undefined;
318
318
  }, resultFuncArgs_1: boolean | undefined, resultFuncArgs_2: number) => boolean;
319
319
  memoizedResultFunc: ((resultFuncArgs_0: {
320
320
  refreshRate: number;
@@ -336,10 +336,6 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
336
336
  other: Record<string, string>;
337
337
  } | undefined;
338
338
  }>;
339
- chainRanking: {
340
- chainId: `${string}:${string}`;
341
- name: string;
342
- }[];
343
339
  priceImpactThreshold?: {
344
340
  gasless: number;
345
341
  normal: number;
@@ -357,6 +353,10 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
357
353
  minimumVersion: string;
358
354
  enabled: boolean;
359
355
  } | undefined;
356
+ chainRanking?: {
357
+ chainId: `${string}:${string}`;
358
+ name: string;
359
+ }[] | undefined;
360
360
  }, resultFuncArgs_1: boolean | undefined, resultFuncArgs_2: number) => boolean) & {
361
361
  clearCache: () => void;
362
362
  resultsCount: () => number;
@@ -383,10 +383,6 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
383
383
  other: Record<string, string>;
384
384
  } | undefined;
385
385
  }>;
386
- chainRanking: {
387
- chainId: `${string}:${string}`;
388
- name: string;
389
- }[];
390
386
  priceImpactThreshold?: {
391
387
  gasless: number;
392
388
  normal: number;
@@ -404,6 +400,10 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
404
400
  minimumVersion: string;
405
401
  enabled: boolean;
406
402
  } | undefined;
403
+ chainRanking?: {
404
+ chainId: `${string}:${string}`;
405
+ name: string;
406
+ }[] | undefined;
407
407
  }) & {
408
408
  clearCache: () => void;
409
409
  resultsCount: () => number;
@@ -429,10 +429,6 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
429
429
  other: Record<string, string>;
430
430
  } | undefined;
431
431
  }>;
432
- chainRanking: {
433
- chainId: `${string}:${string}`;
434
- name: string;
435
- }[];
436
432
  priceImpactThreshold?: {
437
433
  gasless: number;
438
434
  normal: number;
@@ -450,6 +446,10 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
450
446
  minimumVersion: string;
451
447
  enabled: boolean;
452
448
  } | undefined;
449
+ chainRanking?: {
450
+ chainId: `${string}:${string}`;
451
+ name: string;
452
+ }[] | undefined;
453
453
  };
454
454
  memoizedResultFunc: ((resultFuncArgs_0: any) => {
455
455
  refreshRate: number;
@@ -471,10 +471,6 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
471
471
  other: Record<string, string>;
472
472
  } | undefined;
473
473
  }>;
474
- chainRanking: {
475
- chainId: `${string}:${string}`;
476
- name: string;
477
- }[];
478
474
  priceImpactThreshold?: {
479
475
  gasless: number;
480
476
  normal: number;
@@ -492,6 +488,10 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
492
488
  minimumVersion: string;
493
489
  enabled: boolean;
494
490
  } | undefined;
491
+ chainRanking?: {
492
+ chainId: `${string}:${string}`;
493
+ name: string;
494
+ }[] | undefined;
495
495
  }) & {
496
496
  clearCache: () => void;
497
497
  resultsCount: () => number;
@@ -517,10 +517,6 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
517
517
  other: Record<string, string>;
518
518
  } | undefined;
519
519
  }>;
520
- chainRanking: {
521
- chainId: `${string}:${string}`;
522
- name: string;
523
- }[];
524
520
  priceImpactThreshold?: {
525
521
  gasless: number;
526
522
  normal: number;
@@ -538,6 +534,10 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
538
534
  minimumVersion: string;
539
535
  enabled: boolean;
540
536
  } | undefined;
537
+ chainRanking?: {
538
+ chainId: `${string}:${string}`;
539
+ name: string;
540
+ }[] | undefined;
541
541
  };
542
542
  dependencies: [(state: RemoteFeatureFlagControllerState) => unknown];
543
543
  recomputations: () => number;
@@ -584,10 +584,6 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
584
584
  other: Record<string, string>;
585
585
  } | undefined;
586
586
  }>;
587
- chainRanking: {
588
- chainId: `${string}:${string}`;
589
- name: string;
590
- }[];
591
587
  priceImpactThreshold?: {
592
588
  gasless: number;
593
589
  normal: number;
@@ -605,6 +601,10 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
605
601
  minimumVersion: string;
606
602
  enabled: boolean;
607
603
  } | undefined;
604
+ chainRanking?: {
605
+ chainId: `${string}:${string}`;
606
+ name: string;
607
+ }[] | undefined;
608
608
  }, resultFuncArgs_1: string | number | undefined) => number;
609
609
  memoizedResultFunc: ((resultFuncArgs_0: {
610
610
  refreshRate: number;
@@ -626,10 +626,6 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
626
626
  other: Record<string, string>;
627
627
  } | undefined;
628
628
  }>;
629
- chainRanking: {
630
- chainId: `${string}:${string}`;
631
- name: string;
632
- }[];
633
629
  priceImpactThreshold?: {
634
630
  gasless: number;
635
631
  normal: number;
@@ -647,6 +643,10 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
647
643
  minimumVersion: string;
648
644
  enabled: boolean;
649
645
  } | undefined;
646
+ chainRanking?: {
647
+ chainId: `${string}:${string}`;
648
+ name: string;
649
+ }[] | undefined;
650
650
  }, resultFuncArgs_1: string | number | undefined) => number) & {
651
651
  clearCache: () => void;
652
652
  resultsCount: () => number;
@@ -673,10 +673,6 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
673
673
  other: Record<string, string>;
674
674
  } | undefined;
675
675
  }>;
676
- chainRanking: {
677
- chainId: `${string}:${string}`;
678
- name: string;
679
- }[];
680
676
  priceImpactThreshold?: {
681
677
  gasless: number;
682
678
  normal: number;
@@ -694,6 +690,10 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
694
690
  minimumVersion: string;
695
691
  enabled: boolean;
696
692
  } | undefined;
693
+ chainRanking?: {
694
+ chainId: `${string}:${string}`;
695
+ name: string;
696
+ }[] | undefined;
697
697
  }) & {
698
698
  clearCache: () => void;
699
699
  resultsCount: () => number;
@@ -719,10 +719,6 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
719
719
  other: Record<string, string>;
720
720
  } | undefined;
721
721
  }>;
722
- chainRanking: {
723
- chainId: `${string}:${string}`;
724
- name: string;
725
- }[];
726
722
  priceImpactThreshold?: {
727
723
  gasless: number;
728
724
  normal: number;
@@ -740,6 +736,10 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
740
736
  minimumVersion: string;
741
737
  enabled: boolean;
742
738
  } | undefined;
739
+ chainRanking?: {
740
+ chainId: `${string}:${string}`;
741
+ name: string;
742
+ }[] | undefined;
743
743
  };
744
744
  memoizedResultFunc: ((resultFuncArgs_0: any) => {
745
745
  refreshRate: number;
@@ -761,10 +761,6 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
761
761
  other: Record<string, string>;
762
762
  } | undefined;
763
763
  }>;
764
- chainRanking: {
765
- chainId: `${string}:${string}`;
766
- name: string;
767
- }[];
768
764
  priceImpactThreshold?: {
769
765
  gasless: number;
770
766
  normal: number;
@@ -782,6 +778,10 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
782
778
  minimumVersion: string;
783
779
  enabled: boolean;
784
780
  } | undefined;
781
+ chainRanking?: {
782
+ chainId: `${string}:${string}`;
783
+ name: string;
784
+ }[] | undefined;
785
785
  }) & {
786
786
  clearCache: () => void;
787
787
  resultsCount: () => number;
@@ -807,10 +807,6 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
807
807
  other: Record<string, string>;
808
808
  } | undefined;
809
809
  }>;
810
- chainRanking: {
811
- chainId: `${string}:${string}`;
812
- name: string;
813
- }[];
814
810
  priceImpactThreshold?: {
815
811
  gasless: number;
816
812
  normal: number;
@@ -828,6 +824,10 @@ export declare const selectIsQuoteExpired: ((state: RemoteFeatureFlagControllerS
828
824
  minimumVersion: string;
829
825
  enabled: boolean;
830
826
  } | undefined;
827
+ chainRanking?: {
828
+ chainId: `${string}:${string}`;
829
+ name: string;
830
+ }[] | undefined;
831
831
  };
832
832
  dependencies: [(state: RemoteFeatureFlagControllerState) => unknown];
833
833
  recomputations: () => number;
@@ -20782,10 +20782,6 @@ export declare const selectBridgeQuotes: ((state: BridgeControllerState & {
20782
20782
  other: Record<string, string>;
20783
20783
  } | undefined;
20784
20784
  }>;
20785
- chainRanking: {
20786
- chainId: `${string}:${string}`;
20787
- name: string;
20788
- }[];
20789
20785
  priceImpactThreshold?: {
20790
20786
  gasless: number;
20791
20787
  normal: number;
@@ -20803,6 +20799,10 @@ export declare const selectBridgeQuotes: ((state: BridgeControllerState & {
20803
20799
  minimumVersion: string;
20804
20800
  enabled: boolean;
20805
20801
  } | undefined;
20802
+ chainRanking?: {
20803
+ chainId: `${string}:${string}`;
20804
+ name: string;
20805
+ }[] | undefined;
20806
20806
  }, resultFuncArgs_1: boolean | undefined, resultFuncArgs_2: number) => boolean;
20807
20807
  memoizedResultFunc: ((resultFuncArgs_0: {
20808
20808
  refreshRate: number;
@@ -20824,10 +20824,6 @@ export declare const selectBridgeQuotes: ((state: BridgeControllerState & {
20824
20824
  other: Record<string, string>;
20825
20825
  } | undefined;
20826
20826
  }>;
20827
- chainRanking: {
20828
- chainId: `${string}:${string}`;
20829
- name: string;
20830
- }[];
20831
20827
  priceImpactThreshold?: {
20832
20828
  gasless: number;
20833
20829
  normal: number;
@@ -20845,6 +20841,10 @@ export declare const selectBridgeQuotes: ((state: BridgeControllerState & {
20845
20841
  minimumVersion: string;
20846
20842
  enabled: boolean;
20847
20843
  } | undefined;
20844
+ chainRanking?: {
20845
+ chainId: `${string}:${string}`;
20846
+ name: string;
20847
+ }[] | undefined;
20848
20848
  }, resultFuncArgs_1: boolean | undefined, resultFuncArgs_2: number) => boolean) & {
20849
20849
  clearCache: () => void;
20850
20850
  resultsCount: () => number;
@@ -20871,10 +20871,6 @@ export declare const selectBridgeQuotes: ((state: BridgeControllerState & {
20871
20871
  other: Record<string, string>;
20872
20872
  } | undefined;
20873
20873
  }>;
20874
- chainRanking: {
20875
- chainId: `${string}:${string}`;
20876
- name: string;
20877
- }[];
20878
20874
  priceImpactThreshold?: {
20879
20875
  gasless: number;
20880
20876
  normal: number;
@@ -20892,6 +20888,10 @@ export declare const selectBridgeQuotes: ((state: BridgeControllerState & {
20892
20888
  minimumVersion: string;
20893
20889
  enabled: boolean;
20894
20890
  } | undefined;
20891
+ chainRanking?: {
20892
+ chainId: `${string}:${string}`;
20893
+ name: string;
20894
+ }[] | undefined;
20895
20895
  }) & {
20896
20896
  clearCache: () => void;
20897
20897
  resultsCount: () => number;
@@ -20917,10 +20917,6 @@ export declare const selectBridgeQuotes: ((state: BridgeControllerState & {
20917
20917
  other: Record<string, string>;
20918
20918
  } | undefined;
20919
20919
  }>;
20920
- chainRanking: {
20921
- chainId: `${string}:${string}`;
20922
- name: string;
20923
- }[];
20924
20920
  priceImpactThreshold?: {
20925
20921
  gasless: number;
20926
20922
  normal: number;
@@ -20938,6 +20934,10 @@ export declare const selectBridgeQuotes: ((state: BridgeControllerState & {
20938
20934
  minimumVersion: string;
20939
20935
  enabled: boolean;
20940
20936
  } | undefined;
20937
+ chainRanking?: {
20938
+ chainId: `${string}:${string}`;
20939
+ name: string;
20940
+ }[] | undefined;
20941
20941
  };
20942
20942
  memoizedResultFunc: ((resultFuncArgs_0: any) => {
20943
20943
  refreshRate: number;
@@ -20959,10 +20959,6 @@ export declare const selectBridgeQuotes: ((state: BridgeControllerState & {
20959
20959
  other: Record<string, string>;
20960
20960
  } | undefined;
20961
20961
  }>;
20962
- chainRanking: {
20963
- chainId: `${string}:${string}`;
20964
- name: string;
20965
- }[];
20966
20962
  priceImpactThreshold?: {
20967
20963
  gasless: number;
20968
20964
  normal: number;
@@ -20980,6 +20976,10 @@ export declare const selectBridgeQuotes: ((state: BridgeControllerState & {
20980
20976
  minimumVersion: string;
20981
20977
  enabled: boolean;
20982
20978
  } | undefined;
20979
+ chainRanking?: {
20980
+ chainId: `${string}:${string}`;
20981
+ name: string;
20982
+ }[] | undefined;
20983
20983
  }) & {
20984
20984
  clearCache: () => void;
20985
20985
  resultsCount: () => number;
@@ -21005,10 +21005,6 @@ export declare const selectBridgeQuotes: ((state: BridgeControllerState & {
21005
21005
  other: Record<string, string>;
21006
21006
  } | undefined;
21007
21007
  }>;
21008
- chainRanking: {
21009
- chainId: `${string}:${string}`;
21010
- name: string;
21011
- }[];
21012
21008
  priceImpactThreshold?: {
21013
21009
  gasless: number;
21014
21010
  normal: number;
@@ -21026,6 +21022,10 @@ export declare const selectBridgeQuotes: ((state: BridgeControllerState & {
21026
21022
  minimumVersion: string;
21027
21023
  enabled: boolean;
21028
21024
  } | undefined;
21025
+ chainRanking?: {
21026
+ chainId: `${string}:${string}`;
21027
+ name: string;
21028
+ }[] | undefined;
21029
21029
  };
21030
21030
  dependencies: [(state: RemoteFeatureFlagControllerState) => unknown];
21031
21031
  recomputations: () => number;
@@ -6,10 +6,6 @@ export declare const formatFeatureFlags: (bridgeFeatureFlags: FeatureFlagsPlatfo
6
6
  minimumVersion: string;
7
7
  maxRefreshCount: number;
8
8
  support: boolean;
9
- chainRanking: {
10
- chainId: `${string}:${string}`;
11
- name: string;
12
- }[];
13
9
  priceImpactThreshold?: {
14
10
  gasless: number;
15
11
  normal: number;
@@ -27,6 +23,10 @@ export declare const formatFeatureFlags: (bridgeFeatureFlags: FeatureFlagsPlatfo
27
23
  minimumVersion: string;
28
24
  enabled: boolean;
29
25
  } | undefined;
26
+ chainRanking?: {
27
+ chainId: `${string}:${string}`;
28
+ name: string;
29
+ }[] | undefined;
30
30
  };
31
31
  export declare const processFeatureFlags: (bridgeFeatureFlags: unknown) => FeatureFlagsPlatformConfig;
32
32
  /**
@@ -6,10 +6,6 @@ export declare const formatFeatureFlags: (bridgeFeatureFlags: FeatureFlagsPlatfo
6
6
  minimumVersion: string;
7
7
  maxRefreshCount: number;
8
8
  support: boolean;
9
- chainRanking: {
10
- chainId: `${string}:${string}`;
11
- name: string;
12
- }[];
13
9
  priceImpactThreshold?: {
14
10
  gasless: number;
15
11
  normal: number;
@@ -27,6 +23,10 @@ export declare const formatFeatureFlags: (bridgeFeatureFlags: FeatureFlagsPlatfo
27
23
  minimumVersion: string;
28
24
  enabled: boolean;
29
25
  } | undefined;
26
+ chainRanking?: {
27
+ chainId: `${string}:${string}`;
28
+ name: string;
29
+ }[] | undefined;
30
30
  };
31
31
  export declare const processFeatureFlags: (bridgeFeatureFlags: unknown) => FeatureFlagsPlatformConfig;
32
32
  /**
@@ -82,7 +82,7 @@ exports.ChainRankingItemSchema = (0, superstruct_1.type)({
82
82
  */
83
83
  name: (0, superstruct_1.string)(),
84
84
  });
85
- exports.ChainRankingSchema = (0, superstruct_1.array)(exports.ChainRankingItemSchema);
85
+ exports.ChainRankingSchema = (0, superstruct_1.optional)((0, superstruct_1.array)(exports.ChainRankingItemSchema));
86
86
  exports.ChainConfigurationSchema = (0, superstruct_1.type)({
87
87
  isActiveSrc: (0, superstruct_1.boolean)(),
88
88
  isActiveDest: (0, superstruct_1.boolean)(),
@@ -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,2CAIyB;AAEzB,IAAY,OAIX;AAJD,WAAY,OAAO;IACjB,oCAAyB,CAAA;IACzB,4BAAiB,CAAA;IACjB,2BAAgB,CAAA;AAClB,CAAC,EAJW,OAAO,uBAAP,OAAO,QAIlB;AAED,IAAY,SAEX;AAFD,WAAY,SAAS;IACnB,4BAAe,CAAA;AACjB,CAAC,EAFW,SAAS,yBAAT,SAAS,QAEpB;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,EAA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AE;IAC1C,QAAQ,EAAE,IAAA,sBAAQ,EAAC,IAAA,mBAAK,EAAC,CAAC,oBAAY,EAAE,2BAAmB,CAAC,CAAC,CAAC;IAC9D,KAAK,EAAE,IAAA,mBAAK,EAAC;QACX,oBAAY;QACZ,8BAAsB;QACtB,2BAAmB;QACnB,IAAA,oBAAM,GAAE;KACT,CAAC;CACH,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 {\n CaipAssetTypeStruct,\n CaipChainIdStruct,\n isStrictHexString,\n} from '@metamask/utils';\n\nexport enum FeeType {\n METABRIDGE = 'metabridge',\n REFUEL = 'refuel',\n TX_FEE = 'txFee',\n}\n\nexport enum FeatureId {\n PERPS = 'perps',\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\nconst VersionStringSchema = define<string>(\n 'VersionString',\n (v: unknown) =>\n typeof v === 'string' &&\n /^(\\d+\\.*){2}\\d+$/u.test(v) &&\n v.split('.').length === 3,\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\nconst DefaultPairSchema = type({\n /**\n * The standard default pairs. Use this if the pair is only set once.\n * The key is the CAIP asset type of the src token and the value is the CAIP asset type of the dest token.\n */\n standard: record(string(), string()),\n /**\n * The other default pairs. Use this if the dest token depends on the src token and can be set multiple times.\n * The key is the CAIP asset type of the src token and the value is the CAIP asset type of the dest token.\n */\n other: record(string(), string()),\n});\n\nexport const ChainRankingItemSchema = type({\n /**\n * The CAIP-2 chain identifier (e.g., \"eip155:1\" for Ethereum mainnet)\n */\n chainId: CaipChainIdStruct,\n /**\n * The display name of the chain (e.g., \"Ethereum\")\n */\n name: string(),\n});\n\nexport const ChainRankingSchema = array(ChainRankingItemSchema);\n\nexport const ChainConfigurationSchema = type({\n isActiveSrc: boolean(),\n isActiveDest: boolean(),\n refreshRate: optional(number()),\n topAssets: optional(array(string())),\n stablecoins: optional(array(string())),\n isUnifiedUIEnabled: optional(boolean()),\n isSingleSwapBridgeButtonEnabled: optional(boolean()),\n isGaslessSwapEnabled: optional(boolean()),\n noFeeAssets: optional(array(string())),\n defaultPairs: optional(DefaultPairSchema),\n});\n\nexport const PriceImpactThresholdSchema = type({\n gasless: number(),\n normal: number(),\n});\n\nconst GenericQuoteRequestSchema = type({\n aggIds: optional(array(string())),\n bridgeIds: optional(array(string())),\n fee: optional(number()),\n});\n\nconst FeatureIdSchema = enums(Object.values(FeatureId));\n\n/**\n * This is the schema for the feature flags response from the RemoteFeatureFlagController\n */\nexport const PlatformConfigSchema = type({\n priceImpactThreshold: optional(PriceImpactThresholdSchema),\n quoteRequestOverrides: optional(\n record(FeatureIdSchema, optional(GenericQuoteRequestSchema)),\n ),\n minimumVersion: string(),\n refreshRate: number(),\n maxRefreshCount: number(),\n support: boolean(),\n chains: record(string(), ChainConfigurationSchema),\n /**\n * The bip44 default pairs for the chains\n * Key is the CAIP chainId namespace\n */\n bip44DefaultPairs: optional(record(string(), optional(DefaultPairSchema))),\n sse: optional(\n type({\n enabled: boolean(),\n /**\n * The minimum version of the client required to enable SSE, for example 13.8.0\n */\n minimumVersion: VersionStringSchema,\n }),\n ),\n /**\n * Array of chain objects ordered by preference/ranking\n */\n chainRanking: ChainRankingSchema,\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\n// Allow digit strings for amounts/validTo for flexibility across providers\nconst DigitStringOrNumberSchema = union([TruthyDigitStringSchema, number()]);\n\n/**\n * Identifier of the intent protocol used for order creation and submission.\n *\n * Examples:\n * - CoW Swap\n * - Other EIP-712–based intent protocols\n */\nconst IntentProtocolSchema = string();\n\n/**\n * Schema for an intent-based order used for EIP-712 signing and submission.\n *\n * This represents the minimal subset of fields required by intent-based\n * protocols (e.g. CoW Swap) to build, sign, and submit an order.\n */\nexport const IntentOrderSchema = type({\n /**\n * Address of the token being sold.\n */\n sellToken: HexAddressSchema,\n\n /**\n * Address of the token being bought.\n */\n buyToken: HexAddressSchema,\n\n /**\n * Optional receiver of the bought tokens.\n * If omitted, defaults to the signer / order owner.\n */\n receiver: optional(HexAddressSchema),\n\n /**\n * Order expiration time.\n *\n * Can be provided as a UNIX timestamp in seconds, either as a number\n * or as a digit string, depending on provider requirements.\n */\n validTo: DigitStringOrNumberSchema,\n\n /**\n * Arbitrary application-specific data attached to the order.\n */\n appData: string(),\n\n /**\n * Hash of the `appData` field, used for EIP-712 signing.\n */\n appDataHash: HexStringSchema,\n\n /**\n * Fee amount paid for order execution, expressed as a digit string.\n */\n feeAmount: TruthyDigitStringSchema,\n\n /**\n * Order kind.\n *\n * - `sell`: exact sell amount, variable buy amount\n * - `buy`: exact buy amount, variable sell amount\n */\n kind: enums(['sell', 'buy']),\n\n /**\n * Whether the order can be partially filled.\n */\n partiallyFillable: boolean(),\n\n /**\n * Exact amount of the sell token.\n *\n * Required for `sell` orders.\n */\n sellAmount: optional(TruthyDigitStringSchema),\n\n /**\n * Exact amount of the buy token.\n *\n * Required for `buy` orders.\n */\n buyAmount: optional(TruthyDigitStringSchema),\n\n /**\n * Optional order owner / sender address.\n *\n * Provided for convenience when building the EIP-712 domain and message.\n */\n from: optional(HexAddressSchema),\n});\n\n/**\n * Schema representing an intent submission payload.\n *\n * Wraps the intent order along with protocol and optional routing metadata\n * required by the backend or relayer infrastructure.\n */\nexport const IntentSchema = type({\n /**\n * Identifier of the intent protocol used to interpret the order.\n */\n protocol: IntentProtocolSchema,\n\n /**\n * The intent order to be signed and submitted.\n */\n order: IntentOrderSchema,\n\n /**\n * Optional settlement contract address used for execution.\n */\n settlementContract: optional(HexAddressSchema),\n\n /**\n * Optional relayer address responsible for order submission.\n */\n relayer: optional(HexAddressSchema),\n});\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 /**\n * The minimum amount that will be received, in atomic amount\n */\n minDestTokenAmount: 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 /**\n * Whether the quote can use EIP-7702 delegated gasless execution\n */\n gasIncluded7702: 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 totalFeeAmountUsd: optional(string()),\n }),\n ),\n intent: optional(IntentSchema),\n /**\n * A third party sponsors the gas. If true, then gasIncluded7702 is also true.\n */\n gasSponsored: optional(boolean()),\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 effectiveGas: optional(number()),\n});\n\nexport const BitcoinTradeDataSchema = type({\n unsignedPsbtBase64: string(),\n inputsToSign: nullable(array(type({}))),\n});\n\nexport const TronTradeDataSchema = type({\n raw_data_hex: string(),\n visible: optional(boolean()),\n raw_data: optional(\n nullable(\n type({\n contract: optional(\n array(\n type({\n type: optional(string()),\n }),\n ),\n ),\n fee_limit: optional(number()),\n }),\n ),\n ),\n});\n\nexport const QuoteResponseSchema = type({\n quote: QuoteSchema,\n estimatedProcessingTimeInSeconds: number(),\n approval: optional(union([TxDataSchema, TronTradeDataSchema])),\n trade: union([\n TxDataSchema,\n BitcoinTradeDataSchema,\n TronTradeDataSchema,\n string(),\n ]),\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,2CAIyB;AAEzB,IAAY,OAIX;AAJD,WAAY,OAAO;IACjB,oCAAyB,CAAA;IACzB,4BAAiB,CAAA;IACjB,2BAAgB,CAAA;AAClB,CAAC,EAJW,OAAO,uBAAP,OAAO,QAIlB;AAED,IAAY,SAEX;AAFD,WAAY,SAAS;IACnB,4BAAe,CAAA;AACjB,CAAC,EAFW,SAAS,yBAAT,SAAS,QAEpB;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,yBAAiB,EAAC,CAAW,CAAC,CAC/B,CAAC;AAEF,MAAM,mBAAmB,GAAG,IAAA,oBAAM,EAChC,eAAe,EACf,CAAC,CAAU,EAAE,EAAE,CACb,OAAO,CAAC,KAAK,QAAQ;IACrB,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3B,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAC5B,CAAC;AAEK,MAAM,YAAY,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,OAAO,CAAC,CAA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,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 {\n CaipAssetTypeStruct,\n CaipChainIdStruct,\n isStrictHexString,\n} from '@metamask/utils';\n\nexport enum FeeType {\n METABRIDGE = 'metabridge',\n REFUEL = 'refuel',\n TX_FEE = 'txFee',\n}\n\nexport enum FeatureId {\n PERPS = 'perps',\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\nconst VersionStringSchema = define<string>(\n 'VersionString',\n (v: unknown) =>\n typeof v === 'string' &&\n /^(\\d+\\.*){2}\\d+$/u.test(v) &&\n v.split('.').length === 3,\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\nconst DefaultPairSchema = type({\n /**\n * The standard default pairs. Use this if the pair is only set once.\n * The key is the CAIP asset type of the src token and the value is the CAIP asset type of the dest token.\n */\n standard: record(string(), string()),\n /**\n * The other default pairs. Use this if the dest token depends on the src token and can be set multiple times.\n * The key is the CAIP asset type of the src token and the value is the CAIP asset type of the dest token.\n */\n other: record(string(), string()),\n});\n\nexport const ChainRankingItemSchema = type({\n /**\n * The CAIP-2 chain identifier (e.g., \"eip155:1\" for Ethereum mainnet)\n */\n chainId: CaipChainIdStruct,\n /**\n * The display name of the chain (e.g., \"Ethereum\")\n */\n name: string(),\n});\n\nexport const ChainRankingSchema = optional(array(ChainRankingItemSchema));\n\nexport const ChainConfigurationSchema = type({\n isActiveSrc: boolean(),\n isActiveDest: boolean(),\n refreshRate: optional(number()),\n topAssets: optional(array(string())),\n stablecoins: optional(array(string())),\n isUnifiedUIEnabled: optional(boolean()),\n isSingleSwapBridgeButtonEnabled: optional(boolean()),\n isGaslessSwapEnabled: optional(boolean()),\n noFeeAssets: optional(array(string())),\n defaultPairs: optional(DefaultPairSchema),\n});\n\nexport const PriceImpactThresholdSchema = type({\n gasless: number(),\n normal: number(),\n});\n\nconst GenericQuoteRequestSchema = type({\n aggIds: optional(array(string())),\n bridgeIds: optional(array(string())),\n fee: optional(number()),\n});\n\nconst FeatureIdSchema = enums(Object.values(FeatureId));\n\n/**\n * This is the schema for the feature flags response from the RemoteFeatureFlagController\n */\nexport const PlatformConfigSchema = type({\n priceImpactThreshold: optional(PriceImpactThresholdSchema),\n quoteRequestOverrides: optional(\n record(FeatureIdSchema, optional(GenericQuoteRequestSchema)),\n ),\n minimumVersion: string(),\n refreshRate: number(),\n maxRefreshCount: number(),\n support: boolean(),\n chains: record(string(), ChainConfigurationSchema),\n /**\n * The bip44 default pairs for the chains\n * Key is the CAIP chainId namespace\n */\n bip44DefaultPairs: optional(record(string(), optional(DefaultPairSchema))),\n sse: optional(\n type({\n enabled: boolean(),\n /**\n * The minimum version of the client required to enable SSE, for example 13.8.0\n */\n minimumVersion: VersionStringSchema,\n }),\n ),\n /**\n * Array of chain objects ordered by preference/ranking\n */\n chainRanking: ChainRankingSchema,\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\n// Allow digit strings for amounts/validTo for flexibility across providers\nconst DigitStringOrNumberSchema = union([TruthyDigitStringSchema, number()]);\n\n/**\n * Identifier of the intent protocol used for order creation and submission.\n *\n * Examples:\n * - CoW Swap\n * - Other EIP-712–based intent protocols\n */\nconst IntentProtocolSchema = string();\n\n/**\n * Schema for an intent-based order used for EIP-712 signing and submission.\n *\n * This represents the minimal subset of fields required by intent-based\n * protocols (e.g. CoW Swap) to build, sign, and submit an order.\n */\nexport const IntentOrderSchema = type({\n /**\n * Address of the token being sold.\n */\n sellToken: HexAddressSchema,\n\n /**\n * Address of the token being bought.\n */\n buyToken: HexAddressSchema,\n\n /**\n * Optional receiver of the bought tokens.\n * If omitted, defaults to the signer / order owner.\n */\n receiver: optional(HexAddressSchema),\n\n /**\n * Order expiration time.\n *\n * Can be provided as a UNIX timestamp in seconds, either as a number\n * or as a digit string, depending on provider requirements.\n */\n validTo: DigitStringOrNumberSchema,\n\n /**\n * Arbitrary application-specific data attached to the order.\n */\n appData: string(),\n\n /**\n * Hash of the `appData` field, used for EIP-712 signing.\n */\n appDataHash: HexStringSchema,\n\n /**\n * Fee amount paid for order execution, expressed as a digit string.\n */\n feeAmount: TruthyDigitStringSchema,\n\n /**\n * Order kind.\n *\n * - `sell`: exact sell amount, variable buy amount\n * - `buy`: exact buy amount, variable sell amount\n */\n kind: enums(['sell', 'buy']),\n\n /**\n * Whether the order can be partially filled.\n */\n partiallyFillable: boolean(),\n\n /**\n * Exact amount of the sell token.\n *\n * Required for `sell` orders.\n */\n sellAmount: optional(TruthyDigitStringSchema),\n\n /**\n * Exact amount of the buy token.\n *\n * Required for `buy` orders.\n */\n buyAmount: optional(TruthyDigitStringSchema),\n\n /**\n * Optional order owner / sender address.\n *\n * Provided for convenience when building the EIP-712 domain and message.\n */\n from: optional(HexAddressSchema),\n});\n\n/**\n * Schema representing an intent submission payload.\n *\n * Wraps the intent order along with protocol and optional routing metadata\n * required by the backend or relayer infrastructure.\n */\nexport const IntentSchema = type({\n /**\n * Identifier of the intent protocol used to interpret the order.\n */\n protocol: IntentProtocolSchema,\n\n /**\n * The intent order to be signed and submitted.\n */\n order: IntentOrderSchema,\n\n /**\n * Optional settlement contract address used for execution.\n */\n settlementContract: optional(HexAddressSchema),\n\n /**\n * Optional relayer address responsible for order submission.\n */\n relayer: optional(HexAddressSchema),\n});\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 /**\n * The minimum amount that will be received, in atomic amount\n */\n minDestTokenAmount: 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 /**\n * Whether the quote can use EIP-7702 delegated gasless execution\n */\n gasIncluded7702: 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 totalFeeAmountUsd: optional(string()),\n }),\n ),\n intent: optional(IntentSchema),\n /**\n * A third party sponsors the gas. If true, then gasIncluded7702 is also true.\n */\n gasSponsored: optional(boolean()),\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 effectiveGas: optional(number()),\n});\n\nexport const BitcoinTradeDataSchema = type({\n unsignedPsbtBase64: string(),\n inputsToSign: nullable(array(type({}))),\n});\n\nexport const TronTradeDataSchema = type({\n raw_data_hex: string(),\n visible: optional(boolean()),\n raw_data: optional(\n nullable(\n type({\n contract: optional(\n array(\n type({\n type: optional(string()),\n }),\n ),\n ),\n fee_limit: optional(number()),\n }),\n ),\n ),\n});\n\nexport const QuoteResponseSchema = type({\n quote: QuoteSchema,\n estimatedProcessingTimeInSeconds: number(),\n approval: optional(union([TxDataSchema, TronTradeDataSchema])),\n trade: union([\n TxDataSchema,\n BitcoinTradeDataSchema,\n TronTradeDataSchema,\n string(),\n ]),\n});\n\nexport const validateQuoteResponse = (\n data: unknown,\n): data is Infer<typeof QuoteResponseSchema> => {\n assert(data, QuoteResponseSchema);\n return true;\n};\n"]}
@@ -68,7 +68,7 @@ export declare const ChainRankingItemSchema: import("@metamask/superstruct").Str
68
68
  export declare const ChainRankingSchema: import("@metamask/superstruct").Struct<{
69
69
  chainId: `${string}:${string}`;
70
70
  name: string;
71
- }[], import("@metamask/superstruct").Struct<{
71
+ }[] | undefined, import("@metamask/superstruct").Struct<{
72
72
  chainId: `${string}:${string}`;
73
73
  name: string;
74
74
  }, {
@@ -151,10 +151,6 @@ export declare const PlatformConfigSchema: import("@metamask/superstruct").Struc
151
151
  other: Record<string, string>;
152
152
  } | undefined;
153
153
  }>;
154
- chainRanking: {
155
- chainId: `${string}:${string}`;
156
- name: string;
157
- }[];
158
154
  priceImpactThreshold?: {
159
155
  gasless: number;
160
156
  normal: number;
@@ -172,6 +168,10 @@ export declare const PlatformConfigSchema: import("@metamask/superstruct").Struc
172
168
  minimumVersion: string;
173
169
  enabled: boolean;
174
170
  } | undefined;
171
+ chainRanking?: {
172
+ chainId: `${string}:${string}`;
173
+ name: string;
174
+ }[] | undefined;
175
175
  }, {
176
176
  priceImpactThreshold: import("@metamask/superstruct").Struct<{
177
177
  gasless: number;
@@ -228,7 +228,7 @@ export declare const PlatformConfigSchema: import("@metamask/superstruct").Struc
228
228
  chainRanking: import("@metamask/superstruct").Struct<{
229
229
  chainId: `${string}:${string}`;
230
230
  name: string;
231
- }[], import("@metamask/superstruct").Struct<{
231
+ }[] | undefined, import("@metamask/superstruct").Struct<{
232
232
  chainId: `${string}:${string}`;
233
233
  name: string;
234
234
  }, {
@@ -262,10 +262,6 @@ export declare const validateFeatureFlagsResponse: (data: unknown) => data is {
262
262
  other: Record<string, string>;
263
263
  } | undefined;
264
264
  }>;
265
- chainRanking: {
266
- chainId: `${string}:${string}`;
267
- name: string;
268
- }[];
269
265
  priceImpactThreshold?: {
270
266
  gasless: number;
271
267
  normal: number;
@@ -283,6 +279,10 @@ export declare const validateFeatureFlagsResponse: (data: unknown) => data is {
283
279
  minimumVersion: string;
284
280
  enabled: boolean;
285
281
  } | undefined;
282
+ chainRanking?: {
283
+ chainId: `${string}:${string}`;
284
+ name: string;
285
+ }[] | undefined;
286
286
  };
287
287
  export declare const validateSwapsTokenObject: (data: unknown) => data is {
288
288
  symbol: string;