@metamask-previews/keyring-controller 25.0.0-preview-9462ebb8 → 25.0.0-preview-cb897e9

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.mjs","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAqBA;;;;;;;;GAQG;AACH,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAsB/C;;;;;OAKG;IACH,YACE,OAAe,EACf,OAA+C;QAE/C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;QAErC,2FAA2F;QAC3F,MAAM,KAAK,GAAG,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC;QAClE,MAAM,IAAI,GAAG,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC;QAClE,MAAM,OAAO,GAAG,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC;QAExE,0DAA0D;QAC1D,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;YACnB,qDAAqD;YACrD,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;QAC7B,CAAC;QAED,gCAAgC;QAChC,IAAI,IAAI,EAAE,CAAC;YACT,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACnB,CAAC;QACD,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACzB,CAAC;QAED,sDAAsD;QACtD,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,sBAAsB,CAAC,SAAS,CAAC,CAAC;IAChE,CAAC;IAED;;;;;OAKG;IACH,MAAM;QACJ,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,KAAK,EAAE,IAAI,CAAC,KAAK;gBACf,CAAC,CAAC;oBACE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI;oBACrB,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO;oBAC3B,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK;iBACxB;gBACH,CAAC,CAAC,SAAS;SACd,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,QAAQ;QACN,IAAI,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;QAE7C,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,IAAI,CAAC,IAAI,GAAG,CAAC;QAC9B,CAAC;QAED,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,kBAAkB,IAAI,CAAC,KAAK,EAAE,CAAC;QAC3C,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["/**\n * Options for creating a KeyringControllerError.\n */\nexport type KeyringControllerErrorOptions = {\n /**\n * The underlying error that caused this error (for error chaining).\n * Uses the standard Error.cause property (ES2022).\n */\n cause?: Error;\n /**\n * Optional error code for programmatic error handling.\n * This can be used to identify specific error types without string matching.\n */\n code?: string;\n /**\n * Additional context data associated with the error.\n * Useful for debugging and error reporting.\n */\n context?: Record<string, unknown>;\n};\n\n/**\n * Error class for KeyringController-related errors.\n *\n * This error class extends the standard Error class and supports:\n * - Error chaining via the `cause` property (ES2022 standard)\n * - Optional error codes for programmatic error handling\n * - Additional context data for debugging\n * - Backward compatibility with the legacy `originalError` property\n */\nexport class KeyringControllerError extends Error {\n /**\n * Optional error code for programmatic error handling.\n */\n code?: string;\n\n /**\n * Additional context data associated with the error.\n */\n context?: Record<string, unknown>;\n\n /**\n * The underlying error that caused this error (ES2022 standard).\n * This is set manually for compatibility with older TypeScript versions.\n */\n cause?: Error;\n\n /**\n * @deprecated Use `cause` instead. This property is maintained for backward compatibility.\n */\n originalError?: Error;\n\n /**\n * Creates a new KeyringControllerError.\n *\n * @param message - The error message.\n * @param options - Error options or an Error object for backward compatibility.\n */\n constructor(\n message: string,\n options?: KeyringControllerErrorOptions | Error,\n ) {\n super(message);\n this.name = 'KeyringControllerError';\n\n // Support both new signature (options object) and legacy signature (Error as second param)\n const cause = options instanceof Error ? options : options?.cause;\n const code = options instanceof Error ? undefined : options?.code;\n const context = options instanceof Error ? undefined : options?.context;\n\n // Set cause property for error chaining (ES2022 standard)\n if (cause) {\n this.cause = cause;\n // Maintain backward compatibility with originalError\n this.originalError = cause;\n }\n\n // Set code and data if provided\n if (code) {\n this.code = code;\n }\n if (context) {\n this.context = context;\n }\n\n // Ensure proper prototype chain for instanceof checks\n Object.setPrototypeOf(this, KeyringControllerError.prototype);\n }\n\n /**\n * Returns a JSON representation of the error.\n * Useful for logging and error reporting.\n *\n * @returns JSON representation of the error.\n */\n toJSON(): Record<string, unknown> {\n return {\n name: this.name,\n message: this.message,\n code: this.code,\n context: this.context,\n stack: this.stack,\n cause: this.cause\n ? {\n name: this.cause.name,\n message: this.cause.message,\n stack: this.cause.stack,\n }\n : undefined,\n };\n }\n\n /**\n * Returns a string representation of the error chain.\n * Includes all chained errors for better debugging.\n *\n * @returns String representation of the error chain.\n */\n toString(): string {\n let result = `${this.name}: ${this.message}`;\n\n if (this.code) {\n result += ` [${this.code}]`;\n }\n\n if (this.cause) {\n result += `\\n Caused by: ${this.cause}`;\n }\n\n return result;\n }\n}\n"]}
package/dist/index.cjs CHANGED
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./KeyringController.cjs"), exports);
18
+ __exportStar(require("./errors.cjs"), exports);
18
19
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAoC","sourcesContent":["export * from './KeyringController';\nexport type * from './types';\n"]}
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAoC;AAEpC,+CAAyB","sourcesContent":["export * from './KeyringController';\nexport type * from './types';\nexport * from './errors';\n"]}
package/dist/index.d.cts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from "./KeyringController.cjs";
2
2
  export type * from "./types.cjs";
3
+ export * from "./errors.cjs";
3
4
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wCAAoC;AACpC,iCAA6B"}
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wCAAoC;AACpC,iCAA6B;AAC7B,6BAAyB"}
package/dist/index.d.mts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from "./KeyringController.mjs";
2
2
  export type * from "./types.mjs";
3
+ export * from "./errors.mjs";
3
4
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wCAAoC;AACpC,iCAA6B"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wCAAoC;AACpC,iCAA6B;AAC7B,6BAAyB"}
package/dist/index.mjs CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from "./KeyringController.mjs";
2
+ export * from "./errors.mjs";
2
3
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wCAAoC","sourcesContent":["export * from './KeyringController';\nexport type * from './types';\n"]}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wCAAoC;AAEpC,6BAAyB","sourcesContent":["export * from './KeyringController';\nexport type * from './types';\nexport * from './errors';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/keyring-controller",
3
- "version": "25.0.0-preview-9462ebb8",
3
+ "version": "25.0.0-preview-cb897e9",
4
4
  "description": "Stores identities seen in the wallet and manages interactions such as signing",
5
5
  "keywords": [
6
6
  "MetaMask",