@metamask/approval-controller
Advanced tools
Comparing version 6.0.1 to 6.0.2
@@ -10,2 +10,9 @@ # Changelog | ||
## [6.0.2] | ||
### Changed | ||
- Bump TypeScript version to `~4.9.5` ([#4084](https://github.com/MetaMask/core/pull/4084)) | ||
- Bump `@metamask/base-controller` to `^5.0.2` ([#4232](https://github.com/MetaMask/core/pull/4232)) | ||
## [6.0.1] | ||
@@ -190,3 +197,4 @@ | ||
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/approval-controller@6.0.1...HEAD | ||
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/approval-controller@6.0.2...HEAD | ||
[6.0.2]: https://github.com/MetaMask/core/compare/@metamask/approval-controller@6.0.1...@metamask/approval-controller@6.0.2 | ||
[6.0.1]: https://github.com/MetaMask/core/compare/@metamask/approval-controller@6.0.0...@metamask/approval-controller@6.0.1 | ||
@@ -193,0 +201,0 @@ [6.0.0]: https://github.com/MetaMask/core/compare/@metamask/approval-controller@5.1.3...@metamask/approval-controller@6.0.0 |
@@ -7,3 +7,3 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
var _chunkOV2MC4XJjs = require('./chunk-OV2MC4XJ.js'); | ||
var _chunk5K4GVAX5js = require('./chunk-5K4GVAX5.js'); | ||
require('./chunk-LKCXZAKD.js'); | ||
@@ -16,3 +16,3 @@ | ||
exports.APPROVAL_TYPE_RESULT_ERROR = _chunkOV2MC4XJjs.APPROVAL_TYPE_RESULT_ERROR; exports.APPROVAL_TYPE_RESULT_SUCCESS = _chunkOV2MC4XJjs.APPROVAL_TYPE_RESULT_SUCCESS; exports.ApprovalController = _chunkOV2MC4XJjs.ApprovalController; exports.ORIGIN_METAMASK = _chunkOV2MC4XJjs.ORIGIN_METAMASK; exports.default = _chunkOV2MC4XJjs.ApprovalController_default; | ||
exports.APPROVAL_TYPE_RESULT_ERROR = _chunk5K4GVAX5js.APPROVAL_TYPE_RESULT_ERROR; exports.APPROVAL_TYPE_RESULT_SUCCESS = _chunk5K4GVAX5js.APPROVAL_TYPE_RESULT_SUCCESS; exports.ApprovalController = _chunk5K4GVAX5js.ApprovalController; exports.ORIGIN_METAMASK = _chunk5K4GVAX5js.ORIGIN_METAMASK; exports.default = _chunk5K4GVAX5js.ApprovalController_default; | ||
//# sourceMappingURL=ApprovalController.js.map |
@@ -6,3 +6,3 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
var _chunkOV2MC4XJjs = require('./chunk-OV2MC4XJ.js'); | ||
var _chunk5K4GVAX5js = require('./chunk-5K4GVAX5.js'); | ||
@@ -25,3 +25,3 @@ | ||
exports.APPROVAL_TYPE_RESULT_ERROR = _chunkOV2MC4XJjs.APPROVAL_TYPE_RESULT_ERROR; exports.APPROVAL_TYPE_RESULT_SUCCESS = _chunkOV2MC4XJjs.APPROVAL_TYPE_RESULT_SUCCESS; exports.ApprovalController = _chunkOV2MC4XJjs.ApprovalController; exports.ApprovalRequestNoResultSupportError = _chunkLKCXZAKDjs.ApprovalRequestNoResultSupportError; exports.ApprovalRequestNotFoundError = _chunkLKCXZAKDjs.ApprovalRequestNotFoundError; exports.EndInvalidFlowError = _chunkLKCXZAKDjs.EndInvalidFlowError; exports.MissingApprovalFlowError = _chunkLKCXZAKDjs.MissingApprovalFlowError; exports.NoApprovalFlowsError = _chunkLKCXZAKDjs.NoApprovalFlowsError; exports.ORIGIN_METAMASK = _chunkOV2MC4XJjs.ORIGIN_METAMASK; | ||
exports.APPROVAL_TYPE_RESULT_ERROR = _chunk5K4GVAX5js.APPROVAL_TYPE_RESULT_ERROR; exports.APPROVAL_TYPE_RESULT_SUCCESS = _chunk5K4GVAX5js.APPROVAL_TYPE_RESULT_SUCCESS; exports.ApprovalController = _chunk5K4GVAX5js.ApprovalController; exports.ApprovalRequestNoResultSupportError = _chunkLKCXZAKDjs.ApprovalRequestNoResultSupportError; exports.ApprovalRequestNotFoundError = _chunkLKCXZAKDjs.ApprovalRequestNotFoundError; exports.EndInvalidFlowError = _chunkLKCXZAKDjs.EndInvalidFlowError; exports.MissingApprovalFlowError = _chunkLKCXZAKDjs.MissingApprovalFlowError; exports.NoApprovalFlowsError = _chunkLKCXZAKDjs.NoApprovalFlowsError; exports.ORIGIN_METAMASK = _chunk5K4GVAX5js.ORIGIN_METAMASK; | ||
//# sourceMappingURL=index.js.map |
@@ -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> = { | ||
/** | ||
@@ -38,2 +38,4 @@ * The ID of the approval request. | ||
* The type of the approval request. | ||
* Unfortunately, not all values will match the `ApprovalType` enum, so we are using `string` here. | ||
* TODO: Replace `string` with `ApprovalType` when all `type` values used by the clients can be encompassed by the `ApprovalType` enum. | ||
*/ | ||
@@ -43,3 +45,2 @@ type: string; | ||
* Additional data associated with the request. | ||
* TODO:TS4.4 make optional | ||
*/ | ||
@@ -56,4 +57,4 @@ requestData: RequestData; | ||
}; | ||
export declare type ApprovalFlowState = ApprovalFlow; | ||
export declare type ApprovalControllerState = { | ||
export type ApprovalFlowState = ApprovalFlow; | ||
export type ApprovalControllerState = { | ||
pendingApprovals: Record<string, ApprovalRequest<Record<string, Json>>>; | ||
@@ -63,5 +64,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 = { | ||
/** | ||
@@ -84,3 +85,3 @@ * A unique identifier for this instance of the component. | ||
}; | ||
export declare type ApprovalControllerOptions = { | ||
export type ApprovalControllerOptions = { | ||
messenger: ApprovalControllerMessenger; | ||
@@ -91,3 +92,3 @@ showApprovalRequest: ShowApprovalRequest; | ||
}; | ||
export declare type AddApprovalOptions = { | ||
export type AddApprovalOptions = { | ||
id?: string; | ||
@@ -100,7 +101,7 @@ origin: string; | ||
}; | ||
export declare type UpdateRequestStateOptions = { | ||
export type UpdateRequestStateOptions = { | ||
id: string; | ||
requestState: Record<string, Json>; | ||
}; | ||
export declare type AcceptOptions = { | ||
export type AcceptOptions = { | ||
/** | ||
@@ -113,14 +114,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 = { | ||
/** | ||
@@ -139,3 +140,3 @@ * Inform the request acceptor that the post-approval logic was successful. | ||
}; | ||
export declare type AddResult = { | ||
export type AddResult = { | ||
/** | ||
@@ -151,3 +152,3 @@ * An optional value provided by the request acceptor. | ||
}; | ||
export declare type AcceptResult = { | ||
export type AcceptResult = { | ||
/** | ||
@@ -158,53 +159,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; | ||
/** | ||
@@ -211,0 +212,0 @@ * Controller for managing requests that require user approval. |
{ | ||
"name": "@metamask/approval-controller", | ||
"version": "6.0.1", | ||
"version": "6.0.2", | ||
"description": "Manages requests that require user approval", | ||
@@ -44,3 +44,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@metamask/base-controller": "^5.0.1", | ||
"@metamask/base-controller": "^5.0.2", | ||
"@metamask/rpc-errors": "^6.2.1", | ||
@@ -59,3 +59,3 @@ "@metamask/utils": "^8.3.0", | ||
"typedoc-plugin-missing-exports": "^2.0.0", | ||
"typescript": "~4.8.4" | ||
"typescript": "~4.9.5" | ||
}, | ||
@@ -62,0 +62,0 @@ "engines": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
229201
1798
1