@metamask/snaps-execution-environments 7.1.0 → 7.2.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.
- package/CHANGELOG.md +10 -2
- package/dist/browserify/iframe/bundle.js +4 -4
- package/dist/browserify/node-process/bundle.js +2 -2
- package/dist/browserify/node-thread/bundle.js +2 -2
- package/dist/browserify/webview/index.html +4 -4
- package/dist/browserify/worker-executor/bundle.js +4 -4
- package/dist/browserify/worker-pool/bundle.js +2 -2
- package/dist/common/commands.cjs +5 -0
- package/dist/common/commands.cjs.map +1 -1
- package/dist/common/commands.d.cts.map +1 -1
- package/dist/common/commands.d.mts.map +1 -1
- package/dist/common/commands.mjs +6 -1
- package/dist/common/commands.mjs.map +1 -1
- package/dist/common/endowments/console.d.cts +3 -3
- package/dist/common/endowments/console.d.mts +3 -3
- package/dist/common/validation.cjs +35 -8
- package/dist/common/validation.cjs.map +1 -1
- package/dist/common/validation.d.cts +35 -16
- package/dist/common/validation.d.cts.map +1 -1
- package/dist/common/validation.d.mts +35 -16
- package/dist/common/validation.d.mts.map +1 -1
- package/dist/common/validation.mjs +34 -8
- package/dist/common/validation.mjs.map +1 -1
- package/package.json +11 -18
|
@@ -3,8 +3,8 @@ import type { Infer, Struct } from "@metamask/superstruct";
|
|
|
3
3
|
import type { CaipChainId, Json, JsonRpcRequest, JsonRpcSuccess } from "@metamask/utils";
|
|
4
4
|
export declare const JsonRpcRequestWithoutIdStruct: Struct<{
|
|
5
5
|
method: string;
|
|
6
|
-
id?: string | number | null | undefined;
|
|
7
6
|
jsonrpc?: "2.0" | undefined;
|
|
7
|
+
id?: string | number | null | undefined;
|
|
8
8
|
params?: Record<string, Json> | Json[] | undefined;
|
|
9
9
|
}, {
|
|
10
10
|
jsonrpc: Struct<"2.0" | undefined, "2.0">;
|
|
@@ -34,8 +34,8 @@ export declare const TerminateRequestArgumentsStruct: Struct<unknown[] | undefin
|
|
|
34
34
|
export declare const ExecuteSnapRequestArgumentsStruct: Struct<[string, string, string[]], null>;
|
|
35
35
|
export declare const SnapRpcRequestArgumentsStruct: Struct<[string, HandlerType, string, {
|
|
36
36
|
method: string;
|
|
37
|
-
id?: string | number | null | undefined;
|
|
38
37
|
jsonrpc?: "2.0" | undefined;
|
|
38
|
+
id?: string | number | null | undefined;
|
|
39
39
|
params?: Record<string, any> | undefined;
|
|
40
40
|
}], null>;
|
|
41
41
|
export type PingRequestArguments = Infer<typeof PingRequestArgumentsStruct>;
|
|
@@ -44,9 +44,9 @@ export type ExecuteSnapRequestArguments = Infer<typeof ExecuteSnapRequestArgumen
|
|
|
44
44
|
export type SnapRpcRequestArguments = Infer<typeof SnapRpcRequestArgumentsStruct>;
|
|
45
45
|
export type RequestArguments = PingRequestArguments | TerminateRequestArguments | ExecuteSnapRequestArguments | SnapRpcRequestArguments;
|
|
46
46
|
export declare const OnTransactionRequestArgumentsStruct: Struct<{
|
|
47
|
+
transaction: Record<string, Json>;
|
|
47
48
|
chainId: `${string}:${string}`;
|
|
48
49
|
transactionOrigin: string | null;
|
|
49
|
-
transaction: Record<string, Json>;
|
|
50
50
|
}, {
|
|
51
51
|
transaction: Struct<Record<string, Json>, null>;
|
|
52
52
|
chainId: Struct<`${string}:${string}`, null>;
|
|
@@ -63,8 +63,8 @@ export type OnTransactionRequestArguments = Infer<typeof OnTransactionRequestArg
|
|
|
63
63
|
*/
|
|
64
64
|
export declare function assertIsOnTransactionRequestArguments(value: unknown): asserts value is OnTransactionRequestArguments;
|
|
65
65
|
export declare const OnSignatureRequestArgumentsStruct: Struct<{
|
|
66
|
-
signatureOrigin: string | null;
|
|
67
66
|
signature: Record<string, Json>;
|
|
67
|
+
signatureOrigin: string | null;
|
|
68
68
|
}, {
|
|
69
69
|
signature: Struct<Record<string, Json>, null>;
|
|
70
70
|
signatureOrigin: Struct<string | null, null>;
|
|
@@ -83,8 +83,8 @@ declare const baseNameLookupArgs: {
|
|
|
83
83
|
chainId: Struct<`${string}:${string}`, null>;
|
|
84
84
|
};
|
|
85
85
|
export declare const OnNameLookupRequestArgumentsStruct: Struct<{
|
|
86
|
-
address: string;
|
|
87
86
|
chainId: `${string}:${string}`;
|
|
87
|
+
address: string;
|
|
88
88
|
} | {
|
|
89
89
|
chainId: `${string}:${string}`;
|
|
90
90
|
domain: string;
|
|
@@ -103,6 +103,23 @@ export type PossibleLookupRequestArgs = typeof baseNameLookupArgs & {
|
|
|
103
103
|
* object.
|
|
104
104
|
*/
|
|
105
105
|
export declare function assertIsOnNameLookupRequestArguments(value: unknown): asserts value is OnNameLookupRequestArguments;
|
|
106
|
+
export declare const OnAssetHistoricalPriceRequestArgumentsStruct: Struct<{
|
|
107
|
+
from: `${string}:${string}/${string}:${string}`;
|
|
108
|
+
to: `${string}:${string}/${string}:${string}`;
|
|
109
|
+
}, {
|
|
110
|
+
from: Struct<`${string}:${string}/${string}:${string}`, null>;
|
|
111
|
+
to: Struct<`${string}:${string}/${string}:${string}`, null>;
|
|
112
|
+
}>;
|
|
113
|
+
export type OnAssetHistoricalPriceRequestArguments = Infer<typeof OnAssetHistoricalPriceRequestArgumentsStruct>;
|
|
114
|
+
/**
|
|
115
|
+
* Asserts that the given value is a valid {@link OnAssetHistoricalPriceRequestArguments}
|
|
116
|
+
* object.
|
|
117
|
+
*
|
|
118
|
+
* @param value - The value to validate.
|
|
119
|
+
* @throws If the value is not a valid {@link OnAssetHistoricalPriceRequestArguments}
|
|
120
|
+
* object.
|
|
121
|
+
*/
|
|
122
|
+
export declare function assertIsOnAssetHistoricalPriceRequestArguments(value: unknown): asserts value is OnAssetHistoricalPriceRequestArguments;
|
|
106
123
|
export declare const OnAssetsLookupRequestArgumentsStruct: Struct<{
|
|
107
124
|
assets: `${string}:${string}/${string}:${string}`[];
|
|
108
125
|
}, {
|
|
@@ -123,6 +140,7 @@ export declare const OnAssetsConversionRequestArgumentsStruct: Struct<{
|
|
|
123
140
|
from: `${string}:${string}/${string}:${string}`;
|
|
124
141
|
to: `${string}:${string}/${string}:${string}`;
|
|
125
142
|
}[];
|
|
143
|
+
includeMarketData?: boolean | undefined;
|
|
126
144
|
}, {
|
|
127
145
|
conversions: Struct<{
|
|
128
146
|
from: `${string}:${string}/${string}:${string}`;
|
|
@@ -134,6 +152,7 @@ export declare const OnAssetsConversionRequestArgumentsStruct: Struct<{
|
|
|
134
152
|
from: Struct<`${string}:${string}/${string}:${string}`, null>;
|
|
135
153
|
to: Struct<`${string}:${string}/${string}:${string}`, null>;
|
|
136
154
|
}>>;
|
|
155
|
+
includeMarketData: Struct<boolean | undefined, null>;
|
|
137
156
|
}>;
|
|
138
157
|
export type OnAssetsConversionRequestArguments = Infer<typeof OnAssetsConversionRequestArgumentsStruct>;
|
|
139
158
|
/**
|
|
@@ -151,8 +170,6 @@ export declare const OnUserInputArgumentsStruct: Struct<{
|
|
|
151
170
|
type: import("@metamask/snaps-sdk").UserInputEventType.ButtonClickEvent;
|
|
152
171
|
name?: string | undefined;
|
|
153
172
|
} | {
|
|
154
|
-
type: import("@metamask/snaps-sdk").UserInputEventType.FormSubmitEvent;
|
|
155
|
-
name: string;
|
|
156
173
|
value: Record<string, string | boolean | {
|
|
157
174
|
name: string;
|
|
158
175
|
size: number;
|
|
@@ -163,15 +180,18 @@ export declare const OnUserInputArgumentsStruct: Struct<{
|
|
|
163
180
|
name: string;
|
|
164
181
|
asset: `${string}:${string}/${string}:${string}`;
|
|
165
182
|
} | null>;
|
|
166
|
-
} | {
|
|
167
|
-
type: import("@metamask/snaps-sdk").UserInputEventType.InputChangeEvent;
|
|
168
183
|
name: string;
|
|
184
|
+
type: import("@metamask/snaps-sdk").UserInputEventType.FormSubmitEvent;
|
|
185
|
+
} | {
|
|
169
186
|
value: string | boolean | {
|
|
170
187
|
symbol: string;
|
|
171
188
|
name: string;
|
|
172
189
|
asset: `${string}:${string}/${string}:${string}`;
|
|
173
190
|
};
|
|
191
|
+
name: string;
|
|
192
|
+
type: import("@metamask/snaps-sdk").UserInputEventType.InputChangeEvent;
|
|
174
193
|
} | {
|
|
194
|
+
name: string;
|
|
175
195
|
type: import("@metamask/snaps-sdk").UserInputEventType.FileUploadEvent;
|
|
176
196
|
file: {
|
|
177
197
|
name: string;
|
|
@@ -179,7 +199,6 @@ export declare const OnUserInputArgumentsStruct: Struct<{
|
|
|
179
199
|
contentType: string;
|
|
180
200
|
contents: string;
|
|
181
201
|
} | null;
|
|
182
|
-
name: string;
|
|
183
202
|
};
|
|
184
203
|
context?: Record<string, Json> | null | undefined;
|
|
185
204
|
}, {
|
|
@@ -188,8 +207,6 @@ export declare const OnUserInputArgumentsStruct: Struct<{
|
|
|
188
207
|
type: import("@metamask/snaps-sdk").UserInputEventType.ButtonClickEvent;
|
|
189
208
|
name?: string | undefined;
|
|
190
209
|
} | {
|
|
191
|
-
type: import("@metamask/snaps-sdk").UserInputEventType.FormSubmitEvent;
|
|
192
|
-
name: string;
|
|
193
210
|
value: Record<string, string | boolean | {
|
|
194
211
|
name: string;
|
|
195
212
|
size: number;
|
|
@@ -200,15 +217,18 @@ export declare const OnUserInputArgumentsStruct: Struct<{
|
|
|
200
217
|
name: string;
|
|
201
218
|
asset: `${string}:${string}/${string}:${string}`;
|
|
202
219
|
} | null>;
|
|
203
|
-
} | {
|
|
204
|
-
type: import("@metamask/snaps-sdk").UserInputEventType.InputChangeEvent;
|
|
205
220
|
name: string;
|
|
221
|
+
type: import("@metamask/snaps-sdk").UserInputEventType.FormSubmitEvent;
|
|
222
|
+
} | {
|
|
206
223
|
value: string | boolean | {
|
|
207
224
|
symbol: string;
|
|
208
225
|
name: string;
|
|
209
226
|
asset: `${string}:${string}/${string}:${string}`;
|
|
210
227
|
};
|
|
228
|
+
name: string;
|
|
229
|
+
type: import("@metamask/snaps-sdk").UserInputEventType.InputChangeEvent;
|
|
211
230
|
} | {
|
|
231
|
+
name: string;
|
|
212
232
|
type: import("@metamask/snaps-sdk").UserInputEventType.FileUploadEvent;
|
|
213
233
|
file: {
|
|
214
234
|
name: string;
|
|
@@ -216,7 +236,6 @@ export declare const OnUserInputArgumentsStruct: Struct<{
|
|
|
216
236
|
contentType: string;
|
|
217
237
|
contents: string;
|
|
218
238
|
} | null;
|
|
219
|
-
name: string;
|
|
220
239
|
}, null>;
|
|
221
240
|
context: Struct<Record<string, Json> | null | undefined, null>;
|
|
222
241
|
}>;
|
|
@@ -245,9 +264,9 @@ export type OnProtocolRequestArguments = Infer<typeof OnProtocolRequestArguments
|
|
|
245
264
|
*/
|
|
246
265
|
export declare function assertIsOnProtocolRequestArguments(value: unknown): asserts value is OnProtocolRequestArguments;
|
|
247
266
|
declare const OkResponseStruct: Struct<{
|
|
267
|
+
jsonrpc: "2.0";
|
|
248
268
|
id: string | number | null;
|
|
249
269
|
result: "OK";
|
|
250
|
-
jsonrpc: "2.0";
|
|
251
270
|
}, {
|
|
252
271
|
id: Struct<string | number | null, null>;
|
|
253
272
|
jsonrpc: Struct<"2.0", "2.0">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.mts","sourceRoot":"","sources":["../../src/common/validation.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,8BAA8B;AACpD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,8BAA8B;
|
|
1
|
+
{"version":3,"file":"validation.d.mts","sourceRoot":"","sources":["../../src/common/validation.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,8BAA8B;AACpD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,8BAA8B;AAkB3D,OAAO,KAAK,EACV,WAAW,EACX,IAAI,EACJ,cAAc,EACd,cAAc,EACf,wBAAwB;AAazB,eAAO,MAAM,6BAA6B;;;;;;;;;;EAKxC,CAAC;AAEH,MAAM,MAAM,uBAAuB,GAAG,KAAK,CACzC,OAAO,6BAA6B,CACrC,CAAC;AAEF,eAAO,MAAM,eAAe,sBAAW,CAAC;AACxC,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,eAAe,CAAC,CAA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eAAe,CAAC,uBAAuB,EAAE,eAAe,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { rpcErrors } from "@metamask/rpc-errors";
|
|
2
2
|
import { InterfaceContextStruct, UserInputEventStruct } from "@metamask/snaps-sdk";
|
|
3
3
|
import { HandlerType } from "@metamask/snaps-utils";
|
|
4
|
-
import { any, array, assign, enums, is, literal, nullable, object, optional, record, size, string, tuple, union } from "@metamask/superstruct";
|
|
4
|
+
import { any, array, assign, boolean, enums, is, literal, nullable, object, optional, record, size, string, tuple, union } from "@metamask/superstruct";
|
|
5
5
|
import { assertStruct, CaipAssetTypeStruct, CaipChainIdStruct, JsonRpcIdStruct, JsonRpcParamsStruct, JsonRpcRequestStruct, JsonRpcSuccessStruct, JsonRpcVersionStruct, JsonStruct } from "@metamask/utils";
|
|
6
6
|
export const JsonRpcRequestWithoutIdStruct = object({
|
|
7
7
|
jsonrpc: optional(JsonRpcVersionStruct),
|
|
@@ -50,6 +50,16 @@ export const SnapRpcRequestArgumentsStruct = tuple([
|
|
|
50
50
|
params: optional(record(string(), any())),
|
|
51
51
|
})),
|
|
52
52
|
]);
|
|
53
|
+
/**
|
|
54
|
+
* Asserts that the given value is a valid request arguments object.
|
|
55
|
+
*
|
|
56
|
+
* @param value - The value to validate.
|
|
57
|
+
* @param struct - The struct to validate the value against.
|
|
58
|
+
* @throws If the value is not a valid request arguments object.
|
|
59
|
+
*/
|
|
60
|
+
function assertRequestArguments(value, struct) {
|
|
61
|
+
assertStruct(value, struct, 'Invalid request params', rpcErrors.invalidParams);
|
|
62
|
+
}
|
|
53
63
|
export const OnTransactionRequestArgumentsStruct = object({
|
|
54
64
|
// TODO: Improve `transaction` type.
|
|
55
65
|
transaction: record(string(), JsonStruct),
|
|
@@ -65,7 +75,7 @@ export const OnTransactionRequestArgumentsStruct = object({
|
|
|
65
75
|
* object.
|
|
66
76
|
*/
|
|
67
77
|
export function assertIsOnTransactionRequestArguments(value) {
|
|
68
|
-
|
|
78
|
+
assertRequestArguments(value, OnTransactionRequestArgumentsStruct);
|
|
69
79
|
}
|
|
70
80
|
export const OnSignatureRequestArgumentsStruct = object({
|
|
71
81
|
signature: record(string(), JsonStruct),
|
|
@@ -80,7 +90,7 @@ export const OnSignatureRequestArgumentsStruct = object({
|
|
|
80
90
|
* object.
|
|
81
91
|
*/
|
|
82
92
|
export function assertIsOnSignatureRequestArguments(value) {
|
|
83
|
-
|
|
93
|
+
assertRequestArguments(value, OnSignatureRequestArgumentsStruct);
|
|
84
94
|
}
|
|
85
95
|
const baseNameLookupArgs = { chainId: CaipChainIdStruct };
|
|
86
96
|
const domainRequestStruct = object({
|
|
@@ -104,7 +114,22 @@ export const OnNameLookupRequestArgumentsStruct = union([
|
|
|
104
114
|
* object.
|
|
105
115
|
*/
|
|
106
116
|
export function assertIsOnNameLookupRequestArguments(value) {
|
|
107
|
-
|
|
117
|
+
assertRequestArguments(value, OnNameLookupRequestArgumentsStruct);
|
|
118
|
+
}
|
|
119
|
+
export const OnAssetHistoricalPriceRequestArgumentsStruct = object({
|
|
120
|
+
from: CaipAssetTypeStruct,
|
|
121
|
+
to: CaipAssetTypeStruct,
|
|
122
|
+
});
|
|
123
|
+
/**
|
|
124
|
+
* Asserts that the given value is a valid {@link OnAssetHistoricalPriceRequestArguments}
|
|
125
|
+
* object.
|
|
126
|
+
*
|
|
127
|
+
* @param value - The value to validate.
|
|
128
|
+
* @throws If the value is not a valid {@link OnAssetHistoricalPriceRequestArguments}
|
|
129
|
+
* object.
|
|
130
|
+
*/
|
|
131
|
+
export function assertIsOnAssetHistoricalPriceRequestArguments(value) {
|
|
132
|
+
assertRequestArguments(value, OnAssetHistoricalPriceRequestArgumentsStruct);
|
|
108
133
|
}
|
|
109
134
|
export const OnAssetsLookupRequestArgumentsStruct = object({
|
|
110
135
|
assets: size(array(CaipAssetTypeStruct), 1, Infinity),
|
|
@@ -118,13 +143,14 @@ export const OnAssetsLookupRequestArgumentsStruct = object({
|
|
|
118
143
|
* object.
|
|
119
144
|
*/
|
|
120
145
|
export function assertIsOnAssetsLookupRequestArguments(value) {
|
|
121
|
-
|
|
146
|
+
assertRequestArguments(value, OnAssetsLookupRequestArgumentsStruct);
|
|
122
147
|
}
|
|
123
148
|
export const OnAssetsConversionRequestArgumentsStruct = object({
|
|
124
149
|
conversions: size(array(object({
|
|
125
150
|
from: CaipAssetTypeStruct,
|
|
126
151
|
to: CaipAssetTypeStruct,
|
|
127
152
|
})), 1, Infinity),
|
|
153
|
+
includeMarketData: optional(boolean()),
|
|
128
154
|
});
|
|
129
155
|
/**
|
|
130
156
|
* Asserts that the given value is a valid {@link OnAssetsConversionRequestArguments}
|
|
@@ -135,7 +161,7 @@ export const OnAssetsConversionRequestArgumentsStruct = object({
|
|
|
135
161
|
* object.
|
|
136
162
|
*/
|
|
137
163
|
export function assertIsOnAssetsConversionRequestArguments(value) {
|
|
138
|
-
|
|
164
|
+
assertRequestArguments(value, OnAssetsConversionRequestArgumentsStruct);
|
|
139
165
|
}
|
|
140
166
|
export const OnUserInputArgumentsStruct = object({
|
|
141
167
|
id: string(),
|
|
@@ -151,7 +177,7 @@ export const OnUserInputArgumentsStruct = object({
|
|
|
151
177
|
* object.
|
|
152
178
|
*/
|
|
153
179
|
export function assertIsOnUserInputRequestArguments(value) {
|
|
154
|
-
|
|
180
|
+
assertRequestArguments(value, OnUserInputArgumentsStruct);
|
|
155
181
|
}
|
|
156
182
|
export const OnProtocolRequestArgumentsStruct = object({
|
|
157
183
|
scope: CaipChainIdStruct,
|
|
@@ -166,7 +192,7 @@ export const OnProtocolRequestArgumentsStruct = object({
|
|
|
166
192
|
* object.
|
|
167
193
|
*/
|
|
168
194
|
export function assertIsOnProtocolRequestArguments(value) {
|
|
169
|
-
|
|
195
|
+
assertRequestArguments(value, OnProtocolRequestArgumentsStruct);
|
|
170
196
|
}
|
|
171
197
|
// TODO: Either fix this lint violation or explain why it's necessary to ignore.
|
|
172
198
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.mjs","sourceRoot":"","sources":["../../src/common/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,6BAA6B;AACjD,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACrB,4BAA4B;AAC7B,OAAO,EAAE,WAAW,EAAE,8BAA8B;AAEpD,OAAO,EACL,GAAG,EACH,KAAK,EACL,MAAM,EACN,KAAK,EACL,EAAE,EACF,OAAO,EACP,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,MAAM,EACN,KAAK,EACL,KAAK,EACN,8BAA8B;AAO/B,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,UAAU,EACX,wBAAwB;AAEzB,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC;IAClD,OAAO,EAAE,QAAQ,CAAC,oBAAoB,CAAC;IACvC,EAAE,EAAE,QAAQ,CAAC,eAAe,CAAC;IAC7B,MAAM,EAAE,MAAM,EAAE;IAChB,MAAM,EAAE,QAAQ,CAAC,mBAAmB,CAAC;CACtC,CAAC,CAAC;AAMH,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,EAAE,CAAC;AAGxC;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,OAAO,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;AACpC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE/B,MAAM,CAAC,MAAM,0BAA0B,GAAG,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;AAMH;;;;;;;GAOG;AACH,MAAM,UAAU,0CAA0C,CACxD,KAAc;IAEd,YAAY,CACV,KAAK,EACL,wCAAwC,EACxC,wBAAwB,EACxB,SAAS,CAAC,aAAa,CACxB,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC;IAC/C,EAAE,EAAE,MAAM,EAAE;IACZ,KAAK,EAAE,oBAAoB;IAC3B,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC;CACpD,CAAC,CAAC;AAIH;;;;;;;GAOG;AACH,MAAM,UAAU,mCAAmC,CACjD,KAAc;IAEd,YAAY,CACV,KAAK,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,SAAS,CAAC,aAAa,CACxB,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,gCAAgC,GAAG,MAAM,CAAC;IACrD,KAAK,EAAE,iBAAiB;IACxB,OAAO,EAAE,oBAAoB;CAC9B,CAA6E,CAAC;AAM/E;;;;;;;GAOG;AACH,MAAM,UAAU,kCAAkC,CAChD,KAAc;IAEd,YAAY,CACV,KAAK,EACL,gCAAgC,EAChC,wBAAwB,EACxB,SAAS,CAAC,aAAa,CACxB,CAAC;AACJ,CAAC;AAED,gFAAgF;AAChF,6DAA6D;AAC7D,MAAM,gBAAgB,GAAG,MAAM,CAAC;IAC9B,EAAE,EAAE,eAAe;IACnB,OAAO,EAAE,oBAAoB;IAC7B,MAAM,EAAE,QAAQ;CACjB,CAAC,CAAC;AAEH,MAAM,eAAe,GAAG,oBAAoB,CAAC","sourcesContent":["import { rpcErrors } from '@metamask/rpc-errors';\nimport {\n InterfaceContextStruct,\n UserInputEventStruct,\n} from '@metamask/snaps-sdk';\nimport { HandlerType } from '@metamask/snaps-utils';\nimport type { Infer, Struct } from '@metamask/superstruct';\nimport {\n any,\n array,\n assign,\n enums,\n is,\n literal,\n nullable,\n object,\n optional,\n record,\n size,\n string,\n tuple,\n union,\n} from '@metamask/superstruct';\nimport type {\n CaipChainId,\n Json,\n JsonRpcRequest,\n JsonRpcSuccess,\n} from '@metamask/utils';\nimport {\n assertStruct,\n CaipAssetTypeStruct,\n CaipChainIdStruct,\n JsonRpcIdStruct,\n JsonRpcParamsStruct,\n JsonRpcRequestStruct,\n JsonRpcSuccessStruct,\n JsonRpcVersionStruct,\n JsonStruct,\n} from '@metamask/utils';\n\nexport const JsonRpcRequestWithoutIdStruct = object({\n jsonrpc: optional(JsonRpcVersionStruct),\n id: optional(JsonRpcIdStruct),\n method: string(),\n params: optional(JsonRpcParamsStruct),\n});\n\nexport type JsonRpcRequestWithoutId = Infer<\n typeof JsonRpcRequestWithoutIdStruct\n>;\n\nexport const EndowmentStruct = string();\nexport type Endowment = Infer<typeof EndowmentStruct>;\n\n/**\n * Check if the given value is an endowment.\n *\n * @param value - The value to check.\n * @returns Whether the value is an endowment.\n */\nexport function isEndowment(value: unknown): value is Endowment {\n return is(value, EndowmentStruct);\n}\n\n/**\n * Check if the given value is an array of endowments.\n *\n * @param value - The value to check.\n * @returns Whether the value is an array of endowments.\n */\nexport function isEndowmentsArray(value: unknown): value is Endowment[] {\n return Array.isArray(value) && value.every(isEndowment);\n}\n\nconst OkStruct = literal('OK');\n\nexport const PingRequestArgumentsStruct = optional(\n union([literal(undefined), array()]),\n);\n\nexport const TerminateRequestArgumentsStruct = union([\n literal(undefined),\n array(),\n]);\n\nexport const ExecuteSnapRequestArgumentsStruct = tuple([\n string(),\n string(),\n array(EndowmentStruct),\n]);\n\nexport const SnapRpcRequestArgumentsStruct = tuple([\n string(),\n enums(Object.values(HandlerType)),\n string(),\n assign(\n JsonRpcRequestWithoutIdStruct,\n object({\n // Previously this would validate that the parameters were valid JSON.\n // This is already validated for all messages received by the executor.\n // If that assumption changes, this should once again validate JSON.\n params: optional(record(string(), any())),\n }),\n ),\n]);\n\nexport type PingRequestArguments = Infer<typeof PingRequestArgumentsStruct>;\nexport type TerminateRequestArguments = Infer<\n typeof TerminateRequestArgumentsStruct\n>;\n\nexport type ExecuteSnapRequestArguments = Infer<\n typeof ExecuteSnapRequestArgumentsStruct\n>;\n\nexport type SnapRpcRequestArguments = Infer<\n typeof SnapRpcRequestArgumentsStruct\n>;\n\nexport type RequestArguments =\n | PingRequestArguments\n | TerminateRequestArguments\n | ExecuteSnapRequestArguments\n | SnapRpcRequestArguments;\n\nexport const OnTransactionRequestArgumentsStruct = object({\n // TODO: Improve `transaction` type.\n transaction: record(string(), JsonStruct),\n chainId: CaipChainIdStruct,\n transactionOrigin: nullable(string()),\n});\n\nexport type OnTransactionRequestArguments = Infer<\n typeof OnTransactionRequestArgumentsStruct\n>;\n\n/**\n * Asserts that the given value is a valid {@link OnTransactionRequestArguments}\n * object.\n *\n * @param value - The value to validate.\n * @throws If the value is not a valid {@link OnTransactionRequestArguments}\n * object.\n */\nexport function assertIsOnTransactionRequestArguments(\n value: unknown,\n): asserts value is OnTransactionRequestArguments {\n assertStruct(\n value,\n OnTransactionRequestArgumentsStruct,\n 'Invalid request params',\n rpcErrors.invalidParams,\n );\n}\n\nexport const OnSignatureRequestArgumentsStruct = object({\n signature: record(string(), JsonStruct),\n signatureOrigin: nullable(string()),\n});\n\nexport type OnSignatureRequestArguments = Infer<\n typeof OnSignatureRequestArgumentsStruct\n>;\n\n/**\n * Asserts that the given value is a valid {@link OnSignatureRequestArguments}\n * object.\n *\n * @param value - The value to validate.\n * @throws If the value is not a valid {@link OnSignatureRequestArguments}\n * object.\n */\nexport function assertIsOnSignatureRequestArguments(\n value: unknown,\n): asserts value is OnSignatureRequestArguments {\n assertStruct(\n value,\n OnSignatureRequestArgumentsStruct,\n 'Invalid request params',\n rpcErrors.invalidParams,\n );\n}\n\nconst baseNameLookupArgs = { chainId: CaipChainIdStruct };\nconst domainRequestStruct = object({\n ...baseNameLookupArgs,\n address: string(),\n});\nconst addressRequestStruct = object({\n ...baseNameLookupArgs,\n domain: string(),\n});\n\nexport const OnNameLookupRequestArgumentsStruct = union([\n domainRequestStruct,\n addressRequestStruct,\n]);\n\nexport type OnNameLookupRequestArguments = Infer<\n typeof OnNameLookupRequestArgumentsStruct\n>;\n\nexport type PossibleLookupRequestArgs = typeof baseNameLookupArgs & {\n address?: string;\n domain?: string;\n};\n\n/**\n * Asserts that the given value is a valid {@link OnNameLookupRequestArguments}\n * object.\n *\n * @param value - The value to validate.\n * @throws If the value is not a valid {@link OnNameLookupRequestArguments}\n * object.\n */\nexport function assertIsOnNameLookupRequestArguments(\n value: unknown,\n): asserts value is OnNameLookupRequestArguments {\n assertStruct(\n value,\n OnNameLookupRequestArgumentsStruct,\n 'Invalid request params',\n rpcErrors.invalidParams,\n );\n}\n\nexport const OnAssetsLookupRequestArgumentsStruct = object({\n assets: size(array(CaipAssetTypeStruct), 1, Infinity),\n});\n\nexport type OnAssetsLookupRequestArguments = Infer<\n typeof OnAssetsLookupRequestArgumentsStruct\n>;\n\n/**\n * Asserts that the given value is a valid {@link OnAssetsLookupRequestArguments}\n * object.\n *\n * @param value - The value to validate.\n * @throws If the value is not a valid {@link OnAssetsLookupRequestArguments}\n * object.\n */\nexport function assertIsOnAssetsLookupRequestArguments(\n value: unknown,\n): asserts value is OnAssetsLookupRequestArguments {\n assertStruct(\n value,\n OnAssetsLookupRequestArgumentsStruct,\n 'Invalid request params',\n rpcErrors.invalidParams,\n );\n}\n\nexport const OnAssetsConversionRequestArgumentsStruct = object({\n conversions: size(\n array(\n object({\n from: CaipAssetTypeStruct,\n to: CaipAssetTypeStruct,\n }),\n ),\n 1,\n Infinity,\n ),\n});\n\nexport type OnAssetsConversionRequestArguments = Infer<\n typeof OnAssetsConversionRequestArgumentsStruct\n>;\n\n/**\n * Asserts that the given value is a valid {@link OnAssetsConversionRequestArguments}\n * object.\n *\n * @param value - The value to validate.\n * @throws If the value is not a valid {@link OnNameLookupRequestArguments}\n * object.\n */\nexport function assertIsOnAssetsConversionRequestArguments(\n value: unknown,\n): asserts value is OnAssetsConversionRequestArguments {\n assertStruct(\n value,\n OnAssetsConversionRequestArgumentsStruct,\n 'Invalid request params',\n rpcErrors.invalidParams,\n );\n}\n\nexport const OnUserInputArgumentsStruct = object({\n id: string(),\n event: UserInputEventStruct,\n context: optional(nullable(InterfaceContextStruct)),\n});\n\nexport type OnUserInputArguments = Infer<typeof OnUserInputArgumentsStruct>;\n\n/**\n * Asserts that the given value is a valid {@link OnUserInputArguments}\n * object.\n *\n * @param value - The value to validate.\n * @throws If the value is not a valid {@link OnUserInputArguments}\n * object.\n */\nexport function assertIsOnUserInputRequestArguments(\n value: unknown,\n): asserts value is OnUserInputArguments {\n assertStruct(\n value,\n OnUserInputArgumentsStruct,\n 'Invalid request params',\n rpcErrors.invalidParams,\n );\n}\n\nexport const OnProtocolRequestArgumentsStruct = object({\n scope: CaipChainIdStruct,\n request: JsonRpcRequestStruct,\n}) as unknown as Struct<{ scope: CaipChainId; request: JsonRpcRequest }, null>;\n\nexport type OnProtocolRequestArguments = Infer<\n typeof OnProtocolRequestArgumentsStruct\n>;\n\n/**\n * Asserts that the given value is a valid {@link OnProtocolRequestArguments}\n * object.\n *\n * @param value - The value to validate.\n * @throws If the value is not a valid {@link OnProtocolRequestArguments}\n * object.\n */\nexport function assertIsOnProtocolRequestArguments(\n value: unknown,\n): asserts value is OnProtocolRequestArguments {\n assertStruct(\n value,\n OnProtocolRequestArgumentsStruct,\n 'Invalid request params',\n rpcErrors.invalidParams,\n );\n}\n\n// TODO: Either fix this lint violation or explain why it's necessary to ignore.\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nconst OkResponseStruct = object({\n id: JsonRpcIdStruct,\n jsonrpc: JsonRpcVersionStruct,\n result: OkStruct,\n});\n\nconst SnapRpcResponse = JsonRpcSuccessStruct;\n\nexport type OkResponse = Infer<typeof OkResponseStruct>;\nexport type SnapRpcResponse = Infer<typeof SnapRpcResponse>;\n\nexport type Response = OkResponse | SnapRpcResponse;\n\ntype RequestParams<Params extends unknown[] | undefined> =\n Params extends undefined ? [] : Params;\n\ntype RequestFunction<\n Args extends RequestArguments,\n ResponseType extends JsonRpcSuccess<Json>,\n> = (...args: RequestParams<Args>) => Promise<ResponseType['result']>;\n\nexport type Ping = RequestFunction<PingRequestArguments, OkResponse>;\nexport type Terminate = RequestFunction<TerminateRequestArguments, OkResponse>;\nexport type ExecuteSnap = RequestFunction<\n ExecuteSnapRequestArguments,\n OkResponse\n>;\nexport type SnapRpc = RequestFunction<SnapRpcRequestArguments, SnapRpcResponse>;\n"]}
|
|
1
|
+
{"version":3,"file":"validation.mjs","sourceRoot":"","sources":["../../src/common/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,6BAA6B;AACjD,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACrB,4BAA4B;AAC7B,OAAO,EAAE,WAAW,EAAE,8BAA8B;AAEpD,OAAO,EACL,GAAG,EACH,KAAK,EACL,MAAM,EACN,OAAO,EACP,KAAK,EACL,EAAE,EACF,OAAO,EACP,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,MAAM,EACN,KAAK,EACL,KAAK,EACN,8BAA8B;AAO/B,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,UAAU,EACX,wBAAwB;AAEzB,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC;IAClD,OAAO,EAAE,QAAQ,CAAC,oBAAoB,CAAC;IACvC,EAAE,EAAE,QAAQ,CAAC,eAAe,CAAC;IAC7B,MAAM,EAAE,MAAM,EAAE;IAChB,MAAM,EAAE,QAAQ,CAAC,mBAAmB,CAAC;CACtC,CAAC,CAAC;AAMH,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,EAAE,CAAC;AAGxC;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,OAAO,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;AACp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AE,gCAAgC,CAAC,CAAC;AAClE,CAAC;AAED,gFAAgF;AAChF,6DAA6D;AAC7D,MAAM,gBAAgB,GAAG,MAAM,CAAC;IAC9B,EAAE,EAAE,eAAe;IACnB,OAAO,EAAE,oBAAoB;IAC7B,MAAM,EAAE,QAAQ;CACjB,CAAC,CAAC;AAEH,MAAM,eAAe,GAAG,oBAAoB,CAAC","sourcesContent":["import { rpcErrors } from '@metamask/rpc-errors';\nimport {\n InterfaceContextStruct,\n UserInputEventStruct,\n} from '@metamask/snaps-sdk';\nimport { HandlerType } from '@metamask/snaps-utils';\nimport type { Infer, Struct } from '@metamask/superstruct';\nimport {\n any,\n array,\n assign,\n boolean,\n enums,\n is,\n literal,\n nullable,\n object,\n optional,\n record,\n size,\n string,\n tuple,\n union,\n} from '@metamask/superstruct';\nimport type {\n CaipChainId,\n Json,\n JsonRpcRequest,\n JsonRpcSuccess,\n} from '@metamask/utils';\nimport {\n assertStruct,\n CaipAssetTypeStruct,\n CaipChainIdStruct,\n JsonRpcIdStruct,\n JsonRpcParamsStruct,\n JsonRpcRequestStruct,\n JsonRpcSuccessStruct,\n JsonRpcVersionStruct,\n JsonStruct,\n} from '@metamask/utils';\n\nexport const JsonRpcRequestWithoutIdStruct = object({\n jsonrpc: optional(JsonRpcVersionStruct),\n id: optional(JsonRpcIdStruct),\n method: string(),\n params: optional(JsonRpcParamsStruct),\n});\n\nexport type JsonRpcRequestWithoutId = Infer<\n typeof JsonRpcRequestWithoutIdStruct\n>;\n\nexport const EndowmentStruct = string();\nexport type Endowment = Infer<typeof EndowmentStruct>;\n\n/**\n * Check if the given value is an endowment.\n *\n * @param value - The value to check.\n * @returns Whether the value is an endowment.\n */\nexport function isEndowment(value: unknown): value is Endowment {\n return is(value, EndowmentStruct);\n}\n\n/**\n * Check if the given value is an array of endowments.\n *\n * @param value - The value to check.\n * @returns Whether the value is an array of endowments.\n */\nexport function isEndowmentsArray(value: unknown): value is Endowment[] {\n return Array.isArray(value) && value.every(isEndowment);\n}\n\nconst OkStruct = literal('OK');\n\nexport const PingRequestArgumentsStruct = optional(\n union([literal(undefined), array()]),\n);\n\nexport const TerminateRequestArgumentsStruct = union([\n literal(undefined),\n array(),\n]);\n\nexport const ExecuteSnapRequestArgumentsStruct = tuple([\n string(),\n string(),\n array(EndowmentStruct),\n]);\n\nexport const SnapRpcRequestArgumentsStruct = tuple([\n string(),\n enums(Object.values(HandlerType)),\n string(),\n assign(\n JsonRpcRequestWithoutIdStruct,\n object({\n // Previously this would validate that the parameters were valid JSON.\n // This is already validated for all messages received by the executor.\n // If that assumption changes, this should once again validate JSON.\n params: optional(record(string(), any())),\n }),\n ),\n]);\n\nexport type PingRequestArguments = Infer<typeof PingRequestArgumentsStruct>;\nexport type TerminateRequestArguments = Infer<\n typeof TerminateRequestArgumentsStruct\n>;\n\nexport type ExecuteSnapRequestArguments = Infer<\n typeof ExecuteSnapRequestArgumentsStruct\n>;\n\nexport type SnapRpcRequestArguments = Infer<\n typeof SnapRpcRequestArgumentsStruct\n>;\n\nexport type RequestArguments =\n | PingRequestArguments\n | TerminateRequestArguments\n | ExecuteSnapRequestArguments\n | SnapRpcRequestArguments;\n\n/**\n * Asserts that the given value is a valid request arguments object.\n *\n * @param value - The value to validate.\n * @param struct - The struct to validate the value against.\n * @throws If the value is not a valid request arguments object.\n */\nfunction assertRequestArguments<Type, Schema>(\n value: unknown,\n struct: Struct<Type, Schema>,\n): asserts value is Struct<Type, Schema> {\n assertStruct(\n value,\n struct,\n 'Invalid request params',\n rpcErrors.invalidParams,\n );\n}\n\nexport const OnTransactionRequestArgumentsStruct = object({\n // TODO: Improve `transaction` type.\n transaction: record(string(), JsonStruct),\n chainId: CaipChainIdStruct,\n transactionOrigin: nullable(string()),\n});\n\nexport type OnTransactionRequestArguments = Infer<\n typeof OnTransactionRequestArgumentsStruct\n>;\n\n/**\n * Asserts that the given value is a valid {@link OnTransactionRequestArguments}\n * object.\n *\n * @param value - The value to validate.\n * @throws If the value is not a valid {@link OnTransactionRequestArguments}\n * object.\n */\nexport function assertIsOnTransactionRequestArguments(\n value: unknown,\n): asserts value is OnTransactionRequestArguments {\n assertRequestArguments(value, OnTransactionRequestArgumentsStruct);\n}\n\nexport const OnSignatureRequestArgumentsStruct = object({\n signature: record(string(), JsonStruct),\n signatureOrigin: nullable(string()),\n});\n\nexport type OnSignatureRequestArguments = Infer<\n typeof OnSignatureRequestArgumentsStruct\n>;\n\n/**\n * Asserts that the given value is a valid {@link OnSignatureRequestArguments}\n * object.\n *\n * @param value - The value to validate.\n * @throws If the value is not a valid {@link OnSignatureRequestArguments}\n * object.\n */\nexport function assertIsOnSignatureRequestArguments(\n value: unknown,\n): asserts value is OnSignatureRequestArguments {\n assertRequestArguments(value, OnSignatureRequestArgumentsStruct);\n}\n\nconst baseNameLookupArgs = { chainId: CaipChainIdStruct };\nconst domainRequestStruct = object({\n ...baseNameLookupArgs,\n address: string(),\n});\nconst addressRequestStruct = object({\n ...baseNameLookupArgs,\n domain: string(),\n});\n\nexport const OnNameLookupRequestArgumentsStruct = union([\n domainRequestStruct,\n addressRequestStruct,\n]);\n\nexport type OnNameLookupRequestArguments = Infer<\n typeof OnNameLookupRequestArgumentsStruct\n>;\n\nexport type PossibleLookupRequestArgs = typeof baseNameLookupArgs & {\n address?: string;\n domain?: string;\n};\n\n/**\n * Asserts that the given value is a valid {@link OnNameLookupRequestArguments}\n * object.\n *\n * @param value - The value to validate.\n * @throws If the value is not a valid {@link OnNameLookupRequestArguments}\n * object.\n */\nexport function assertIsOnNameLookupRequestArguments(\n value: unknown,\n): asserts value is OnNameLookupRequestArguments {\n assertRequestArguments(value, OnNameLookupRequestArgumentsStruct);\n}\n\nexport const OnAssetHistoricalPriceRequestArgumentsStruct = object({\n from: CaipAssetTypeStruct,\n to: CaipAssetTypeStruct,\n});\n\nexport type OnAssetHistoricalPriceRequestArguments = Infer<\n typeof OnAssetHistoricalPriceRequestArgumentsStruct\n>;\n\n/**\n * Asserts that the given value is a valid {@link OnAssetHistoricalPriceRequestArguments}\n * object.\n *\n * @param value - The value to validate.\n * @throws If the value is not a valid {@link OnAssetHistoricalPriceRequestArguments}\n * object.\n */\nexport function assertIsOnAssetHistoricalPriceRequestArguments(\n value: unknown,\n): asserts value is OnAssetHistoricalPriceRequestArguments {\n assertRequestArguments(value, OnAssetHistoricalPriceRequestArgumentsStruct);\n}\n\nexport const OnAssetsLookupRequestArgumentsStruct = object({\n assets: size(array(CaipAssetTypeStruct), 1, Infinity),\n});\n\nexport type OnAssetsLookupRequestArguments = Infer<\n typeof OnAssetsLookupRequestArgumentsStruct\n>;\n\n/**\n * Asserts that the given value is a valid {@link OnAssetsLookupRequestArguments}\n * object.\n *\n * @param value - The value to validate.\n * @throws If the value is not a valid {@link OnAssetsLookupRequestArguments}\n * object.\n */\nexport function assertIsOnAssetsLookupRequestArguments(\n value: unknown,\n): asserts value is OnAssetsLookupRequestArguments {\n assertRequestArguments(value, OnAssetsLookupRequestArgumentsStruct);\n}\n\nexport const OnAssetsConversionRequestArgumentsStruct = object({\n conversions: size(\n array(\n object({\n from: CaipAssetTypeStruct,\n to: CaipAssetTypeStruct,\n }),\n ),\n 1,\n Infinity,\n ),\n includeMarketData: optional(boolean()),\n});\n\nexport type OnAssetsConversionRequestArguments = Infer<\n typeof OnAssetsConversionRequestArgumentsStruct\n>;\n\n/**\n * Asserts that the given value is a valid {@link OnAssetsConversionRequestArguments}\n * object.\n *\n * @param value - The value to validate.\n * @throws If the value is not a valid {@link OnNameLookupRequestArguments}\n * object.\n */\nexport function assertIsOnAssetsConversionRequestArguments(\n value: unknown,\n): asserts value is OnAssetsConversionRequestArguments {\n assertRequestArguments(value, OnAssetsConversionRequestArgumentsStruct);\n}\n\nexport const OnUserInputArgumentsStruct = object({\n id: string(),\n event: UserInputEventStruct,\n context: optional(nullable(InterfaceContextStruct)),\n});\n\nexport type OnUserInputArguments = Infer<typeof OnUserInputArgumentsStruct>;\n\n/**\n * Asserts that the given value is a valid {@link OnUserInputArguments}\n * object.\n *\n * @param value - The value to validate.\n * @throws If the value is not a valid {@link OnUserInputArguments}\n * object.\n */\nexport function assertIsOnUserInputRequestArguments(\n value: unknown,\n): asserts value is OnUserInputArguments {\n assertRequestArguments(value, OnUserInputArgumentsStruct);\n}\n\nexport const OnProtocolRequestArgumentsStruct = object({\n scope: CaipChainIdStruct,\n request: JsonRpcRequestStruct,\n}) as unknown as Struct<{ scope: CaipChainId; request: JsonRpcRequest }, null>;\n\nexport type OnProtocolRequestArguments = Infer<\n typeof OnProtocolRequestArgumentsStruct\n>;\n\n/**\n * Asserts that the given value is a valid {@link OnProtocolRequestArguments}\n * object.\n *\n * @param value - The value to validate.\n * @throws If the value is not a valid {@link OnProtocolRequestArguments}\n * object.\n */\nexport function assertIsOnProtocolRequestArguments(\n value: unknown,\n): asserts value is OnProtocolRequestArguments {\n assertRequestArguments(value, OnProtocolRequestArgumentsStruct);\n}\n\n// TODO: Either fix this lint violation or explain why it's necessary to ignore.\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nconst OkResponseStruct = object({\n id: JsonRpcIdStruct,\n jsonrpc: JsonRpcVersionStruct,\n result: OkStruct,\n});\n\nconst SnapRpcResponse = JsonRpcSuccessStruct;\n\nexport type OkResponse = Infer<typeof OkResponseStruct>;\nexport type SnapRpcResponse = Infer<typeof SnapRpcResponse>;\n\nexport type Response = OkResponse | SnapRpcResponse;\n\ntype RequestParams<Params extends unknown[] | undefined> =\n Params extends undefined ? [] : Params;\n\ntype RequestFunction<\n Args extends RequestArguments,\n ResponseType extends JsonRpcSuccess<Json>,\n> = (...args: RequestParams<Args>) => Promise<ResponseType['result']>;\n\nexport type Ping = RequestFunction<PingRequestArguments, OkResponse>;\nexport type Terminate = RequestFunction<TerminateRequestArguments, OkResponse>;\nexport type ExecuteSnap = RequestFunction<\n ExecuteSnapRequestArguments,\n OkResponse\n>;\nexport type SnapRpc = RequestFunction<SnapRpcRequestArguments, SnapRpcResponse>;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/snaps-execution-environments",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"description": "Snap sandbox environments for executing SES javascript",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MetaMask",
|
|
@@ -57,9 +57,10 @@
|
|
|
57
57
|
"since-latest-release": "../../scripts/since-latest-release.sh",
|
|
58
58
|
"start": "node scripts/start.js",
|
|
59
59
|
"test": "jest --reporters=jest-silent-reporter && yarn test:browser",
|
|
60
|
-
"test:browser": "
|
|
60
|
+
"test:browser": "vitest",
|
|
61
|
+
"test:browser:firefox": "vitest --config ./vitest.config.firefox.mts",
|
|
61
62
|
"test:clean": "jest --clearCache",
|
|
62
|
-
"test:post": "ts-node scripts/coverage.ts && rimraf coverage/jest coverage/
|
|
63
|
+
"test:post": "ts-node scripts/coverage.ts && rimraf coverage/jest coverage/vite",
|
|
63
64
|
"test:verbose": "jest --verbose",
|
|
64
65
|
"test:watch": "jest --watch"
|
|
65
66
|
},
|
|
@@ -69,9 +70,9 @@
|
|
|
69
70
|
"@metamask/post-message-stream": "^9.0.0",
|
|
70
71
|
"@metamask/providers": "^21.0.0",
|
|
71
72
|
"@metamask/rpc-errors": "^7.0.2",
|
|
72
|
-
"@metamask/snaps-sdk": "^6.
|
|
73
|
-
"@metamask/snaps-utils": "^9.
|
|
74
|
-
"@metamask/superstruct": "^3.1
|
|
73
|
+
"@metamask/snaps-sdk": "^6.22.0",
|
|
74
|
+
"@metamask/snaps-utils": "^9.2.0",
|
|
75
|
+
"@metamask/superstruct": "^3.2.1",
|
|
75
76
|
"@metamask/utils": "^11.2.0",
|
|
76
77
|
"nanoid": "^3.3.10",
|
|
77
78
|
"readable-stream": "^3.6.2"
|
|
@@ -85,27 +86,21 @@
|
|
|
85
86
|
"@lavamoat/allow-scripts": "^3.0.4",
|
|
86
87
|
"@lavamoat/lavapack": "^6.1.1",
|
|
87
88
|
"@lavamoat/lavatube": "^1.0.0",
|
|
88
|
-
"@metamask/auto-changelog": "^
|
|
89
|
+
"@metamask/auto-changelog": "^5.0.1",
|
|
89
90
|
"@swc/core": "1.3.78",
|
|
90
91
|
"@swc/jest": "^0.2.26",
|
|
91
92
|
"@ts-bridge/cli": "^0.6.1",
|
|
92
93
|
"@types/express": "^4.17.17",
|
|
93
94
|
"@types/jest": "^27.5.1",
|
|
94
95
|
"@types/node": "18.14.2",
|
|
95
|
-
"@
|
|
96
|
-
"@
|
|
97
|
-
"@wdio/globals": "^8.19.0",
|
|
98
|
-
"@wdio/mocha-framework": "^8.19.0",
|
|
99
|
-
"@wdio/spec-reporter": "^8.19.0",
|
|
100
|
-
"@wdio/static-server-service": "^8.19.0",
|
|
96
|
+
"@vitest/browser": "^3.0.8",
|
|
97
|
+
"@vitest/coverage-v8": "^3.0.8",
|
|
101
98
|
"babel-plugin-tsconfig-paths-module-resolver": "^1.0.4",
|
|
102
99
|
"babelify": "^10.0.0",
|
|
103
100
|
"browserify": "^17.0.0",
|
|
104
101
|
"deepmerge": "^4.2.2",
|
|
105
102
|
"depcheck": "^1.4.7",
|
|
106
|
-
"esbuild": "^0.25.1",
|
|
107
103
|
"eslint": "^9.11.0",
|
|
108
|
-
"expect-webdriverio": "^4.4.1",
|
|
109
104
|
"istanbul-lib-coverage": "^3.2.0",
|
|
110
105
|
"istanbul-lib-report": "^3.0.0",
|
|
111
106
|
"istanbul-reports": "^3.1.5",
|
|
@@ -124,9 +119,7 @@
|
|
|
124
119
|
"typescript": "~5.3.3",
|
|
125
120
|
"vite": "^6.2.3",
|
|
126
121
|
"vite-tsconfig-paths": "^4.0.5",
|
|
127
|
-
"
|
|
128
|
-
"wdio-geckodriver-service": "^5.0.2",
|
|
129
|
-
"webdriverio": "^8.19.0",
|
|
122
|
+
"vitest": "^3.0.8",
|
|
130
123
|
"yargs": "^17.7.1"
|
|
131
124
|
},
|
|
132
125
|
"engines": {
|