@metamask-previews/approval-controller 8.0.0-preview-25d2d4502 → 9.0.0-preview-152e02d

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 CHANGED
@@ -7,8 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [9.0.0]
11
+
12
+ ### Added
13
+
14
+ - New `addRequest()` public method ([#8183](https://github.com/MetaMask/core/pull/8183))
15
+ - Expose missing public `ApprovalController` methods through its messenger ([#8183](https://github.com/MetaMask/core/pull/8183))
16
+ - The following actions are now available:
17
+ - `ApprovalController:add`
18
+ - `ApprovalController:addAndShowApprovalRequest`
19
+ - `ApprovalController:get`
20
+ - `ApprovalController:getApprovalCount`
21
+ - `ApprovalController:getTotalApprovalCount`
22
+ - Corresponding action types (e.g. `ApprovalControllerAddAction`) are available as well.
23
+
10
24
  ### Changed
11
25
 
26
+ - **BREAKING:** Standardize names of `ApprovalController` methods ([#8183](https://github.com/MetaMask/core/pull/8183))
27
+ - All existing methods for handling requests have been renamed so they include `Request` (e.g. `clear()` -> `clearRequest()`). You will need to update usage appropriately.
28
+ - The error handling method `error()` has been renamed to include `show` (`error()` -> `showError()`). You will need to update usage appropriately.
29
+ - **BREAKING:** Rename get-state action type: `GetApprovalsState` → `ApprovalControllerGetStateAction` ([#8183](https://github.com/MetaMask/core/pull/8183))
12
30
  - Upgrade `@metamask/utils` from `^11.8.1` to `^11.9.0` ([#7511](https://github.com/MetaMask/core/pull/7511))
13
31
 
14
32
  ## [8.0.0]
@@ -298,7 +316,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
298
316
 
299
317
  All changes listed after this point were applied to this package following the monorepo conversion.
300
318
 
301
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/approval-controller@8.0.0...HEAD
319
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/approval-controller@9.0.0...HEAD
320
+ [9.0.0]: https://github.com/MetaMask/core/compare/@metamask/approval-controller@8.0.0...@metamask/approval-controller@9.0.0
302
321
  [8.0.0]: https://github.com/MetaMask/core/compare/@metamask/approval-controller@7.2.1...@metamask/approval-controller@8.0.0
303
322
  [7.2.1]: https://github.com/MetaMask/core/compare/@metamask/approval-controller@7.2.0...@metamask/approval-controller@7.2.1
304
323
  [7.2.0]: https://github.com/MetaMask/core/compare/@metamask/approval-controller@7.1.3...@metamask/approval-controller@7.2.0
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * This file is auto generated by `scripts/generate-method-action-types.ts`.
4
+ * Do not edit manually.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ //# sourceMappingURL=ApprovalController-method-action-types.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApprovalController-method-action-types.cjs","sourceRoot":"","sources":["../src/ApprovalController-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated by `scripts/generate-method-action-types.ts`.\n * Do not edit manually.\n */\n\nimport type { ApprovalController } from './ApprovalController';\n\n/**\n * Adds an approval request per the given arguments, optionally showing\n * the approval request to the user.\n *\n * @param opts - Options bag.\n * @param opts.id - The id of the approval request. A random id will be\n * generated if none is provided.\n * @param opts.origin - The origin of the approval request.\n * @param opts.type - The type associated with the approval request.\n * @param opts.requestData - Additional data associated with the request,\n * if any.\n * @param opts.requestState - Additional state associated with the request,\n * if any.\n * @param shouldShowRequest - Whether to show the approval request to the user.\n * @returns The approval promise.\n */\nexport type ApprovalControllerAddRequestAction = {\n type: `ApprovalController:addRequest`;\n handler: ApprovalController['addRequest'];\n};\n\n/**\n * Adds an approval request per the given arguments, calls the show approval\n * request function, and returns the associated approval promise resolving to\n * an AddResult object.\n *\n * There can only be one approval per origin and type. An error is thrown if\n * attempting to add an invalid or duplicate request.\n *\n * @param opts - Options bag.\n * @param opts.id - The id of the approval request. A random id will be\n * generated if none is provided.\n * @param opts.origin - The origin of the approval request.\n * @param opts.type - The type associated with the approval request.\n * @param opts.requestData - Additional data associated with the request,\n * @param opts.requestState - Additional state associated with the request,\n * if any.\n * @returns The approval promise resolving to an AddResult object.\n */\nexport type ApprovalControllerAddAndShowApprovalRequestAction = {\n type: `ApprovalController:addAndShowApprovalRequest`;\n handler: ApprovalController['addAndShowApprovalRequest'];\n};\n\n/**\n * Adds an approval request per the given arguments and returns the approval\n * promise resolving to an AddResult object.\n *\n * There can only be one approval per origin and type. An error is thrown if\n * attempting to add an invalid or duplicate request.\n *\n * @param opts - Options bag.\n * @param opts.id - The id of the approval request. A random id will be\n * generated if none is provided.\n * @param opts.origin - The origin of the approval request.\n * @param opts.type - The type associated with the approval request.\n * @param opts.requestData - Additional data associated with the request,\n * if any.\n * @returns The approval promise resolving to an AddResult object.\n */\nexport type ApprovalControllerAddAction = {\n type: `ApprovalController:add`;\n handler: ApprovalController['add'];\n};\n\n/**\n * Gets the info for the approval request with the given id.\n *\n * @param id - The id of the approval request.\n * @returns The approval request data associated with the id.\n */\nexport type ApprovalControllerGetAction = {\n type: `ApprovalController:get`;\n handler: ApprovalController['get'];\n};\n\n/**\n * Gets the number of pending approvals, by origin and/or type.\n *\n * If only `origin` is specified, all approvals for that origin will be\n * counted, regardless of type.\n * If only `type` is specified, all approvals for that type will be counted,\n * regardless of origin.\n * If both `origin` and `type` are specified, 0 or 1 will be returned.\n *\n * @param opts - The approval count options.\n * @param opts.origin - An approval origin.\n * @param opts.type - The type of the approval request.\n * @returns The current approval request count for the given origin and/or\n * type.\n */\nexport type ApprovalControllerGetApprovalCountAction = {\n type: `ApprovalController:getApprovalCount`;\n handler: ApprovalController['getApprovalCount'];\n};\n\n/**\n * Get the total count of all pending approval requests for all origins.\n *\n * @returns The total pending approval request count.\n */\nexport type ApprovalControllerGetTotalApprovalCountAction = {\n type: `ApprovalController:getTotalApprovalCount`;\n handler: ApprovalController['getTotalApprovalCount'];\n};\n\n/**\n * Checks if there's a pending approval request per the given parameters.\n * At least one parameter must be specified. An error will be thrown if the\n * parameters are invalid.\n *\n * If `id` is specified, all other parameters will be ignored.\n * If `id` is not specified, the method will check for requests that match\n * all of the specified parameters.\n *\n * @param opts - Options bag.\n * @param opts.id - The ID to check for.\n * @param opts.origin - The origin to check for.\n * @param opts.type - The type to check for.\n * @returns `true` if a matching approval is found, and `false` otherwise.\n */\nexport type ApprovalControllerHasRequestAction = {\n type: `ApprovalController:hasRequest`;\n handler: ApprovalController['hasRequest'];\n};\n\n/**\n * Resolves the promise of the approval with the given id, and deletes the\n * approval. Throws an error if no such approval exists.\n *\n * @param id - The id of the approval request.\n * @param value - The value to resolve the approval promise with.\n * @param options - Options bag.\n * @returns A promise that either resolves once a result is provided by\n * the creator of the approval request, or immediately if `options.waitForResult`\n * is `false` or `undefined`.\n */\nexport type ApprovalControllerAcceptRequestAction = {\n type: `ApprovalController:acceptRequest`;\n handler: ApprovalController['acceptRequest'];\n};\n\n/**\n * Rejects the promise of the approval with the given id, and deletes the\n * approval. Throws an error if no such approval exists.\n *\n * @param id - The id of the approval request.\n * @param error - The error to reject the approval promise with.\n */\nexport type ApprovalControllerRejectRequestAction = {\n type: `ApprovalController:rejectRequest`;\n handler: ApprovalController['rejectRequest'];\n};\n\n/**\n * Rejects and deletes all approval requests.\n *\n * @param rejectionError - The JsonRpcError to reject the approval\n * requests with.\n */\nexport type ApprovalControllerClearRequestsAction = {\n type: `ApprovalController:clearRequests`;\n handler: ApprovalController['clearRequests'];\n};\n\n/**\n * Updates the request state of the approval with the given id.\n *\n * @param opts - Options bag.\n * @param opts.id - The id of the approval request.\n * @param opts.requestState - Additional data associated with the request\n */\nexport type ApprovalControllerUpdateRequestStateAction = {\n type: `ApprovalController:updateRequestState`;\n handler: ApprovalController['updateRequestState'];\n};\n\n/**\n * Starts a new approval flow.\n *\n * @param opts - Options bag.\n * @param opts.id - The id of the approval flow.\n * @param opts.loadingText - The loading text that will be associated to the approval flow.\n * @param opts.show - A flag to determine whether the approval should show to the user.\n * @returns The object containing the approval flow id.\n */\nexport type ApprovalControllerStartFlowAction = {\n type: `ApprovalController:startFlow`;\n handler: ApprovalController['startFlow'];\n};\n\n/**\n * Ends the current approval flow.\n *\n * @param opts - Options bag.\n * @param opts.id - The id of the approval flow that will be finished.\n */\nexport type ApprovalControllerEndFlowAction = {\n type: `ApprovalController:endFlow`;\n handler: ApprovalController['endFlow'];\n};\n\n/**\n * Sets the loading text for the approval flow.\n *\n * @param opts - Options bag.\n * @param opts.id - The approval flow loading text that will be displayed.\n * @param opts.loadingText - The loading text that will be associated to the approval flow.\n */\nexport type ApprovalControllerSetFlowLoadingTextAction = {\n type: `ApprovalController:setFlowLoadingText`;\n handler: ApprovalController['setFlowLoadingText'];\n};\n\n/**\n * Show a success page.\n *\n * @param opts - Options bag.\n * @param opts.message - The message text or components to display in the page.\n * @param opts.header - The text or components to display in the header of the page.\n * @param opts.flowToEnd - The ID of the approval flow to end once the success page is approved.\n * @param opts.title - The title to display above the message. Shown by default but can be hidden with `null`.\n * @param opts.icon - The icon to display in the page. Shown by default but can be hidden with `null`.\n * @returns Empty object to support future additions.\n */\nexport type ApprovalControllerShowSuccessAction = {\n type: `ApprovalController:showSuccess`;\n handler: ApprovalController['showSuccess'];\n};\n\n/**\n * Show an error page.\n *\n * @param opts - Options bag.\n * @param opts.message - The message text or components to display in the page.\n * @param opts.header - The text or components to display in the header of the page.\n * @param opts.flowToEnd - The ID of the approval flow to end once the error page is approved.\n * @param opts.title - The title to display above the message. Shown by default but can be hidden with `null`.\n * @param opts.icon - The icon to display in the page. Shown by default but can be hidden with `null`.\n * @returns Empty object to support future additions.\n */\nexport type ApprovalControllerShowErrorAction = {\n type: `ApprovalController:showError`;\n handler: ApprovalController['showError'];\n};\n\n/**\n * Union of all ApprovalController action types.\n */\nexport type ApprovalControllerMethodActions =\n | ApprovalControllerAddRequestAction\n | ApprovalControllerAddAndShowApprovalRequestAction\n | ApprovalControllerAddAction\n | ApprovalControllerGetAction\n | ApprovalControllerGetApprovalCountAction\n | ApprovalControllerGetTotalApprovalCountAction\n | ApprovalControllerHasRequestAction\n | ApprovalControllerAcceptRequestAction\n | ApprovalControllerRejectRequestAction\n | ApprovalControllerClearRequestsAction\n | ApprovalControllerUpdateRequestStateAction\n | ApprovalControllerStartFlowAction\n | ApprovalControllerEndFlowAction\n | ApprovalControllerSetFlowLoadingTextAction\n | ApprovalControllerShowSuccessAction\n | ApprovalControllerShowErrorAction;\n"]}
@@ -0,0 +1,240 @@
1
+ /**
2
+ * This file is auto generated by `scripts/generate-method-action-types.ts`.
3
+ * Do not edit manually.
4
+ */
5
+ import type { ApprovalController } from "./ApprovalController.cjs";
6
+ /**
7
+ * Adds an approval request per the given arguments, optionally showing
8
+ * the approval request to the user.
9
+ *
10
+ * @param opts - Options bag.
11
+ * @param opts.id - The id of the approval request. A random id will be
12
+ * generated if none is provided.
13
+ * @param opts.origin - The origin of the approval request.
14
+ * @param opts.type - The type associated with the approval request.
15
+ * @param opts.requestData - Additional data associated with the request,
16
+ * if any.
17
+ * @param opts.requestState - Additional state associated with the request,
18
+ * if any.
19
+ * @param shouldShowRequest - Whether to show the approval request to the user.
20
+ * @returns The approval promise.
21
+ */
22
+ export type ApprovalControllerAddRequestAction = {
23
+ type: `ApprovalController:addRequest`;
24
+ handler: ApprovalController['addRequest'];
25
+ };
26
+ /**
27
+ * Adds an approval request per the given arguments, calls the show approval
28
+ * request function, and returns the associated approval promise resolving to
29
+ * an AddResult object.
30
+ *
31
+ * There can only be one approval per origin and type. An error is thrown if
32
+ * attempting to add an invalid or duplicate request.
33
+ *
34
+ * @param opts - Options bag.
35
+ * @param opts.id - The id of the approval request. A random id will be
36
+ * generated if none is provided.
37
+ * @param opts.origin - The origin of the approval request.
38
+ * @param opts.type - The type associated with the approval request.
39
+ * @param opts.requestData - Additional data associated with the request,
40
+ * @param opts.requestState - Additional state associated with the request,
41
+ * if any.
42
+ * @returns The approval promise resolving to an AddResult object.
43
+ */
44
+ export type ApprovalControllerAddAndShowApprovalRequestAction = {
45
+ type: `ApprovalController:addAndShowApprovalRequest`;
46
+ handler: ApprovalController['addAndShowApprovalRequest'];
47
+ };
48
+ /**
49
+ * Adds an approval request per the given arguments and returns the approval
50
+ * promise resolving to an AddResult object.
51
+ *
52
+ * There can only be one approval per origin and type. An error is thrown if
53
+ * attempting to add an invalid or duplicate request.
54
+ *
55
+ * @param opts - Options bag.
56
+ * @param opts.id - The id of the approval request. A random id will be
57
+ * generated if none is provided.
58
+ * @param opts.origin - The origin of the approval request.
59
+ * @param opts.type - The type associated with the approval request.
60
+ * @param opts.requestData - Additional data associated with the request,
61
+ * if any.
62
+ * @returns The approval promise resolving to an AddResult object.
63
+ */
64
+ export type ApprovalControllerAddAction = {
65
+ type: `ApprovalController:add`;
66
+ handler: ApprovalController['add'];
67
+ };
68
+ /**
69
+ * Gets the info for the approval request with the given id.
70
+ *
71
+ * @param id - The id of the approval request.
72
+ * @returns The approval request data associated with the id.
73
+ */
74
+ export type ApprovalControllerGetAction = {
75
+ type: `ApprovalController:get`;
76
+ handler: ApprovalController['get'];
77
+ };
78
+ /**
79
+ * Gets the number of pending approvals, by origin and/or type.
80
+ *
81
+ * If only `origin` is specified, all approvals for that origin will be
82
+ * counted, regardless of type.
83
+ * If only `type` is specified, all approvals for that type will be counted,
84
+ * regardless of origin.
85
+ * If both `origin` and `type` are specified, 0 or 1 will be returned.
86
+ *
87
+ * @param opts - The approval count options.
88
+ * @param opts.origin - An approval origin.
89
+ * @param opts.type - The type of the approval request.
90
+ * @returns The current approval request count for the given origin and/or
91
+ * type.
92
+ */
93
+ export type ApprovalControllerGetApprovalCountAction = {
94
+ type: `ApprovalController:getApprovalCount`;
95
+ handler: ApprovalController['getApprovalCount'];
96
+ };
97
+ /**
98
+ * Get the total count of all pending approval requests for all origins.
99
+ *
100
+ * @returns The total pending approval request count.
101
+ */
102
+ export type ApprovalControllerGetTotalApprovalCountAction = {
103
+ type: `ApprovalController:getTotalApprovalCount`;
104
+ handler: ApprovalController['getTotalApprovalCount'];
105
+ };
106
+ /**
107
+ * Checks if there's a pending approval request per the given parameters.
108
+ * At least one parameter must be specified. An error will be thrown if the
109
+ * parameters are invalid.
110
+ *
111
+ * If `id` is specified, all other parameters will be ignored.
112
+ * If `id` is not specified, the method will check for requests that match
113
+ * all of the specified parameters.
114
+ *
115
+ * @param opts - Options bag.
116
+ * @param opts.id - The ID to check for.
117
+ * @param opts.origin - The origin to check for.
118
+ * @param opts.type - The type to check for.
119
+ * @returns `true` if a matching approval is found, and `false` otherwise.
120
+ */
121
+ export type ApprovalControllerHasRequestAction = {
122
+ type: `ApprovalController:hasRequest`;
123
+ handler: ApprovalController['hasRequest'];
124
+ };
125
+ /**
126
+ * Resolves the promise of the approval with the given id, and deletes the
127
+ * approval. Throws an error if no such approval exists.
128
+ *
129
+ * @param id - The id of the approval request.
130
+ * @param value - The value to resolve the approval promise with.
131
+ * @param options - Options bag.
132
+ * @returns A promise that either resolves once a result is provided by
133
+ * the creator of the approval request, or immediately if `options.waitForResult`
134
+ * is `false` or `undefined`.
135
+ */
136
+ export type ApprovalControllerAcceptRequestAction = {
137
+ type: `ApprovalController:acceptRequest`;
138
+ handler: ApprovalController['acceptRequest'];
139
+ };
140
+ /**
141
+ * Rejects the promise of the approval with the given id, and deletes the
142
+ * approval. Throws an error if no such approval exists.
143
+ *
144
+ * @param id - The id of the approval request.
145
+ * @param error - The error to reject the approval promise with.
146
+ */
147
+ export type ApprovalControllerRejectRequestAction = {
148
+ type: `ApprovalController:rejectRequest`;
149
+ handler: ApprovalController['rejectRequest'];
150
+ };
151
+ /**
152
+ * Rejects and deletes all approval requests.
153
+ *
154
+ * @param rejectionError - The JsonRpcError to reject the approval
155
+ * requests with.
156
+ */
157
+ export type ApprovalControllerClearRequestsAction = {
158
+ type: `ApprovalController:clearRequests`;
159
+ handler: ApprovalController['clearRequests'];
160
+ };
161
+ /**
162
+ * Updates the request state of the approval with the given id.
163
+ *
164
+ * @param opts - Options bag.
165
+ * @param opts.id - The id of the approval request.
166
+ * @param opts.requestState - Additional data associated with the request
167
+ */
168
+ export type ApprovalControllerUpdateRequestStateAction = {
169
+ type: `ApprovalController:updateRequestState`;
170
+ handler: ApprovalController['updateRequestState'];
171
+ };
172
+ /**
173
+ * Starts a new approval flow.
174
+ *
175
+ * @param opts - Options bag.
176
+ * @param opts.id - The id of the approval flow.
177
+ * @param opts.loadingText - The loading text that will be associated to the approval flow.
178
+ * @param opts.show - A flag to determine whether the approval should show to the user.
179
+ * @returns The object containing the approval flow id.
180
+ */
181
+ export type ApprovalControllerStartFlowAction = {
182
+ type: `ApprovalController:startFlow`;
183
+ handler: ApprovalController['startFlow'];
184
+ };
185
+ /**
186
+ * Ends the current approval flow.
187
+ *
188
+ * @param opts - Options bag.
189
+ * @param opts.id - The id of the approval flow that will be finished.
190
+ */
191
+ export type ApprovalControllerEndFlowAction = {
192
+ type: `ApprovalController:endFlow`;
193
+ handler: ApprovalController['endFlow'];
194
+ };
195
+ /**
196
+ * Sets the loading text for the approval flow.
197
+ *
198
+ * @param opts - Options bag.
199
+ * @param opts.id - The approval flow loading text that will be displayed.
200
+ * @param opts.loadingText - The loading text that will be associated to the approval flow.
201
+ */
202
+ export type ApprovalControllerSetFlowLoadingTextAction = {
203
+ type: `ApprovalController:setFlowLoadingText`;
204
+ handler: ApprovalController['setFlowLoadingText'];
205
+ };
206
+ /**
207
+ * Show a success page.
208
+ *
209
+ * @param opts - Options bag.
210
+ * @param opts.message - The message text or components to display in the page.
211
+ * @param opts.header - The text or components to display in the header of the page.
212
+ * @param opts.flowToEnd - The ID of the approval flow to end once the success page is approved.
213
+ * @param opts.title - The title to display above the message. Shown by default but can be hidden with `null`.
214
+ * @param opts.icon - The icon to display in the page. Shown by default but can be hidden with `null`.
215
+ * @returns Empty object to support future additions.
216
+ */
217
+ export type ApprovalControllerShowSuccessAction = {
218
+ type: `ApprovalController:showSuccess`;
219
+ handler: ApprovalController['showSuccess'];
220
+ };
221
+ /**
222
+ * Show an error page.
223
+ *
224
+ * @param opts - Options bag.
225
+ * @param opts.message - The message text or components to display in the page.
226
+ * @param opts.header - The text or components to display in the header of the page.
227
+ * @param opts.flowToEnd - The ID of the approval flow to end once the error page is approved.
228
+ * @param opts.title - The title to display above the message. Shown by default but can be hidden with `null`.
229
+ * @param opts.icon - The icon to display in the page. Shown by default but can be hidden with `null`.
230
+ * @returns Empty object to support future additions.
231
+ */
232
+ export type ApprovalControllerShowErrorAction = {
233
+ type: `ApprovalController:showError`;
234
+ handler: ApprovalController['showError'];
235
+ };
236
+ /**
237
+ * Union of all ApprovalController action types.
238
+ */
239
+ export type ApprovalControllerMethodActions = ApprovalControllerAddRequestAction | ApprovalControllerAddAndShowApprovalRequestAction | ApprovalControllerAddAction | ApprovalControllerGetAction | ApprovalControllerGetApprovalCountAction | ApprovalControllerGetTotalApprovalCountAction | ApprovalControllerHasRequestAction | ApprovalControllerAcceptRequestAction | ApprovalControllerRejectRequestAction | ApprovalControllerClearRequestsAction | ApprovalControllerUpdateRequestStateAction | ApprovalControllerStartFlowAction | ApprovalControllerEndFlowAction | ApprovalControllerSetFlowLoadingTextAction | ApprovalControllerShowSuccessAction | ApprovalControllerShowErrorAction;
240
+ //# sourceMappingURL=ApprovalController-method-action-types.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApprovalController-method-action-types.d.cts","sourceRoot":"","sources":["../src/ApprovalController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,iCAA6B;AAE/D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,iDAAiD,GAAG;IAC9D,IAAI,EAAE,8CAA8C,CAAC;IACrD,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
2
+ * This file is auto generated by `scripts/generate-method-action-types.ts`.
3
+ * Do not edit manually.
4
+ */
5
+ import type { ApprovalController } from "./ApprovalController.mjs";
6
+ /**
7
+ * Adds an approval request per the given arguments, optionally showing
8
+ * the approval request to the user.
9
+ *
10
+ * @param opts - Options bag.
11
+ * @param opts.id - The id of the approval request. A random id will be
12
+ * generated if none is provided.
13
+ * @param opts.origin - The origin of the approval request.
14
+ * @param opts.type - The type associated with the approval request.
15
+ * @param opts.requestData - Additional data associated with the request,
16
+ * if any.
17
+ * @param opts.requestState - Additional state associated with the request,
18
+ * if any.
19
+ * @param shouldShowRequest - Whether to show the approval request to the user.
20
+ * @returns The approval promise.
21
+ */
22
+ export type ApprovalControllerAddRequestAction = {
23
+ type: `ApprovalController:addRequest`;
24
+ handler: ApprovalController['addRequest'];
25
+ };
26
+ /**
27
+ * Adds an approval request per the given arguments, calls the show approval
28
+ * request function, and returns the associated approval promise resolving to
29
+ * an AddResult object.
30
+ *
31
+ * There can only be one approval per origin and type. An error is thrown if
32
+ * attempting to add an invalid or duplicate request.
33
+ *
34
+ * @param opts - Options bag.
35
+ * @param opts.id - The id of the approval request. A random id will be
36
+ * generated if none is provided.
37
+ * @param opts.origin - The origin of the approval request.
38
+ * @param opts.type - The type associated with the approval request.
39
+ * @param opts.requestData - Additional data associated with the request,
40
+ * @param opts.requestState - Additional state associated with the request,
41
+ * if any.
42
+ * @returns The approval promise resolving to an AddResult object.
43
+ */
44
+ export type ApprovalControllerAddAndShowApprovalRequestAction = {
45
+ type: `ApprovalController:addAndShowApprovalRequest`;
46
+ handler: ApprovalController['addAndShowApprovalRequest'];
47
+ };
48
+ /**
49
+ * Adds an approval request per the given arguments and returns the approval
50
+ * promise resolving to an AddResult object.
51
+ *
52
+ * There can only be one approval per origin and type. An error is thrown if
53
+ * attempting to add an invalid or duplicate request.
54
+ *
55
+ * @param opts - Options bag.
56
+ * @param opts.id - The id of the approval request. A random id will be
57
+ * generated if none is provided.
58
+ * @param opts.origin - The origin of the approval request.
59
+ * @param opts.type - The type associated with the approval request.
60
+ * @param opts.requestData - Additional data associated with the request,
61
+ * if any.
62
+ * @returns The approval promise resolving to an AddResult object.
63
+ */
64
+ export type ApprovalControllerAddAction = {
65
+ type: `ApprovalController:add`;
66
+ handler: ApprovalController['add'];
67
+ };
68
+ /**
69
+ * Gets the info for the approval request with the given id.
70
+ *
71
+ * @param id - The id of the approval request.
72
+ * @returns The approval request data associated with the id.
73
+ */
74
+ export type ApprovalControllerGetAction = {
75
+ type: `ApprovalController:get`;
76
+ handler: ApprovalController['get'];
77
+ };
78
+ /**
79
+ * Gets the number of pending approvals, by origin and/or type.
80
+ *
81
+ * If only `origin` is specified, all approvals for that origin will be
82
+ * counted, regardless of type.
83
+ * If only `type` is specified, all approvals for that type will be counted,
84
+ * regardless of origin.
85
+ * If both `origin` and `type` are specified, 0 or 1 will be returned.
86
+ *
87
+ * @param opts - The approval count options.
88
+ * @param opts.origin - An approval origin.
89
+ * @param opts.type - The type of the approval request.
90
+ * @returns The current approval request count for the given origin and/or
91
+ * type.
92
+ */
93
+ export type ApprovalControllerGetApprovalCountAction = {
94
+ type: `ApprovalController:getApprovalCount`;
95
+ handler: ApprovalController['getApprovalCount'];
96
+ };
97
+ /**
98
+ * Get the total count of all pending approval requests for all origins.
99
+ *
100
+ * @returns The total pending approval request count.
101
+ */
102
+ export type ApprovalControllerGetTotalApprovalCountAction = {
103
+ type: `ApprovalController:getTotalApprovalCount`;
104
+ handler: ApprovalController['getTotalApprovalCount'];
105
+ };
106
+ /**
107
+ * Checks if there's a pending approval request per the given parameters.
108
+ * At least one parameter must be specified. An error will be thrown if the
109
+ * parameters are invalid.
110
+ *
111
+ * If `id` is specified, all other parameters will be ignored.
112
+ * If `id` is not specified, the method will check for requests that match
113
+ * all of the specified parameters.
114
+ *
115
+ * @param opts - Options bag.
116
+ * @param opts.id - The ID to check for.
117
+ * @param opts.origin - The origin to check for.
118
+ * @param opts.type - The type to check for.
119
+ * @returns `true` if a matching approval is found, and `false` otherwise.
120
+ */
121
+ export type ApprovalControllerHasRequestAction = {
122
+ type: `ApprovalController:hasRequest`;
123
+ handler: ApprovalController['hasRequest'];
124
+ };
125
+ /**
126
+ * Resolves the promise of the approval with the given id, and deletes the
127
+ * approval. Throws an error if no such approval exists.
128
+ *
129
+ * @param id - The id of the approval request.
130
+ * @param value - The value to resolve the approval promise with.
131
+ * @param options - Options bag.
132
+ * @returns A promise that either resolves once a result is provided by
133
+ * the creator of the approval request, or immediately if `options.waitForResult`
134
+ * is `false` or `undefined`.
135
+ */
136
+ export type ApprovalControllerAcceptRequestAction = {
137
+ type: `ApprovalController:acceptRequest`;
138
+ handler: ApprovalController['acceptRequest'];
139
+ };
140
+ /**
141
+ * Rejects the promise of the approval with the given id, and deletes the
142
+ * approval. Throws an error if no such approval exists.
143
+ *
144
+ * @param id - The id of the approval request.
145
+ * @param error - The error to reject the approval promise with.
146
+ */
147
+ export type ApprovalControllerRejectRequestAction = {
148
+ type: `ApprovalController:rejectRequest`;
149
+ handler: ApprovalController['rejectRequest'];
150
+ };
151
+ /**
152
+ * Rejects and deletes all approval requests.
153
+ *
154
+ * @param rejectionError - The JsonRpcError to reject the approval
155
+ * requests with.
156
+ */
157
+ export type ApprovalControllerClearRequestsAction = {
158
+ type: `ApprovalController:clearRequests`;
159
+ handler: ApprovalController['clearRequests'];
160
+ };
161
+ /**
162
+ * Updates the request state of the approval with the given id.
163
+ *
164
+ * @param opts - Options bag.
165
+ * @param opts.id - The id of the approval request.
166
+ * @param opts.requestState - Additional data associated with the request
167
+ */
168
+ export type ApprovalControllerUpdateRequestStateAction = {
169
+ type: `ApprovalController:updateRequestState`;
170
+ handler: ApprovalController['updateRequestState'];
171
+ };
172
+ /**
173
+ * Starts a new approval flow.
174
+ *
175
+ * @param opts - Options bag.
176
+ * @param opts.id - The id of the approval flow.
177
+ * @param opts.loadingText - The loading text that will be associated to the approval flow.
178
+ * @param opts.show - A flag to determine whether the approval should show to the user.
179
+ * @returns The object containing the approval flow id.
180
+ */
181
+ export type ApprovalControllerStartFlowAction = {
182
+ type: `ApprovalController:startFlow`;
183
+ handler: ApprovalController['startFlow'];
184
+ };
185
+ /**
186
+ * Ends the current approval flow.
187
+ *
188
+ * @param opts - Options bag.
189
+ * @param opts.id - The id of the approval flow that will be finished.
190
+ */
191
+ export type ApprovalControllerEndFlowAction = {
192
+ type: `ApprovalController:endFlow`;
193
+ handler: ApprovalController['endFlow'];
194
+ };
195
+ /**
196
+ * Sets the loading text for the approval flow.
197
+ *
198
+ * @param opts - Options bag.
199
+ * @param opts.id - The approval flow loading text that will be displayed.
200
+ * @param opts.loadingText - The loading text that will be associated to the approval flow.
201
+ */
202
+ export type ApprovalControllerSetFlowLoadingTextAction = {
203
+ type: `ApprovalController:setFlowLoadingText`;
204
+ handler: ApprovalController['setFlowLoadingText'];
205
+ };
206
+ /**
207
+ * Show a success page.
208
+ *
209
+ * @param opts - Options bag.
210
+ * @param opts.message - The message text or components to display in the page.
211
+ * @param opts.header - The text or components to display in the header of the page.
212
+ * @param opts.flowToEnd - The ID of the approval flow to end once the success page is approved.
213
+ * @param opts.title - The title to display above the message. Shown by default but can be hidden with `null`.
214
+ * @param opts.icon - The icon to display in the page. Shown by default but can be hidden with `null`.
215
+ * @returns Empty object to support future additions.
216
+ */
217
+ export type ApprovalControllerShowSuccessAction = {
218
+ type: `ApprovalController:showSuccess`;
219
+ handler: ApprovalController['showSuccess'];
220
+ };
221
+ /**
222
+ * Show an error page.
223
+ *
224
+ * @param opts - Options bag.
225
+ * @param opts.message - The message text or components to display in the page.
226
+ * @param opts.header - The text or components to display in the header of the page.
227
+ * @param opts.flowToEnd - The ID of the approval flow to end once the error page is approved.
228
+ * @param opts.title - The title to display above the message. Shown by default but can be hidden with `null`.
229
+ * @param opts.icon - The icon to display in the page. Shown by default but can be hidden with `null`.
230
+ * @returns Empty object to support future additions.
231
+ */
232
+ export type ApprovalControllerShowErrorAction = {
233
+ type: `ApprovalController:showError`;
234
+ handler: ApprovalController['showError'];
235
+ };
236
+ /**
237
+ * Union of all ApprovalController action types.
238
+ */
239
+ export type ApprovalControllerMethodActions = ApprovalControllerAddRequestAction | ApprovalControllerAddAndShowApprovalRequestAction | ApprovalControllerAddAction | ApprovalControllerGetAction | ApprovalControllerGetApprovalCountAction | ApprovalControllerGetTotalApprovalCountAction | ApprovalControllerHasRequestAction | ApprovalControllerAcceptRequestAction | ApprovalControllerRejectRequestAction | ApprovalControllerClearRequestsAction | ApprovalControllerUpdateRequestStateAction | ApprovalControllerStartFlowAction | ApprovalControllerEndFlowAction | ApprovalControllerSetFlowLoadingTextAction | ApprovalControllerShowSuccessAction | ApprovalControllerShowErrorAction;
240
+ //# sourceMappingURL=ApprovalController-method-action-types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApprovalController-method-action-types.d.mts","sourceRoot":"","sources":["../src/ApprovalController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,iCAA6B;AAE/D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,iDAAiD,GAAG;IAC9D,IAAI,EAAE,8CAA8C,CAAC;IACrD,OAAO,EAAE,kBAAkB,CAAC,2BAA2B,CAAC,CAAC;CAC1D,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,IAAI,EAAE,wBAAwB,CAAC;IAC/B,OAAO,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAC;CACpC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,IAAI,EAAE,wBAAwB,CAAC;IAC/B,OAAO,EAAE,kBAAkB,CAAC,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;;;;;GAKG;AACH,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,4BAA4B,CAAC;IACnC,OAAO,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC;CACxC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,0CAA0C,GAAG;IACvD,IAAI,EAAE,uCAAuC,CAAC;IAC9C,OAAO,EAAE,kBAAkB,CAAC,oBAAoB,CAAC,CAAC;CACnD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,IAAI,EAAE,gCAAgC,CAAC;IACvC,OAAO,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;CAC5C,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC9C,IAAI,EAAE,8BAA8B,CAAC;IACrC,OAAO,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC;CAC1C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,+BAA+B,GACvC,kCAAkC,GAClC,iDAAiD,GACjD,2BAA2B,GAC3B,2BAA2B,GAC3B,wCAAwC,GACxC,6CAA6C,GAC7C,kCAAkC,GAClC,qCAAqC,GACrC,qCAAqC,GACrC,qCAAqC,GACrC,0CAA0C,GAC1C,iCAAiC,GACjC,+BAA+B,GAC/B,0CAA0C,GAC1C,mCAAmC,GACnC,iCAAiC,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This file is auto generated by `scripts/generate-method-action-types.ts`.
3
+ * Do not edit manually.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=ApprovalController-method-action-types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApprovalController-method-action-types.mjs","sourceRoot":"","sources":["../src/ApprovalController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated by `scripts/generate-method-action-types.ts`.\n * Do not edit manually.\n */\n\nimport type { ApprovalController } from './ApprovalController';\n\n/**\n * Adds an approval request per the given arguments, optionally showing\n * the approval request to the user.\n *\n * @param opts - Options bag.\n * @param opts.id - The id of the approval request. A random id will be\n * generated if none is provided.\n * @param opts.origin - The origin of the approval request.\n * @param opts.type - The type associated with the approval request.\n * @param opts.requestData - Additional data associated with the request,\n * if any.\n * @param opts.requestState - Additional state associated with the request,\n * if any.\n * @param shouldShowRequest - Whether to show the approval request to the user.\n * @returns The approval promise.\n */\nexport type ApprovalControllerAddRequestAction = {\n type: `ApprovalController:addRequest`;\n handler: ApprovalController['addRequest'];\n};\n\n/**\n * Adds an approval request per the given arguments, calls the show approval\n * request function, and returns the associated approval promise resolving to\n * an AddResult object.\n *\n * There can only be one approval per origin and type. An error is thrown if\n * attempting to add an invalid or duplicate request.\n *\n * @param opts - Options bag.\n * @param opts.id - The id of the approval request. A random id will be\n * generated if none is provided.\n * @param opts.origin - The origin of the approval request.\n * @param opts.type - The type associated with the approval request.\n * @param opts.requestData - Additional data associated with the request,\n * @param opts.requestState - Additional state associated with the request,\n * if any.\n * @returns The approval promise resolving to an AddResult object.\n */\nexport type ApprovalControllerAddAndShowApprovalRequestAction = {\n type: `ApprovalController:addAndShowApprovalRequest`;\n handler: ApprovalController['addAndShowApprovalRequest'];\n};\n\n/**\n * Adds an approval request per the given arguments and returns the approval\n * promise resolving to an AddResult object.\n *\n * There can only be one approval per origin and type. An error is thrown if\n * attempting to add an invalid or duplicate request.\n *\n * @param opts - Options bag.\n * @param opts.id - The id of the approval request. A random id will be\n * generated if none is provided.\n * @param opts.origin - The origin of the approval request.\n * @param opts.type - The type associated with the approval request.\n * @param opts.requestData - Additional data associated with the request,\n * if any.\n * @returns The approval promise resolving to an AddResult object.\n */\nexport type ApprovalControllerAddAction = {\n type: `ApprovalController:add`;\n handler: ApprovalController['add'];\n};\n\n/**\n * Gets the info for the approval request with the given id.\n *\n * @param id - The id of the approval request.\n * @returns The approval request data associated with the id.\n */\nexport type ApprovalControllerGetAction = {\n type: `ApprovalController:get`;\n handler: ApprovalController['get'];\n};\n\n/**\n * Gets the number of pending approvals, by origin and/or type.\n *\n * If only `origin` is specified, all approvals for that origin will be\n * counted, regardless of type.\n * If only `type` is specified, all approvals for that type will be counted,\n * regardless of origin.\n * If both `origin` and `type` are specified, 0 or 1 will be returned.\n *\n * @param opts - The approval count options.\n * @param opts.origin - An approval origin.\n * @param opts.type - The type of the approval request.\n * @returns The current approval request count for the given origin and/or\n * type.\n */\nexport type ApprovalControllerGetApprovalCountAction = {\n type: `ApprovalController:getApprovalCount`;\n handler: ApprovalController['getApprovalCount'];\n};\n\n/**\n * Get the total count of all pending approval requests for all origins.\n *\n * @returns The total pending approval request count.\n */\nexport type ApprovalControllerGetTotalApprovalCountAction = {\n type: `ApprovalController:getTotalApprovalCount`;\n handler: ApprovalController['getTotalApprovalCount'];\n};\n\n/**\n * Checks if there's a pending approval request per the given parameters.\n * At least one parameter must be specified. An error will be thrown if the\n * parameters are invalid.\n *\n * If `id` is specified, all other parameters will be ignored.\n * If `id` is not specified, the method will check for requests that match\n * all of the specified parameters.\n *\n * @param opts - Options bag.\n * @param opts.id - The ID to check for.\n * @param opts.origin - The origin to check for.\n * @param opts.type - The type to check for.\n * @returns `true` if a matching approval is found, and `false` otherwise.\n */\nexport type ApprovalControllerHasRequestAction = {\n type: `ApprovalController:hasRequest`;\n handler: ApprovalController['hasRequest'];\n};\n\n/**\n * Resolves the promise of the approval with the given id, and deletes the\n * approval. Throws an error if no such approval exists.\n *\n * @param id - The id of the approval request.\n * @param value - The value to resolve the approval promise with.\n * @param options - Options bag.\n * @returns A promise that either resolves once a result is provided by\n * the creator of the approval request, or immediately if `options.waitForResult`\n * is `false` or `undefined`.\n */\nexport type ApprovalControllerAcceptRequestAction = {\n type: `ApprovalController:acceptRequest`;\n handler: ApprovalController['acceptRequest'];\n};\n\n/**\n * Rejects the promise of the approval with the given id, and deletes the\n * approval. Throws an error if no such approval exists.\n *\n * @param id - The id of the approval request.\n * @param error - The error to reject the approval promise with.\n */\nexport type ApprovalControllerRejectRequestAction = {\n type: `ApprovalController:rejectRequest`;\n handler: ApprovalController['rejectRequest'];\n};\n\n/**\n * Rejects and deletes all approval requests.\n *\n * @param rejectionError - The JsonRpcError to reject the approval\n * requests with.\n */\nexport type ApprovalControllerClearRequestsAction = {\n type: `ApprovalController:clearRequests`;\n handler: ApprovalController['clearRequests'];\n};\n\n/**\n * Updates the request state of the approval with the given id.\n *\n * @param opts - Options bag.\n * @param opts.id - The id of the approval request.\n * @param opts.requestState - Additional data associated with the request\n */\nexport type ApprovalControllerUpdateRequestStateAction = {\n type: `ApprovalController:updateRequestState`;\n handler: ApprovalController['updateRequestState'];\n};\n\n/**\n * Starts a new approval flow.\n *\n * @param opts - Options bag.\n * @param opts.id - The id of the approval flow.\n * @param opts.loadingText - The loading text that will be associated to the approval flow.\n * @param opts.show - A flag to determine whether the approval should show to the user.\n * @returns The object containing the approval flow id.\n */\nexport type ApprovalControllerStartFlowAction = {\n type: `ApprovalController:startFlow`;\n handler: ApprovalController['startFlow'];\n};\n\n/**\n * Ends the current approval flow.\n *\n * @param opts - Options bag.\n * @param opts.id - The id of the approval flow that will be finished.\n */\nexport type ApprovalControllerEndFlowAction = {\n type: `ApprovalController:endFlow`;\n handler: ApprovalController['endFlow'];\n};\n\n/**\n * Sets the loading text for the approval flow.\n *\n * @param opts - Options bag.\n * @param opts.id - The approval flow loading text that will be displayed.\n * @param opts.loadingText - The loading text that will be associated to the approval flow.\n */\nexport type ApprovalControllerSetFlowLoadingTextAction = {\n type: `ApprovalController:setFlowLoadingText`;\n handler: ApprovalController['setFlowLoadingText'];\n};\n\n/**\n * Show a success page.\n *\n * @param opts - Options bag.\n * @param opts.message - The message text or components to display in the page.\n * @param opts.header - The text or components to display in the header of the page.\n * @param opts.flowToEnd - The ID of the approval flow to end once the success page is approved.\n * @param opts.title - The title to display above the message. Shown by default but can be hidden with `null`.\n * @param opts.icon - The icon to display in the page. Shown by default but can be hidden with `null`.\n * @returns Empty object to support future additions.\n */\nexport type ApprovalControllerShowSuccessAction = {\n type: `ApprovalController:showSuccess`;\n handler: ApprovalController['showSuccess'];\n};\n\n/**\n * Show an error page.\n *\n * @param opts - Options bag.\n * @param opts.message - The message text or components to display in the page.\n * @param opts.header - The text or components to display in the header of the page.\n * @param opts.flowToEnd - The ID of the approval flow to end once the error page is approved.\n * @param opts.title - The title to display above the message. Shown by default but can be hidden with `null`.\n * @param opts.icon - The icon to display in the page. Shown by default but can be hidden with `null`.\n * @returns Empty object to support future additions.\n */\nexport type ApprovalControllerShowErrorAction = {\n type: `ApprovalController:showError`;\n handler: ApprovalController['showError'];\n};\n\n/**\n * Union of all ApprovalController action types.\n */\nexport type ApprovalControllerMethodActions =\n | ApprovalControllerAddRequestAction\n | ApprovalControllerAddAndShowApprovalRequestAction\n | ApprovalControllerAddAction\n | ApprovalControllerGetAction\n | ApprovalControllerGetApprovalCountAction\n | ApprovalControllerGetTotalApprovalCountAction\n | ApprovalControllerHasRequestAction\n | ApprovalControllerAcceptRequestAction\n | ApprovalControllerRejectRequestAction\n | ApprovalControllerClearRequestsAction\n | ApprovalControllerUpdateRequestStateAction\n | ApprovalControllerStartFlowAction\n | ApprovalControllerEndFlowAction\n | ApprovalControllerSetFlowLoadingTextAction\n | ApprovalControllerShowSuccessAction\n | ApprovalControllerShowErrorAction;\n"]}