@metamask/snaps-utils 7.0.3 → 7.1.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.
Files changed (62) hide show
  1. package/CHANGELOG.md +17 -1
  2. package/dist/{chunk-2IWSQJKQ.mjs → chunk-2M6G46W6.mjs} +1 -1
  3. package/dist/chunk-2M6G46W6.mjs.map +1 -0
  4. package/dist/{chunk-AWRMYDIN.js → chunk-7EDRFEUH.js} +11 -11
  5. package/dist/{chunk-ENKAY3PI.js → chunk-E5WSD47S.js} +16 -14
  6. package/dist/chunk-E5WSD47S.js.map +1 -0
  7. package/dist/{chunk-LGT3PBPZ.mjs → chunk-E6U344HR.mjs} +3 -3
  8. package/dist/{chunk-LCWDLIK5.mjs → chunk-HTS6HGUU.mjs} +14 -12
  9. package/dist/chunk-HTS6HGUU.mjs.map +1 -0
  10. package/dist/{chunk-TG4BDSYJ.js → chunk-HVTYDKBO.js} +1 -1
  11. package/dist/chunk-HVTYDKBO.js.map +1 -0
  12. package/dist/{chunk-HDZ3BJBL.mjs → chunk-KP4ZAWMP.mjs} +8 -4
  13. package/dist/chunk-KP4ZAWMP.mjs.map +1 -0
  14. package/dist/{chunk-YMUOYQFU.js → chunk-MKTAIEG7.js} +5 -5
  15. package/dist/{chunk-EX4PPLND.js → chunk-NDIITWO4.js} +7 -3
  16. package/dist/chunk-NDIITWO4.js.map +1 -0
  17. package/dist/{chunk-QX6MAFJU.mjs → chunk-PBXAWRWW.mjs} +6 -1
  18. package/dist/chunk-PBXAWRWW.mjs.map +1 -0
  19. package/dist/{chunk-2PCPD5XY.js → chunk-XNUUUOKX.js} +6 -1
  20. package/dist/chunk-XNUUUOKX.js.map +1 -0
  21. package/dist/{chunk-PIG67G67.mjs → chunk-YP3ZXUME.mjs} +3 -3
  22. package/dist/derivation-paths.js +2 -2
  23. package/dist/derivation-paths.mjs +1 -1
  24. package/dist/index.js +10 -6
  25. package/dist/index.mjs +9 -5
  26. package/dist/manifest/index.js +5 -3
  27. package/dist/manifest/index.mjs +4 -2
  28. package/dist/manifest/manifest.js +4 -4
  29. package/dist/manifest/manifest.mjs +3 -3
  30. package/dist/manifest/node.js +6 -4
  31. package/dist/manifest/node.mjs +5 -3
  32. package/dist/manifest/validation.js +5 -3
  33. package/dist/manifest/validation.mjs +4 -2
  34. package/dist/node.js +11 -7
  35. package/dist/node.mjs +10 -6
  36. package/dist/npm.js +4 -4
  37. package/dist/npm.mjs +3 -3
  38. package/dist/snaps.js +2 -2
  39. package/dist/snaps.mjs +1 -1
  40. package/dist/tsconfig.build.tsbuildinfo +1 -1
  41. package/dist/types/handlers.d.ts +87 -87
  42. package/dist/types/localization.d.ts +31 -55
  43. package/dist/types/manifest/validation.d.ts +65 -489
  44. package/dist/types/snaps.d.ts +5 -1
  45. package/dist/types/ui.d.ts +8 -1
  46. package/dist/ui.js +4 -2
  47. package/dist/ui.mjs +3 -1
  48. package/dist/validation.js +4 -4
  49. package/dist/validation.mjs +3 -3
  50. package/package.json +5 -5
  51. package/dist/chunk-2IWSQJKQ.mjs.map +0 -1
  52. package/dist/chunk-2PCPD5XY.js.map +0 -1
  53. package/dist/chunk-ENKAY3PI.js.map +0 -1
  54. package/dist/chunk-EX4PPLND.js.map +0 -1
  55. package/dist/chunk-HDZ3BJBL.mjs.map +0 -1
  56. package/dist/chunk-LCWDLIK5.mjs.map +0 -1
  57. package/dist/chunk-QX6MAFJU.mjs.map +0 -1
  58. package/dist/chunk-TG4BDSYJ.js.map +0 -1
  59. /package/dist/{chunk-AWRMYDIN.js.map → chunk-7EDRFEUH.js.map} +0 -0
  60. /package/dist/{chunk-LGT3PBPZ.mjs.map → chunk-E6U344HR.mjs.map} +0 -0
  61. /package/dist/{chunk-YMUOYQFU.js.map → chunk-MKTAIEG7.js.map} +0 -0
  62. /package/dist/{chunk-PIG67G67.mjs.map → chunk-YP3ZXUME.mjs.map} +0 -0
@@ -1,5 +1,5 @@
1
- import type { InitialPermissions } from '@metamask/snaps-sdk';
2
- import type { Infer, Struct } from 'superstruct';
1
+ import type { EmptyObject, InitialPermissions } from '@metamask/snaps-sdk';
2
+ import type { Describe, Infer, Struct } from 'superstruct';
3
3
  import type { InferMatching } from '../structs';
4
4
  export declare const FORBIDDEN_COIN_TYPES: number[];
5
5
  export declare const Bip32PathStruct: Struct<string[], Struct<string, null>>;
@@ -54,231 +54,8 @@ export declare const HandlerCaveatsStruct: Struct<{
54
54
  maxRequestTime: Struct<number | undefined, null>;
55
55
  }>;
56
56
  export declare type HandlerCaveats = Infer<typeof HandlerCaveatsStruct>;
57
- export declare const PermissionsStruct: Struct<{
58
- snap_dialog?: {} | undefined;
59
- snap_getBip32Entropy?: {
60
- path: string[];
61
- curve: "ed25519" | "secp256k1";
62
- }[] | undefined;
63
- snap_getBip32PublicKey?: {
64
- path: string[];
65
- curve: "ed25519" | "secp256k1";
66
- }[] | undefined;
67
- snap_getBip44Entropy?: {
68
- coinType: number;
69
- }[] | undefined;
70
- snap_getEntropy?: {} | undefined;
71
- snap_getLocale?: {} | undefined;
72
- snap_manageAccounts?: {} | undefined;
73
- snap_manageState?: {} | undefined;
74
- snap_notify?: {} | undefined;
75
- wallet_snap?: Record<string, {
76
- version?: string | undefined;
77
- }> | undefined;
78
- 'endowment:cronjob'?: {
79
- jobs: {
80
- request: {
81
- method: string;
82
- id?: string | number | null | undefined;
83
- jsonrpc?: "2.0" | undefined;
84
- params?: Record<string, import("@metamask/snaps-sdk").Json> | import("@metamask/snaps-sdk").Json[] | undefined;
85
- };
86
- expression: string;
87
- }[];
88
- maxRequestTime?: number | undefined;
89
- } | undefined;
90
- 'endowment:ethereum-provider'?: {} | undefined;
91
- 'endowment:keyring'?: {
92
- allowedOrigins?: string[] | undefined;
93
- maxRequestTime?: number | undefined;
94
- } | undefined;
95
- 'endowment:lifecycle-hooks'?: {
96
- maxRequestTime?: number | undefined;
97
- } | undefined;
98
- 'endowment:name-lookup'?: {
99
- chains?: `${string}:${string}`[] | undefined;
100
- maxRequestTime?: number | undefined;
101
- matchers?: {
102
- tlds: string[];
103
- } | {
104
- schemes: string[];
105
- } | {
106
- tlds: string[];
107
- schemes: string[];
108
- } | undefined;
109
- } | undefined;
110
- 'endowment:network-access'?: {} | undefined;
111
- 'endowment:page-home'?: {
112
- maxRequestTime?: number | undefined;
113
- } | undefined;
114
- 'endowment:rpc'?: {
115
- snaps?: boolean | undefined;
116
- dapps?: boolean | undefined;
117
- allowedOrigins?: string[] | undefined;
118
- } | undefined;
119
- 'endowment:signature-insight'?: {
120
- maxRequestTime?: number | undefined;
121
- allowSignatureOrigin?: boolean | undefined;
122
- } | undefined;
123
- 'endowment:transaction-insight'?: {
124
- maxRequestTime?: number | undefined;
125
- allowTransactionOrigin?: boolean | undefined;
126
- } | undefined;
127
- 'endowment:webassembly'?: {} | undefined;
128
- }, {
129
- 'endowment:cronjob': Struct<{
130
- jobs: {
131
- request: {
132
- method: string;
133
- id?: string | number | null | undefined;
134
- jsonrpc?: "2.0" | undefined;
135
- params?: Record<string, import("@metamask/snaps-sdk").Json> | import("@metamask/snaps-sdk").Json[] | undefined;
136
- };
137
- expression: string;
138
- }[];
139
- maxRequestTime?: number | undefined;
140
- } | undefined, {
141
- jobs: Struct<{
142
- request: {
143
- method: string;
144
- id?: string | number | null | undefined;
145
- jsonrpc?: "2.0" | undefined;
146
- params?: Record<string, import("@metamask/snaps-sdk").Json> | import("@metamask/snaps-sdk").Json[] | undefined;
147
- };
148
- expression: string;
149
- }[], Struct<{
150
- request: {
151
- method: string;
152
- id?: string | number | null | undefined;
153
- jsonrpc?: "2.0" | undefined;
154
- params?: Record<string, import("@metamask/snaps-sdk").Json> | import("@metamask/snaps-sdk").Json[] | undefined;
155
- };
156
- expression: string;
157
- }, {
158
- expression: Struct<string, null>;
159
- request: Struct<{
160
- method: string;
161
- id?: string | number | null | undefined;
162
- jsonrpc?: "2.0" | undefined;
163
- params?: Record<string, import("@metamask/snaps-sdk").Json> | import("@metamask/snaps-sdk").Json[] | undefined;
164
- }, {
165
- jsonrpc: Struct<"2.0" | undefined, "2.0">;
166
- id: Struct<string | number | null | undefined, null>;
167
- method: Struct<string, null>;
168
- params: Struct<Record<string, import("@metamask/snaps-sdk").Json> | import("@metamask/snaps-sdk").Json[] | undefined, null>;
169
- }>;
170
- }>>;
171
- maxRequestTime: Struct<number | undefined, null>;
172
- }>;
173
- 'endowment:ethereum-provider': Struct<{} | undefined, {}>;
174
- 'endowment:keyring': Struct<{
175
- allowedOrigins?: string[] | undefined;
176
- maxRequestTime?: number | undefined;
177
- } | undefined, {
178
- allowedOrigins: Struct<string[] | undefined, Struct<string, null>>;
179
- maxRequestTime: Struct<number | undefined, null>;
180
- }>;
181
- 'endowment:lifecycle-hooks': Struct<{
182
- maxRequestTime?: number | undefined;
183
- } | undefined, {
184
- maxRequestTime: Struct<number | undefined, null>;
185
- }>;
186
- 'endowment:name-lookup': Struct<{
187
- chains?: `${string}:${string}`[] | undefined;
188
- maxRequestTime?: number | undefined;
189
- matchers?: {
190
- tlds: string[];
191
- } | {
192
- schemes: string[];
193
- } | {
194
- tlds: string[];
195
- schemes: string[];
196
- } | undefined;
197
- } | undefined, {
198
- chains: Struct<`${string}:${string}`[] | undefined, Struct<`${string}:${string}`, null>>;
199
- matchers: Struct<{
200
- tlds: string[];
201
- } | {
202
- schemes: string[];
203
- } | {
204
- tlds: string[];
205
- schemes: string[];
206
- } | undefined, null>;
207
- maxRequestTime: Struct<number | undefined, null>;
208
- }>;
209
- 'endowment:network-access': Struct<{} | undefined, {}>;
210
- 'endowment:page-home': Struct<{
211
- maxRequestTime?: number | undefined;
212
- } | undefined, {
213
- maxRequestTime: Struct<number | undefined, null>;
214
- }>;
215
- 'endowment:rpc': Struct<{
216
- snaps?: boolean | undefined;
217
- dapps?: boolean | undefined;
218
- allowedOrigins?: string[] | undefined;
219
- } | undefined, {
220
- dapps: Struct<boolean | undefined, null>;
221
- snaps: Struct<boolean | undefined, null>;
222
- allowedOrigins: Struct<string[] | undefined, Struct<string, null>>;
223
- }>;
224
- 'endowment:signature-insight': Struct<{
225
- maxRequestTime?: number | undefined;
226
- allowSignatureOrigin?: boolean | undefined;
227
- } | undefined, {
228
- allowSignatureOrigin: Struct<boolean | undefined, null>;
229
- maxRequestTime: Struct<number | undefined, null>;
230
- }>;
231
- 'endowment:transaction-insight': Struct<{
232
- maxRequestTime?: number | undefined;
233
- allowTransactionOrigin?: boolean | undefined;
234
- } | undefined, {
235
- allowTransactionOrigin: Struct<boolean | undefined, null>;
236
- maxRequestTime: Struct<number | undefined, null>;
237
- }>;
238
- 'endowment:webassembly': Struct<{} | undefined, {}>;
239
- snap_dialog: Struct<{} | undefined, {}>;
240
- snap_manageState: Struct<{} | undefined, {}>;
241
- snap_manageAccounts: Struct<{} | undefined, {}>;
242
- snap_notify: Struct<{} | undefined, {}>;
243
- snap_getBip32Entropy: Struct<{
244
- path: string[];
245
- curve: "ed25519" | "secp256k1";
246
- }[] | undefined, Struct<{
247
- path: string[];
248
- curve: "ed25519" | "secp256k1";
249
- }, {
250
- path: Struct<string[], Struct<string, null>>;
251
- curve: Struct<"ed25519" | "secp256k1", {
252
- ed25519: "ed25519";
253
- secp256k1: "secp256k1";
254
- }>;
255
- }>>;
256
- snap_getBip32PublicKey: Struct<{
257
- path: string[];
258
- curve: "ed25519" | "secp256k1";
259
- }[] | undefined, Struct<{
260
- path: string[];
261
- curve: "ed25519" | "secp256k1";
262
- }, {
263
- path: Struct<string[], Struct<string, null>>;
264
- curve: Struct<"ed25519" | "secp256k1", {
265
- ed25519: "ed25519";
266
- secp256k1: "secp256k1";
267
- }>;
268
- }>>;
269
- snap_getBip44Entropy: Struct<{
270
- coinType: number;
271
- }[] | undefined, Struct<{
272
- coinType: number;
273
- }, {
274
- coinType: Struct<number, null>;
275
- }>>;
276
- snap_getEntropy: Struct<{} | undefined, {}>;
277
- snap_getLocale: Struct<{} | undefined, {}>;
278
- wallet_snap: Struct<Record<string, {
279
- version?: string | undefined;
280
- }> | undefined, null>;
281
- }>;
57
+ export declare const EmptyObjectStruct: Struct<EmptyObject, null>;
58
+ export declare const PermissionsStruct: Describe<InitialPermissions>;
282
59
  export declare type SnapPermissions = InferMatching<typeof PermissionsStruct, InitialPermissions>;
283
60
  export declare const SnapAuxilaryFilesStruct: Struct<string[], Struct<string, null>>;
284
61
  export declare const InitialConnectionsStruct: Struct<Record<string & URL, {}>, null>;
@@ -300,78 +77,54 @@ export declare const SnapManifestStruct: Struct<{
300
77
  locales?: string[] | undefined;
301
78
  };
302
79
  proposedName: string;
303
- initialPermissions: {
304
- snap_dialog?: {} | undefined;
305
- snap_getBip32Entropy?: {
306
- path: string[];
307
- curve: "ed25519" | "secp256k1";
308
- }[] | undefined;
309
- snap_getBip32PublicKey?: {
310
- path: string[];
311
- curve: "ed25519" | "secp256k1";
312
- }[] | undefined;
313
- snap_getBip44Entropy?: {
314
- coinType: number;
315
- }[] | undefined;
316
- snap_getEntropy?: {} | undefined;
317
- snap_getLocale?: {} | undefined;
318
- snap_manageAccounts?: {} | undefined;
319
- snap_manageState?: {} | undefined;
320
- snap_notify?: {} | undefined;
321
- wallet_snap?: Record<string, {
322
- version?: string | undefined;
323
- }> | undefined;
324
- 'endowment:cronjob'?: {
325
- jobs: {
326
- request: {
327
- method: string;
328
- id?: string | number | null | undefined;
329
- jsonrpc?: "2.0" | undefined;
330
- params?: Record<string, import("@metamask/snaps-sdk").Json> | import("@metamask/snaps-sdk").Json[] | undefined;
331
- };
332
- expression: string;
333
- }[];
80
+ initialPermissions: Partial<{
81
+ 'endowment:cronjob': {
82
+ jobs: import("@metamask/snaps-sdk").Cronjob[];
334
83
  maxRequestTime?: number | undefined;
335
- } | undefined;
336
- 'endowment:ethereum-provider'?: {} | undefined;
337
- 'endowment:keyring'?: {
84
+ };
85
+ 'endowment:ethereum-provider': EmptyObject;
86
+ 'endowment:keyring': {
338
87
  allowedOrigins?: string[] | undefined;
339
88
  maxRequestTime?: number | undefined;
340
- } | undefined;
89
+ };
341
90
  'endowment:lifecycle-hooks'?: {
342
91
  maxRequestTime?: number | undefined;
343
92
  } | undefined;
344
- 'endowment:name-lookup'?: {
93
+ 'endowment:name-lookup': {
345
94
  chains?: `${string}:${string}`[] | undefined;
95
+ matchers?: import("@metamask/snaps-sdk").NameLookupMatchers | undefined;
346
96
  maxRequestTime?: number | undefined;
347
- matchers?: {
348
- tlds: string[];
349
- } | {
350
- schemes: string[];
351
- } | {
352
- tlds: string[];
353
- schemes: string[];
354
- } | undefined;
355
- } | undefined;
356
- 'endowment:network-access'?: {} | undefined;
97
+ };
98
+ 'endowment:network-access': EmptyObject;
357
99
  'endowment:page-home'?: {
358
100
  maxRequestTime?: number | undefined;
359
101
  } | undefined;
360
- 'endowment:rpc'?: {
361
- snaps?: boolean | undefined;
102
+ 'endowment:rpc': {
362
103
  dapps?: boolean | undefined;
104
+ snaps?: boolean | undefined;
363
105
  allowedOrigins?: string[] | undefined;
364
- } | undefined;
365
- 'endowment:signature-insight'?: {
366
106
  maxRequestTime?: number | undefined;
107
+ };
108
+ 'endowment:signature-insight': {
367
109
  allowSignatureOrigin?: boolean | undefined;
368
- } | undefined;
369
- 'endowment:transaction-insight'?: {
370
110
  maxRequestTime?: number | undefined;
111
+ };
112
+ 'endowment:transaction-insight': {
371
113
  allowTransactionOrigin?: boolean | undefined;
372
- } | undefined;
373
- 'endowment:webassembly'?: {} | undefined;
374
- };
114
+ maxRequestTime?: number | undefined;
115
+ };
116
+ 'endowment:webassembly': EmptyObject;
117
+ snap_dialog: EmptyObject;
118
+ snap_getBip32Entropy: import("@metamask/snaps-sdk").Bip32Entropy[];
119
+ snap_getBip32PublicKey: import("@metamask/snaps-sdk").Bip32Entropy[];
120
+ snap_getBip44Entropy: import("@metamask/snaps-sdk").Bip44Entropy[];
121
+ snap_getEntropy: EmptyObject;
122
+ snap_getLocale: EmptyObject;
123
+ snap_manageAccounts: EmptyObject;
124
+ snap_manageState: EmptyObject;
125
+ snap_notify: EmptyObject;
126
+ wallet_snap: Record<string, import("@metamask/snaps-sdk").RequestedSnap>;
127
+ }>;
375
128
  manifestVersion: "0.1";
376
129
  repository?: {
377
130
  type: string;
@@ -428,231 +181,54 @@ export declare const SnapManifestStruct: Struct<{
428
181
  locales: Struct<string[] | undefined, Struct<string, null>>;
429
182
  }>;
430
183
  initialConnections: Struct<Record<string & URL, {}> | undefined, null>;
431
- initialPermissions: Struct<{
432
- snap_dialog?: {} | undefined;
433
- snap_getBip32Entropy?: {
434
- path: string[];
435
- curve: "ed25519" | "secp256k1";
436
- }[] | undefined;
437
- snap_getBip32PublicKey?: {
438
- path: string[];
439
- curve: "ed25519" | "secp256k1";
440
- }[] | undefined;
441
- snap_getBip44Entropy?: {
442
- coinType: number;
443
- }[] | undefined;
444
- snap_getEntropy?: {} | undefined;
445
- snap_getLocale?: {} | undefined;
446
- snap_manageAccounts?: {} | undefined;
447
- snap_manageState?: {} | undefined;
448
- snap_notify?: {} | undefined;
449
- wallet_snap?: Record<string, {
450
- version?: string | undefined;
451
- }> | undefined;
452
- 'endowment:cronjob'?: {
453
- jobs: {
454
- request: {
455
- method: string;
456
- id?: string | number | null | undefined;
457
- jsonrpc?: "2.0" | undefined;
458
- params?: Record<string, import("@metamask/snaps-sdk").Json> | import("@metamask/snaps-sdk").Json[] | undefined;
459
- };
460
- expression: string;
461
- }[];
184
+ initialPermissions: Describe<Partial<{
185
+ 'endowment:cronjob': {
186
+ jobs: import("@metamask/snaps-sdk").Cronjob[];
462
187
  maxRequestTime?: number | undefined;
463
- } | undefined;
464
- 'endowment:ethereum-provider'?: {} | undefined;
465
- 'endowment:keyring'?: {
188
+ };
189
+ 'endowment:ethereum-provider': EmptyObject;
190
+ 'endowment:keyring': {
466
191
  allowedOrigins?: string[] | undefined;
467
192
  maxRequestTime?: number | undefined;
468
- } | undefined;
193
+ };
469
194
  'endowment:lifecycle-hooks'?: {
470
195
  maxRequestTime?: number | undefined;
471
196
  } | undefined;
472
- 'endowment:name-lookup'?: {
197
+ 'endowment:name-lookup': {
473
198
  chains?: `${string}:${string}`[] | undefined;
199
+ matchers?: import("@metamask/snaps-sdk").NameLookupMatchers | undefined;
474
200
  maxRequestTime?: number | undefined;
475
- matchers?: {
476
- tlds: string[];
477
- } | {
478
- schemes: string[];
479
- } | {
480
- tlds: string[];
481
- schemes: string[];
482
- } | undefined;
483
- } | undefined;
484
- 'endowment:network-access'?: {} | undefined;
201
+ };
202
+ 'endowment:network-access': EmptyObject;
485
203
  'endowment:page-home'?: {
486
204
  maxRequestTime?: number | undefined;
487
205
  } | undefined;
488
- 'endowment:rpc'?: {
489
- snaps?: boolean | undefined;
206
+ 'endowment:rpc': {
490
207
  dapps?: boolean | undefined;
491
- allowedOrigins?: string[] | undefined;
492
- } | undefined;
493
- 'endowment:signature-insight'?: {
494
- maxRequestTime?: number | undefined;
495
- allowSignatureOrigin?: boolean | undefined;
496
- } | undefined;
497
- 'endowment:transaction-insight'?: {
498
- maxRequestTime?: number | undefined;
499
- allowTransactionOrigin?: boolean | undefined;
500
- } | undefined;
501
- 'endowment:webassembly'?: {} | undefined;
502
- }, {
503
- 'endowment:cronjob': Struct<{
504
- jobs: {
505
- request: {
506
- method: string;
507
- id?: string | number | null | undefined;
508
- jsonrpc?: "2.0" | undefined;
509
- params?: Record<string, import("@metamask/snaps-sdk").Json> | import("@metamask/snaps-sdk").Json[] | undefined;
510
- };
511
- expression: string;
512
- }[];
513
- maxRequestTime?: number | undefined;
514
- } | undefined, {
515
- jobs: Struct<{
516
- request: {
517
- method: string;
518
- id?: string | number | null | undefined;
519
- jsonrpc?: "2.0" | undefined;
520
- params?: Record<string, import("@metamask/snaps-sdk").Json> | import("@metamask/snaps-sdk").Json[] | undefined;
521
- };
522
- expression: string;
523
- }[], Struct<{
524
- request: {
525
- method: string;
526
- id?: string | number | null | undefined;
527
- jsonrpc?: "2.0" | undefined;
528
- params?: Record<string, import("@metamask/snaps-sdk").Json> | import("@metamask/snaps-sdk").Json[] | undefined;
529
- };
530
- expression: string;
531
- }, {
532
- expression: Struct<string, null>;
533
- request: Struct<{
534
- method: string;
535
- id?: string | number | null | undefined;
536
- jsonrpc?: "2.0" | undefined;
537
- params?: Record<string, import("@metamask/snaps-sdk").Json> | import("@metamask/snaps-sdk").Json[] | undefined;
538
- }, {
539
- jsonrpc: Struct<"2.0" | undefined, "2.0">;
540
- id: Struct<string | number | null | undefined, null>;
541
- method: Struct<string, null>;
542
- params: Struct<Record<string, import("@metamask/snaps-sdk").Json> | import("@metamask/snaps-sdk").Json[] | undefined, null>;
543
- }>;
544
- }>>;
545
- maxRequestTime: Struct<number | undefined, null>;
546
- }>;
547
- 'endowment:ethereum-provider': Struct<{} | undefined, {}>;
548
- 'endowment:keyring': Struct<{
549
- allowedOrigins?: string[] | undefined;
550
- maxRequestTime?: number | undefined;
551
- } | undefined, {
552
- allowedOrigins: Struct<string[] | undefined, Struct<string, null>>;
553
- maxRequestTime: Struct<number | undefined, null>;
554
- }>;
555
- 'endowment:lifecycle-hooks': Struct<{
556
- maxRequestTime?: number | undefined;
557
- } | undefined, {
558
- maxRequestTime: Struct<number | undefined, null>;
559
- }>;
560
- 'endowment:name-lookup': Struct<{
561
- chains?: `${string}:${string}`[] | undefined;
562
- maxRequestTime?: number | undefined;
563
- matchers?: {
564
- tlds: string[];
565
- } | {
566
- schemes: string[];
567
- } | {
568
- tlds: string[];
569
- schemes: string[];
570
- } | undefined;
571
- } | undefined, {
572
- chains: Struct<`${string}:${string}`[] | undefined, Struct<`${string}:${string}`, null>>;
573
- matchers: Struct<{
574
- tlds: string[];
575
- } | {
576
- schemes: string[];
577
- } | {
578
- tlds: string[];
579
- schemes: string[];
580
- } | undefined, null>;
581
- maxRequestTime: Struct<number | undefined, null>;
582
- }>;
583
- 'endowment:network-access': Struct<{} | undefined, {}>;
584
- 'endowment:page-home': Struct<{
585
- maxRequestTime?: number | undefined;
586
- } | undefined, {
587
- maxRequestTime: Struct<number | undefined, null>;
588
- }>;
589
- 'endowment:rpc': Struct<{
590
208
  snaps?: boolean | undefined;
591
- dapps?: boolean | undefined;
592
209
  allowedOrigins?: string[] | undefined;
593
- } | undefined, {
594
- dapps: Struct<boolean | undefined, null>;
595
- snaps: Struct<boolean | undefined, null>;
596
- allowedOrigins: Struct<string[] | undefined, Struct<string, null>>;
597
- }>;
598
- 'endowment:signature-insight': Struct<{
599
210
  maxRequestTime?: number | undefined;
211
+ };
212
+ 'endowment:signature-insight': {
600
213
  allowSignatureOrigin?: boolean | undefined;
601
- } | undefined, {
602
- allowSignatureOrigin: Struct<boolean | undefined, null>;
603
- maxRequestTime: Struct<number | undefined, null>;
604
- }>;
605
- 'endowment:transaction-insight': Struct<{
606
214
  maxRequestTime?: number | undefined;
215
+ };
216
+ 'endowment:transaction-insight': {
607
217
  allowTransactionOrigin?: boolean | undefined;
608
- } | undefined, {
609
- allowTransactionOrigin: Struct<boolean | undefined, null>;
610
- maxRequestTime: Struct<number | undefined, null>;
611
- }>;
612
- 'endowment:webassembly': Struct<{} | undefined, {}>;
613
- snap_dialog: Struct<{} | undefined, {}>;
614
- snap_manageState: Struct<{} | undefined, {}>;
615
- snap_manageAccounts: Struct<{} | undefined, {}>;
616
- snap_notify: Struct<{} | undefined, {}>;
617
- snap_getBip32Entropy: Struct<{
618
- path: string[];
619
- curve: "ed25519" | "secp256k1";
620
- }[] | undefined, Struct<{
621
- path: string[];
622
- curve: "ed25519" | "secp256k1";
623
- }, {
624
- path: Struct<string[], Struct<string, null>>;
625
- curve: Struct<"ed25519" | "secp256k1", {
626
- ed25519: "ed25519";
627
- secp256k1: "secp256k1";
628
- }>;
629
- }>>;
630
- snap_getBip32PublicKey: Struct<{
631
- path: string[];
632
- curve: "ed25519" | "secp256k1";
633
- }[] | undefined, Struct<{
634
- path: string[];
635
- curve: "ed25519" | "secp256k1";
636
- }, {
637
- path: Struct<string[], Struct<string, null>>;
638
- curve: Struct<"ed25519" | "secp256k1", {
639
- ed25519: "ed25519";
640
- secp256k1: "secp256k1";
641
- }>;
642
- }>>;
643
- snap_getBip44Entropy: Struct<{
644
- coinType: number;
645
- }[] | undefined, Struct<{
646
- coinType: number;
647
- }, {
648
- coinType: Struct<number, null>;
649
- }>>;
650
- snap_getEntropy: Struct<{} | undefined, {}>;
651
- snap_getLocale: Struct<{} | undefined, {}>;
652
- wallet_snap: Struct<Record<string, {
653
- version?: string | undefined;
654
- }> | undefined, null>;
655
- }>;
218
+ maxRequestTime?: number | undefined;
219
+ };
220
+ 'endowment:webassembly': EmptyObject;
221
+ snap_dialog: EmptyObject;
222
+ snap_getBip32Entropy: import("@metamask/snaps-sdk").Bip32Entropy[];
223
+ snap_getBip32PublicKey: import("@metamask/snaps-sdk").Bip32Entropy[];
224
+ snap_getBip44Entropy: import("@metamask/snaps-sdk").Bip44Entropy[];
225
+ snap_getEntropy: EmptyObject;
226
+ snap_getLocale: EmptyObject;
227
+ snap_manageAccounts: EmptyObject;
228
+ snap_manageState: EmptyObject;
229
+ snap_notify: EmptyObject;
230
+ wallet_snap: Record<string, import("@metamask/snaps-sdk").RequestedSnap>;
231
+ }>>;
656
232
  manifestVersion: Struct<"0.1", "0.1">;
657
233
  $schema: Struct<string | undefined, null>;
658
234
  }>;
@@ -3,7 +3,7 @@ import type { BlockReason } from '@metamask/snaps-registry';
3
3
  import type { SnapId, Snap as TruncatedSnap } from '@metamask/snaps-sdk';
4
4
  import type { Struct } from 'superstruct';
5
5
  import type { LocalizationFile } from './localization';
6
- import type { SnapManifest, SnapPermissions } from './manifest/validation';
6
+ import type { InitialConnections, SnapManifest, SnapPermissions } from './manifest/validation';
7
7
  import type { FetchedSnapFiles, SnapsPermissionRequest } from './types';
8
8
  import { SnapIdPrefixes, SnapValidationFailureReason } from './types';
9
9
  export declare const PROPOSED_NAME_REGEX: RegExp;
@@ -45,6 +45,10 @@ export declare type PersistedSnap = Snap;
45
45
  * A Snap as it exists in {@link SnapController} state.
46
46
  */
47
47
  export declare type Snap = TruncatedSnap & {
48
+ /**
49
+ * The initial connections of the Snap, optional, requested on installation.
50
+ */
51
+ initialConnections?: InitialConnections;
48
52
  /**
49
53
  * The initial permissions of the Snap, which will be requested when it is
50
54
  * installed.
@@ -1,4 +1,4 @@
1
- import type { Component } from '@metamask/snaps-sdk';
1
+ import type { Component, NodeWithChildren } from '@metamask/snaps-sdk';
2
2
  /**
3
3
  * Searches for markdown links in a string and checks them against the phishing list.
4
4
  *
@@ -25,3 +25,10 @@ export declare function validateComponentLinks(component: Component, isOnPhishin
25
25
  * @returns The total length of all text components in the component.
26
26
  */
27
27
  export declare function getTotalTextLength(component: Component): number;
28
+ /**
29
+ * Check if a component has children.
30
+ *
31
+ * @param component - A custom UI component.
32
+ * @returns `true` if the component has children, `false` otherwise.
33
+ */
34
+ export declare function hasChildren(component: Component): component is NodeWithChildren;
package/dist/ui.js CHANGED
@@ -2,11 +2,13 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkEX4PPLNDjs = require('./chunk-EX4PPLND.js');
5
+
6
+ var _chunkNDIITWO4js = require('./chunk-NDIITWO4.js');
6
7
  require('./chunk-PHUTP7NB.js');
7
8
 
8
9
 
9
10
 
10
11
 
11
- exports.getTotalTextLength = _chunkEX4PPLNDjs.getTotalTextLength; exports.validateComponentLinks = _chunkEX4PPLNDjs.validateComponentLinks; exports.validateTextLinks = _chunkEX4PPLNDjs.validateTextLinks;
12
+
13
+ exports.getTotalTextLength = _chunkNDIITWO4js.getTotalTextLength; exports.hasChildren = _chunkNDIITWO4js.hasChildren; exports.validateComponentLinks = _chunkNDIITWO4js.validateComponentLinks; exports.validateTextLinks = _chunkNDIITWO4js.validateTextLinks;
12
14
  //# sourceMappingURL=ui.js.map
package/dist/ui.mjs CHANGED
@@ -1,11 +1,13 @@
1
1
  import {
2
2
  getTotalTextLength,
3
+ hasChildren,
3
4
  validateComponentLinks,
4
5
  validateTextLinks
5
- } from "./chunk-HDZ3BJBL.mjs";
6
+ } from "./chunk-KP4ZAWMP.mjs";
6
7
  import "./chunk-JMDSN227.mjs";
7
8
  export {
8
9
  getTotalTextLength,
10
+ hasChildren,
9
11
  validateComponentLinks,
10
12
  validateTextLinks
11
13
  };