@metamask/snaps-rpc-methods 11.6.0 → 11.7.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 -1
- package/dist/permitted/createInterface.d.cts +2 -2
- package/dist/permitted/createInterface.d.mts +2 -2
- package/dist/permitted/updateInterface.d.cts +2 -2
- package/dist/permitted/updateInterface.d.mts +2 -2
- package/dist/restricted/dialog.d.cts +4 -4
- package/dist/restricted/dialog.d.mts +4 -4
- package/dist/restricted/getBip32Entropy.cjs +5 -1
- package/dist/restricted/getBip32Entropy.cjs.map +1 -1
- package/dist/restricted/getBip32Entropy.d.cts +12 -1
- package/dist/restricted/getBip32Entropy.d.cts.map +1 -1
- package/dist/restricted/getBip32Entropy.d.mts +12 -1
- package/dist/restricted/getBip32Entropy.d.mts.map +1 -1
- package/dist/restricted/getBip32Entropy.mjs +5 -1
- package/dist/restricted/getBip32Entropy.mjs.map +1 -1
- package/dist/restricted/getBip32PublicKey.cjs +5 -1
- package/dist/restricted/getBip32PublicKey.cjs.map +1 -1
- package/dist/restricted/getBip32PublicKey.d.cts +12 -1
- package/dist/restricted/getBip32PublicKey.d.cts.map +1 -1
- package/dist/restricted/getBip32PublicKey.d.mts +12 -1
- package/dist/restricted/getBip32PublicKey.d.mts.map +1 -1
- package/dist/restricted/getBip32PublicKey.mjs +5 -1
- package/dist/restricted/getBip32PublicKey.mjs.map +1 -1
- package/dist/restricted/getBip44Entropy.cjs +5 -6
- package/dist/restricted/getBip44Entropy.cjs.map +1 -1
- package/dist/restricted/getBip44Entropy.d.cts +12 -1
- package/dist/restricted/getBip44Entropy.d.cts.map +1 -1
- package/dist/restricted/getBip44Entropy.d.mts +12 -1
- package/dist/restricted/getBip44Entropy.d.mts.map +1 -1
- package/dist/restricted/getBip44Entropy.mjs +5 -6
- package/dist/restricted/getBip44Entropy.mjs.map +1 -1
- package/dist/restricted/getEntropy.cjs +5 -1
- package/dist/restricted/getEntropy.cjs.map +1 -1
- package/dist/restricted/getEntropy.d.cts +12 -1
- package/dist/restricted/getEntropy.d.cts.map +1 -1
- package/dist/restricted/getEntropy.d.mts +12 -1
- package/dist/restricted/getEntropy.d.mts.map +1 -1
- package/dist/restricted/getEntropy.mjs +5 -1
- package/dist/restricted/getEntropy.mjs.map +1 -1
- package/dist/restricted/manageState.cjs +4 -1
- package/dist/restricted/manageState.cjs.map +1 -1
- package/dist/restricted/manageState.d.cts +5 -1
- package/dist/restricted/manageState.d.cts.map +1 -1
- package/dist/restricted/manageState.d.mts +5 -1
- package/dist/restricted/manageState.d.mts.map +1 -1
- package/dist/restricted/manageState.mjs +4 -1
- package/dist/restricted/manageState.mjs.map +1 -1
- package/dist/restricted/notify.cjs +49 -5
- package/dist/restricted/notify.cjs.map +1 -1
- package/dist/restricted/notify.d.cts +311 -13
- package/dist/restricted/notify.d.cts.map +1 -1
- package/dist/restricted/notify.d.mts +311 -13
- package/dist/restricted/notify.d.mts.map +1 -1
- package/dist/restricted/notify.mjs +52 -8
- package/dist/restricted/notify.mjs.map +1 -1
- package/dist/utils.cjs +8 -4
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +12 -3
- package/dist/utils.d.cts.map +1 -1
- package/dist/utils.d.mts +12 -3
- package/dist/utils.d.mts.map +1 -1
- package/dist/utils.mjs +8 -4
- package/dist/utils.mjs.map +1 -1
- package/package.json +5 -5
|
@@ -1,21 +1,314 @@
|
|
|
1
1
|
import type { PermissionSpecificationBuilder, RestrictedMethodOptions, ValidPermissionSpecification } from "@metamask/permission-controller";
|
|
2
2
|
import { PermissionType } from "@metamask/permission-controller";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
3
|
+
import type { NotifyParams, NotifyResult, InterfaceContext, ComponentOrElement } from "@metamask/snaps-sdk";
|
|
4
|
+
import { ContentType } from "@metamask/snaps-sdk";
|
|
5
5
|
import { type Snap } from "@metamask/snaps-utils";
|
|
6
|
+
import type { InferMatching } from "@metamask/snaps-utils";
|
|
6
7
|
import type { NonEmptyArray } from "@metamask/utils";
|
|
7
8
|
import { type MethodHooksObject } from "../utils.cjs";
|
|
8
9
|
declare const methodName = "snap_notify";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* Enum type to determine notification type.
|
|
12
|
-
*/
|
|
13
|
-
type: EnumToUnion<NotificationType>;
|
|
14
|
-
/**
|
|
15
|
-
* A message to show on the notification.
|
|
16
|
-
*/
|
|
10
|
+
declare const NotificationParametersStruct: import("@metamask/superstruct").Struct<{
|
|
11
|
+
type: "native";
|
|
17
12
|
message: string;
|
|
18
|
-
}
|
|
13
|
+
} | {
|
|
14
|
+
type: "inApp";
|
|
15
|
+
message: string;
|
|
16
|
+
} | {
|
|
17
|
+
type: "inApp";
|
|
18
|
+
message: string;
|
|
19
|
+
content: import("@metamask/snaps-sdk").Panel | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").ButtonProps, "Button"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").CheckboxProps, "Checkbox"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").FormProps, "Form"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").FieldProps, "Field"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").FileInputProps, "FileInput"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").InputProps, "Input"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").DropdownProps, "Dropdown"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").SelectorProps, "Selector"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").BoldProps, "Bold"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").ItalicProps, "Italic"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").AvatarProps, "Avatar"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").AddressProps, "Address"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").BoxProps, "Box"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").CardProps, "Card"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").ContainerProps, "Container"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").CopyableProps, "Copyable"> | import("@metamask/snaps-sdk/jsx").SnapElement<Record<string, never>, "Divider"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").IconProps, "Icon"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").LinkProps, "Link"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").RowProps, "Row"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").SectionProps, "Section"> | import("@metamask/snaps-sdk/jsx").SnapElement<Record<string, never>, "Spinner"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").TextProps, "Text"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").TooltipProps, "Tooltip"> | {
|
|
20
|
+
type: import("@metamask/snaps-sdk").NodeType.Copyable;
|
|
21
|
+
value: string;
|
|
22
|
+
sensitive?: boolean | undefined;
|
|
23
|
+
} | {
|
|
24
|
+
type: import("@metamask/snaps-sdk").NodeType.Divider;
|
|
25
|
+
} | {
|
|
26
|
+
type: import("@metamask/snaps-sdk").NodeType.Heading; /**
|
|
27
|
+
* @param snapId - The ID of the Snap that created the notification.
|
|
28
|
+
* @param args - The notification arguments.
|
|
29
|
+
*/
|
|
30
|
+
value: string;
|
|
31
|
+
} | {
|
|
32
|
+
type: import("@metamask/snaps-sdk").NodeType.Image;
|
|
33
|
+
value: string;
|
|
34
|
+
} | {
|
|
35
|
+
type: import("@metamask/snaps-sdk").NodeType.Spinner;
|
|
36
|
+
} | {
|
|
37
|
+
type: import("@metamask/snaps-sdk").NodeType.Text;
|
|
38
|
+
value: string;
|
|
39
|
+
markdown?: boolean | undefined;
|
|
40
|
+
} | {
|
|
41
|
+
type: import("@metamask/snaps-sdk").NodeType.Address;
|
|
42
|
+
value: `0x${string}`;
|
|
43
|
+
} | {
|
|
44
|
+
type: import("@metamask/snaps-sdk").NodeType.Row;
|
|
45
|
+
value: {
|
|
46
|
+
type: import("@metamask/snaps-sdk").NodeType.Image;
|
|
47
|
+
value: string;
|
|
48
|
+
} | {
|
|
49
|
+
type: import("@metamask/snaps-sdk").NodeType.Text;
|
|
50
|
+
value: string;
|
|
51
|
+
markdown?: boolean | undefined;
|
|
52
|
+
} | {
|
|
53
|
+
type: import("@metamask/snaps-sdk").NodeType.Address;
|
|
54
|
+
value: `0x${string}`;
|
|
55
|
+
};
|
|
56
|
+
label: string;
|
|
57
|
+
variant?: "default" | "warning" | "critical" | undefined;
|
|
58
|
+
} | {
|
|
59
|
+
type: import("@metamask/snaps-sdk").NodeType.Input;
|
|
60
|
+
name: string;
|
|
61
|
+
error?: string | undefined;
|
|
62
|
+
inputType?: "number" | "text" | "password" | undefined;
|
|
63
|
+
value?: string | undefined;
|
|
64
|
+
label?: string | undefined;
|
|
65
|
+
placeholder?: string | undefined;
|
|
66
|
+
} | {
|
|
67
|
+
type: import("@metamask/snaps-sdk").NodeType.Button;
|
|
68
|
+
value: string;
|
|
69
|
+
variant?: "primary" | "secondary" | undefined;
|
|
70
|
+
name?: string | undefined;
|
|
71
|
+
buttonType?: "button" | "submit" | undefined;
|
|
72
|
+
} | {
|
|
73
|
+
type: import("@metamask/snaps-sdk").NodeType.Form;
|
|
74
|
+
name: string;
|
|
75
|
+
children: ({
|
|
76
|
+
type: import("@metamask/snaps-sdk").NodeType.Input;
|
|
77
|
+
name: string;
|
|
78
|
+
error?: string | undefined;
|
|
79
|
+
inputType?: "number" | "text" | "password" | undefined;
|
|
80
|
+
value?: string | undefined;
|
|
81
|
+
label?: string | undefined;
|
|
82
|
+
placeholder?: string | undefined;
|
|
83
|
+
} | {
|
|
84
|
+
type: import("@metamask/snaps-sdk").NodeType.Button;
|
|
85
|
+
value: string;
|
|
86
|
+
variant?: "primary" | "secondary" | undefined;
|
|
87
|
+
name?: string | undefined;
|
|
88
|
+
buttonType?: "button" | "submit" | undefined;
|
|
89
|
+
})[];
|
|
90
|
+
} | import("@metamask/snaps-sdk/jsx").SnapElement<{
|
|
91
|
+
src: string;
|
|
92
|
+
alt?: string | undefined;
|
|
93
|
+
}, "Image"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
|
|
94
|
+
name: string;
|
|
95
|
+
value?: string | undefined;
|
|
96
|
+
children: import("@metamask/snaps-sdk/jsx").SnapsChildren<import("@metamask/snaps-sdk/jsx").SnapElement<{
|
|
97
|
+
value: string;
|
|
98
|
+
children: string;
|
|
99
|
+
}, "Radio">>;
|
|
100
|
+
}, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
|
|
101
|
+
children: import("@metamask/snaps-sdk/jsx").StringElement;
|
|
102
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
103
|
+
}, "Heading">;
|
|
104
|
+
title: string;
|
|
105
|
+
footerLink?: {
|
|
106
|
+
text: string;
|
|
107
|
+
href: string;
|
|
108
|
+
} | undefined;
|
|
109
|
+
}, [head: import("@metamask/superstruct").Struct<{
|
|
110
|
+
type: "inApp";
|
|
111
|
+
message: string;
|
|
112
|
+
}, {
|
|
113
|
+
type: import("@metamask/superstruct").Struct<"inApp", null>;
|
|
114
|
+
message: import("@metamask/superstruct").Struct<string, null>;
|
|
115
|
+
}>, import("@metamask/superstruct").Struct<{
|
|
116
|
+
type: "inApp";
|
|
117
|
+
message: string;
|
|
118
|
+
content: import("@metamask/snaps-sdk").Panel | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").ButtonProps, "Button"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").CheckboxProps, "Checkbox"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").FormProps, "Form"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").FieldProps, "Field"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").FileInputProps, "FileInput"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").InputProps, "Input"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").DropdownProps, "Dropdown"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").SelectorProps, "Selector"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").BoldProps, "Bold"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").ItalicProps, "Italic"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").AvatarProps, "Avatar"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").AddressProps, "Address"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").BoxProps, "Box"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").CardProps, "Card"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").ContainerProps, "Container"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").CopyableProps, "Copyable"> | import("@metamask/snaps-sdk/jsx").SnapElement<Record<string, never>, "Divider"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").IconProps, "Icon"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").LinkProps, "Link"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").RowProps, "Row"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").SectionProps, "Section"> | import("@metamask/snaps-sdk/jsx").SnapElement<Record<string, never>, "Spinner"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").TextProps, "Text"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").TooltipProps, "Tooltip"> | {
|
|
119
|
+
type: import("@metamask/snaps-sdk").NodeType.Copyable;
|
|
120
|
+
value: string;
|
|
121
|
+
sensitive?: boolean | undefined;
|
|
122
|
+
} | {
|
|
123
|
+
type: import("@metamask/snaps-sdk").NodeType.Divider;
|
|
124
|
+
} | {
|
|
125
|
+
type: import("@metamask/snaps-sdk").NodeType.Heading; /**
|
|
126
|
+
* @param snapId - The ID of the Snap that created the notification.
|
|
127
|
+
* @param args - The notification arguments.
|
|
128
|
+
*/
|
|
129
|
+
value: string;
|
|
130
|
+
} | {
|
|
131
|
+
type: import("@metamask/snaps-sdk").NodeType.Image;
|
|
132
|
+
value: string;
|
|
133
|
+
} | {
|
|
134
|
+
type: import("@metamask/snaps-sdk").NodeType.Spinner;
|
|
135
|
+
} | {
|
|
136
|
+
type: import("@metamask/snaps-sdk").NodeType.Text;
|
|
137
|
+
value: string;
|
|
138
|
+
markdown?: boolean | undefined;
|
|
139
|
+
} | {
|
|
140
|
+
type: import("@metamask/snaps-sdk").NodeType.Address;
|
|
141
|
+
value: `0x${string}`;
|
|
142
|
+
} | {
|
|
143
|
+
type: import("@metamask/snaps-sdk").NodeType.Row;
|
|
144
|
+
value: {
|
|
145
|
+
type: import("@metamask/snaps-sdk").NodeType.Image;
|
|
146
|
+
value: string;
|
|
147
|
+
} | {
|
|
148
|
+
type: import("@metamask/snaps-sdk").NodeType.Text;
|
|
149
|
+
value: string;
|
|
150
|
+
markdown?: boolean | undefined;
|
|
151
|
+
} | {
|
|
152
|
+
type: import("@metamask/snaps-sdk").NodeType.Address;
|
|
153
|
+
value: `0x${string}`;
|
|
154
|
+
};
|
|
155
|
+
label: string;
|
|
156
|
+
variant?: "default" | "warning" | "critical" | undefined;
|
|
157
|
+
} | {
|
|
158
|
+
type: import("@metamask/snaps-sdk").NodeType.Input;
|
|
159
|
+
name: string;
|
|
160
|
+
error?: string | undefined;
|
|
161
|
+
inputType?: "number" | "text" | "password" | undefined;
|
|
162
|
+
value?: string | undefined;
|
|
163
|
+
label?: string | undefined;
|
|
164
|
+
placeholder?: string | undefined;
|
|
165
|
+
} | {
|
|
166
|
+
type: import("@metamask/snaps-sdk").NodeType.Button;
|
|
167
|
+
value: string;
|
|
168
|
+
variant?: "primary" | "secondary" | undefined;
|
|
169
|
+
name?: string | undefined;
|
|
170
|
+
buttonType?: "button" | "submit" | undefined;
|
|
171
|
+
} | {
|
|
172
|
+
type: import("@metamask/snaps-sdk").NodeType.Form;
|
|
173
|
+
name: string;
|
|
174
|
+
children: ({
|
|
175
|
+
type: import("@metamask/snaps-sdk").NodeType.Input;
|
|
176
|
+
name: string;
|
|
177
|
+
error?: string | undefined;
|
|
178
|
+
inputType?: "number" | "text" | "password" | undefined;
|
|
179
|
+
value?: string | undefined;
|
|
180
|
+
label?: string | undefined;
|
|
181
|
+
placeholder?: string | undefined;
|
|
182
|
+
} | {
|
|
183
|
+
type: import("@metamask/snaps-sdk").NodeType.Button;
|
|
184
|
+
value: string;
|
|
185
|
+
variant?: "primary" | "secondary" | undefined;
|
|
186
|
+
name?: string | undefined;
|
|
187
|
+
buttonType?: "button" | "submit" | undefined;
|
|
188
|
+
})[];
|
|
189
|
+
} | import("@metamask/snaps-sdk/jsx").SnapElement<{
|
|
190
|
+
src: string;
|
|
191
|
+
alt?: string | undefined;
|
|
192
|
+
}, "Image"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
|
|
193
|
+
name: string;
|
|
194
|
+
value?: string | undefined;
|
|
195
|
+
children: import("@metamask/snaps-sdk/jsx").SnapsChildren<import("@metamask/snaps-sdk/jsx").SnapElement<{
|
|
196
|
+
value: string;
|
|
197
|
+
children: string;
|
|
198
|
+
}, "Radio">>;
|
|
199
|
+
}, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
|
|
200
|
+
children: import("@metamask/snaps-sdk/jsx").StringElement;
|
|
201
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
202
|
+
}, "Heading">;
|
|
203
|
+
title: string;
|
|
204
|
+
footerLink?: {
|
|
205
|
+
text: string;
|
|
206
|
+
href: string;
|
|
207
|
+
} | undefined;
|
|
208
|
+
}, {
|
|
209
|
+
type: import("@metamask/superstruct").Struct<"inApp", null>;
|
|
210
|
+
message: import("@metamask/superstruct").Struct<string, null>;
|
|
211
|
+
content: import("@metamask/superstruct").Struct<import("@metamask/snaps-sdk").Panel | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").ButtonProps, "Button"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").CheckboxProps, "Checkbox"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").FormProps, "Form"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").FieldProps, "Field"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").FileInputProps, "FileInput"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").InputProps, "Input"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").DropdownProps, "Dropdown"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").SelectorProps, "Selector"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").BoldProps, "Bold"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").ItalicProps, "Italic"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").AvatarProps, "Avatar"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").AddressProps, "Address"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").BoxProps, "Box"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").CardProps, "Card"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").ContainerProps, "Container"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").CopyableProps, "Copyable"> | import("@metamask/snaps-sdk/jsx").SnapElement<Record<string, never>, "Divider"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").IconProps, "Icon"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").LinkProps, "Link"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").RowProps, "Row"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").SectionProps, "Section"> | import("@metamask/snaps-sdk/jsx").SnapElement<Record<string, never>, "Spinner"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").TextProps, "Text"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").TooltipProps, "Tooltip"> | {
|
|
212
|
+
type: import("@metamask/snaps-sdk").NodeType.Copyable;
|
|
213
|
+
value: string;
|
|
214
|
+
sensitive?: boolean | undefined;
|
|
215
|
+
} | {
|
|
216
|
+
type: import("@metamask/snaps-sdk").NodeType.Divider;
|
|
217
|
+
} | {
|
|
218
|
+
type: import("@metamask/snaps-sdk").NodeType.Heading; /**
|
|
219
|
+
* @param snapId - The ID of the Snap that created the notification.
|
|
220
|
+
* @param args - The notification arguments.
|
|
221
|
+
*/
|
|
222
|
+
value: string;
|
|
223
|
+
} | {
|
|
224
|
+
type: import("@metamask/snaps-sdk").NodeType.Image;
|
|
225
|
+
value: string;
|
|
226
|
+
} | {
|
|
227
|
+
type: import("@metamask/snaps-sdk").NodeType.Spinner;
|
|
228
|
+
} | {
|
|
229
|
+
type: import("@metamask/snaps-sdk").NodeType.Text;
|
|
230
|
+
value: string;
|
|
231
|
+
markdown?: boolean | undefined;
|
|
232
|
+
} | {
|
|
233
|
+
type: import("@metamask/snaps-sdk").NodeType.Address;
|
|
234
|
+
value: `0x${string}`;
|
|
235
|
+
} | {
|
|
236
|
+
type: import("@metamask/snaps-sdk").NodeType.Row;
|
|
237
|
+
value: {
|
|
238
|
+
type: import("@metamask/snaps-sdk").NodeType.Image;
|
|
239
|
+
value: string;
|
|
240
|
+
} | {
|
|
241
|
+
type: import("@metamask/snaps-sdk").NodeType.Text;
|
|
242
|
+
value: string;
|
|
243
|
+
markdown?: boolean | undefined;
|
|
244
|
+
} | {
|
|
245
|
+
type: import("@metamask/snaps-sdk").NodeType.Address;
|
|
246
|
+
value: `0x${string}`;
|
|
247
|
+
};
|
|
248
|
+
label: string;
|
|
249
|
+
variant?: "default" | "warning" | "critical" | undefined;
|
|
250
|
+
} | {
|
|
251
|
+
type: import("@metamask/snaps-sdk").NodeType.Input;
|
|
252
|
+
name: string;
|
|
253
|
+
error?: string | undefined;
|
|
254
|
+
inputType?: "number" | "text" | "password" | undefined;
|
|
255
|
+
value?: string | undefined;
|
|
256
|
+
label?: string | undefined;
|
|
257
|
+
placeholder?: string | undefined;
|
|
258
|
+
} | {
|
|
259
|
+
type: import("@metamask/snaps-sdk").NodeType.Button;
|
|
260
|
+
value: string;
|
|
261
|
+
variant?: "primary" | "secondary" | undefined;
|
|
262
|
+
name?: string | undefined;
|
|
263
|
+
buttonType?: "button" | "submit" | undefined;
|
|
264
|
+
} | {
|
|
265
|
+
type: import("@metamask/snaps-sdk").NodeType.Form;
|
|
266
|
+
name: string;
|
|
267
|
+
children: ({
|
|
268
|
+
type: import("@metamask/snaps-sdk").NodeType.Input;
|
|
269
|
+
name: string;
|
|
270
|
+
error?: string | undefined;
|
|
271
|
+
inputType?: "number" | "text" | "password" | undefined;
|
|
272
|
+
value?: string | undefined;
|
|
273
|
+
label?: string | undefined;
|
|
274
|
+
placeholder?: string | undefined;
|
|
275
|
+
} | {
|
|
276
|
+
type: import("@metamask/snaps-sdk").NodeType.Button;
|
|
277
|
+
value: string;
|
|
278
|
+
variant?: "primary" | "secondary" | undefined;
|
|
279
|
+
name?: string | undefined;
|
|
280
|
+
buttonType?: "button" | "submit" | undefined;
|
|
281
|
+
})[];
|
|
282
|
+
} | import("@metamask/snaps-sdk/jsx").SnapElement<{
|
|
283
|
+
src: string;
|
|
284
|
+
alt?: string | undefined;
|
|
285
|
+
}, "Image"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
|
|
286
|
+
name: string;
|
|
287
|
+
value?: string | undefined;
|
|
288
|
+
children: import("@metamask/snaps-sdk/jsx").SnapsChildren<import("@metamask/snaps-sdk/jsx").SnapElement<{
|
|
289
|
+
value: string;
|
|
290
|
+
children: string;
|
|
291
|
+
}, "Radio">>;
|
|
292
|
+
}, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
|
|
293
|
+
children: import("@metamask/snaps-sdk/jsx").StringElement;
|
|
294
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
295
|
+
}, "Heading">, null>;
|
|
296
|
+
title: import("@metamask/superstruct").Struct<string, null>;
|
|
297
|
+
footerLink: import("@metamask/superstruct").Struct<{
|
|
298
|
+
text: string;
|
|
299
|
+
href: string;
|
|
300
|
+
} | undefined, {
|
|
301
|
+
href: import("@metamask/superstruct").Struct<string, null>;
|
|
302
|
+
text: import("@metamask/superstruct").Struct<string, null>;
|
|
303
|
+
}>;
|
|
304
|
+
}>, import("@metamask/superstruct").Struct<{
|
|
305
|
+
type: "native";
|
|
306
|
+
message: string;
|
|
307
|
+
}, {
|
|
308
|
+
type: import("@metamask/superstruct").Struct<"native", null>;
|
|
309
|
+
message: import("@metamask/superstruct").Struct<string, null>;
|
|
310
|
+
}>]>;
|
|
311
|
+
export type NotificationArgs = InferMatching<typeof NotificationParametersStruct, NotifyParams>;
|
|
19
312
|
export type NotifyMethodHooks = {
|
|
20
313
|
/**
|
|
21
314
|
* @param snapId - The ID of the Snap that created the notification.
|
|
@@ -29,6 +322,7 @@ export type NotifyMethodHooks = {
|
|
|
29
322
|
showInAppNotification: (snapId: string, args: NotificationArgs) => Promise<null>;
|
|
30
323
|
isOnPhishingList: (url: string) => boolean;
|
|
31
324
|
maybeUpdatePhishingList: () => Promise<void>;
|
|
325
|
+
createInterface: (origin: string, content: ComponentOrElement, context?: InterfaceContext, contentType?: ContentType) => Promise<string>;
|
|
32
326
|
getSnap: (snapId: string) => Snap | undefined;
|
|
33
327
|
};
|
|
34
328
|
type SpecificationBuilderOptions = {
|
|
@@ -69,18 +363,22 @@ export declare const notifyBuilder: Readonly<{
|
|
|
69
363
|
* @param hooks.showInAppNotification - A function that shows a notification in the MetaMask UI.
|
|
70
364
|
* @param hooks.isOnPhishingList - A function that checks for links against the phishing list.
|
|
71
365
|
* @param hooks.maybeUpdatePhishingList - A function that updates the phishing list if needed.
|
|
366
|
+
* @param hooks.createInterface - A function that creates the interface in SnapInterfaceController.
|
|
72
367
|
* @param hooks.getSnap - A function that checks if a snap is installed.
|
|
73
368
|
* @returns The method implementation which returns `null` on success.
|
|
74
369
|
* @throws If the params are invalid.
|
|
75
370
|
*/
|
|
76
|
-
export declare function getImplementation({ showNativeNotification, showInAppNotification, isOnPhishingList, maybeUpdatePhishingList, getSnap, }: NotifyMethodHooks): (args: RestrictedMethodOptions<NotifyParams>) => Promise<NotifyResult>;
|
|
371
|
+
export declare function getImplementation({ showNativeNotification, showInAppNotification, isOnPhishingList, maybeUpdatePhishingList, createInterface, getSnap, }: NotifyMethodHooks): (args: RestrictedMethodOptions<NotifyParams>) => Promise<NotifyResult>;
|
|
77
372
|
/**
|
|
78
373
|
* Validates the notify method `params` and returns them cast to the correct
|
|
79
374
|
* type. Throws if validation fails.
|
|
80
375
|
*
|
|
81
376
|
* @param params - The unvalidated params object from the method request.
|
|
377
|
+
* @param isOnPhishingList - The function that checks for links against the phishing list.
|
|
378
|
+
* @param getSnap - A function that checks if a snap is installed.
|
|
82
379
|
* @returns The validated method parameter object.
|
|
380
|
+
* @throws If the params are invalid.
|
|
83
381
|
*/
|
|
84
|
-
export declare function getValidatedParams(params: unknown): NotifyParams;
|
|
382
|
+
export declare function getValidatedParams(params: unknown, isOnPhishingList: NotifyMethodHooks['isOnPhishingList'], getSnap: NotifyMethodHooks['getSnap']): NotifyParams;
|
|
85
383
|
export {};
|
|
86
384
|
//# sourceMappingURL=notify.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notify.d.cts","sourceRoot":"","sources":["../../src/restricted/notify.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,8BAA8B,EAC9B,uBAAuB,EACvB,4BAA4B,EAC7B,wCAAwC;AACzC,OAAO,EAAE,cAAc,EAAe,wCAAwC;AAE9E,OAAO,
|
|
1
|
+
{"version":3,"file":"notify.d.cts","sourceRoot":"","sources":["../../src/restricted/notify.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,8BAA8B,EAC9B,uBAAuB,EACvB,4BAA4B,EAC7B,wCAAwC;AACzC,OAAO,EAAE,cAAc,EAAe,wCAAwC;AAE9E,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EACnB,4BAA4B;AAC7B,OAAO,EAIL,WAAW,EAGZ,4BAA4B;AAC7B,OAAO,EAIL,KAAK,IAAI,EACV,8BAA8B;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,8BAA8B;AAE3D,OAAO,KAAK,EAAE,aAAa,EAAE,wBA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