@metamask-previews/bridge-status-controller 40.1.0-preview-6a91767a → 40.2.0-preview-970969ca
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 +8 -1
- package/dist/bridge-status-controller.cjs +22 -3
- package/dist/bridge-status-controller.cjs.map +1 -1
- package/dist/bridge-status-controller.d.cts.map +1 -1
- package/dist/bridge-status-controller.d.mts.map +1 -1
- package/dist/bridge-status-controller.mjs +22 -3
- package/dist/bridge-status-controller.mjs.map +1 -1
- package/dist/utils/bridge-status.cjs +24 -4
- package/dist/utils/bridge-status.cjs.map +1 -1
- package/dist/utils/bridge-status.d.cts +4 -1
- package/dist/utils/bridge-status.d.cts.map +1 -1
- package/dist/utils/bridge-status.d.mts +4 -1
- package/dist/utils/bridge-status.d.mts.map +1 -1
- package/dist/utils/bridge-status.mjs +24 -4
- package/dist/utils/bridge-status.mjs.map +1 -1
- package/dist/utils/validators.cjs +2 -19
- package/dist/utils/validators.cjs.map +1 -1
- package/dist/utils/validators.d.cts +43 -19
- package/dist/utils/validators.d.cts.map +1 -1
- package/dist/utils/validators.d.mts +43 -19
- package/dist/utils/validators.d.mts.map +1 -1
- package/dist/utils/validators.mjs +3 -20
- package/dist/utils/validators.mjs.map +1 -1
- package/package.json +2 -2
@@ -9,9 +9,7 @@ export declare const StatusResponseSchema: import("@metamask/superstruct").Struc
|
|
9
9
|
address: string;
|
10
10
|
name: string;
|
11
11
|
chainId: number;
|
12
|
-
decimals: number;
|
13
|
-
* The atomic amount of the token sent minus fees on the source chain
|
14
|
-
*/
|
12
|
+
decimals: number;
|
15
13
|
assetId: `${string}:${string}/${string}:${string}`;
|
16
14
|
iconUrl?: string | null | undefined;
|
17
15
|
icon?: string | null | undefined;
|
@@ -28,9 +26,7 @@ export declare const StatusResponseSchema: import("@metamask/superstruct").Struc
|
|
28
26
|
address: string;
|
29
27
|
name: string;
|
30
28
|
chainId: number;
|
31
|
-
decimals: number;
|
32
|
-
* The atomic amount of the token sent minus fees on the source chain
|
33
|
-
*/
|
29
|
+
decimals: number;
|
34
30
|
assetId: `${string}:${string}/${string}:${string}`;
|
35
31
|
iconUrl?: string | null | undefined;
|
36
32
|
icon?: string | null | undefined;
|
@@ -54,9 +50,7 @@ export declare const StatusResponseSchema: import("@metamask/superstruct").Struc
|
|
54
50
|
address: string;
|
55
51
|
name: string;
|
56
52
|
chainId: number;
|
57
|
-
decimals: number;
|
58
|
-
* The atomic amount of the token sent minus fees on the source chain
|
59
|
-
*/
|
53
|
+
decimals: number;
|
60
54
|
assetId: `${string}:${string}/${string}:${string}`;
|
61
55
|
iconUrl?: string | null | undefined;
|
62
56
|
icon?: string | null | undefined;
|
@@ -78,9 +72,7 @@ export declare const StatusResponseSchema: import("@metamask/superstruct").Struc
|
|
78
72
|
address: string;
|
79
73
|
name: string;
|
80
74
|
chainId: number;
|
81
|
-
decimals: number;
|
82
|
-
* The atomic amount of the token sent minus fees on the source chain
|
83
|
-
*/
|
75
|
+
decimals: number;
|
84
76
|
assetId: `${string}:${string}/${string}:${string}`;
|
85
77
|
iconUrl?: string | null | undefined;
|
86
78
|
icon?: string | null | undefined;
|
@@ -94,9 +86,7 @@ export declare const StatusResponseSchema: import("@metamask/superstruct").Struc
|
|
94
86
|
address: string;
|
95
87
|
name: string;
|
96
88
|
chainId: number;
|
97
|
-
decimals: number;
|
98
|
-
* The atomic amount of the token sent minus fees on the source chain
|
99
|
-
*/
|
89
|
+
decimals: number;
|
100
90
|
assetId: `${string}:${string}/${string}:${string}`;
|
101
91
|
iconUrl?: string | null | undefined;
|
102
92
|
icon?: string | null | undefined;
|
@@ -114,9 +104,7 @@ export declare const StatusResponseSchema: import("@metamask/superstruct").Struc
|
|
114
104
|
address: string;
|
115
105
|
name: string;
|
116
106
|
chainId: number;
|
117
|
-
decimals: number;
|
118
|
-
* The atomic amount of the token sent minus fees on the source chain
|
119
|
-
*/
|
107
|
+
decimals: number;
|
120
108
|
assetId: `${string}:${string}/${string}:${string}`;
|
121
109
|
iconUrl?: string | null | undefined;
|
122
110
|
icon?: string | null | undefined;
|
@@ -127,5 +115,41 @@ export declare const StatusResponseSchema: import("@metamask/superstruct").Struc
|
|
127
115
|
isUnrecognizedRouterAddress: import("@metamask/superstruct").Struct<boolean | undefined, null>;
|
128
116
|
refuel: import("@metamask/superstruct").Struct<{} | undefined, {}>;
|
129
117
|
}>;
|
130
|
-
export declare const validateBridgeStatusResponse: (data: unknown) =>
|
118
|
+
export declare const validateBridgeStatusResponse: (data: unknown) => data is {
|
119
|
+
status: StatusTypes;
|
120
|
+
srcChain: {
|
121
|
+
chainId: number;
|
122
|
+
amount?: string | undefined;
|
123
|
+
token?: {
|
124
|
+
symbol: string;
|
125
|
+
address: string;
|
126
|
+
name: string;
|
127
|
+
chainId: number;
|
128
|
+
decimals: number;
|
129
|
+
assetId: `${string}:${string}/${string}:${string}`;
|
130
|
+
iconUrl?: string | null | undefined;
|
131
|
+
icon?: string | null | undefined;
|
132
|
+
} | {} | undefined;
|
133
|
+
txHash?: string | undefined;
|
134
|
+
};
|
135
|
+
bridge?: string | undefined;
|
136
|
+
refuel?: {} | undefined;
|
137
|
+
destChain?: {
|
138
|
+
chainId: number;
|
139
|
+
amount?: string | undefined;
|
140
|
+
token?: {
|
141
|
+
symbol: string;
|
142
|
+
address: string;
|
143
|
+
name: string;
|
144
|
+
chainId: number;
|
145
|
+
decimals: number;
|
146
|
+
assetId: `${string}:${string}/${string}:${string}`;
|
147
|
+
iconUrl?: string | null | undefined;
|
148
|
+
icon?: string | null | undefined;
|
149
|
+
} | {} | undefined;
|
150
|
+
txHash?: string | undefined;
|
151
|
+
} | undefined;
|
152
|
+
isExpectedToken?: boolean | undefined;
|
153
|
+
isUnrecognizedRouterAddress?: boolean | undefined;
|
154
|
+
};
|
131
155
|
//# sourceMappingURL=validators.d.cts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"validators.d.cts","sourceRoot":"","sources":["../../src/utils/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAqB,oCAAoC;AA2C7E,eAAO,MAAM,oBAAoB
|
1
|
+
{"version":3,"file":"validators.d.cts","sourceRoot":"","sources":["../../src/utils/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAqB,oCAAoC;AA2C7E,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAxB/B;;;WAGG;;QAEH;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAQH;;WAEG;;;;;;;;;;;;;;;;;EAeH,CAAC;AAEH,eAAO,MAAM,4BAA4B,SACjC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAId,CAAC"}
|
@@ -9,9 +9,7 @@ export declare const StatusResponseSchema: import("@metamask/superstruct").Struc
|
|
9
9
|
address: string;
|
10
10
|
name: string;
|
11
11
|
chainId: number;
|
12
|
-
decimals: number;
|
13
|
-
* The atomic amount of the token sent minus fees on the source chain
|
14
|
-
*/
|
12
|
+
decimals: number;
|
15
13
|
assetId: `${string}:${string}/${string}:${string}`;
|
16
14
|
iconUrl?: string | null | undefined;
|
17
15
|
icon?: string | null | undefined;
|
@@ -28,9 +26,7 @@ export declare const StatusResponseSchema: import("@metamask/superstruct").Struc
|
|
28
26
|
address: string;
|
29
27
|
name: string;
|
30
28
|
chainId: number;
|
31
|
-
decimals: number;
|
32
|
-
* The atomic amount of the token sent minus fees on the source chain
|
33
|
-
*/
|
29
|
+
decimals: number;
|
34
30
|
assetId: `${string}:${string}/${string}:${string}`;
|
35
31
|
iconUrl?: string | null | undefined;
|
36
32
|
icon?: string | null | undefined;
|
@@ -54,9 +50,7 @@ export declare const StatusResponseSchema: import("@metamask/superstruct").Struc
|
|
54
50
|
address: string;
|
55
51
|
name: string;
|
56
52
|
chainId: number;
|
57
|
-
decimals: number;
|
58
|
-
* The atomic amount of the token sent minus fees on the source chain
|
59
|
-
*/
|
53
|
+
decimals: number;
|
60
54
|
assetId: `${string}:${string}/${string}:${string}`;
|
61
55
|
iconUrl?: string | null | undefined;
|
62
56
|
icon?: string | null | undefined;
|
@@ -78,9 +72,7 @@ export declare const StatusResponseSchema: import("@metamask/superstruct").Struc
|
|
78
72
|
address: string;
|
79
73
|
name: string;
|
80
74
|
chainId: number;
|
81
|
-
decimals: number;
|
82
|
-
* The atomic amount of the token sent minus fees on the source chain
|
83
|
-
*/
|
75
|
+
decimals: number;
|
84
76
|
assetId: `${string}:${string}/${string}:${string}`;
|
85
77
|
iconUrl?: string | null | undefined;
|
86
78
|
icon?: string | null | undefined;
|
@@ -94,9 +86,7 @@ export declare const StatusResponseSchema: import("@metamask/superstruct").Struc
|
|
94
86
|
address: string;
|
95
87
|
name: string;
|
96
88
|
chainId: number;
|
97
|
-
decimals: number;
|
98
|
-
* The atomic amount of the token sent minus fees on the source chain
|
99
|
-
*/
|
89
|
+
decimals: number;
|
100
90
|
assetId: `${string}:${string}/${string}:${string}`;
|
101
91
|
iconUrl?: string | null | undefined;
|
102
92
|
icon?: string | null | undefined;
|
@@ -114,9 +104,7 @@ export declare const StatusResponseSchema: import("@metamask/superstruct").Struc
|
|
114
104
|
address: string;
|
115
105
|
name: string;
|
116
106
|
chainId: number;
|
117
|
-
decimals: number;
|
118
|
-
* The atomic amount of the token sent minus fees on the source chain
|
119
|
-
*/
|
107
|
+
decimals: number;
|
120
108
|
assetId: `${string}:${string}/${string}:${string}`;
|
121
109
|
iconUrl?: string | null | undefined;
|
122
110
|
icon?: string | null | undefined;
|
@@ -127,5 +115,41 @@ export declare const StatusResponseSchema: import("@metamask/superstruct").Struc
|
|
127
115
|
isUnrecognizedRouterAddress: import("@metamask/superstruct").Struct<boolean | undefined, null>;
|
128
116
|
refuel: import("@metamask/superstruct").Struct<{} | undefined, {}>;
|
129
117
|
}>;
|
130
|
-
export declare const validateBridgeStatusResponse: (data: unknown) =>
|
118
|
+
export declare const validateBridgeStatusResponse: (data: unknown) => data is {
|
119
|
+
status: StatusTypes;
|
120
|
+
srcChain: {
|
121
|
+
chainId: number;
|
122
|
+
amount?: string | undefined;
|
123
|
+
token?: {
|
124
|
+
symbol: string;
|
125
|
+
address: string;
|
126
|
+
name: string;
|
127
|
+
chainId: number;
|
128
|
+
decimals: number;
|
129
|
+
assetId: `${string}:${string}/${string}:${string}`;
|
130
|
+
iconUrl?: string | null | undefined;
|
131
|
+
icon?: string | null | undefined;
|
132
|
+
} | {} | undefined;
|
133
|
+
txHash?: string | undefined;
|
134
|
+
};
|
135
|
+
bridge?: string | undefined;
|
136
|
+
refuel?: {} | undefined;
|
137
|
+
destChain?: {
|
138
|
+
chainId: number;
|
139
|
+
amount?: string | undefined;
|
140
|
+
token?: {
|
141
|
+
symbol: string;
|
142
|
+
address: string;
|
143
|
+
name: string;
|
144
|
+
chainId: number;
|
145
|
+
decimals: number;
|
146
|
+
assetId: `${string}:${string}/${string}:${string}`;
|
147
|
+
iconUrl?: string | null | undefined;
|
148
|
+
icon?: string | null | undefined;
|
149
|
+
} | {} | undefined;
|
150
|
+
txHash?: string | undefined;
|
151
|
+
} | undefined;
|
152
|
+
isExpectedToken?: boolean | undefined;
|
153
|
+
isUnrecognizedRouterAddress?: boolean | undefined;
|
154
|
+
};
|
131
155
|
//# sourceMappingURL=validators.d.mts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"validators.d.mts","sourceRoot":"","sources":["../../src/utils/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAqB,oCAAoC;AA2C7E,eAAO,MAAM,oBAAoB
|
1
|
+
{"version":3,"file":"validators.d.mts","sourceRoot":"","sources":["../../src/utils/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAqB,oCAAoC;AA2C7E,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAxB/B;;;WAGG;;QAEH;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAQH;;WAEG;;;;;;;;;;;;;;;;;EAeH,CAAC;AAEH,eAAO,MAAM,4BAA4B,SACjC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAId,CAAC"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { StatusTypes, BridgeAssetSchema } from "@metamask/bridge-controller";
|
2
|
-
import { string, boolean, number, optional, enums, union, type, assert
|
2
|
+
import { string, boolean, number, optional, enums, union, type, assert } from "@metamask/superstruct";
|
3
3
|
const ChainIdSchema = number();
|
4
4
|
const EmptyObjectSchema = type({});
|
5
5
|
const SrcChainStatusSchema = type({
|
@@ -35,24 +35,7 @@ export const StatusResponseSchema = type({
|
|
35
35
|
refuel: optional(RefuelStatusResponseSchema),
|
36
36
|
});
|
37
37
|
export const validateBridgeStatusResponse = (data) => {
|
38
|
-
|
39
|
-
|
40
|
-
assert(data, StatusResponseSchema);
|
41
|
-
}
|
42
|
-
catch (error) {
|
43
|
-
if (error instanceof StructError) {
|
44
|
-
error.failures().forEach(({ branch, path, message }) => {
|
45
|
-
const pathString = path?.join('.') || 'unknown';
|
46
|
-
validationFailures[pathString] =
|
47
|
-
`[${branch?.[0]?.bridge || 'unknown'}] ${message}`;
|
48
|
-
});
|
49
|
-
}
|
50
|
-
throw error;
|
51
|
-
}
|
52
|
-
finally {
|
53
|
-
if (Object.keys(validationFailures).length > 0) {
|
54
|
-
console.error(`Bridge status validation failed`, validationFailures);
|
55
|
-
}
|
56
|
-
}
|
38
|
+
assert(data, StatusResponseSchema);
|
39
|
+
return true;
|
57
40
|
};
|
58
41
|
//# sourceMappingURL=validators.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"validators.mjs","sourceRoot":"","sources":["../../src/utils/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,oCAAoC;
|
1
|
+
{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eAAe,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC;IACpC,2BAA2B,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC;IAChD,MAAM,EAAE,QAAQ,CAAC,0BAA0B,CAAC;CAC7C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAC1C,IAAa,EAC+B,EAAE;IAC9C,MAAM,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;IACnC,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","sourcesContent":["import { StatusTypes, BridgeAssetSchema } from '@metamask/bridge-controller';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n string,\n boolean,\n number,\n optional,\n enums,\n union,\n type,\n assert,\n} from '@metamask/superstruct';\n\nconst ChainIdSchema = number();\n\nconst EmptyObjectSchema = type({});\n\nconst SrcChainStatusSchema = type({\n chainId: ChainIdSchema,\n /**\n * The txHash of the transaction on the source chain.\n * This might be undefined for smart transactions (STX)\n */\n txHash: optional(string()),\n /**\n * The atomic amount of the token sent minus fees on the source chain\n */\n amount: optional(string()),\n token: optional(union([EmptyObjectSchema, BridgeAssetSchema])),\n});\n\nconst DestChainStatusSchema = type({\n chainId: ChainIdSchema,\n txHash: optional(string()),\n /**\n * The atomic amount of the token received on the destination chain\n */\n amount: optional(string()),\n token: optional(union([EmptyObjectSchema, BridgeAssetSchema])),\n});\n\nconst RefuelStatusResponseSchema = type({});\n\nexport const StatusResponseSchema = type({\n status: enums(Object.values(StatusTypes)),\n srcChain: SrcChainStatusSchema,\n destChain: optional(DestChainStatusSchema),\n bridge: optional(string()),\n isExpectedToken: optional(boolean()),\n isUnrecognizedRouterAddress: optional(boolean()),\n refuel: optional(RefuelStatusResponseSchema),\n});\n\nexport const validateBridgeStatusResponse = (\n data: unknown,\n): data is Infer<typeof StatusResponseSchema> => {\n assert(data, StatusResponseSchema);\n return true;\n};\n"]}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@metamask-previews/bridge-status-controller",
|
3
|
-
"version": "40.
|
3
|
+
"version": "40.2.0-preview-970969ca",
|
4
4
|
"description": "Manages bridge-related status fetching functionality for MetaMask",
|
5
5
|
"keywords": [
|
6
6
|
"MetaMask",
|
@@ -59,7 +59,7 @@
|
|
59
59
|
"devDependencies": {
|
60
60
|
"@metamask/accounts-controller": "^33.0.0",
|
61
61
|
"@metamask/auto-changelog": "^3.4.4",
|
62
|
-
"@metamask/bridge-controller": "^41.
|
62
|
+
"@metamask/bridge-controller": "^41.3.0",
|
63
63
|
"@metamask/gas-fee-controller": "^24.0.0",
|
64
64
|
"@metamask/network-controller": "^24.1.0",
|
65
65
|
"@metamask/snaps-controllers": "^14.0.1",
|