@metamask/snaps-sdk 6.19.0 → 6.21.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 (82) hide show
  1. package/CHANGELOG.md +21 -1
  2. package/dist/error-wrappers.d.cts +192 -192
  3. package/dist/error-wrappers.d.mts +192 -192
  4. package/dist/internals/error-wrappers.d.cts +12 -12
  5. package/dist/internals/error-wrappers.d.mts +12 -12
  6. package/dist/internals/jsx.cjs.map +1 -1
  7. package/dist/internals/jsx.d.cts +2 -1
  8. package/dist/internals/jsx.d.cts.map +1 -1
  9. package/dist/internals/jsx.d.mts +2 -1
  10. package/dist/internals/jsx.d.mts.map +1 -1
  11. package/dist/internals/jsx.mjs.map +1 -1
  12. package/dist/jsx/components/form/AddressInput.cjs +21 -0
  13. package/dist/jsx/components/form/AddressInput.cjs.map +1 -0
  14. package/dist/jsx/components/form/AddressInput.d.cts +26 -0
  15. package/dist/jsx/components/form/AddressInput.d.cts.map +1 -0
  16. package/dist/jsx/components/form/AddressInput.d.mts +26 -0
  17. package/dist/jsx/components/form/AddressInput.d.mts.map +1 -0
  18. package/dist/jsx/components/form/AddressInput.mjs +18 -0
  19. package/dist/jsx/components/form/AddressInput.mjs.map +1 -0
  20. package/dist/jsx/components/form/AssetSelector.cjs +37 -0
  21. package/dist/jsx/components/form/AssetSelector.cjs.map +1 -0
  22. package/dist/jsx/components/form/AssetSelector.d.cts +55 -0
  23. package/dist/jsx/components/form/AssetSelector.d.cts.map +1 -0
  24. package/dist/jsx/components/form/AssetSelector.d.mts +55 -0
  25. package/dist/jsx/components/form/AssetSelector.d.mts.map +1 -0
  26. package/dist/jsx/components/form/AssetSelector.mjs +34 -0
  27. package/dist/jsx/components/form/AssetSelector.mjs.map +1 -0
  28. package/dist/jsx/components/form/Field.cjs.map +1 -1
  29. package/dist/jsx/components/form/Field.d.cts +3 -1
  30. package/dist/jsx/components/form/Field.d.cts.map +1 -1
  31. package/dist/jsx/components/form/Field.d.mts +3 -1
  32. package/dist/jsx/components/form/Field.d.mts.map +1 -1
  33. package/dist/jsx/components/form/Field.mjs.map +1 -1
  34. package/dist/jsx/components/form/index.cjs +2 -0
  35. package/dist/jsx/components/form/index.cjs.map +1 -1
  36. package/dist/jsx/components/form/index.d.cts +5 -1
  37. package/dist/jsx/components/form/index.d.cts.map +1 -1
  38. package/dist/jsx/components/form/index.d.mts +5 -1
  39. package/dist/jsx/components/form/index.d.mts.map +1 -1
  40. package/dist/jsx/components/form/index.mjs +2 -0
  41. package/dist/jsx/components/form/index.mjs.map +1 -1
  42. package/dist/jsx/validation.cjs +30 -2
  43. package/dist/jsx/validation.cjs.map +1 -1
  44. package/dist/jsx/validation.d.cts +12 -4
  45. package/dist/jsx/validation.d.cts.map +1 -1
  46. package/dist/jsx/validation.d.mts +12 -4
  47. package/dist/jsx/validation.d.mts.map +1 -1
  48. package/dist/jsx/validation.mjs +29 -1
  49. package/dist/jsx/validation.mjs.map +1 -1
  50. package/dist/types/caip.cjs +40 -0
  51. package/dist/types/caip.cjs.map +1 -1
  52. package/dist/types/caip.d.cts +13 -1
  53. package/dist/types/caip.d.cts.map +1 -1
  54. package/dist/types/caip.d.mts +13 -1
  55. package/dist/types/caip.d.mts.map +1 -1
  56. package/dist/types/caip.mjs +39 -1
  57. package/dist/types/caip.mjs.map +1 -1
  58. package/dist/types/handlers/user-input.cjs +9 -3
  59. package/dist/types/handlers/user-input.cjs.map +1 -1
  60. package/dist/types/handlers/user-input.d.cts +44 -3
  61. package/dist/types/handlers/user-input.d.cts.map +1 -1
  62. package/dist/types/handlers/user-input.d.mts +44 -3
  63. package/dist/types/handlers/user-input.d.mts.map +1 -1
  64. package/dist/types/handlers/user-input.mjs +8 -2
  65. package/dist/types/handlers/user-input.mjs.map +1 -1
  66. package/dist/types/index.cjs +2 -0
  67. package/dist/types/index.cjs.map +1 -1
  68. package/dist/types/index.d.cts +1 -1
  69. package/dist/types/index.d.cts.map +1 -1
  70. package/dist/types/index.d.mts +1 -1
  71. package/dist/types/index.d.mts.map +1 -1
  72. package/dist/types/index.mjs +2 -0
  73. package/dist/types/index.mjs.map +1 -1
  74. package/dist/types/interface.cjs +7 -1
  75. package/dist/types/interface.cjs.map +1 -1
  76. package/dist/types/interface.d.cts +17 -1
  77. package/dist/types/interface.d.cts.map +1 -1
  78. package/dist/types/interface.d.mts +17 -1
  79. package/dist/types/interface.d.mts.map +1 -1
  80. package/dist/types/interface.mjs +9 -3
  81. package/dist/types/interface.mjs.map +1 -1
  82. package/package.json +3 -3
@@ -59,6 +59,23 @@ export declare const FileStruct: import("@metamask/superstruct").Struct<{
59
59
  * @property contents - The base64 encoded contents of the file.
60
60
  */
61
61
  export type File = Infer<typeof FileStruct>;
62
+ export declare const AssetSelectorStateStruct: import("@metamask/superstruct").Struct<{
63
+ symbol: string;
64
+ name: string;
65
+ asset: `${string}:${string}/${string}:${string}`;
66
+ }, {
67
+ asset: import("@metamask/superstruct").Struct<`${string}:${string}/${string}:${string}`, null>;
68
+ name: import("@metamask/superstruct").Struct<string, null>;
69
+ symbol: import("@metamask/superstruct").Struct<string, null>;
70
+ }>;
71
+ /**
72
+ * The state of the asset selector component.
73
+ *
74
+ * @property asset - The CAIP-19 asset ID.
75
+ * @property name - The name of the asset.
76
+ * @property symbol - The symbol of the asset.
77
+ */
78
+ export type AssetSelectorState = Infer<typeof AssetSelectorStateStruct>;
62
79
  export declare const FormSubmitEventStruct: import("@metamask/superstruct").Struct<{
63
80
  type: UserInputEventType.FormSubmitEvent;
64
81
  name: string;
@@ -67,6 +84,10 @@ export declare const FormSubmitEventStruct: import("@metamask/superstruct").Stru
67
84
  size: number;
68
85
  contentType: string;
69
86
  contents: string;
87
+ } | {
88
+ symbol: string;
89
+ name: string;
90
+ asset: `${string}:${string}/${string}:${string}`;
70
91
  } | null>;
71
92
  }, {
72
93
  type: import("@metamask/superstruct").Struct<UserInputEventType.FormSubmitEvent, UserInputEventType.FormSubmitEvent>;
@@ -75,6 +96,10 @@ export declare const FormSubmitEventStruct: import("@metamask/superstruct").Stru
75
96
  size: number;
76
97
  contentType: string;
77
98
  contents: string;
99
+ } | {
100
+ symbol: string;
101
+ name: string;
102
+ asset: `${string}:${string}/${string}:${string}`;
78
103
  } | null>, null>;
79
104
  name: import("@metamask/superstruct").Struct<string, null>;
80
105
  }>;
@@ -95,11 +120,19 @@ export type FormSubmitEvent = Infer<typeof FormSubmitEventStruct>;
95
120
  export declare const InputChangeEventStruct: import("@metamask/superstruct").Struct<{
96
121
  type: UserInputEventType.InputChangeEvent;
97
122
  name: string;
98
- value: string | boolean;
123
+ value: string | boolean | {
124
+ symbol: string;
125
+ name: string;
126
+ asset: `${string}:${string}/${string}:${string}`;
127
+ };
99
128
  }, {
100
129
  type: import("@metamask/superstruct").Struct<UserInputEventType.InputChangeEvent, UserInputEventType.InputChangeEvent>;
101
130
  name: import("@metamask/superstruct").Struct<string, null>;
102
- value: import("@metamask/superstruct").Struct<string | boolean, null>;
131
+ value: import("@metamask/superstruct").Struct<string | boolean | {
132
+ symbol: string;
133
+ name: string;
134
+ asset: `${string}:${string}/${string}:${string}`;
135
+ }, null>;
103
136
  }>;
104
137
  /**
105
138
  * An input change event, which is fired when the value of an input field
@@ -156,11 +189,19 @@ export declare const UserInputEventStruct: import("@metamask/superstruct").Struc
156
189
  size: number;
157
190
  contentType: string;
158
191
  contents: string;
192
+ } | {
193
+ symbol: string;
194
+ name: string;
195
+ asset: `${string}:${string}/${string}:${string}`;
159
196
  } | null>;
160
197
  } | {
161
198
  type: UserInputEventType.InputChangeEvent;
162
199
  name: string;
163
- value: string | boolean;
200
+ value: string | boolean | {
201
+ symbol: string;
202
+ name: string;
203
+ asset: `${string}:${string}/${string}:${string}`;
204
+ };
164
205
  } | {
165
206
  type: UserInputEventType.FileUploadEvent;
166
207
  file: {
@@ -1 +1 @@
1
- {"version":3,"file":"user-input.d.cts","sourceRoot":"","sources":["../../../src/types/handlers/user-input.ts"],"names":[],"mappings":"AAAA,OAAO,KAA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;;;;;;;;;;;EAOjC,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAElE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAK/B,CAAC;AAEH;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,GACtB,gBAAgB,GAChB,eAAe,GACf,gBAAgB,GAChB,eAAe,CAAC;AAEpB;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,cAAc,CAAC;IACtB,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAClC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -59,6 +59,23 @@ export declare const FileStruct: import("@metamask/superstruct").Struct<{
59
59
  * @property contents - The base64 encoded contents of the file.
60
60
  */
61
61
  export type File = Infer<typeof FileStruct>;
62
+ export declare const AssetSelectorStateStruct: import("@metamask/superstruct").Struct<{
63
+ symbol: string;
64
+ name: string;
65
+ asset: `${string}:${string}/${string}:${string}`;
66
+ }, {
67
+ asset: import("@metamask/superstruct").Struct<`${string}:${string}/${string}:${string}`, null>;
68
+ name: import("@metamask/superstruct").Struct<string, null>;
69
+ symbol: import("@metamask/superstruct").Struct<string, null>;
70
+ }>;
71
+ /**
72
+ * The state of the asset selector component.
73
+ *
74
+ * @property asset - The CAIP-19 asset ID.
75
+ * @property name - The name of the asset.
76
+ * @property symbol - The symbol of the asset.
77
+ */
78
+ export type AssetSelectorState = Infer<typeof AssetSelectorStateStruct>;
62
79
  export declare const FormSubmitEventStruct: import("@metamask/superstruct").Struct<{
63
80
  type: UserInputEventType.FormSubmitEvent;
64
81
  name: string;
@@ -67,6 +84,10 @@ export declare const FormSubmitEventStruct: import("@metamask/superstruct").Stru
67
84
  size: number;
68
85
  contentType: string;
69
86
  contents: string;
87
+ } | {
88
+ symbol: string;
89
+ name: string;
90
+ asset: `${string}:${string}/${string}:${string}`;
70
91
  } | null>;
71
92
  }, {
72
93
  type: import("@metamask/superstruct").Struct<UserInputEventType.FormSubmitEvent, UserInputEventType.FormSubmitEvent>;
@@ -75,6 +96,10 @@ export declare const FormSubmitEventStruct: import("@metamask/superstruct").Stru
75
96
  size: number;
76
97
  contentType: string;
77
98
  contents: string;
99
+ } | {
100
+ symbol: string;
101
+ name: string;
102
+ asset: `${string}:${string}/${string}:${string}`;
78
103
  } | null>, null>;
79
104
  name: import("@metamask/superstruct").Struct<string, null>;
80
105
  }>;
@@ -95,11 +120,19 @@ export type FormSubmitEvent = Infer<typeof FormSubmitEventStruct>;
95
120
  export declare const InputChangeEventStruct: import("@metamask/superstruct").Struct<{
96
121
  type: UserInputEventType.InputChangeEvent;
97
122
  name: string;
98
- value: string | boolean;
123
+ value: string | boolean | {
124
+ symbol: string;
125
+ name: string;
126
+ asset: `${string}:${string}/${string}:${string}`;
127
+ };
99
128
  }, {
100
129
  type: import("@metamask/superstruct").Struct<UserInputEventType.InputChangeEvent, UserInputEventType.InputChangeEvent>;
101
130
  name: import("@metamask/superstruct").Struct<string, null>;
102
- value: import("@metamask/superstruct").Struct<string | boolean, null>;
131
+ value: import("@metamask/superstruct").Struct<string | boolean | {
132
+ symbol: string;
133
+ name: string;
134
+ asset: `${string}:${string}/${string}:${string}`;
135
+ }, null>;
103
136
  }>;
104
137
  /**
105
138
  * An input change event, which is fired when the value of an input field
@@ -156,11 +189,19 @@ export declare const UserInputEventStruct: import("@metamask/superstruct").Struc
156
189
  size: number;
157
190
  contentType: string;
158
191
  contents: string;
192
+ } | {
193
+ symbol: string;
194
+ name: string;
195
+ asset: `${string}:${string}/${string}:${string}`;
159
196
  } | null>;
160
197
  } | {
161
198
  type: UserInputEventType.InputChangeEvent;
162
199
  name: string;
163
- value: string | boolean;
200
+ value: string | boolean | {
201
+ symbol: string;
202
+ name: string;
203
+ asset: `${string}:${string}/${string}:${string}`;
204
+ };
164
205
  } | {
165
206
  type: UserInputEventType.FileUploadEvent;
166
207
  file: {
@@ -1 +1 @@
1
- {"version":3,"file":"user-input.d.mts","sourceRoot":"","sources":["../../../src/types/handlers/user-input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAcnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,yBAAqB;AAErD;;;;;;;;GAQG;AACH,oBAAY,kBAAkB;IAC5B,gBAAgB,qBAAqB;IACrC,eAAe,oBAAoB;IACnC,gBAAgB,qBAAqB;IACrC,eAAe,oBAAoB;CACpC;AAED,eAAO,MAAM,kBAAkB;;;;;;EAG7B,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;EAMlC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEpE,eAAO,MAAM,UAAU;;;;;;;;;;EAKrB,CAAC;AAEH;;;;;;;;GAQG;AACH,MAAM,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAE5C,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;EAOjC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAElE,eAAO,MAAM,sBAAsB;;;;;;;;EAOlC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEpE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;EAOjC,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAElE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;QAK/B,CAAC;AAEH;;;;;;;;GA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AAM,sBAAsB;;;;;;;;;;;;;;;;EAOlC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEpE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;EAOjC,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAElE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAK/B,CAAC;AAEH;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,GACtB,gBAAgB,GAChB,eAAe,GACf,gBAAgB,GAChB,eAAe,CAAC;AAEpB;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,cAAc,CAAC;IACtB,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAClC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { number, assign, literal, nullable, object, optional, record, string, union, boolean } from "@metamask/superstruct";
2
+ import { CaipAssetTypeStruct } from "@metamask/utils";
2
3
  /**
3
4
  * The type of user input event fired.
4
5
  * Currently only three events are supported:
@@ -29,15 +30,20 @@ export const FileStruct = object({
29
30
  contentType: string(),
30
31
  contents: string(),
31
32
  });
33
+ export const AssetSelectorStateStruct = object({
34
+ asset: CaipAssetTypeStruct,
35
+ name: string(),
36
+ symbol: string(),
37
+ });
32
38
  export const FormSubmitEventStruct = assign(GenericEventStruct, object({
33
39
  type: literal(UserInputEventType.FormSubmitEvent),
34
- value: record(string(), nullable(union([string(), FileStruct, boolean()]))),
40
+ value: record(string(), nullable(union([string(), FileStruct, boolean(), AssetSelectorStateStruct]))),
35
41
  name: string(),
36
42
  }));
37
43
  export const InputChangeEventStruct = assign(GenericEventStruct, object({
38
44
  type: literal(UserInputEventType.InputChangeEvent),
39
45
  name: string(),
40
- value: union([string(), boolean()]),
46
+ value: union([string(), boolean(), AssetSelectorStateStruct]),
41
47
  }));
42
48
  export const FileUploadEventStruct = assign(GenericEventStruct, object({
43
49
  type: literal(UserInputEventType.FileUploadEvent),
@@ -1 +1 @@
1
- {"version":3,"file":"user-input.mjs","sourceRoot":"","sources":["../../../src/types/handlers/user-input.ts"],"names":[],"mappings":"AACA,OAAO,EACL,MAAM,EACN,MAAM,EACN,OAAO,EACP,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,MAAM,EACN,MAAM,EACN,KAAK,EACL,OAAO,EACR,8BAA8B;AAI/B;;;;;;;;GAQG;AACH,MAAM,CAAN,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,2DAAqC,CAAA;IACrC,yDAAmC,CAAA;IACnC,2DAAqC,CAAA;IACrC,yDAAmC,CAAA;AACrC,CAAC,EALW,kBAAkB,KAAlB,kBAAkB,QAK7B;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC;IACvC,IAAI,EAAE,MAAM,EAAE;IACd,IAAI,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;CACzB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAC1C,kBAAkB,EAClB,MAAM,CAAC;IACL,IAAI,EAAE,OAAO,CAAC,kBAAkB,CAAC,gBAAgB,CAAC;IAClD,IAAI,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;CACzB,CAAC,CACH,CAAC;AAYF,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC;IAC/B,IAAI,EAAE,MAAM,EAAE;IACd,IAAI,EAAE,MAAM,EAAE;IACd,WAAW,EAAE,MAAM,EAAE;IACrB,QAAQ,EAAE,MAAM,EAAE;CACnB,CAAC,CAAC;AAaH,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CACzC,kBAAkB,EAClB,MAAM,CAAC;IACL,IAAI,EAAE,OAAO,CAAC,kBAAkB,CAAC,eAAe,CAAC;IACjD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;IAC3E,IAAI,EAAE,MAAM,EAAE;CACf,CAAC,CACH,CAAC;AAiBF,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAC1C,kBAAkB,EAClB,MAAM,CAAC;IACL,IAAI,EAAE,OAAO,CAAC,kBAAkB,CAAC,gBAAgB,CAAC;IAClD,IAAI,EAAE,MAAM,EAAE;IACd,KAAK,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;CACpC,CAAC,CACH,CAAC;AAYF,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CACzC,kBAAkB,EAClB,MAAM,CAAC;IACL,IAAI,EAAE,OAAO,CAAC,kBAAkB,CAAC,eAAe,CAAC;IACjD,IAAI,EAAE,MAAM,EAAE;IACd,IAAI,EAAE,QAAQ,CAAC,UAAU,CAAC;CAC3B,CAAC,CACH,CAAC;AAcF,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,CAAC;IACxC,sBAAsB;IACtB,qBAAqB;IACrB,sBAAsB;IACtB,qBAAqB;CACtB,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport {\n number,\n assign,\n literal,\n nullable,\n object,\n optional,\n record,\n string,\n union,\n boolean,\n} from '@metamask/superstruct';\n\nimport type { InterfaceContext } from '../interface';\n\n/**\n * The type of user input event fired.\n * Currently only three events are supported:\n *\n * - `ButtonClickEvent` - A button has been clicked in the UI.\n * - `FormSubmitEvent` - A Form has been submitted in the UI.\n * - `InputChangeEvent` - The value of an input field has changed in the UI.\n * - `FileUploadEvent` - A file has been uploaded in the UI.\n */\nexport enum UserInputEventType {\n ButtonClickEvent = 'ButtonClickEvent',\n FormSubmitEvent = 'FormSubmitEvent',\n InputChangeEvent = 'InputChangeEvent',\n FileUploadEvent = 'FileUploadEvent',\n}\n\nexport const GenericEventStruct = object({\n type: string(),\n name: optional(string()),\n});\n\nexport const ButtonClickEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.ButtonClickEvent),\n name: optional(string()),\n }),\n);\n\n/**\n * A button click event fired in the UI. This is passed to the params of the\n * `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for\n * the different types. This is always `ButtonClickEvent`.\n * @property name - The optional component name that fired the event.\n */\nexport type ButtonClickEvent = Infer<typeof ButtonClickEventStruct>;\n\nexport const FileStruct = object({\n name: string(),\n size: number(),\n contentType: string(),\n contents: string(),\n});\n\n/**\n * A file object containing the file name, size, content type, and the base64\n * encoded contents of the file.\n *\n * @property name - The name of the file.\n * @property size - The size of the file in bytes.\n * @property contentType - The content type of the file.\n * @property contents - The base64 encoded contents of the file.\n */\nexport type File = Infer<typeof FileStruct>;\n\nexport const FormSubmitEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FormSubmitEvent),\n value: record(string(), nullable(union([string(), FileStruct, boolean()]))),\n name: string(),\n }),\n);\n\n/**\n * A form submit event, which is fired when a submit button is clicked.\n *\n * @property type - The type of event fired. This is always `FormSubmitEvent`.\n * @property name - The name of the form that was submitted.\n * @property value - The form values submitted as an object. The keys are the\n * names of the form fields and the values are the values of the form fields. If\n * a form field is empty, the value is `null` or an empty string.\n * @property files - The files uploaded in the form. The keys are the names of\n * the file input fields and the values are the file objects containing the file\n * name, size, content type, and the base64 encoded contents of the file. See\n * {@link File}.\n */\nexport type FormSubmitEvent = Infer<typeof FormSubmitEventStruct>;\n\nexport const InputChangeEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.InputChangeEvent),\n name: string(),\n value: union([string(), boolean()]),\n }),\n);\n\n/**\n * An input change event, which is fired when the value of an input field\n * changes.\n *\n * @property type - The type of event fired. This is always `InputChangeEvent`.\n * @property name - The name of the input field that changed.\n * @property value - The new value of the input field.\n */\nexport type InputChangeEvent = Infer<typeof InputChangeEventStruct>;\n\nexport const FileUploadEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FileUploadEvent),\n name: string(),\n file: nullable(FileStruct),\n }),\n);\n\n/**\n * A file upload event, which is fired when a file is uploaded.\n *\n * @property type - The type of event fired. This is always `FileUploadEvent`.\n * @property name - The name of the file input field that was used to upload the\n * file.\n * @property file - The file object containing the file name, size,\n * content type, and the base64 encoded contents of the file.\n * @see File\n */\nexport type FileUploadEvent = Infer<typeof FileUploadEventStruct>;\n\nexport const UserInputEventStruct = union([\n ButtonClickEventStruct,\n FormSubmitEventStruct,\n InputChangeEventStruct,\n FileUploadEventStruct,\n]);\n\n/**\n * A user input event fired in the UI. This is passed to the params of the `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for the different types.\n * @property name - The component name that fired the event. It is optional for\n * an {@link UserInputEventType.ButtonClickEvent}.\n * @property value - The value associated with the event. Only available when an\n * {@link UserInputEventType.FormSubmitEvent} is fired. It contains the form values submitted.\n */\nexport type UserInputEvent =\n | ButtonClickEvent\n | FormSubmitEvent\n | InputChangeEvent\n | FileUploadEvent;\n\n/**\n * The `onUserInput` handler. This is called when an user input event is fired in the UI.\n *\n * @param args - The user input event.\n * @param args.id - The user interface id.\n * @param args.event - The {@link UserInputEvent} object, containing the data about the fired event.\n */\nexport type OnUserInputHandler = (args: {\n id: string;\n event: UserInputEvent;\n context: InterfaceContext | null;\n}) => Promise<void>;\n"]}
1
+ {"version":3,"file":"user-input.mjs","sourceRoot":"","sources":["../../../src/types/handlers/user-input.ts"],"names":[],"mappings":"AACA,OAAO,EACL,MAAM,EACN,MAAM,EACN,OAAO,EACP,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,MAAM,EACN,MAAM,EACN,KAAK,EACL,OAAO,EACR,8BAA8B;AAC/B,OA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E,MAAM,EAAE;CACf,CAAC,CACH,CAAC;AAiBF,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAC1C,kBAAkB,EAClB,MAAM,CAAC;IACL,IAAI,EAAE,OAAO,CAAC,kBAAkB,CAAC,gBAAgB,CAAC;IAClD,IAAI,EAAE,MAAM,EAAE;IACd,KAAK,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,wBAAwB,CAAC,CAAC;CAC9D,CAAC,CACH,CAAC;AAYF,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CACzC,kBAAkB,EAClB,MAAM,CAAC;IACL,IAAI,EAAE,OAAO,CAAC,kBAAkB,CAAC,eAAe,CAAC;IACjD,IAAI,EAAE,MAAM,EAAE;IACd,IAAI,EAAE,QAAQ,CAAC,UAAU,CAAC;CAC3B,CAAC,CACH,CAAC;AAcF,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,CAAC;IACxC,sBAAsB;IACtB,qBAAqB;IACrB,sBAAsB;IACtB,qBAAqB;CACtB,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport {\n number,\n assign,\n literal,\n nullable,\n object,\n optional,\n record,\n string,\n union,\n boolean,\n} from '@metamask/superstruct';\nimport { CaipAssetTypeStruct } from '@metamask/utils';\n\nimport type { InterfaceContext } from '../interface';\n\n/**\n * The type of user input event fired.\n * Currently only three events are supported:\n *\n * - `ButtonClickEvent` - A button has been clicked in the UI.\n * - `FormSubmitEvent` - A Form has been submitted in the UI.\n * - `InputChangeEvent` - The value of an input field has changed in the UI.\n * - `FileUploadEvent` - A file has been uploaded in the UI.\n */\nexport enum UserInputEventType {\n ButtonClickEvent = 'ButtonClickEvent',\n FormSubmitEvent = 'FormSubmitEvent',\n InputChangeEvent = 'InputChangeEvent',\n FileUploadEvent = 'FileUploadEvent',\n}\n\nexport const GenericEventStruct = object({\n type: string(),\n name: optional(string()),\n});\n\nexport const ButtonClickEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.ButtonClickEvent),\n name: optional(string()),\n }),\n);\n\n/**\n * A button click event fired in the UI. This is passed to the params of the\n * `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for\n * the different types. This is always `ButtonClickEvent`.\n * @property name - The optional component name that fired the event.\n */\nexport type ButtonClickEvent = Infer<typeof ButtonClickEventStruct>;\n\nexport const FileStruct = object({\n name: string(),\n size: number(),\n contentType: string(),\n contents: string(),\n});\n\n/**\n * A file object containing the file name, size, content type, and the base64\n * encoded contents of the file.\n *\n * @property name - The name of the file.\n * @property size - The size of the file in bytes.\n * @property contentType - The content type of the file.\n * @property contents - The base64 encoded contents of the file.\n */\nexport type File = Infer<typeof FileStruct>;\n\nexport const AssetSelectorStateStruct = object({\n asset: CaipAssetTypeStruct,\n name: string(),\n symbol: string(),\n});\n\n/**\n * The state of the asset selector component.\n *\n * @property asset - The CAIP-19 asset ID.\n * @property name - The name of the asset.\n * @property symbol - The symbol of the asset.\n */\nexport type AssetSelectorState = Infer<typeof AssetSelectorStateStruct>;\n\nexport const FormSubmitEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FormSubmitEvent),\n value: record(\n string(),\n nullable(\n union([string(), FileStruct, boolean(), AssetSelectorStateStruct]),\n ),\n ),\n name: string(),\n }),\n);\n\n/**\n * A form submit event, which is fired when a submit button is clicked.\n *\n * @property type - The type of event fired. This is always `FormSubmitEvent`.\n * @property name - The name of the form that was submitted.\n * @property value - The form values submitted as an object. The keys are the\n * names of the form fields and the values are the values of the form fields. If\n * a form field is empty, the value is `null` or an empty string.\n * @property files - The files uploaded in the form. The keys are the names of\n * the file input fields and the values are the file objects containing the file\n * name, size, content type, and the base64 encoded contents of the file. See\n * {@link File}.\n */\nexport type FormSubmitEvent = Infer<typeof FormSubmitEventStruct>;\n\nexport const InputChangeEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.InputChangeEvent),\n name: string(),\n value: union([string(), boolean(), AssetSelectorStateStruct]),\n }),\n);\n\n/**\n * An input change event, which is fired when the value of an input field\n * changes.\n *\n * @property type - The type of event fired. This is always `InputChangeEvent`.\n * @property name - The name of the input field that changed.\n * @property value - The new value of the input field.\n */\nexport type InputChangeEvent = Infer<typeof InputChangeEventStruct>;\n\nexport const FileUploadEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FileUploadEvent),\n name: string(),\n file: nullable(FileStruct),\n }),\n);\n\n/**\n * A file upload event, which is fired when a file is uploaded.\n *\n * @property type - The type of event fired. This is always `FileUploadEvent`.\n * @property name - The name of the file input field that was used to upload the\n * file.\n * @property file - The file object containing the file name, size,\n * content type, and the base64 encoded contents of the file.\n * @see File\n */\nexport type FileUploadEvent = Infer<typeof FileUploadEventStruct>;\n\nexport const UserInputEventStruct = union([\n ButtonClickEventStruct,\n FormSubmitEventStruct,\n InputChangeEventStruct,\n FileUploadEventStruct,\n]);\n\n/**\n * A user input event fired in the UI. This is passed to the params of the `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for the different types.\n * @property name - The component name that fired the event. It is optional for\n * an {@link UserInputEventType.ButtonClickEvent}.\n * @property value - The value associated with the event. Only available when an\n * {@link UserInputEventType.FormSubmitEvent} is fired. It contains the form values submitted.\n */\nexport type UserInputEvent =\n | ButtonClickEvent\n | FormSubmitEvent\n | InputChangeEvent\n | FileUploadEvent;\n\n/**\n * The `onUserInput` handler. This is called when an user input event is fired in the UI.\n *\n * @param args - The user input event.\n * @param args.id - The user interface id.\n * @param args.event - The {@link UserInputEvent} object, containing the data about the fired event.\n */\nexport type OnUserInputHandler = (args: {\n id: string;\n event: UserInputEvent;\n context: InterfaceContext | null;\n}) => Promise<void>;\n"]}
@@ -18,6 +18,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  /* eslint-disable import-x/no-unassigned-import */
19
19
  require("./global.cjs");
20
20
  require("./images.cjs");
21
+ /* eslint-enable import-x/no-unassigned-import */
22
+ __exportStar(require("./caip.cjs"), exports);
21
23
  __exportStar(require("./handlers/index.cjs"), exports);
22
24
  __exportStar(require("./methods/index.cjs"), exports);
23
25
  __exportStar(require("./interface.cjs"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAA2D;AAC3D,kDAAkD;AAClD,wBAAkB;AAClB,wBAAkB;AAIlB,uDAA2B;AAC3B,sDAA0B;AAI1B,kDAA4B","sourcesContent":["// This is intentionally imported, rather than re-exported.\n/* eslint-disable import-x/no-unassigned-import */\nimport './global';\nimport './images';\n/* eslint-enable import-x/no-unassigned-import */\n\nexport type * from './caip';\nexport * from './handlers';\nexport * from './methods';\nexport type * from './permissions';\nexport type * from './provider';\nexport type * from './snap';\nexport * from './interface';\n"]}
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAA2D;AAC3D,kDAAkD;AAClD,wBAAkB;AAClB,wBAAkB;AAClB,iDAAiD;AAEjD,6CAAuB;AACvB,uDAA2B;AAC3B,sDAA0B;AAI1B,kDAA4B","sourcesContent":["// This is intentionally imported, rather than re-exported.\n/* eslint-disable import-x/no-unassigned-import */\nimport './global';\nimport './images';\n/* eslint-enable import-x/no-unassigned-import */\n\nexport * from './caip';\nexport * from './handlers';\nexport * from './methods';\nexport type * from './permissions';\nexport type * from './provider';\nexport type * from './snap';\nexport * from './interface';\n"]}
@@ -1,6 +1,6 @@
1
1
  import "./global.cjs";
2
2
  import "./images.cjs";
3
- export type * from "./caip.cjs";
3
+ export * from "./caip.cjs";
4
4
  export * from "./handlers/index.cjs";
5
5
  export * from "./methods/index.cjs";
6
6
  export type * from "./permissions.cjs";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAEA,sBAAkB;AAClB,sBAAkB;AAGlB,gCAA4B;AAC5B,qCAA2B;AAC3B,oCAA0B;AAC1B,uCAAmC;AACnC,oCAAgC;AAChC,gCAA4B;AAC5B,gCAA4B"}
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAEA,sBAAkB;AAClB,sBAAkB;AAGlB,2BAAuB;AACvB,qCAA2B;AAC3B,oCAA0B;AAC1B,uCAAmC;AACnC,oCAAgC;AAChC,gCAA4B;AAC5B,gCAA4B"}
@@ -1,6 +1,6 @@
1
1
  import "./global.mjs";
2
2
  import "./images.mjs";
3
- export type * from "./caip.mjs";
3
+ export * from "./caip.mjs";
4
4
  export * from "./handlers/index.mjs";
5
5
  export * from "./methods/index.mjs";
6
6
  export type * from "./permissions.mjs";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAEA,sBAAkB;AAClB,sBAAkB;AAGlB,gCAA4B;AAC5B,qCAA2B;AAC3B,oCAA0B;AAC1B,uCAAmC;AACnC,oCAAgC;AAChC,gCAA4B;AAC5B,gCAA4B"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAEA,sBAAkB;AAClB,sBAAkB;AAGlB,2BAAuB;AACvB,qCAA2B;AAC3B,oCAA0B;AAC1B,uCAAmC;AACnC,oCAAgC;AAChC,gCAA4B;AAC5B,gCAA4B"}
@@ -2,6 +2,8 @@
2
2
  /* eslint-disable import-x/no-unassigned-import */
3
3
  import "./global.mjs";
4
4
  import "./images.mjs";
5
+ /* eslint-enable import-x/no-unassigned-import */
6
+ export * from "./caip.mjs";
5
7
  export * from "./handlers/index.mjs";
6
8
  export * from "./methods/index.mjs";
7
9
  export * from "./interface.mjs";
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,kDAAkD;AAClD,sBAAkB;AAClB,sBAAkB;AAIlB,qCAA2B;AAC3B,oCAA0B;AAI1B,gCAA4B","sourcesContent":["// This is intentionally imported, rather than re-exported.\n/* eslint-disable import-x/no-unassigned-import */\nimport './global';\nimport './images';\n/* eslint-enable import-x/no-unassigned-import */\n\nexport type * from './caip';\nexport * from './handlers';\nexport * from './methods';\nexport type * from './permissions';\nexport type * from './provider';\nexport type * from './snap';\nexport * from './interface';\n"]}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,kDAAkD;AAClD,sBAAkB;AAClB,sBAAkB;AAClB,iDAAiD;AAEjD,2BAAuB;AACvB,qCAA2B;AAC3B,oCAA0B;AAI1B,gCAA4B","sourcesContent":["// This is intentionally imported, rather than re-exported.\n/* eslint-disable import-x/no-unassigned-import */\nimport './global';\nimport './images';\n/* eslint-enable import-x/no-unassigned-import */\n\nexport * from './caip';\nexport * from './handlers';\nexport * from './methods';\nexport type * from './permissions';\nexport type * from './provider';\nexport type * from './snap';\nexport * from './interface';\n"]}
@@ -13,7 +13,13 @@ const ui_1 = require("../ui/index.cjs");
13
13
  * root state) and the root state since a key in the root stat can contain
14
14
  * either the value of an input or a sub-state of a form.
15
15
  */
16
- exports.StateStruct = (0, superstruct_1.union)([handlers_1.FileStruct, (0, superstruct_1.string)(), (0, superstruct_1.boolean)()]);
16
+ exports.StateStruct = (0, superstruct_1.union)([
17
+ handlers_1.AssetSelectorStateStruct,
18
+ handlers_1.FileStruct,
19
+ (0, superstruct_1.string)(),
20
+ (0, superstruct_1.boolean)(),
21
+ utils_1.CaipAccountIdStruct,
22
+ ]);
17
23
  exports.FormStateStruct = (0, superstruct_1.record)((0, superstruct_1.string)(), (0, superstruct_1.nullable)(exports.StateStruct));
18
24
  exports.InterfaceStateStruct = (0, superstruct_1.record)((0, superstruct_1.string)(), (0, superstruct_1.union)([exports.FormStateStruct, (0, superstruct_1.nullable)(exports.StateStruct)]));
19
25
  exports.ComponentOrElementStruct = (0, internals_1.selectiveUnion)((value) => {
@@ -1 +1 @@
1
- {"version":3,"file":"interface.cjs","sourceRoot":"","sources":["../../src/types/interface.ts"],"names":[],"mappings":";;;AACA,uDAM+B;AAC/B,2CAAoE;AAEpE,mDAAwC;AACxC,sDAA8C;AAE9C,0CAA8C;AAE9C,wCAAwC;AAExC;;;;;GAKG;AAEU,QAAA,WAAW,GAAG,IAAA,mBAAK,EAAC,CAAC,qBAAU,EAAE,IAAA,oBAAM,GAAE,EAAE,IAAA,qBAAO,GAAE,CAAC,CAAC,CAAC;AAEvD,QAAA,eAAe,GAAG,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,sBAAQ,EAAC,mBAAW,CAAC,CAAC,CAAC;AAE1D,QAAA,oBAAoB,GAAG,IAAA,oBAAM,EACxC,IAAA,oBAAM,GAAE,EACR,IAAA,mBAAK,EAAC,CAAC,uBAAe,EAAE,IAAA,sBAAQ,EAAC,mBAAW,CAAC,CAAC,CAAC,CAChD,CAAC;AAOW,QAAA,wBAAwB,GAAG,IAAA,0BAAc,EAAC,CAAC,KAAK,EAAE,EAAE;IAC/D,IAAI,IAAA,gBAAQ,EAAC,KAAK,CAAC,IAAI,CAAC,IAAA,mBAAW,EAAC,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC;QACpD,OAAO,oBAAe,CAAC;IACzB,CAAC;IACD,OAAO,0BAAoB,CAAC;AAC9B,CAAC,CAAC,CAAC;AAEU,QAAA,sBAAsB,GAAG,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC,CAAC;AAGnE,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,kCAAmB,CAAA;IACnB,gCAAiB,CAAA;IACjB,4CAA6B,CAAA;IAC7B,oCAAqB,CAAA;AACvB,CAAC,EALW,WAAW,2BAAX,WAAW,QAKtB","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport {\n boolean,\n nullable,\n record,\n string,\n union,\n} from '@metamask/superstruct';\nimport { JsonStruct, hasProperty, isObject } from '@metamask/utils';\n\nimport { FileStruct } from './handlers';\nimport { selectiveUnion } from '../internals';\nimport type { JSXElement } from '../jsx';\nimport { RootJSXElementStruct } from '../jsx';\nimport type { Component } from '../ui';\nimport { ComponentStruct } from '../ui';\n\n/**\n * To avoid typing problems with the interface state when manipulating it we\n * have to differentiate the state of a form (that will be contained inside the\n * root state) and the root state since a key in the root stat can contain\n * either the value of an input or a sub-state of a form.\n */\n\nexport const StateStruct = union([FileStruct, string(), boolean()]);\n\nexport const FormStateStruct = record(string(), nullable(StateStruct));\n\nexport const InterfaceStateStruct = record(\n string(),\n union([FormStateStruct, nullable(StateStruct)]),\n);\n\nexport type State = Infer<typeof StateStruct>;\nexport type FormState = Infer<typeof FormStateStruct>;\nexport type InterfaceState = Infer<typeof InterfaceStateStruct>;\n\nexport type ComponentOrElement = Component | JSXElement;\nexport const ComponentOrElementStruct = selectiveUnion((value) => {\n if (isObject(value) && !hasProperty(value, 'props')) {\n return ComponentStruct;\n }\n return RootJSXElementStruct;\n});\n\nexport const InterfaceContextStruct = record(string(), JsonStruct);\nexport type InterfaceContext = Infer<typeof InterfaceContextStruct>;\n\nexport enum ContentType {\n Insight = 'Insight',\n Dialog = 'Dialog',\n Notification = 'Notification',\n HomePage = 'HomePage',\n}\n"]}
1
+ {"version":3,"file":"interface.cjs","sourceRoot":"","sources":["../../src/types/interface.ts"],"names":[],"mappings":";;;AACA,uDAM+B;AAC/B,2CAKyB;AAEzB,mDAAkE;AAClE,sDAA8C;AAE9C,0CAA8C;AAE9C,wCAAwC;AAExC;;;;;GAKG;AAEU,QAAA,WAAW,GAAG,IAAA,mBAAK,EAAC;IAC/B,mCAAwB;IACxB,qBAAU;IACV,IAAA,oBAAM,GAAE;IACR,IAAA,qBAAO,GAAE;IACT,2BAAmB;CACpB,CAAC,CAAC;AAEU,QAAA,eAAe,GAAG,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,sBAAQ,EAAC,mBAAW,CAAC,CAAC,CAAC;AAE1D,QAAA,oBAAoB,GAAG,IAAA,oBAAM,EACxC,IAAA,oBAAM,GAAE,EACR,IAAA,mBAAK,EAAC,CAAC,uBAAe,EAAE,IAAA,sBAAQ,EAAC,mBAAW,CAAC,CAAC,CAAC,CAChD,CAAC;AAOW,QAAA,wBAAwB,GAAG,IAAA,0BAAc,EAAC,CAAC,KAAK,EAAE,EAAE;IAC/D,IAAI,IAAA,gBAAQ,EAAC,KAAK,CAAC,IAAI,CAAC,IAAA,mBAAW,EAAC,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC;QACpD,OAAO,oBAAe,CAAC;IACzB,CAAC;IACD,OAAO,0BAAoB,CAAC;AAC9B,CAAC,CAAC,CAAC;AAEU,QAAA,sBAAsB,GAAG,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC,CAAC;AAGnE,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,kCAAmB,CAAA;IACnB,gCAAiB,CAAA;IACjB,4CAA6B,CAAA;IAC7B,oCAAqB,CAAA;AACvB,CAAC,EALW,WAAW,2BAAX,WAAW,QAKtB","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport {\n boolean,\n nullable,\n record,\n string,\n union,\n} from '@metamask/superstruct';\nimport {\n CaipAccountIdStruct,\n JsonStruct,\n hasProperty,\n isObject,\n} from '@metamask/utils';\n\nimport { AssetSelectorStateStruct, FileStruct } from './handlers';\nimport { selectiveUnion } from '../internals';\nimport type { JSXElement } from '../jsx';\nimport { RootJSXElementStruct } from '../jsx';\nimport type { Component } from '../ui';\nimport { ComponentStruct } from '../ui';\n\n/**\n * To avoid typing problems with the interface state when manipulating it we\n * have to differentiate the state of a form (that will be contained inside the\n * root state) and the root state since a key in the root stat can contain\n * either the value of an input or a sub-state of a form.\n */\n\nexport const StateStruct = union([\n AssetSelectorStateStruct,\n FileStruct,\n string(),\n boolean(),\n CaipAccountIdStruct,\n]);\n\nexport const FormStateStruct = record(string(), nullable(StateStruct));\n\nexport const InterfaceStateStruct = record(\n string(),\n union([FormStateStruct, nullable(StateStruct)]),\n);\n\nexport type State = Infer<typeof StateStruct>;\nexport type FormState = Infer<typeof FormStateStruct>;\nexport type InterfaceState = Infer<typeof InterfaceStateStruct>;\n\nexport type ComponentOrElement = Component | JSXElement;\nexport const ComponentOrElementStruct = selectiveUnion((value) => {\n if (isObject(value) && !hasProperty(value, 'props')) {\n return ComponentStruct;\n }\n return RootJSXElementStruct;\n});\n\nexport const InterfaceContextStruct = record(string(), JsonStruct);\nexport type InterfaceContext = Infer<typeof InterfaceContextStruct>;\n\nexport enum ContentType {\n Insight = 'Insight',\n Dialog = 'Dialog',\n Notification = 'Notification',\n HomePage = 'HomePage',\n}\n"]}
@@ -12,23 +12,39 @@ export declare const StateStruct: import("@metamask/superstruct").Struct<string
12
12
  size: number;
13
13
  contentType: string;
14
14
  contents: string;
15
+ } | {
16
+ symbol: string;
17
+ name: string;
18
+ asset: `${string}:${string}/${string}:${string}`;
15
19
  }, null>;
16
20
  export declare const FormStateStruct: import("@metamask/superstruct").Struct<Record<string, string | boolean | {
17
21
  name: string;
18
22
  size: number;
19
23
  contentType: string;
20
24
  contents: string;
25
+ } | {
26
+ symbol: string;
27
+ name: string;
28
+ asset: `${string}:${string}/${string}:${string}`;
21
29
  } | null>, null>;
22
30
  export declare const InterfaceStateStruct: import("@metamask/superstruct").Struct<Record<string, string | boolean | {
23
31
  name: string;
24
32
  size: number;
25
33
  contentType: string;
26
34
  contents: string;
35
+ } | {
36
+ symbol: string;
37
+ name: string;
38
+ asset: `${string}:${string}/${string}:${string}`;
27
39
  } | Record<string, string | boolean | {
28
40
  name: string;
29
41
  size: number;
30
42
  contentType: string;
31
43
  contents: string;
44
+ } | {
45
+ symbol: string;
46
+ name: string;
47
+ asset: `${string}:${string}/${string}:${string}`;
32
48
  } | null> | null>, null>;
33
49
  export type State = Infer<typeof StateStruct>;
34
50
  export type FormState = Infer<typeof FormStateStruct>;
@@ -102,7 +118,7 @@ export declare const ComponentOrElementStruct: import("@metamask/superstruct").S
102
118
  name?: string | undefined;
103
119
  buttonType?: "button" | "submit" | undefined;
104
120
  })[];
105
- } | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").IconProps, "Icon"> | import("../jsx/index.cjs").SnapElement<{
121
+ } | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").AssetSelectorProps, "AssetSelector"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").AddressInputProps, "AddressInput"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").IconProps, "Icon"> | import("../jsx/index.cjs").SnapElement<{
106
122
  src: string;
107
123
  alt?: string | undefined;
108
124
  borderRadius?: import("../jsx/index.cjs").BorderRadius;
@@ -1 +1 @@
1
- {"version":3,"file":"interface.d.cts","sourceRoot":"","sources":["../../src/types/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAYnD,OAAO,KAAK,EAAE,UAAU,EAAE,yBAAe;AAEzC,OAAO,KAAK,EAAE,SAAS,EAAE,wBAAc;AAGvC;;;;;GAKG;AAEH,eAAO,MAAM,WAAW;;;;;QAA2C,CAAC;AAEpE,eAAO,MAAM,eAAe;;;;;gBAA0C,CAAC;AAEvE,eAAO,MAAM,oBAAoB;;;;;;;;;;wBAGhC,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAC9C,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AACtD,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEhE,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,UAAU,CAAC;AACxD,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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nB,MAAM,WAAW;IACjB,YAAY,iBAAiB;IAC7B,QAAQ,aAAa;CACtB"}
@@ -12,23 +12,39 @@ export declare const StateStruct: import("@metamask/superstruct").Struct<string
12
12
  size: number;
13
13
  contentType: string;
14
14
  contents: string;
15
+ } | {
16
+ symbol: string;
17
+ name: string;
18
+ asset: `${string}:${string}/${string}:${string}`;
15
19
  }, null>;
16
20
  export declare const FormStateStruct: import("@metamask/superstruct").Struct<Record<string, string | boolean | {
17
21
  name: string;
18
22
  size: number;
19
23
  contentType: string;
20
24
  contents: string;
25
+ } | {
26
+ symbol: string;
27
+ name: string;
28
+ asset: `${string}:${string}/${string}:${string}`;
21
29
  } | null>, null>;
22
30
  export declare const InterfaceStateStruct: import("@metamask/superstruct").Struct<Record<string, string | boolean | {
23
31
  name: string;
24
32
  size: number;
25
33
  contentType: string;
26
34
  contents: string;
35
+ } | {
36
+ symbol: string;
37
+ name: string;
38
+ asset: `${string}:${string}/${string}:${string}`;
27
39
  } | Record<string, string | boolean | {
28
40
  name: string;
29
41
  size: number;
30
42
  contentType: string;
31
43
  contents: string;
44
+ } | {
45
+ symbol: string;
46
+ name: string;
47
+ asset: `${string}:${string}/${string}:${string}`;
32
48
  } | null> | null>, null>;
33
49
  export type State = Infer<typeof StateStruct>;
34
50
  export type FormState = Infer<typeof FormStateStruct>;
@@ -102,7 +118,7 @@ export declare const ComponentOrElementStruct: import("@metamask/superstruct").S
102
118
  name?: string | undefined;
103
119
  buttonType?: "button" | "submit" | undefined;
104
120
  })[];
105
- } | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").IconProps, "Icon"> | import("../jsx/index.mjs").SnapElement<{
121
+ } | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").AssetSelectorProps, "AssetSelector"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").AddressInputProps, "AddressInput"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").IconProps, "Icon"> | import("../jsx/index.mjs").SnapElement<{
106
122
  src: string;
107
123
  alt?: string | undefined;
108
124
  borderRadius?: import("../jsx/index.mjs").BorderRadius;
@@ -1 +1 @@
1
- {"version":3,"file":"interface.d.mts","sourceRoot":"","sources":["../../src/types/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAYnD,OAAO,KAAK,EAAE,UAAU,EAAE,yBAAe;AAEzC,OAAO,KAAK,EAAE,SAAS,EAAE,wBAAc;AAGvC;;;;;GAKG;AAEH,eAAO,MAAM,WAAW;;;;;QAA2C,CAAC;AAEpE,eAAO,MAAM,eAAe;;;;;gBAA0C,CAAC;AAEvE,eAAO,MAAM,oBAAoB;;;;;;;;;;wBAGhC,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAC9C,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AACtD,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEhE,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,UAAU,CAAC;AACxD,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+WAKnC,CAAC;AAEH,eAAO,MAAM,sBAAsB,8FAA+B,CAAC;AACnE,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEpE,oBAAY,WAAW;IACrB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,YAAY,iBAAiB;IAC7B,QAAQ,aAAa;CACtB"}
1
+ {"version":3,"file":"interface.d.mts","sourceRoot":"","sources":["../../src/types/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAiBnD,OAAO,KAAK,EAAE,UAAU,EAAE,yBAAe;AAEzC,OAAO,KAAK,EAAE,SAAS,EAAE,wBAAc;AAGvC;;;;;GAKG;AAEH,eAAO,MAAM,WAAW;;;;;;;;;QAMtB,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;gBAA0C,CAAC;AAEvE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;wBAGhC,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAC9C,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AACtD,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEhE,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,UAAU,CAAC;AACxD,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+WAKnC,CAAC;AAEH,eAAO,MAAM,sBAAsB,8FAA+B,CAAC;AACnE,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEpE,oBAAY,WAAW;IACrB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,YAAY,iBAAiB;IAC7B,QAAQ,aAAa;CACtB"}
@@ -1,6 +1,6 @@
1
1
  import { boolean, nullable, record, string, union } from "@metamask/superstruct";
2
- import { JsonStruct, hasProperty, isObject } from "@metamask/utils";
3
- import { FileStruct } from "./handlers/index.mjs";
2
+ import { CaipAccountIdStruct, JsonStruct, hasProperty, isObject } from "@metamask/utils";
3
+ import { AssetSelectorStateStruct, FileStruct } from "./handlers/index.mjs";
4
4
  import { selectiveUnion } from "../internals/index.mjs";
5
5
  import { RootJSXElementStruct } from "../jsx/index.mjs";
6
6
  import { ComponentStruct } from "../ui/index.mjs";
@@ -10,7 +10,13 @@ import { ComponentStruct } from "../ui/index.mjs";
10
10
  * root state) and the root state since a key in the root stat can contain
11
11
  * either the value of an input or a sub-state of a form.
12
12
  */
13
- export const StateStruct = union([FileStruct, string(), boolean()]);
13
+ export const StateStruct = union([
14
+ AssetSelectorStateStruct,
15
+ FileStruct,
16
+ string(),
17
+ boolean(),
18
+ CaipAccountIdStruct,
19
+ ]);
14
20
  export const FormStateStruct = record(string(), nullable(StateStruct));
15
21
  export const InterfaceStateStruct = record(string(), union([FormStateStruct, nullable(StateStruct)]));
16
22
  export const ComponentOrElementStruct = selectiveUnion((value) => {
@@ -1 +1 @@
1
- {"version":3,"file":"interface.mjs","sourceRoot":"","sources":["../../src/types/interface.ts"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,EACP,QAAQ,EACR,MAAM,EACN,MAAM,EACN,KAAK,EACN,8BAA8B;AAC/B,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,wBAAwB;AAEpE,OAAO,EAAE,UAAU,EAAE,6BAAmB;AACxC,OAAO,EAAE,cAAc,EAAE,+BAAqB;AAE9C,OAAO,EAAE,oBAAoB,EAAE,yBAAe;AAE9C,OAAO,EAAE,eAAe,EAAE,wBAAc;AAExC;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;AAEpE,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;AAEvE,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CACxC,MAAM,EAAE,EACR,KAAK,CAAC,CAAC,eAAe,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAChD,CAAC;AAOF,MAAM,CAAC,MAAM,wBAAwB,GAAG,cAAc,CAAC,CAAC,KAAK,EAAE,EAAE;IAC/D,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC;QACpD,OAAO,eAAe,CAAC;IACzB,CAAC;IACD,OAAO,oBAAoB,CAAC;AAC9B,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC,CAAC;AAGnE,MAAM,CAAN,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,kCAAmB,CAAA;IACnB,gCAAiB,CAAA;IACjB,4CAA6B,CAAA;IAC7B,oCAAqB,CAAA;AACvB,CAAC,EALW,WAAW,KAAX,WAAW,QAKtB","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport {\n boolean,\n nullable,\n record,\n string,\n union,\n} from '@metamask/superstruct';\nimport { JsonStruct, hasProperty, isObject } from '@metamask/utils';\n\nimport { FileStruct } from './handlers';\nimport { selectiveUnion } from '../internals';\nimport type { JSXElement } from '../jsx';\nimport { RootJSXElementStruct } from '../jsx';\nimport type { Component } from '../ui';\nimport { ComponentStruct } from '../ui';\n\n/**\n * To avoid typing problems with the interface state when manipulating it we\n * have to differentiate the state of a form (that will be contained inside the\n * root state) and the root state since a key in the root stat can contain\n * either the value of an input or a sub-state of a form.\n */\n\nexport const StateStruct = union([FileStruct, string(), boolean()]);\n\nexport const FormStateStruct = record(string(), nullable(StateStruct));\n\nexport const InterfaceStateStruct = record(\n string(),\n union([FormStateStruct, nullable(StateStruct)]),\n);\n\nexport type State = Infer<typeof StateStruct>;\nexport type FormState = Infer<typeof FormStateStruct>;\nexport type InterfaceState = Infer<typeof InterfaceStateStruct>;\n\nexport type ComponentOrElement = Component | JSXElement;\nexport const ComponentOrElementStruct = selectiveUnion((value) => {\n if (isObject(value) && !hasProperty(value, 'props')) {\n return ComponentStruct;\n }\n return RootJSXElementStruct;\n});\n\nexport const InterfaceContextStruct = record(string(), JsonStruct);\nexport type InterfaceContext = Infer<typeof InterfaceContextStruct>;\n\nexport enum ContentType {\n Insight = 'Insight',\n Dialog = 'Dialog',\n Notification = 'Notification',\n HomePage = 'HomePage',\n}\n"]}
1
+ {"version":3,"file":"interface.mjs","sourceRoot":"","sources":["../../src/types/interface.ts"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,EACP,QAAQ,EACR,MAAM,EACN,MAAM,EACN,KAAK,EACN,8BAA8B;AAC/B,OAAO,EACL,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,QAAQ,EACT,wBAAwB;AAEzB,OAAO,EAAE,wBAAwB,EAAE,UAAU,EAAE,6BAAmB;AAClE,OAAO,EAAE,cAAc,EAAE,+BAAqB;AAE9C,OAAO,EAAE,oBAAoB,EAAE,yBAAe;AAE9C,OAAO,EAAE,eAAe,EAAE,wBAAc;AAExC;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAC;IAC/B,wBAAwB;IACxB,UAAU;IACV,MAAM,EAAE;IACR,OAAO,EAAE;IACT,mBAAmB;CACpB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;AAEvE,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CACxC,MAAM,EAAE,EACR,KAAK,CAAC,CAAC,eAAe,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAChD,CAAC;AAOF,MAAM,CAAC,MAAM,wBAAwB,GAAG,cAAc,CAAC,CAAC,KAAK,EAAE,EAAE;IAC/D,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC;QACpD,OAAO,eAAe,CAAC;IACzB,CAAC;IACD,OAAO,oBAAoB,CAAC;AAC9B,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC,CAAC;AAGnE,MAAM,CAAN,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,kCAAmB,CAAA;IACnB,gCAAiB,CAAA;IACjB,4CAA6B,CAAA;IAC7B,oCAAqB,CAAA;AACvB,CAAC,EALW,WAAW,KAAX,WAAW,QAKtB","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport {\n boolean,\n nullable,\n record,\n string,\n union,\n} from '@metamask/superstruct';\nimport {\n CaipAccountIdStruct,\n JsonStruct,\n hasProperty,\n isObject,\n} from '@metamask/utils';\n\nimport { AssetSelectorStateStruct, FileStruct } from './handlers';\nimport { selectiveUnion } from '../internals';\nimport type { JSXElement } from '../jsx';\nimport { RootJSXElementStruct } from '../jsx';\nimport type { Component } from '../ui';\nimport { ComponentStruct } from '../ui';\n\n/**\n * To avoid typing problems with the interface state when manipulating it we\n * have to differentiate the state of a form (that will be contained inside the\n * root state) and the root state since a key in the root stat can contain\n * either the value of an input or a sub-state of a form.\n */\n\nexport const StateStruct = union([\n AssetSelectorStateStruct,\n FileStruct,\n string(),\n boolean(),\n CaipAccountIdStruct,\n]);\n\nexport const FormStateStruct = record(string(), nullable(StateStruct));\n\nexport const InterfaceStateStruct = record(\n string(),\n union([FormStateStruct, nullable(StateStruct)]),\n);\n\nexport type State = Infer<typeof StateStruct>;\nexport type FormState = Infer<typeof FormStateStruct>;\nexport type InterfaceState = Infer<typeof InterfaceStateStruct>;\n\nexport type ComponentOrElement = Component | JSXElement;\nexport const ComponentOrElementStruct = selectiveUnion((value) => {\n if (isObject(value) && !hasProperty(value, 'props')) {\n return ComponentStruct;\n }\n return RootJSXElementStruct;\n});\n\nexport const InterfaceContextStruct = record(string(), JsonStruct);\nexport type InterfaceContext = Infer<typeof InterfaceContextStruct>;\n\nexport enum ContentType {\n Insight = 'Insight',\n Dialog = 'Dialog',\n Notification = 'Notification',\n HomePage = 'HomePage',\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask/snaps-sdk",
3
- "version": "6.19.0",
3
+ "version": "6.21.0",
4
4
  "description": "A library containing the core functionality for building MetaMask Snaps",
5
5
  "keywords": [
6
6
  "MetaMask",
@@ -91,8 +91,8 @@
91
91
  "test:watch": "jest --watch"
92
92
  },
93
93
  "dependencies": {
94
- "@metamask/key-tree": "^10.0.2",
95
- "@metamask/providers": "^20.0.0",
94
+ "@metamask/key-tree": "^10.1.1",
95
+ "@metamask/providers": "^21.0.0",
96
96
  "@metamask/rpc-errors": "^7.0.2",
97
97
  "@metamask/superstruct": "^3.1.0",
98
98
  "@metamask/utils": "^11.2.0"