@metamask-previews/approval-controller
Advanced tools
Comparing version 6.0.1-preview-4851cbc9 to 6.0.1-preview-59bf6d5d
@@ -9,9 +9,9 @@ import type { ControllerGetStateAction } from '@metamask/base-controller'; | ||
declare const controllerName = "ApprovalController"; | ||
declare type ApprovalRequestData = Record<string, Json> | null; | ||
declare type ApprovalRequestState = Record<string, Json> | null; | ||
declare type ApprovalFlow = { | ||
type ApprovalRequestData = Record<string, Json> | null; | ||
type ApprovalRequestState = Record<string, Json> | null; | ||
type ApprovalFlow = { | ||
id: string; | ||
loadingText: string | null; | ||
}; | ||
declare type ResultOptions = { | ||
type ResultOptions = { | ||
flowToEnd?: string; | ||
@@ -22,3 +22,3 @@ header?: (string | ResultComponent)[]; | ||
}; | ||
export declare type ApprovalRequest<RequestData extends ApprovalRequestData> = { | ||
export type ApprovalRequest<RequestData extends ApprovalRequestData> = { | ||
/** | ||
@@ -54,4 +54,4 @@ * The ID of the approval request. | ||
}; | ||
export declare type ApprovalFlowState = ApprovalFlow; | ||
export declare type ApprovalControllerState = { | ||
export type ApprovalFlowState = ApprovalFlow; | ||
export type ApprovalControllerState = { | ||
pendingApprovals: Record<string, ApprovalRequest<Record<string, Json>>>; | ||
@@ -61,5 +61,5 @@ pendingApprovalCount: number; | ||
}; | ||
export declare type ApprovalControllerMessenger = RestrictedControllerMessenger<typeof controllerName, ApprovalControllerActions, ApprovalControllerEvents, never, never>; | ||
export declare type ShowApprovalRequest = () => void | Promise<void>; | ||
export declare type ResultComponent = { | ||
export type ApprovalControllerMessenger = RestrictedControllerMessenger<typeof controllerName, ApprovalControllerActions, ApprovalControllerEvents, never, never>; | ||
export type ShowApprovalRequest = () => void | Promise<void>; | ||
export type ResultComponent = { | ||
/** | ||
@@ -82,3 +82,3 @@ * A unique identifier for this instance of the component. | ||
}; | ||
export declare type ApprovalControllerOptions = { | ||
export type ApprovalControllerOptions = { | ||
messenger: ApprovalControllerMessenger; | ||
@@ -89,3 +89,3 @@ showApprovalRequest: ShowApprovalRequest; | ||
}; | ||
export declare type AddApprovalOptions = { | ||
export type AddApprovalOptions = { | ||
id?: string; | ||
@@ -98,7 +98,7 @@ origin: string; | ||
}; | ||
export declare type UpdateRequestStateOptions = { | ||
export type UpdateRequestStateOptions = { | ||
id: string; | ||
requestState: Record<string, Json>; | ||
}; | ||
export declare type AcceptOptions = { | ||
export type AcceptOptions = { | ||
/** | ||
@@ -111,14 +111,14 @@ * Whether to resolve the returned promise only when the request creator indicates the success of the | ||
}; | ||
export declare type StartFlowOptions = OptionalField<ApprovalFlow, 'id' | 'loadingText'> & { | ||
export type StartFlowOptions = OptionalField<ApprovalFlow, 'id' | 'loadingText'> & { | ||
show?: boolean; | ||
}; | ||
export declare type EndFlowOptions = Pick<ApprovalFlow, 'id'>; | ||
export declare type SetFlowLoadingTextOptions = ApprovalFlow; | ||
export declare type SuccessOptions = ResultOptions & { | ||
export type EndFlowOptions = Pick<ApprovalFlow, 'id'>; | ||
export type SetFlowLoadingTextOptions = ApprovalFlow; | ||
export type SuccessOptions = ResultOptions & { | ||
message?: string | ResultComponent | (string | ResultComponent)[]; | ||
}; | ||
export declare type ErrorOptions = ResultOptions & { | ||
export type ErrorOptions = ResultOptions & { | ||
error?: string | ResultComponent | (string | ResultComponent)[]; | ||
}; | ||
export declare type AcceptResultCallbacks = { | ||
export type AcceptResultCallbacks = { | ||
/** | ||
@@ -137,3 +137,3 @@ * Inform the request acceptor that the post-approval logic was successful. | ||
}; | ||
export declare type AddResult = { | ||
export type AddResult = { | ||
/** | ||
@@ -149,3 +149,3 @@ * An optional value provided by the request acceptor. | ||
}; | ||
export declare type AcceptResult = { | ||
export type AcceptResult = { | ||
/** | ||
@@ -156,53 +156,53 @@ * An optional value provided by the request creator when indicating a successful result. | ||
}; | ||
export declare type ApprovalFlowStartResult = ApprovalFlow; | ||
export declare type SuccessResult = Record<string, never>; | ||
export declare type ErrorResult = Record<string, never>; | ||
export declare type ApprovalStateChange = ControllerStateChangeEvent<typeof controllerName, ApprovalControllerState>; | ||
export declare type ApprovalControllerEvents = ApprovalStateChange; | ||
export declare type GetApprovalsState = ControllerGetStateAction<typeof controllerName, ApprovalControllerState>; | ||
export declare type ClearApprovalRequests = { | ||
export type ApprovalFlowStartResult = ApprovalFlow; | ||
export type SuccessResult = Record<string, never>; | ||
export type ErrorResult = Record<string, never>; | ||
export type ApprovalStateChange = ControllerStateChangeEvent<typeof controllerName, ApprovalControllerState>; | ||
export type ApprovalControllerEvents = ApprovalStateChange; | ||
export type GetApprovalsState = ControllerGetStateAction<typeof controllerName, ApprovalControllerState>; | ||
export type ClearApprovalRequests = { | ||
type: `${typeof controllerName}:clearRequests`; | ||
handler: (error: JsonRpcError<DataWithOptionalCause>) => void; | ||
}; | ||
export declare type AddApprovalRequest = { | ||
export type AddApprovalRequest = { | ||
type: `${typeof controllerName}:addRequest`; | ||
handler: (opts: AddApprovalOptions, shouldShowRequest: boolean) => ReturnType<ApprovalController['add']>; | ||
}; | ||
export declare type HasApprovalRequest = { | ||
export type HasApprovalRequest = { | ||
type: `${typeof controllerName}:hasRequest`; | ||
handler: ApprovalController['has']; | ||
}; | ||
export declare type AcceptRequest = { | ||
export type AcceptRequest = { | ||
type: `${typeof controllerName}:acceptRequest`; | ||
handler: ApprovalController['accept']; | ||
}; | ||
export declare type RejectRequest = { | ||
export type RejectRequest = { | ||
type: `${typeof controllerName}:rejectRequest`; | ||
handler: ApprovalController['reject']; | ||
}; | ||
export declare type UpdateRequestState = { | ||
export type UpdateRequestState = { | ||
type: `${typeof controllerName}:updateRequestState`; | ||
handler: ApprovalController['updateRequestState']; | ||
}; | ||
export declare type StartFlow = { | ||
export type StartFlow = { | ||
type: `${typeof controllerName}:startFlow`; | ||
handler: ApprovalController['startFlow']; | ||
}; | ||
export declare type EndFlow = { | ||
export type EndFlow = { | ||
type: `${typeof controllerName}:endFlow`; | ||
handler: ApprovalController['endFlow']; | ||
}; | ||
export declare type SetFlowLoadingText = { | ||
export type SetFlowLoadingText = { | ||
type: `${typeof controllerName}:setFlowLoadingText`; | ||
handler: ApprovalController['setFlowLoadingText']; | ||
}; | ||
export declare type ShowSuccess = { | ||
export type ShowSuccess = { | ||
type: `${typeof controllerName}:showSuccess`; | ||
handler: ApprovalController['success']; | ||
}; | ||
export declare type ShowError = { | ||
export type ShowError = { | ||
type: `${typeof controllerName}:showError`; | ||
handler: ApprovalController['error']; | ||
}; | ||
export declare type ApprovalControllerActions = GetApprovalsState | ClearApprovalRequests | AddApprovalRequest | HasApprovalRequest | AcceptRequest | RejectRequest | UpdateRequestState | StartFlow | EndFlow | SetFlowLoadingText | ShowSuccess | ShowError; | ||
export type ApprovalControllerActions = GetApprovalsState | ClearApprovalRequests | AddApprovalRequest | HasApprovalRequest | AcceptRequest | RejectRequest | UpdateRequestState | StartFlow | EndFlow | SetFlowLoadingText | ShowSuccess | ShowError; | ||
/** | ||
@@ -209,0 +209,0 @@ * Controller for managing requests that require user approval. |
{ | ||
"name": "@metamask-previews/approval-controller", | ||
"version": "6.0.1-preview-4851cbc9", | ||
"version": "6.0.1-preview-59bf6d5d", | ||
"description": "Manages requests that require user approval", | ||
@@ -58,3 +58,3 @@ "keywords": [ | ||
"typedoc-plugin-missing-exports": "^2.0.0", | ||
"typescript": "~4.8.4" | ||
"typescript": "~4.9.5" | ||
}, | ||
@@ -61,0 +61,0 @@ "engines": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
228446