@metamask-previews/bridge-controller 64.1.0-preview-8a0c757a → 64.2.0-preview-e776a73
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 +9 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/selectors.d.cts +354 -1836
- package/dist/selectors.d.cts.map +1 -1
- package/dist/selectors.d.mts +354 -1836
- package/dist/selectors.d.mts.map +1 -1
- package/dist/types.cjs +0 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +1 -4
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +1 -4
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs +0 -1
- package/dist/types.mjs.map +1 -1
- package/dist/utils/bridge.d.cts +2 -2
- package/dist/utils/bridge.d.mts +2 -2
- package/dist/utils/trade-utils.d.cts +1 -1
- package/dist/utils/trade-utils.d.mts +1 -1
- package/dist/utils/validators.cjs +1 -30
- package/dist/utils/validators.cjs.map +1 -1
- package/dist/utils/validators.d.cts +7 -281
- package/dist/utils/validators.d.cts.map +1 -1
- package/dist/utils/validators.d.mts +7 -281
- package/dist/utils/validators.d.mts.map +1 -1
- package/dist/utils/validators.mjs +0 -29
- package/dist/utils/validators.mjs.map +1 -1
- package/package.json +4 -4
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Infer } from "@metamask/superstruct";
|
|
2
1
|
export declare enum FeeType {
|
|
3
2
|
METABRIDGE = "metabridge",
|
|
4
3
|
REFUEL = "refuel",
|
|
@@ -434,93 +433,6 @@ export declare const StepSchema: import("@metamask/superstruct").Struct<{
|
|
|
434
433
|
icon: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
435
434
|
}>;
|
|
436
435
|
}>;
|
|
437
|
-
export declare const IntentOrderSchema: import("@metamask/superstruct").Struct<{
|
|
438
|
-
sellToken: string;
|
|
439
|
-
buyToken: string;
|
|
440
|
-
validTo: string | number;
|
|
441
|
-
appData: string;
|
|
442
|
-
appDataHash: string;
|
|
443
|
-
feeAmount: string;
|
|
444
|
-
kind: "sell" | "buy";
|
|
445
|
-
partiallyFillable: boolean;
|
|
446
|
-
receiver?: string | undefined;
|
|
447
|
-
sellAmount?: string | undefined;
|
|
448
|
-
buyAmount?: string | undefined;
|
|
449
|
-
from?: string | undefined;
|
|
450
|
-
}, {
|
|
451
|
-
sellToken: import("@metamask/superstruct").Struct<string, null>;
|
|
452
|
-
buyToken: import("@metamask/superstruct").Struct<string, null>;
|
|
453
|
-
receiver: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
454
|
-
validTo: import("@metamask/superstruct").Struct<string | number, null>;
|
|
455
|
-
appData: import("@metamask/superstruct").Struct<string, null>;
|
|
456
|
-
appDataHash: import("@metamask/superstruct").Struct<string, null>;
|
|
457
|
-
feeAmount: import("@metamask/superstruct").Struct<string, null>;
|
|
458
|
-
kind: import("@metamask/superstruct").Struct<"sell" | "buy", {
|
|
459
|
-
sell: "sell";
|
|
460
|
-
buy: "buy";
|
|
461
|
-
}>;
|
|
462
|
-
partiallyFillable: import("@metamask/superstruct").Struct<boolean, null>;
|
|
463
|
-
sellAmount: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
464
|
-
buyAmount: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
465
|
-
from: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
466
|
-
}>;
|
|
467
|
-
export declare const IntentSchema: import("@metamask/superstruct").Struct<{
|
|
468
|
-
protocol: "cowswap";
|
|
469
|
-
order: {
|
|
470
|
-
sellToken: string;
|
|
471
|
-
buyToken: string;
|
|
472
|
-
validTo: string | number;
|
|
473
|
-
appData: string;
|
|
474
|
-
appDataHash: string;
|
|
475
|
-
feeAmount: string;
|
|
476
|
-
kind: "sell" | "buy";
|
|
477
|
-
partiallyFillable: boolean;
|
|
478
|
-
receiver?: string | undefined;
|
|
479
|
-
sellAmount?: string | undefined;
|
|
480
|
-
buyAmount?: string | undefined;
|
|
481
|
-
from?: string | undefined;
|
|
482
|
-
};
|
|
483
|
-
settlementContract?: string | undefined;
|
|
484
|
-
relayer?: string | undefined;
|
|
485
|
-
}, {
|
|
486
|
-
protocol: import("@metamask/superstruct").Struct<"cowswap", {
|
|
487
|
-
cowswap: "cowswap";
|
|
488
|
-
}>;
|
|
489
|
-
order: import("@metamask/superstruct").Struct<{
|
|
490
|
-
sellToken: string;
|
|
491
|
-
buyToken: string;
|
|
492
|
-
validTo: string | number;
|
|
493
|
-
appData: string;
|
|
494
|
-
appDataHash: string;
|
|
495
|
-
feeAmount: string;
|
|
496
|
-
kind: "sell" | "buy";
|
|
497
|
-
partiallyFillable: boolean;
|
|
498
|
-
receiver?: string | undefined;
|
|
499
|
-
sellAmount?: string | undefined;
|
|
500
|
-
buyAmount?: string | undefined;
|
|
501
|
-
from?: string | undefined;
|
|
502
|
-
}, {
|
|
503
|
-
sellToken: import("@metamask/superstruct").Struct<string, null>;
|
|
504
|
-
buyToken: import("@metamask/superstruct").Struct<string, null>;
|
|
505
|
-
receiver: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
506
|
-
validTo: import("@metamask/superstruct").Struct<string | number, null>;
|
|
507
|
-
appData: import("@metamask/superstruct").Struct<string, null>;
|
|
508
|
-
appDataHash: import("@metamask/superstruct").Struct<string, null>;
|
|
509
|
-
feeAmount: import("@metamask/superstruct").Struct<string, null>;
|
|
510
|
-
kind: import("@metamask/superstruct").Struct<"sell" | "buy", {
|
|
511
|
-
sell: "sell";
|
|
512
|
-
buy: "buy";
|
|
513
|
-
}>;
|
|
514
|
-
partiallyFillable: import("@metamask/superstruct").Struct<boolean, null>;
|
|
515
|
-
sellAmount: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
516
|
-
buyAmount: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
517
|
-
from: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
518
|
-
}>;
|
|
519
|
-
settlementContract: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
520
|
-
relayer: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
521
|
-
}>;
|
|
522
|
-
export type IntentOrder = Infer<typeof IntentOrderSchema>;
|
|
523
|
-
export type Intent = Infer<typeof IntentSchema>;
|
|
524
436
|
export declare const QuoteSchema: import("@metamask/superstruct").Struct<{
|
|
525
437
|
srcChainId: number;
|
|
526
438
|
destChainId: number;
|
|
@@ -653,25 +565,6 @@ export declare const QuoteSchema: import("@metamask/superstruct").Struct<{
|
|
|
653
565
|
priceImpact?: string | undefined;
|
|
654
566
|
totalFeeAmountUsd?: string | undefined;
|
|
655
567
|
} | undefined;
|
|
656
|
-
intent?: {
|
|
657
|
-
protocol: "cowswap";
|
|
658
|
-
order: {
|
|
659
|
-
sellToken: string;
|
|
660
|
-
buyToken: string;
|
|
661
|
-
validTo: string | number;
|
|
662
|
-
appData: string;
|
|
663
|
-
appDataHash: string;
|
|
664
|
-
feeAmount: string;
|
|
665
|
-
kind: "sell" | "buy";
|
|
666
|
-
partiallyFillable: boolean;
|
|
667
|
-
receiver?: string | undefined;
|
|
668
|
-
sellAmount?: string | undefined;
|
|
669
|
-
buyAmount?: string | undefined;
|
|
670
|
-
from?: string | undefined;
|
|
671
|
-
};
|
|
672
|
-
settlementContract?: string | undefined;
|
|
673
|
-
relayer?: string | undefined;
|
|
674
|
-
} | undefined;
|
|
675
568
|
gasSponsored?: boolean | undefined;
|
|
676
569
|
}, {
|
|
677
570
|
requestId: import("@metamask/superstruct").Struct<string, null>;
|
|
@@ -1188,61 +1081,6 @@ export declare const QuoteSchema: import("@metamask/superstruct").Struct<{
|
|
|
1188
1081
|
priceImpact: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
1189
1082
|
totalFeeAmountUsd: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
1190
1083
|
}>;
|
|
1191
|
-
intent: import("@metamask/superstruct").Struct<{
|
|
1192
|
-
protocol: "cowswap";
|
|
1193
|
-
order: {
|
|
1194
|
-
sellToken: string;
|
|
1195
|
-
buyToken: string;
|
|
1196
|
-
validTo: string | number;
|
|
1197
|
-
appData: string;
|
|
1198
|
-
appDataHash: string;
|
|
1199
|
-
feeAmount: string;
|
|
1200
|
-
kind: "sell" | "buy";
|
|
1201
|
-
partiallyFillable: boolean;
|
|
1202
|
-
receiver?: string | undefined;
|
|
1203
|
-
sellAmount?: string | undefined;
|
|
1204
|
-
buyAmount?: string | undefined;
|
|
1205
|
-
from?: string | undefined;
|
|
1206
|
-
};
|
|
1207
|
-
settlementContract?: string | undefined;
|
|
1208
|
-
relayer?: string | undefined;
|
|
1209
|
-
} | undefined, {
|
|
1210
|
-
protocol: import("@metamask/superstruct").Struct<"cowswap", {
|
|
1211
|
-
cowswap: "cowswap";
|
|
1212
|
-
}>;
|
|
1213
|
-
order: import("@metamask/superstruct").Struct<{
|
|
1214
|
-
sellToken: string;
|
|
1215
|
-
buyToken: string;
|
|
1216
|
-
validTo: string | number;
|
|
1217
|
-
appData: string;
|
|
1218
|
-
appDataHash: string;
|
|
1219
|
-
feeAmount: string;
|
|
1220
|
-
kind: "sell" | "buy";
|
|
1221
|
-
partiallyFillable: boolean;
|
|
1222
|
-
receiver?: string | undefined;
|
|
1223
|
-
sellAmount?: string | undefined;
|
|
1224
|
-
buyAmount?: string | undefined;
|
|
1225
|
-
from?: string | undefined;
|
|
1226
|
-
}, {
|
|
1227
|
-
sellToken: import("@metamask/superstruct").Struct<string, null>;
|
|
1228
|
-
buyToken: import("@metamask/superstruct").Struct<string, null>;
|
|
1229
|
-
receiver: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
1230
|
-
validTo: import("@metamask/superstruct").Struct<string | number, null>;
|
|
1231
|
-
appData: import("@metamask/superstruct").Struct<string, null>;
|
|
1232
|
-
appDataHash: import("@metamask/superstruct").Struct<string, null>;
|
|
1233
|
-
feeAmount: import("@metamask/superstruct").Struct<string, null>;
|
|
1234
|
-
kind: import("@metamask/superstruct").Struct<"sell" | "buy", {
|
|
1235
|
-
sell: "sell";
|
|
1236
|
-
buy: "buy";
|
|
1237
|
-
}>;
|
|
1238
|
-
partiallyFillable: import("@metamask/superstruct").Struct<boolean, null>;
|
|
1239
|
-
sellAmount: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
1240
|
-
buyAmount: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
1241
|
-
from: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
1242
|
-
}>;
|
|
1243
|
-
settlementContract: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
1244
|
-
relayer: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
1245
|
-
}>;
|
|
1246
1084
|
/**
|
|
1247
1085
|
* A third party sponsors the gas. If true, then gasIncluded7702 is also true.
|
|
1248
1086
|
*/
|
|
@@ -1250,8 +1088,8 @@ export declare const QuoteSchema: import("@metamask/superstruct").Struct<{
|
|
|
1250
1088
|
}>;
|
|
1251
1089
|
export declare const TxDataSchema: import("@metamask/superstruct").Struct<{
|
|
1252
1090
|
chainId: number;
|
|
1253
|
-
from: string;
|
|
1254
1091
|
to: string;
|
|
1092
|
+
from: string;
|
|
1255
1093
|
value: string;
|
|
1256
1094
|
data: string;
|
|
1257
1095
|
gasLimit: number | null;
|
|
@@ -1433,32 +1271,13 @@ export declare const QuoteResponseSchema: import("@metamask/superstruct").Struct
|
|
|
1433
1271
|
priceImpact?: string | undefined;
|
|
1434
1272
|
totalFeeAmountUsd?: string | undefined;
|
|
1435
1273
|
} | undefined;
|
|
1436
|
-
intent?: {
|
|
1437
|
-
protocol: "cowswap";
|
|
1438
|
-
order: {
|
|
1439
|
-
sellToken: string;
|
|
1440
|
-
buyToken: string;
|
|
1441
|
-
validTo: string | number;
|
|
1442
|
-
appData: string;
|
|
1443
|
-
appDataHash: string;
|
|
1444
|
-
feeAmount: string;
|
|
1445
|
-
kind: "sell" | "buy";
|
|
1446
|
-
partiallyFillable: boolean;
|
|
1447
|
-
receiver?: string | undefined;
|
|
1448
|
-
sellAmount?: string | undefined;
|
|
1449
|
-
buyAmount?: string | undefined;
|
|
1450
|
-
from?: string | undefined;
|
|
1451
|
-
};
|
|
1452
|
-
settlementContract?: string | undefined;
|
|
1453
|
-
relayer?: string | undefined;
|
|
1454
|
-
} | undefined;
|
|
1455
1274
|
gasSponsored?: boolean | undefined;
|
|
1456
1275
|
};
|
|
1457
1276
|
estimatedProcessingTimeInSeconds: number;
|
|
1458
1277
|
trade: string | {
|
|
1459
1278
|
chainId: number;
|
|
1460
|
-
from: string;
|
|
1461
1279
|
to: string;
|
|
1280
|
+
from: string;
|
|
1462
1281
|
value: string;
|
|
1463
1282
|
data: string;
|
|
1464
1283
|
gasLimit: number | null;
|
|
@@ -1478,8 +1297,8 @@ export declare const QuoteResponseSchema: import("@metamask/superstruct").Struct
|
|
|
1478
1297
|
};
|
|
1479
1298
|
approval?: {
|
|
1480
1299
|
chainId: number;
|
|
1481
|
-
from: string;
|
|
1482
1300
|
to: string;
|
|
1301
|
+
from: string;
|
|
1483
1302
|
value: string;
|
|
1484
1303
|
data: string;
|
|
1485
1304
|
gasLimit: number | null;
|
|
@@ -1627,25 +1446,6 @@ export declare const QuoteResponseSchema: import("@metamask/superstruct").Struct
|
|
|
1627
1446
|
priceImpact?: string | undefined;
|
|
1628
1447
|
totalFeeAmountUsd?: string | undefined;
|
|
1629
1448
|
} | undefined;
|
|
1630
|
-
intent?: {
|
|
1631
|
-
protocol: "cowswap";
|
|
1632
|
-
order: {
|
|
1633
|
-
sellToken: string;
|
|
1634
|
-
buyToken: string;
|
|
1635
|
-
validTo: string | number;
|
|
1636
|
-
appData: string;
|
|
1637
|
-
appDataHash: string;
|
|
1638
|
-
feeAmount: string;
|
|
1639
|
-
kind: "sell" | "buy";
|
|
1640
|
-
partiallyFillable: boolean;
|
|
1641
|
-
receiver?: string | undefined;
|
|
1642
|
-
sellAmount?: string | undefined;
|
|
1643
|
-
buyAmount?: string | undefined;
|
|
1644
|
-
from?: string | undefined;
|
|
1645
|
-
};
|
|
1646
|
-
settlementContract?: string | undefined;
|
|
1647
|
-
relayer?: string | undefined;
|
|
1648
|
-
} | undefined;
|
|
1649
1449
|
gasSponsored?: boolean | undefined;
|
|
1650
1450
|
}, {
|
|
1651
1451
|
requestId: import("@metamask/superstruct").Struct<string, null>;
|
|
@@ -2162,61 +1962,6 @@ export declare const QuoteResponseSchema: import("@metamask/superstruct").Struct
|
|
|
2162
1962
|
priceImpact: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
2163
1963
|
totalFeeAmountUsd: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
2164
1964
|
}>;
|
|
2165
|
-
intent: import("@metamask/superstruct").Struct<{
|
|
2166
|
-
protocol: "cowswap";
|
|
2167
|
-
order: {
|
|
2168
|
-
sellToken: string;
|
|
2169
|
-
buyToken: string;
|
|
2170
|
-
validTo: string | number;
|
|
2171
|
-
appData: string;
|
|
2172
|
-
appDataHash: string;
|
|
2173
|
-
feeAmount: string;
|
|
2174
|
-
kind: "sell" | "buy";
|
|
2175
|
-
partiallyFillable: boolean;
|
|
2176
|
-
receiver?: string | undefined;
|
|
2177
|
-
sellAmount?: string | undefined;
|
|
2178
|
-
buyAmount?: string | undefined;
|
|
2179
|
-
from?: string | undefined;
|
|
2180
|
-
};
|
|
2181
|
-
settlementContract?: string | undefined;
|
|
2182
|
-
relayer?: string | undefined;
|
|
2183
|
-
} | undefined, {
|
|
2184
|
-
protocol: import("@metamask/superstruct").Struct<"cowswap", {
|
|
2185
|
-
cowswap: "cowswap";
|
|
2186
|
-
}>;
|
|
2187
|
-
order: import("@metamask/superstruct").Struct<{
|
|
2188
|
-
sellToken: string;
|
|
2189
|
-
buyToken: string;
|
|
2190
|
-
validTo: string | number;
|
|
2191
|
-
appData: string;
|
|
2192
|
-
appDataHash: string;
|
|
2193
|
-
feeAmount: string;
|
|
2194
|
-
kind: "sell" | "buy";
|
|
2195
|
-
partiallyFillable: boolean;
|
|
2196
|
-
receiver?: string | undefined;
|
|
2197
|
-
sellAmount?: string | undefined;
|
|
2198
|
-
buyAmount?: string | undefined;
|
|
2199
|
-
from?: string | undefined;
|
|
2200
|
-
}, {
|
|
2201
|
-
sellToken: import("@metamask/superstruct").Struct<string, null>;
|
|
2202
|
-
buyToken: import("@metamask/superstruct").Struct<string, null>;
|
|
2203
|
-
receiver: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
2204
|
-
validTo: import("@metamask/superstruct").Struct<string | number, null>;
|
|
2205
|
-
appData: import("@metamask/superstruct").Struct<string, null>;
|
|
2206
|
-
appDataHash: import("@metamask/superstruct").Struct<string, null>;
|
|
2207
|
-
feeAmount: import("@metamask/superstruct").Struct<string, null>;
|
|
2208
|
-
kind: import("@metamask/superstruct").Struct<"sell" | "buy", {
|
|
2209
|
-
sell: "sell";
|
|
2210
|
-
buy: "buy";
|
|
2211
|
-
}>;
|
|
2212
|
-
partiallyFillable: import("@metamask/superstruct").Struct<boolean, null>;
|
|
2213
|
-
sellAmount: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
2214
|
-
buyAmount: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
2215
|
-
from: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
2216
|
-
}>;
|
|
2217
|
-
settlementContract: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
2218
|
-
relayer: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
2219
|
-
}>;
|
|
2220
1965
|
/**
|
|
2221
1966
|
* A third party sponsors the gas. If true, then gasIncluded7702 is also true.
|
|
2222
1967
|
*/
|
|
@@ -2225,8 +1970,8 @@ export declare const QuoteResponseSchema: import("@metamask/superstruct").Struct
|
|
|
2225
1970
|
estimatedProcessingTimeInSeconds: import("@metamask/superstruct").Struct<number, null>;
|
|
2226
1971
|
approval: import("@metamask/superstruct").Struct<{
|
|
2227
1972
|
chainId: number;
|
|
2228
|
-
from: string;
|
|
2229
1973
|
to: string;
|
|
1974
|
+
from: string;
|
|
2230
1975
|
value: string;
|
|
2231
1976
|
data: string;
|
|
2232
1977
|
gasLimit: number | null;
|
|
@@ -2243,8 +1988,8 @@ export declare const QuoteResponseSchema: import("@metamask/superstruct").Struct
|
|
|
2243
1988
|
} | undefined, null>;
|
|
2244
1989
|
trade: import("@metamask/superstruct").Struct<string | {
|
|
2245
1990
|
chainId: number;
|
|
2246
|
-
from: string;
|
|
2247
1991
|
to: string;
|
|
1992
|
+
from: string;
|
|
2248
1993
|
value: string;
|
|
2249
1994
|
data: string;
|
|
2250
1995
|
gasLimit: number | null;
|
|
@@ -2396,32 +2141,13 @@ export declare const validateQuoteResponse: (data: unknown) => data is {
|
|
|
2396
2141
|
priceImpact?: string | undefined;
|
|
2397
2142
|
totalFeeAmountUsd?: string | undefined;
|
|
2398
2143
|
} | undefined;
|
|
2399
|
-
intent?: {
|
|
2400
|
-
protocol: "cowswap";
|
|
2401
|
-
order: {
|
|
2402
|
-
sellToken: string;
|
|
2403
|
-
buyToken: string;
|
|
2404
|
-
validTo: string | number;
|
|
2405
|
-
appData: string;
|
|
2406
|
-
appDataHash: string;
|
|
2407
|
-
feeAmount: string;
|
|
2408
|
-
kind: "sell" | "buy";
|
|
2409
|
-
partiallyFillable: boolean;
|
|
2410
|
-
receiver?: string | undefined;
|
|
2411
|
-
sellAmount?: string | undefined;
|
|
2412
|
-
buyAmount?: string | undefined;
|
|
2413
|
-
from?: string | undefined;
|
|
2414
|
-
};
|
|
2415
|
-
settlementContract?: string | undefined;
|
|
2416
|
-
relayer?: string | undefined;
|
|
2417
|
-
} | undefined;
|
|
2418
2144
|
gasSponsored?: boolean | undefined;
|
|
2419
2145
|
};
|
|
2420
2146
|
estimatedProcessingTimeInSeconds: number;
|
|
2421
2147
|
trade: string | {
|
|
2422
2148
|
chainId: number;
|
|
2423
|
-
from: string;
|
|
2424
2149
|
to: string;
|
|
2150
|
+
from: string;
|
|
2425
2151
|
value: string;
|
|
2426
2152
|
data: string;
|
|
2427
2153
|
gasLimit: number | null;
|
|
@@ -2441,8 +2167,8 @@ export declare const validateQuoteResponse: (data: unknown) => data is {
|
|
|
2441
2167
|
};
|
|
2442
2168
|
approval?: {
|
|
2443
2169
|
chainId: number;
|
|
2444
|
-
from: string;
|
|
2445
2170
|
to: string;
|
|
2171
|
+
from: string;
|
|
2446
2172
|
value: string;
|
|
2447
2173
|
data: string;
|
|
2448
2174
|
gasLimit: number | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.d.mts","sourceRoot":"","sources":["../../src/utils/validators.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validators.d.mts","sourceRoot":"","sources":["../../src/utils/validators.ts"],"names":[],"mappings":"AAqBA,oBAAY,OAAO;IACjB,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,MAAM,UAAU;CACjB;AAED,oBAAY,SAAS;IACnB,KAAK,UAAU;CAChB;AAED,oBAAY,WAAW;IACrB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,MAAM,WAAW;CAClB;AAkBD,eAAO,MAAM,YAAY,MAAO,MAAM,YAAuB,CAAC;AAK9D,eAAO,MAAM,iBAAiB;;;;;;;;;;IAC5B;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;;IAGH;;OAEG;;IAEH;;OAEG;;EAEH,CAAC;AAeH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAZnC;;;WAGG;;QAEH;;;WAGG;;;EAeH,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;EAGrC,CAAC;AAUH;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAU/B;;;OAGG;;;;;;;;;;QAKC;;WAEG;;;EAIP,C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BAGH;;mBAEG;;gBAEH;;mBAEG;;;;;;;;;;;;;gBA3BH;;mBAEG;;gBAEH;;mBAEG;;gBAEH;;mBAEG;;gBAEH;;mBAEG;;gBAEH;;mBAEG;;;gBAGH;;mBAEG;;gBAEH;;mBAEG;;;;;;;;;;;;;;;;;;;;;;;;;;QAgKH;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgDH,CAAC;AAEH,eAAO,MAAM,qBAAqB,SAC1B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAId,CAAC"}
|
|
@@ -140,34 +140,6 @@ export const StepSchema = type({
|
|
|
140
140
|
protocol: ProtocolSchema,
|
|
141
141
|
});
|
|
142
142
|
const RefuelDataSchema = StepSchema;
|
|
143
|
-
// Allow digit strings for amounts/validTo for flexibility across providers
|
|
144
|
-
const DigitStringOrNumberSchema = union([TruthyDigitStringSchema, number()]);
|
|
145
|
-
// Intent support (e.g., CoW Swap EIP-712 order signing)
|
|
146
|
-
const IntentProtocolSchema = enums(['cowswap']);
|
|
147
|
-
export const IntentOrderSchema = type({
|
|
148
|
-
// EIP-712 Order fields (subset required for signing/submission)
|
|
149
|
-
sellToken: HexAddressSchema,
|
|
150
|
-
buyToken: HexAddressSchema,
|
|
151
|
-
receiver: optional(HexAddressSchema),
|
|
152
|
-
validTo: DigitStringOrNumberSchema,
|
|
153
|
-
appData: string(),
|
|
154
|
-
appDataHash: HexStringSchema,
|
|
155
|
-
feeAmount: TruthyDigitStringSchema,
|
|
156
|
-
kind: enums(['sell', 'buy']),
|
|
157
|
-
partiallyFillable: boolean(),
|
|
158
|
-
// One of these is required by CoW depending on kind; we keep both optional here and rely on backend validation
|
|
159
|
-
sellAmount: optional(TruthyDigitStringSchema),
|
|
160
|
-
buyAmount: optional(TruthyDigitStringSchema),
|
|
161
|
-
// Optional owner/from for convenience when building domain/message
|
|
162
|
-
from: optional(HexAddressSchema),
|
|
163
|
-
});
|
|
164
|
-
export const IntentSchema = type({
|
|
165
|
-
protocol: IntentProtocolSchema,
|
|
166
|
-
order: IntentOrderSchema,
|
|
167
|
-
// Optional metadata to aid submission/routing
|
|
168
|
-
settlementContract: optional(HexAddressSchema),
|
|
169
|
-
relayer: optional(HexAddressSchema),
|
|
170
|
-
});
|
|
171
143
|
export const QuoteSchema = type({
|
|
172
144
|
requestId: string(),
|
|
173
145
|
srcChainId: ChainIdSchema,
|
|
@@ -216,7 +188,6 @@ export const QuoteSchema = type({
|
|
|
216
188
|
priceImpact: optional(string()),
|
|
217
189
|
totalFeeAmountUsd: optional(string()),
|
|
218
190
|
})),
|
|
219
|
-
intent: optional(IntentSchema),
|
|
220
191
|
/**
|
|
221
192
|
* A third party sponsors the gas. If true, then gasIncluded7702 is also true.
|
|
222
193
|
*/
|
|
@@ -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,KAAK,EACL,MAAM,EACN,OAAO,EACP,YAAY,EACb,8BAA8B;AAC/B,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,wBAAwB;AAEzE,MAAM,CAAN,IAAY,OAIX;AAJD,WAAY,OAAO;IACjB,oCAAyB,CAAA;IACzB,4BAAiB,CAAA;IACjB,2BAAgB,CAAA;AAClB,CAAC,EAJW,OAAO,KAAP,OAAO,QAIlB;AAED,MAAM,CAAN,IAAY,SA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,QAAQ,CAAC,MAAM,EAAE,CAAC;KAC9B,CAAC,CACH,CACF;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;IACtC,KAAK,EAAE,WAAW;IAClB,gCAAgC,EAAE,MAAM,EAAE;IAC1C,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,YAAY,EAAE,mBAAmB,CAAC,CAAC,CAAC;IAC9D,KAAK,EAAE,KAAK,CAAC;QACX,YAAY;QACZ,sBAAsB;QACtB,mBAAmB;QACnB,MAAM,EAAE;KACT,CAAC;CACH,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 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 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\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// Intent support (e.g., CoW Swap EIP-712 order signing)\nconst IntentProtocolSchema = enums(['cowswap']);\n\nexport const IntentOrderSchema = type({\n // EIP-712 Order fields (subset required for signing/submission)\n sellToken: HexAddressSchema,\n buyToken: HexAddressSchema,\n receiver: optional(HexAddressSchema),\n validTo: DigitStringOrNumberSchema,\n appData: string(),\n appDataHash: HexStringSchema,\n feeAmount: TruthyDigitStringSchema,\n kind: enums(['sell', 'buy']),\n partiallyFillable: boolean(),\n // One of these is required by CoW depending on kind; we keep both optional here and rely on backend validation\n sellAmount: optional(TruthyDigitStringSchema),\n buyAmount: optional(TruthyDigitStringSchema),\n // Optional owner/from for convenience when building domain/message\n from: optional(HexAddressSchema),\n});\n\nexport const IntentSchema = type({\n protocol: IntentProtocolSchema,\n order: IntentOrderSchema,\n // Optional metadata to aid submission/routing\n settlementContract: optional(HexAddressSchema),\n relayer: optional(HexAddressSchema),\n});\n\n// Export types for use in other modules\nexport type IntentOrder = Infer<typeof IntentOrderSchema>;\nexport type Intent = Infer<typeof IntentSchema>;\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.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,KAAK,EACL,MAAM,EACN,OAAO,EACP,YAAY,EACb,8BAA8B;AAC/B,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,wBAAwB;AAEzE,MAAM,CAAN,IAAY,OAIX;AAJD,WAAY,OAAO;IACjB,oCAAyB,CAAA;IACzB,4BAAiB,CAAA;IACjB,2BAAgB,CAAA;AAClB,CAAC,EAJW,OAAO,KAAP,OAAO,QAIlB;AAED,MAAM,CAAN,IAAY,SAEX;AAFD,WAAY,SAAS;IACnB,4BAAe,CAAA;AACjB,CAAC,EAFW,SAAS,KAAT,SAAS,QAEpB;AAED,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,gCAAiB,CAAA;IACjB,4BAAa,CAAA;IACb,gCAAiB,CAAA;AACnB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AAE,QAAQ,CAAC,MAAM,EAAE,CAAC;KAC9B,CAAC,CACH,CACF;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;IACtC,KAAK,EAAE,WAAW;IAClB,gCAAgC,EAAE,MAAM,EAAE;IAC1C,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,YAAY,EAAE,mBAAmB,CAAC,CAAC,CAAC;IAC9D,KAAK,EAAE,KAAK,CAAC;QACX,YAAY;QACZ,sBAAsB;QACtB,mBAAmB;QACnB,MAAM,EAAE;KACT,CAAC;CACH,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 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 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\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 /**\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 /**\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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask-previews/bridge-controller",
|
|
3
|
-
"version": "64.
|
|
3
|
+
"version": "64.2.0-preview-e776a73",
|
|
4
4
|
"description": "Manages bridge-related quote fetching functionality for MetaMask",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MetaMask",
|
|
@@ -56,15 +56,15 @@
|
|
|
56
56
|
"@metamask/accounts-controller": "^35.0.0",
|
|
57
57
|
"@metamask/assets-controllers": "^94.1.0",
|
|
58
58
|
"@metamask/base-controller": "^9.0.0",
|
|
59
|
-
"@metamask/controller-utils": "^11.
|
|
59
|
+
"@metamask/controller-utils": "^11.17.0",
|
|
60
60
|
"@metamask/gas-fee-controller": "^26.0.0",
|
|
61
61
|
"@metamask/keyring-api": "^21.0.0",
|
|
62
62
|
"@metamask/messenger": "^0.3.0",
|
|
63
63
|
"@metamask/metamask-eth-abis": "^3.1.1",
|
|
64
64
|
"@metamask/multichain-network-controller": "^3.0.0",
|
|
65
|
-
"@metamask/network-controller": "^27.
|
|
65
|
+
"@metamask/network-controller": "^27.1.0",
|
|
66
66
|
"@metamask/polling-controller": "^16.0.0",
|
|
67
|
-
"@metamask/remote-feature-flag-controller": "^3.
|
|
67
|
+
"@metamask/remote-feature-flag-controller": "^3.1.0",
|
|
68
68
|
"@metamask/snaps-controllers": "^14.0.1",
|
|
69
69
|
"@metamask/transaction-controller": "^62.7.0",
|
|
70
70
|
"@metamask/utils": "^11.8.1",
|