{"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.\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"]}