From 357139e0d73dc127203aea114f881d441dc3d428 Mon Sep 17 00:00:00 2001 From: legobt <6wbvkn0j@anonaddy.me> Date: Fri, 31 May 2024 02:06:51 +0000 Subject: [PATCH] update @metamask/rpc-errors published from 08108c535cf5ee25603715cbfae0cd9aa3f2dea6 https://github.com/MetaMask/rpc-errors/pull/140 --- ...mask-rpc-errors-npm-6.2.1-9f2b83a911.patch | 1156 ----------------- package.json | 6 +- yarn.lock | 20 +- 3 files changed, 7 insertions(+), 1175 deletions(-) delete mode 100644 .yarn/patches/@metamask-rpc-errors-npm-6.2.1-9f2b83a911.patch diff --git a/.yarn/patches/@metamask-rpc-errors-npm-6.2.1-9f2b83a911.patch b/.yarn/patches/@metamask-rpc-errors-npm-6.2.1-9f2b83a911.patch deleted file mode 100644 index eb20a7ecb952..000000000000 --- a/.yarn/patches/@metamask-rpc-errors-npm-6.2.1-9f2b83a911.patch +++ /dev/null @@ -1,1156 +0,0 @@ -diff --git a/dist/chunk-EI2FYNGY.js b/dist/chunk-EI2FYNGY.js -new file mode 100644 -index 0000000000000000000000000000000000000000..42a749097dba6ec93fe87674799fb8713ed1c4bd ---- /dev/null -+++ b/dist/chunk-EI2FYNGY.js -@@ -0,0 +1,96 @@ -+"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -+ -+ -+var _chunkXOYARAPPjs = require('./chunk-XOYARAPP.js'); -+ -+// src/classes.ts -+var _utils = require('@metamask/utils'); -+var _fastsafestringify = require('fast-safe-stringify'); var _fastsafestringify2 = _interopRequireDefault(_fastsafestringify); -+var JsonRpcError = class extends Error { -+ constructor(code, message, data) { -+ var __super = (...args) => { -+ super(...args); -+ }; -+ if (!Number.isInteger(code)) { -+ throw new Error('"code" must be an integer.'); -+ } -+ if (!message || typeof message !== "string") { -+ throw new Error('"message" must be a non-empty string.'); -+ } -+ if (_chunkXOYARAPPjs.dataHasCause.call(void 0, data)) { -+ __super(message, { cause: data.cause }); -+ if (!this.cause) { -+ this.cause = data.cause; -+ } -+ } else { -+ __super(message); -+ } -+ if (data !== void 0) { -+ this.data = data; -+ } -+ this.code = code; -+ } -+ /** -+ * Get the error as JSON-serializable object. -+ * -+ * @returns A plain object with all public class properties. -+ */ -+ serialize() { -+ const serialized = { -+ code: this.code, -+ message: this.message -+ }; -+ if (this.data !== void 0) { -+ serialized.data = this.data; -+ if (_utils.isPlainObject.call(void 0, this.data)) { -+ serialized.data.cause = _chunkXOYARAPPjs.serializeCause.call(void 0, this.data.cause); -+ } -+ } -+ if (this.stack) { -+ serialized.stack = this.stack; -+ } -+ return serialized; -+ } -+ /** -+ * Get a string representation of the serialized error, omitting any circular -+ * references. -+ * -+ * @returns A string representation of the serialized error. -+ */ -+ toString() { -+ return _fastsafestringify2.default.call(void 0, this.serialize(), stringifyReplacer, 2); -+ } -+}; -+var EthereumProviderError = class extends JsonRpcError { -+ /** -+ * Create an Ethereum Provider JSON-RPC error. -+ * -+ * @param code - The JSON-RPC error code. Must be an integer in the -+ * `1000 <= n <= 4999` range. -+ * @param message - The JSON-RPC error message. -+ * @param data - Optional data to include in the error. -+ */ -+ constructor(code, message, data) { -+ if (!isValidEthProviderCode(code)) { -+ throw new Error( -+ '"code" must be an integer such that: 1000 <= code <= 4999' -+ ); -+ } -+ super(code, message, data); -+ } -+}; -+function isValidEthProviderCode(code) { -+ return Number.isInteger(code) && code >= 1e3 && code <= 4999; -+} -+function stringifyReplacer(_, value) { -+ if (value === "[Circular]") { -+ return void 0; -+ } -+ return value; -+} -+ -+ -+ -+ -+exports.JsonRpcError = JsonRpcError; exports.EthereumProviderError = EthereumProviderError; -+//# sourceMappingURL=chunk-EI2FYNGY.js.map -\ No newline at end of file -diff --git a/dist/chunk-EI2FYNGY.js.map b/dist/chunk-EI2FYNGY.js.map -new file mode 100644 -index 0000000000000000000000000000000000000000..6b404e239b6fbca1b89a43474422570af8e7923c ---- /dev/null -+++ b/dist/chunk-EI2FYNGY.js.map -@@ -0,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YAAY,MAAc,SAAiB,MAAa;AACtD,QAAI,CAAC,uBAAuB,IAAI,GAAG;AACjC,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,UAAM,MAAM,SAAS,IAAI;AAAA,EAC3B;AACF;AAQA,SAAS,uBAAuB,MAAuB;AACrD,SAAO,OAAO,UAAU,IAAI,KAAK,QAAQ,OAAQ,QAAQ;AAC3D;AASA,SAAS,kBAAkB,GAAY,OAAyB;AAC9D,MAAI,UAAU,cAAc;AAC1B,WAAO;AAAA,EACT;AAEA,SAAO;AACT","sourcesContent":["import type {\n Json,\n JsonRpcError as SerializedJsonRpcError,\n} from '@metamask/utils';\nimport { isPlainObject } from '@metamask/utils';\nimport safeStringify from 'fast-safe-stringify';\n\nimport type { OptionalDataWithOptionalCause } from './utils';\nimport { dataHasCause, serializeCause } from './utils';\n\nexport type { SerializedJsonRpcError };\n\n/**\n * Error subclass implementing JSON RPC 2.0 errors and Ethereum RPC errors\n * per EIP-1474.\n *\n * Permits any integer error code.\n */\nexport class JsonRpcError<\n Data extends OptionalDataWithOptionalCause,\n> extends Error {\n public code: number;\n\n public data?: Data;\n\n constructor(code: number, message: string, data?: Data) {\n if (!Number.isInteger(code)) {\n throw new Error('\"code\" must be an integer.');\n }\n\n if (!message || typeof message !== 'string') {\n throw new Error('\"message\" must be a non-empty string.');\n }\n\n if (dataHasCause(data)) {\n super(message, { cause: data.cause });\n // Browser backwards-compatibility\n if (!this.cause) {\n this.cause = data.cause;\n }\n } else {\n super(message);\n }\n\n if (data !== undefined) {\n this.data = data;\n }\n\n this.code = code;\n }\n\n /**\n * Get the error as JSON-serializable object.\n *\n * @returns A plain object with all public class properties.\n */\n serialize(): SerializedJsonRpcError {\n const serialized: SerializedJsonRpcError = {\n code: this.code,\n message: this.message,\n };\n\n if (this.data !== undefined) {\n // `this.data` is not guaranteed to be a plain object, but this simplifies\n // the type guard below. We can safely cast it because we know it's a\n // JSON-serializable value.\n serialized.data = this.data as { [key: string]: Json };\n\n if (isPlainObject(this.data)) {\n serialized.data.cause = serializeCause(this.data.cause);\n }\n }\n\n if (this.stack) {\n serialized.stack = this.stack;\n }\n\n return serialized;\n }\n\n /**\n * Get a string representation of the serialized error, omitting any circular\n * references.\n *\n * @returns A string representation of the serialized error.\n */\n toString(): string {\n return safeStringify(this.serialize(), stringifyReplacer, 2);\n }\n}\n\n/**\n * Error subclass implementing Ethereum Provider errors per EIP-1193.\n * Permits integer error codes in the [ 1000 <= 4999 ] range.\n */\nexport class EthereumProviderError<\n Data extends OptionalDataWithOptionalCause,\n> extends JsonRpcError {\n /**\n * Create an Ethereum Provider JSON-RPC error.\n *\n * @param code - The JSON-RPC error code. Must be an integer in the\n * `1000 <= n <= 4999` range.\n * @param message - The JSON-RPC error message.\n * @param data - Optional data to include in the error.\n */\n constructor(code: number, message: string, data?: Data) {\n if (!isValidEthProviderCode(code)) {\n throw new Error(\n '\"code\" must be an integer such that: 1000 <= code <= 4999',\n );\n }\n\n super(code, message, data);\n }\n}\n\n/**\n * Check if the given code is a valid JSON-RPC error code.\n *\n * @param code - The code to check.\n * @returns Whether the code is valid.\n */\nfunction isValidEthProviderCode(code: number): boolean {\n return Number.isInteger(code) && code >= 1000 && code <= 4999;\n}\n\n/**\n * A JSON replacer function that omits circular references.\n *\n * @param _ - The key being replaced.\n * @param value - The value being replaced.\n * @returns The value to use in place of the original value.\n */\nfunction stringifyReplacer(_: unknown, value: unknown): unknown {\n if (value === '[Circular]') {\n return undefined;\n }\n\n return value;\n}\n"]} -\ No newline at end of file -diff --git a/dist/chunk-HHE56EX3.mjs b/dist/chunk-HHE56EX3.mjs -new file mode 100644 -index 0000000000000000000000000000000000000000..9cc577c2ea14ddcda1bdf46d93c220fa1b791939 ---- /dev/null -+++ b/dist/chunk-HHE56EX3.mjs -@@ -0,0 +1,106 @@ -+import { -+ errorCodes, -+ errorValues -+} from "./chunk-MIW4NMY6.mjs"; -+ -+// src/utils.ts -+import { -+ hasProperty, -+ isValidJson, -+ isObject, -+ isJsonRpcError -+} from "@metamask/utils"; -+var FALLBACK_ERROR_CODE = errorCodes.rpc.internal; -+var FALLBACK_MESSAGE = "Unspecified error message. This is a bug, please report it."; -+var FALLBACK_ERROR = { -+ code: FALLBACK_ERROR_CODE, -+ message: getMessageFromCode(FALLBACK_ERROR_CODE) -+}; -+var JSON_RPC_SERVER_ERROR_MESSAGE = "Unspecified server error."; -+function getMessageFromCode(code, fallbackMessage = FALLBACK_MESSAGE) { -+ if (isValidCode(code)) { -+ const codeString = code.toString(); -+ if (hasProperty(errorValues, codeString)) { -+ return errorValues[codeString].message; -+ } -+ if (isJsonRpcServerError(code)) { -+ return JSON_RPC_SERVER_ERROR_MESSAGE; -+ } -+ } -+ return fallbackMessage; -+} -+function isValidCode(code) { -+ return Number.isInteger(code); -+} -+function serializeError(error, { fallbackError = FALLBACK_ERROR, shouldIncludeStack = true } = {}) { -+ if (!isJsonRpcError(fallbackError)) { -+ throw new Error( -+ "Must provide fallback error with integer number code and string message." -+ ); -+ } -+ const serialized = buildError(error, fallbackError); -+ if (!shouldIncludeStack) { -+ delete serialized.stack; -+ } -+ return serialized; -+} -+function buildError(error, fallbackError) { -+ if (error && typeof error === "object" && "serialize" in error && typeof error.serialize === "function") { -+ return error.serialize(); -+ } -+ if (isJsonRpcError(error)) { -+ return error; -+ } -+ const cause = serializeCause(error); -+ const fallbackWithCause = { -+ ...fallbackError, -+ data: { cause } -+ }; -+ return fallbackWithCause; -+} -+function isJsonRpcServerError(code) { -+ return code >= -32099 && code <= -32e3; -+} -+function serializeCause(error) { -+ if (Array.isArray(error)) { -+ return error.map((entry) => { -+ if (isValidJson(entry)) { -+ return entry; -+ } else if (isObject(entry)) { -+ return serializeObject(entry); -+ } -+ return null; -+ }); -+ } else if (isObject(error)) { -+ return serializeObject(error); -+ } -+ if (isValidJson(error)) { -+ return error; -+ } -+ return null; -+} -+function serializeObject(object) { -+ return Object.getOwnPropertyNames(object).reduce( -+ (acc, key) => { -+ const value = object[key]; -+ if (isValidJson(value)) { -+ acc[key] = value; -+ } -+ return acc; -+ }, -+ {} -+ ); -+} -+function dataHasCause(data) { -+ return isObject(data) && hasProperty(data, "cause") && isObject(data.cause); -+} -+ -+export { -+ JSON_RPC_SERVER_ERROR_MESSAGE, -+ getMessageFromCode, -+ isValidCode, -+ serializeError, -+ serializeCause, -+ dataHasCause -+}; -+//# sourceMappingURL=chunk-HHE56EX3.mjs.map -\ No newline at end of file -diff --git a/dist/chunk-HHE56EX3.mjs.map b/dist/chunk-HHE56EX3.mjs.map -new file mode 100644 -index 0000000000000000000000000000000000000000..0a30b2213c0640c9f3b6e9f784e5117c15ebac5b ---- /dev/null -+++ b/dist/chunk-HHE56EX3.mjs.map -@@ -0,0 +1 @@ -+{"version":3,"sources":["../src/utils.ts"],"sourcesContent":["import type {\n Json,\n JsonRpcError as SerializedJsonRpcError,\n RuntimeObject,\n} from '@metamask/utils';\nimport {\n hasProperty,\n isValidJson,\n isObject,\n isJsonRpcError,\n} from '@metamask/utils';\n\nimport { errorCodes, errorValues } from './error-constants';\n\n/**\n * A data object, that must be either:\n *\n * - A JSON-serializable object.\n * - An object with a `cause` property that is an error-like value, and any\n * other properties that are JSON-serializable.\n */\nexport type DataWithOptionalCause =\n | Json\n | {\n // Unfortunately we can't use just `Json` here, because all properties of\n // an object with an index signature must be assignable to the index\n // signature's type. So we have to use `Json | unknown` instead.\n [key: string]: Json | unknown;\n cause?: unknown;\n };\n\n/**\n * A data object, that must be either:\n *\n * - A valid DataWithOptionalCause value.\n * - undefined.\n */\nexport type OptionalDataWithOptionalCause = undefined | DataWithOptionalCause;\n\nconst FALLBACK_ERROR_CODE = errorCodes.rpc.internal;\nconst FALLBACK_MESSAGE =\n 'Unspecified error message. This is a bug, please report it.';\nconst FALLBACK_ERROR: SerializedJsonRpcError = {\n code: FALLBACK_ERROR_CODE,\n message: getMessageFromCode(FALLBACK_ERROR_CODE),\n};\n\nexport const JSON_RPC_SERVER_ERROR_MESSAGE = 'Unspecified server error.';\n\ntype ErrorValueKey = keyof typeof errorValues;\n\n/**\n * Gets the message for a given code, or a fallback message if the code has\n * no corresponding message.\n *\n * @param code - The error code.\n * @param fallbackMessage - The fallback message to use if the code has no\n * corresponding message.\n * @returns The message for the given code, or the fallback message if the code\n * has no corresponding message.\n */\nexport function getMessageFromCode(\n code: unknown,\n fallbackMessage: string = FALLBACK_MESSAGE,\n): string {\n if (isValidCode(code)) {\n const codeString = code.toString();\n\n if (hasProperty(errorValues, codeString)) {\n return errorValues[codeString as ErrorValueKey].message;\n }\n\n if (isJsonRpcServerError(code)) {\n return JSON_RPC_SERVER_ERROR_MESSAGE;\n }\n }\n return fallbackMessage;\n}\n\n/**\n * Returns whether the given code is valid.\n * A code is valid if it is an integer.\n *\n * @param code - The error code.\n * @returns Whether the given code is valid.\n */\nexport function isValidCode(code: unknown): code is number {\n return Number.isInteger(code);\n}\n\n/**\n * Serializes the given error to an Ethereum JSON RPC-compatible error object.\n * If the given error is not fully compatible, it will be preserved on the\n * returned object's data.cause property.\n *\n * @param error - The error to serialize.\n * @param options - Options bag.\n * @param options.fallbackError - The error to return if the given error is\n * not compatible. Should be a JSON serializable value.\n * @param options.shouldIncludeStack - Whether to include the error's stack\n * on the returned object.\n * @returns The serialized error.\n */\nexport function serializeError(\n error: unknown,\n { fallbackError = FALLBACK_ERROR, shouldIncludeStack = true } = {},\n): SerializedJsonRpcError {\n if (!isJsonRpcError(fallbackError)) {\n throw new Error(\n 'Must provide fallback error with integer number code and string message.',\n );\n }\n\n const serialized = buildError(error, fallbackError);\n\n if (!shouldIncludeStack) {\n delete serialized.stack;\n }\n\n return serialized;\n}\n\n/**\n * Construct a JSON-serializable object given an error and a JSON serializable `fallbackError`\n *\n * @param error - The error in question.\n * @param fallbackError - A JSON serializable fallback error.\n * @returns A JSON serializable error object.\n */\nfunction buildError(\n error: unknown,\n fallbackError: SerializedJsonRpcError,\n): SerializedJsonRpcError {\n // If an error specifies a `serialize` function, we call it and return the result.\n if (\n error &&\n typeof error === 'object' &&\n 'serialize' in error &&\n typeof error.serialize === 'function'\n ) {\n return error.serialize();\n }\n\n if (isJsonRpcError(error)) {\n return error;\n }\n\n // If the error does not match the JsonRpcError type, use the fallback error, but try to include the original error as `cause`.\n const cause = serializeCause(error);\n const fallbackWithCause = {\n ...fallbackError,\n data: { cause },\n };\n\n return fallbackWithCause;\n}\n\n/**\n * Check if the given code is a valid JSON-RPC server error code.\n *\n * @param code - The error code.\n * @returns Whether the given code is a valid JSON-RPC server error code.\n */\nfunction isJsonRpcServerError(code: number): boolean {\n return code >= -32099 && code <= -32000;\n}\n\n/**\n * Serializes an unknown error to be used as the `cause` in a fallback error.\n *\n * @param error - The unknown error.\n * @returns A JSON-serializable object containing as much information about the original error as possible.\n */\nexport function serializeCause(error: unknown): Json {\n if (Array.isArray(error)) {\n return error.map((entry) => {\n if (isValidJson(entry)) {\n return entry;\n } else if (isObject(entry)) {\n return serializeObject(entry);\n }\n return null;\n });\n } else if (isObject(error)) {\n return serializeObject(error);\n }\n\n if (isValidJson(error)) {\n return error;\n }\n\n return null;\n}\n\n/**\n * Extracts all JSON-serializable properties from an object.\n *\n * @param object - The object in question.\n * @returns An object containing all the JSON-serializable properties.\n */\nfunction serializeObject(object: RuntimeObject): Json {\n return Object.getOwnPropertyNames(object).reduce>(\n (acc, key) => {\n const value = object[key];\n if (isValidJson(value)) {\n acc[key] = value;\n }\n\n return acc;\n },\n {},\n );\n}\n\n/**\n * Returns true if supplied error data has a usable `cause` property; false otherwise.\n *\n * @param data - Optional data to validate.\n * @returns Whether cause property is present and an object.\n */\nexport function dataHasCause(data: unknown): data is {\n [key: string]: Json | unknown;\n cause: object;\n} {\n return isObject(data) && hasProperty(data, 'cause') && isObject(data.cause);\n}\n"],"mappings":";;;;;;AAKA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA6BP,IAAM,sBAAsB,WAAW,IAAI;AAC3C,IAAM,mBACJ;AACF,IAAM,iBAAyC;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1B,eAAO,gBAAgB,KAAK;AAAA,MAC9B;AACA,aAAO;AAAA,IACT,CAAC;AAAA,EACH,WAAW,SAAS,KAAK,GAAG;AAC1B,WAAO,gBAAgB,KAAK;AAAA,EAC9B;AAEA,MAAI,YAAY,KAAK,GAAG;AACtB,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAQA,SAAS,gBAAgB,QAA6B;AACpD,SAAO,OAAO,oBAAoB,MAAM,EAAE;AAAA,IACxC,CAAC,KAAK,QAAQ;AACZ,YAAM,QAAQ,OAAO,GAAG;AACxB,UAAI,YAAY,KAAK,GAAG;AACtB,YAAI,GAAG,IAAI;AAAA,MACb;AAEA,aAAO;AAAA,IACT;AAAA,IACA,CAAC;AAAA,EACH;AACF;AAQO,SAAS,aAAa,MAG3B;AACA,SAAO,SAAS,IAAI,KAAK,YAAY,MAAM,OAAO,KAAK,SAAS,KAAK,KAAK;AAC5E;","names":[]} -\ No newline at end of file -diff --git a/dist/chunk-O4VI6JN3.mjs b/dist/chunk-O4VI6JN3.mjs -new file mode 100644 -index 0000000000000000000000000000000000000000..05a8a5123bcb37d935dd07fe19f1306d62b394cb ---- /dev/null -+++ b/dist/chunk-O4VI6JN3.mjs -@@ -0,0 +1,96 @@ -+import { -+ dataHasCause, -+ serializeCause -+} from "./chunk-HHE56EX3.mjs"; -+ -+// src/classes.ts -+import { isPlainObject } from "@metamask/utils"; -+import safeStringify from "fast-safe-stringify"; -+var JsonRpcError = class extends Error { -+ constructor(code, message, data) { -+ var __super = (...args) => { -+ super(...args); -+ }; -+ if (!Number.isInteger(code)) { -+ throw new Error('"code" must be an integer.'); -+ } -+ if (!message || typeof message !== "string") { -+ throw new Error('"message" must be a non-empty string.'); -+ } -+ if (dataHasCause(data)) { -+ __super(message, { cause: data.cause }); -+ if (!this.cause) { -+ this.cause = data.cause; -+ } -+ } else { -+ __super(message); -+ } -+ if (data !== void 0) { -+ this.data = data; -+ } -+ this.code = code; -+ } -+ /** -+ * Get the error as JSON-serializable object. -+ * -+ * @returns A plain object with all public class properties. -+ */ -+ serialize() { -+ const serialized = { -+ code: this.code, -+ message: this.message -+ }; -+ if (this.data !== void 0) { -+ serialized.data = this.data; -+ if (isPlainObject(this.data)) { -+ serialized.data.cause = serializeCause(this.data.cause); -+ } -+ } -+ if (this.stack) { -+ serialized.stack = this.stack; -+ } -+ return serialized; -+ } -+ /** -+ * Get a string representation of the serialized error, omitting any circular -+ * references. -+ * -+ * @returns A string representation of the serialized error. -+ */ -+ toString() { -+ return safeStringify(this.serialize(), stringifyReplacer, 2); -+ } -+}; -+var EthereumProviderError = class extends JsonRpcError { -+ /** -+ * Create an Ethereum Provider JSON-RPC error. -+ * -+ * @param code - The JSON-RPC error code. Must be an integer in the -+ * `1000 <= n <= 4999` range. -+ * @param message - The JSON-RPC error message. -+ * @param data - Optional data to include in the error. -+ */ -+ constructor(code, message, data) { -+ if (!isValidEthProviderCode(code)) { -+ throw new Error( -+ '"code" must be an integer such that: 1000 <= code <= 4999' -+ ); -+ } -+ super(code, message, data); -+ } -+}; -+function isValidEthProviderCode(code) { -+ return Number.isInteger(code) && code >= 1e3 && code <= 4999; -+} -+function stringifyReplacer(_, value) { -+ if (value === "[Circular]") { -+ return void 0; -+ } -+ return value; -+} -+ -+export { -+ JsonRpcError, -+ EthereumProviderError -+}; -+//# sourceMappingURL=chunk-O4VI6JN3.mjs.map -\ No newline at end of file -diff --git a/dist/chunk-O4VI6JN3.mjs.map b/dist/chunk-O4VI6JN3.mjs.map -new file mode 100644 -index 0000000000000000000000000000000000000000..9d400998f4779beb1ceef13da9cb681d5adfb122 ---- /dev/null -+++ b/dist/chunk-O4VI6JN3.mjs.map -@@ -0,0 +1 @@ -+{"version":3,"sources":["../src/classes.ts"],"sourcesContent":["import type {\n Json,\n JsonRpcError as SerializedJsonRpcError,\n} from '@metamask/utils';\nimport { isPlainObject } from '@metamask/utils';\nimport safeStringify from 'fast-safe-stringify';\n\nimport type { OptionalDataWithOptionalCause } from './utils';\nimport { dataHasCause, serializeCause } from './utils';\n\nexport type { SerializedJsonRpcError };\n\n/**\n * Error subclass implementing JSON RPC 2.0 errors and Ethereum RPC errors\n * per EIP-1474.\n *\n * Permits any integer error code.\n */\nexport class JsonRpcError<\n Data extends OptionalDataWithOptionalCause,\n> extends Error {\n public code: number;\n\n public data?: Data;\n\n constructor(code: number, message: string, data?: Data) {\n if (!Number.isInteger(code)) {\n throw new Error('\"code\" must be an integer.');\n }\n\n if (!message || typeof message !== 'string') {\n throw new Error('\"message\" must be a non-empty string.');\n }\n\n if (dataHasCause(data)) {\n super(message, { cause: data.cause });\n // Browser backwards-compatibility\n if (!this.cause) {\n this.cause = data.cause;\n }\n } else {\n super(message);\n }\n\n if (data !== undefined) {\n this.data = data;\n }\n\n this.code = code;\n }\n\n /**\n * Get the error as JSON-serializable object.\n *\n * @returns A plain object with all public class properties.\n */\n serialize(): SerializedJsonRpcError {\n const serialized: SerializedJsonRpcError = {\n code: this.code,\n message: this.message,\n };\n\n if (this.data !== undefined) {\n // `this.data` is not guaranteed to be a plain object, but this simplifies\n // the type guard below. We can safely cast it because we know it's a\n // JSON-serializable value.\n serialized.data = this.data as { [key: string]: Json };\n\n if (isPlainObject(this.data)) {\n serialized.data.cause = serializeCause(this.data.cause);\n }\n }\n\n if (this.stack) {\n serialized.stack = this.stack;\n }\n\n return serialized;\n }\n\n /**\n * Get a string representation of the serialized error, omitting any circular\n * references.\n *\n * @returns A string representation of the serialized error.\n */\n toString(): string {\n return safeStringify(this.serialize(), stringifyReplacer, 2);\n }\n}\n\n/**\n * Error subclass implementing Ethereum Provider errors per EIP-1193.\n * Permits integer error codes in the [ 1000 <= 4999 ] range.\n */\nexport class EthereumProviderError<\n Data extends OptionalDataWithOptionalCause,\n> extends JsonRpcError {\n /**\n * Create an Ethereum Provider JSON-RPC error.\n *\n * @param code - The JSON-RPC error code. Must be an integer in the\n * `1000 <= n <= 4999` range.\n * @param message - The JSON-RPC error message.\n * @param data - Optional data to include in the error.\n */\n constructor(code: number, message: string, data?: Data) {\n if (!isValidEthProviderCode(code)) {\n throw new Error(\n '\"code\" must be an integer such that: 1000 <= code <= 4999',\n );\n }\n\n super(code, message, data);\n }\n}\n\n/**\n * Check if the given code is a valid JSON-RPC error code.\n *\n * @param code - The code to check.\n * @returns Whether the code is valid.\n */\nfunction isValidEthProviderCode(code: number): boolean {\n return Number.isInteger(code) && code >= 1000 && code <= 4999;\n}\n\n/**\n * A JSON replacer function that omits circular references.\n *\n * @param _ - The key being replaced.\n * @param value - The value being replaced.\n * @returns The value to use in place of the original value.\n */\nfunction stringifyReplacer(_: unknown, value: unknown): unknown {\n if (value === '[Circular]') {\n return undefined;\n }\n\n return value;\n}\n"],"mappings":";;;;;;AAIA,SAAS,qBAAqB;AAC9B,OAAO,mBAAmB;AAanB,IAAM,eAAN,cAEG,MAAM;AAAA,EAKd,YAAY,MAAc,SAAiB,MAAa;AAAA;AAAA;AAAA;AACtD,QAAI,CAAC,OAAO,UAAU,IAAI,GAAG;AAC3B,YAAM,IAAI,MAAM,4BAA4B;AAAA,IAC9C;AAEA,QAAI,CAAC,WAAW,OAAO,YAAY,UAAU;AAC3C,YAAM,IAAI,MAAM,uCAAuC;AAAA,IACzD;AAEA,QAAI,aAAa,IAAI,GAAG;AACtB,cAAM,SAAS,EAAE,OAAO,KAAK,MAAM,CAAC;AAEpC,UAAI,CAAC,KAAK,OAAO;AACf,aAAK,QAAQ,KAAK;AAAA,MACpB;AAAA,IACF,OAAO;AACL,cAAM,OAAO;AAAA,IACf;AAEA,QAAI,SAAS,QAAW;AACtB,WAAK,OAAO;AAAA,IACd;AAEA,SAAK,OAAO;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,YAAoC;AAClC,UAAM,aAAqC;AAAA,MACzC,MAAM,KAAK;AAAA,MACX,SAAS,KAAK;AAAA,IAChB;AAEA,QAAI,KAAK,SAAS,QAAW;AAI3B,iBAAW,OAAO,KAAK;AAEvB,UAAI,cAAc,KAAK,IAAI,GAAG;AAC5B,mBAAW,KAAK,QAAQ,eAAe,KAAK,KAAK,KAAK;AAAA,MACxD;AAAA,IACF;AAEA,QAAI,KAAK,OAAO;AACd,iBAAW,QAAQ,KAAK;AAAA,IAC1B;AAEA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,WAAmB;AACjB,WAAO,cAAc,KAAK,UAAU,GAAG,mBAAmB,CAAC;AAAA,EAC7D;AACF;AAMO,IAAM,wBAAN,cAEG,aAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAS3B,YAAY,MAAc,SAAiB,MAAa;AACtD,QAAI,CAAC,uBAAuB,IAAI,GAAG;AACjC,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,UAAM,MAAM,SAAS,IAAI;AAAA,EAC3B;AACF;AAQA,SAAS,uBAAuB,MAAuB;AACrD,SAAO,OAAO,UAAU,IAAI,KAAK,QAAQ,OAAQ,QAAQ;AAC3D;AASA,SAAS,kBAAkB,GAAY,OAAyB;AAC9D,MAAI,UAAU,cAAc;AAC1B,WAAO;AAAA,EACT;AAEA,SAAO;AACT;","names":[]} -\ No newline at end of file -diff --git a/dist/chunk-QQFAQUCR.js b/dist/chunk-QQFAQUCR.js -new file mode 100644 -index 0000000000000000000000000000000000000000..709ebb74cd0c865d5f6e3d518e6acf048d06877b ---- /dev/null -+++ b/dist/chunk-QQFAQUCR.js -@@ -0,0 +1,210 @@ -+"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } -+ -+ -+var _chunkEI2FYNGYjs = require('./chunk-EI2FYNGY.js'); -+ -+ -+var _chunkXOYARAPPjs = require('./chunk-XOYARAPP.js'); -+ -+ -+var _chunkFBHPY3A4js = require('./chunk-FBHPY3A4.js'); -+ -+// src/errors.ts -+var rpcErrors = { -+ /** -+ * Get a JSON RPC 2.0 Parse (-32700) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link JsonRpcError} class. -+ */ -+ parse: (arg) => getJsonRpcError(_chunkFBHPY3A4js.errorCodes.rpc.parse, arg), -+ /** -+ * Get a JSON RPC 2.0 Invalid Request (-32600) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link JsonRpcError} class. -+ */ -+ invalidRequest: (arg) => getJsonRpcError(_chunkFBHPY3A4js.errorCodes.rpc.invalidRequest, arg), -+ /** -+ * Get a JSON RPC 2.0 Invalid Params (-32602) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link JsonRpcError} class. -+ */ -+ invalidParams: (arg) => getJsonRpcError(_chunkFBHPY3A4js.errorCodes.rpc.invalidParams, arg), -+ /** -+ * Get a JSON RPC 2.0 Method Not Found (-32601) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link JsonRpcError} class. -+ */ -+ methodNotFound: (arg) => getJsonRpcError(_chunkFBHPY3A4js.errorCodes.rpc.methodNotFound, arg), -+ /** -+ * Get a JSON RPC 2.0 Internal (-32603) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link JsonRpcError} class. -+ */ -+ internal: (arg) => getJsonRpcError(_chunkFBHPY3A4js.errorCodes.rpc.internal, arg), -+ /** -+ * Get a JSON RPC 2.0 Server error. -+ * Permits integer error codes in the [ -32099 <= -32005 ] range. -+ * Codes -32000 through -32004 are reserved by EIP-1474. -+ * -+ * @param opts - The error options bag. -+ * @returns An instance of the {@link JsonRpcError} class. -+ */ -+ server: (opts) => { -+ if (!opts || typeof opts !== "object" || Array.isArray(opts)) { -+ throw new Error( -+ "Ethereum RPC Server errors must provide single object argument." -+ ); -+ } -+ const { code } = opts; -+ if (!Number.isInteger(code) || code > -32005 || code < -32099) { -+ throw new Error( -+ '"code" must be an integer such that: -32099 <= code <= -32005' -+ ); -+ } -+ return getJsonRpcError(code, opts); -+ }, -+ /** -+ * Get an Ethereum JSON RPC Invalid Input (-32000) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link JsonRpcError} class. -+ */ -+ invalidInput: (arg) => getJsonRpcError(_chunkFBHPY3A4js.errorCodes.rpc.invalidInput, arg), -+ /** -+ * Get an Ethereum JSON RPC Resource Not Found (-32001) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link JsonRpcError} class. -+ */ -+ resourceNotFound: (arg) => getJsonRpcError(_chunkFBHPY3A4js.errorCodes.rpc.resourceNotFound, arg), -+ /** -+ * Get an Ethereum JSON RPC Resource Unavailable (-32002) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link JsonRpcError} class. -+ */ -+ resourceUnavailable: (arg) => getJsonRpcError(_chunkFBHPY3A4js.errorCodes.rpc.resourceUnavailable, arg), -+ /** -+ * Get an Ethereum JSON RPC Transaction Rejected (-32003) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link JsonRpcError} class. -+ */ -+ transactionRejected: (arg) => getJsonRpcError(_chunkFBHPY3A4js.errorCodes.rpc.transactionRejected, arg), -+ /** -+ * Get an Ethereum JSON RPC Method Not Supported (-32004) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link JsonRpcError} class. -+ */ -+ methodNotSupported: (arg) => getJsonRpcError(_chunkFBHPY3A4js.errorCodes.rpc.methodNotSupported, arg), -+ /** -+ * Get an Ethereum JSON RPC Limit Exceeded (-32005) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link JsonRpcError} class. -+ */ -+ limitExceeded: (arg) => getJsonRpcError(_chunkFBHPY3A4js.errorCodes.rpc.limitExceeded, arg) -+}; -+var providerErrors = { -+ /** -+ * Get an Ethereum Provider User Rejected Request (4001) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link EthereumProviderError} class. -+ */ -+ userRejectedRequest: (arg) => { -+ return getEthProviderError(_chunkFBHPY3A4js.errorCodes.provider.userRejectedRequest, arg); -+ }, -+ /** -+ * Get an Ethereum Provider Unauthorized (4100) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link EthereumProviderError} class. -+ */ -+ unauthorized: (arg) => { -+ return getEthProviderError(_chunkFBHPY3A4js.errorCodes.provider.unauthorized, arg); -+ }, -+ /** -+ * Get an Ethereum Provider Unsupported Method (4200) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link EthereumProviderError} class. -+ */ -+ unsupportedMethod: (arg) => { -+ return getEthProviderError(_chunkFBHPY3A4js.errorCodes.provider.unsupportedMethod, arg); -+ }, -+ /** -+ * Get an Ethereum Provider Not Connected (4900) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link EthereumProviderError} class. -+ */ -+ disconnected: (arg) => { -+ return getEthProviderError(_chunkFBHPY3A4js.errorCodes.provider.disconnected, arg); -+ }, -+ /** -+ * Get an Ethereum Provider Chain Not Connected (4901) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link EthereumProviderError} class. -+ */ -+ chainDisconnected: (arg) => { -+ return getEthProviderError(_chunkFBHPY3A4js.errorCodes.provider.chainDisconnected, arg); -+ }, -+ /** -+ * Get a custom Ethereum Provider error. -+ * -+ * @param opts - The error options bag. -+ * @returns An instance of the {@link EthereumProviderError} class. -+ */ -+ custom: (opts) => { -+ if (!opts || typeof opts !== "object" || Array.isArray(opts)) { -+ throw new Error( -+ "Ethereum Provider custom errors must provide single object argument." -+ ); -+ } -+ const { code, message, data } = opts; -+ if (!message || typeof message !== "string") { -+ throw new Error('"message" must be a nonempty string'); -+ } -+ return new (0, _chunkEI2FYNGYjs.EthereumProviderError)(code, message, data); -+ } -+}; -+function getJsonRpcError(code, arg) { -+ const [message, data] = parseOpts(arg); -+ return new (0, _chunkEI2FYNGYjs.JsonRpcError)(code, _nullishCoalesce(message, () => ( _chunkXOYARAPPjs.getMessageFromCode.call(void 0, code))), data); -+} -+function getEthProviderError(code, arg) { -+ const [message, data] = parseOpts(arg); -+ return new (0, _chunkEI2FYNGYjs.EthereumProviderError)( -+ code, -+ _nullishCoalesce(message, () => ( _chunkXOYARAPPjs.getMessageFromCode.call(void 0, code))), -+ data -+ ); -+} -+function parseOpts(arg) { -+ if (arg) { -+ if (typeof arg === "string") { -+ return [arg]; -+ } else if (typeof arg === "object" && !Array.isArray(arg)) { -+ const { message, data } = arg; -+ if (message && typeof message !== "string") { -+ throw new Error("Must specify string message."); -+ } -+ return [_nullishCoalesce(message, () => ( void 0)), data]; -+ } -+ } -+ return []; -+} -+ -+ -+ -+ -+exports.rpcErrors = rpcErrors; exports.providerErrors = providerErrors; -+//# sourceMappingURL=chunk-QQFAQUCR.js.map -\ No newline at end of file -diff --git a/dist/chunk-QQFAQUCR.js.map b/dist/chunk-QQFAQUCR.js.map -new file mode 100644 -index 0000000000000000000000000000000000000000..6bb9864e2ac2b2e812991b4d6dc33469525f917d ---- /dev/null -+++ b/dist/chunk-QQFAQUCR.js.map -@@ -0,0 +1 @@ -+{"version":3,"sources":["../src/errors.ts"],"names":[],"mappings":";;;;;;;;;;;;AAqBO,IAAM,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOvB,OAAO,CACL,QACG,gBAAgB,WAAW,IAAI,OAAO,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ9C,gBAAgB,CACd,QACG,gBAAgB,WAAW,IAAI,gBAAgB,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQvD,eAAe,CACb,QACG,gBAAgB,WAAW,IAAI,eAAe,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQtD,gBAAgB,CACd,QACG,gBAAgB,WAAW,IAAI,gBAAgB,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQvD,UAAU,CACR,QACG,gBAAgB,WAAW,IAAI,UAAU,GAAG;AAAA;AAAA;AAAA;AAAA;A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AAG;AACzD,YAAM,EAAE,SAAS,KAAK,IAAI;AAE1B,UAAI,WAAW,OAAO,YAAY,UAAU;AAC1C,cAAM,IAAI,MAAM,8BAA8B;AAAA,MAChD;AACA,aAAO,CAAC,WAAW,QAAW,IAAI;AAAA,IACpC;AAAA,EACF;AAEA,SAAO,CAAC;AACV","sourcesContent":["import { JsonRpcError, EthereumProviderError } from './classes';\nimport { errorCodes } from './error-constants';\nimport type { OptionalDataWithOptionalCause } from './utils';\nimport { getMessageFromCode } from './utils';\n\ntype EthereumErrorOptions = {\n message?: string;\n data?: Data;\n};\n\ntype ServerErrorOptions = {\n code: number;\n} & EthereumErrorOptions;\n\ntype CustomErrorArg =\n ServerErrorOptions;\n\ntype JsonRpcErrorsArg =\n | EthereumErrorOptions\n | string;\n\nexport const rpcErrors = {\n /**\n * Get a JSON RPC 2.0 Parse (-32700) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link JsonRpcError} class.\n */\n parse: (\n arg?: JsonRpcErrorsArg,\n ) => getJsonRpcError(errorCodes.rpc.parse, arg),\n\n /**\n * Get a JSON RPC 2.0 Invalid Request (-32600) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link JsonRpcError} class.\n */\n invalidRequest: (\n arg?: JsonRpcErrorsArg,\n ) => getJsonRpcError(errorCodes.rpc.invalidRequest, arg),\n\n /**\n * Get a JSON RPC 2.0 Invalid Params (-32602) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link JsonRpcError} class.\n */\n invalidParams: (\n arg?: JsonRpcErrorsArg,\n ) => getJsonRpcError(errorCodes.rpc.invalidParams, arg),\n\n /**\n * Get a JSON RPC 2.0 Method Not Found (-32601) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link JsonRpcError} class.\n */\n methodNotFound: (\n arg?: JsonRpcErrorsArg,\n ) => getJsonRpcError(errorCodes.rpc.methodNotFound, arg),\n\n /**\n * Get a JSON RPC 2.0 Internal (-32603) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link JsonRpcError} class.\n */\n internal: (\n arg?: JsonRpcErrorsArg,\n ) => getJsonRpcError(errorCodes.rpc.internal, arg),\n\n /**\n * Get a JSON RPC 2.0 Server error.\n * Permits integer error codes in the [ -32099 <= -32005 ] range.\n * Codes -32000 through -32004 are reserved by EIP-1474.\n *\n * @param opts - The error options bag.\n * @returns An instance of the {@link JsonRpcError} class.\n */\n server: (\n opts: ServerErrorOptions,\n ) => {\n if (!opts || typeof opts !== 'object' || Array.isArray(opts)) {\n throw new Error(\n 'Ethereum RPC Server errors must provide single object argument.',\n );\n }\n const { code } = opts;\n if (!Number.isInteger(code) || code > -32005 || code < -32099) {\n throw new Error(\n '\"code\" must be an integer such that: -32099 <= code <= -32005',\n );\n }\n return getJsonRpcError(code, opts);\n },\n\n /**\n * Get an Ethereum JSON RPC Invalid Input (-32000) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link JsonRpcError} class.\n */\n invalidInput: (\n arg?: JsonRpcErrorsArg,\n ) => getJsonRpcError(errorCodes.rpc.invalidInput, arg),\n\n /**\n * Get an Ethereum JSON RPC Resource Not Found (-32001) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link JsonRpcError} class.\n */\n resourceNotFound: (\n arg?: JsonRpcErrorsArg,\n ) => getJsonRpcError(errorCodes.rpc.resourceNotFound, arg),\n\n /**\n * Get an Ethereum JSON RPC Resource Unavailable (-32002) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link JsonRpcError} class.\n */\n resourceUnavailable: (\n arg?: JsonRpcErrorsArg,\n ) => getJsonRpcError(errorCodes.rpc.resourceUnavailable, arg),\n\n /**\n * Get an Ethereum JSON RPC Transaction Rejected (-32003) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link JsonRpcError} class.\n */\n transactionRejected: (\n arg?: JsonRpcErrorsArg,\n ) => getJsonRpcError(errorCodes.rpc.transactionRejected, arg),\n\n /**\n * Get an Ethereum JSON RPC Method Not Supported (-32004) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link JsonRpcError} class.\n */\n methodNotSupported: (\n arg?: JsonRpcErrorsArg,\n ) => getJsonRpcError(errorCodes.rpc.methodNotSupported, arg),\n\n /**\n * Get an Ethereum JSON RPC Limit Exceeded (-32005) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link JsonRpcError} class.\n */\n limitExceeded: (\n arg?: JsonRpcErrorsArg,\n ) => getJsonRpcError(errorCodes.rpc.limitExceeded, arg),\n};\n\nexport const providerErrors = {\n /**\n * Get an Ethereum Provider User Rejected Request (4001) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link EthereumProviderError} class.\n */\n userRejectedRequest: (\n arg?: JsonRpcErrorsArg,\n ) => {\n return getEthProviderError(errorCodes.provider.userRejectedRequest, arg);\n },\n\n /**\n * Get an Ethereum Provider Unauthorized (4100) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link EthereumProviderError} class.\n */\n unauthorized: (\n arg?: JsonRpcErrorsArg,\n ) => {\n return getEthProviderError(errorCodes.provider.unauthorized, arg);\n },\n\n /**\n * Get an Ethereum Provider Unsupported Method (4200) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link EthereumProviderError} class.\n */\n unsupportedMethod: (\n arg?: JsonRpcErrorsArg,\n ) => {\n return getEthProviderError(errorCodes.provider.unsupportedMethod, arg);\n },\n\n /**\n * Get an Ethereum Provider Not Connected (4900) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link EthereumProviderError} class.\n */\n disconnected: (\n arg?: JsonRpcErrorsArg,\n ) => {\n return getEthProviderError(errorCodes.provider.disconnected, arg);\n },\n\n /**\n * Get an Ethereum Provider Chain Not Connected (4901) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link EthereumProviderError} class.\n */\n chainDisconnected: (\n arg?: JsonRpcErrorsArg,\n ) => {\n return getEthProviderError(errorCodes.provider.chainDisconnected, arg);\n },\n\n /**\n * Get a custom Ethereum Provider error.\n *\n * @param opts - The error options bag.\n * @returns An instance of the {@link EthereumProviderError} class.\n */\n custom: (\n opts: CustomErrorArg,\n ) => {\n if (!opts || typeof opts !== 'object' || Array.isArray(opts)) {\n throw new Error(\n 'Ethereum Provider custom errors must provide single object argument.',\n );\n }\n\n const { code, message, data } = opts;\n\n if (!message || typeof message !== 'string') {\n throw new Error('\"message\" must be a nonempty string');\n }\n return new EthereumProviderError(code, message, data);\n },\n};\n\n/**\n * Get a generic JSON-RPC error class instance.\n *\n * @param code - The error code.\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link JsonRpcError} class.\n */\nfunction getJsonRpcError(\n code: number,\n arg?: JsonRpcErrorsArg,\n): JsonRpcError {\n const [message, data] = parseOpts(arg);\n return new JsonRpcError(code, message ?? getMessageFromCode(code), data);\n}\n\n/**\n * Get an Ethereum Provider error class instance.\n *\n * @param code - The error code.\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link EthereumProviderError} class.\n */\nfunction getEthProviderError(\n code: number,\n arg?: JsonRpcErrorsArg,\n): EthereumProviderError {\n const [message, data] = parseOpts(arg);\n return new EthereumProviderError(\n code,\n message ?? getMessageFromCode(code),\n data,\n );\n}\n\n/**\n * Get an error message and optional data from an options bag.\n *\n * @param arg - The error message or options bag.\n * @returns A tuple containing the error message and optional data.\n */\nfunction parseOpts(\n arg?: JsonRpcErrorsArg,\n): [message?: string | undefined, data?: Data | undefined] {\n if (arg) {\n if (typeof arg === 'string') {\n return [arg];\n } else if (typeof arg === 'object' && !Array.isArray(arg)) {\n const { message, data } = arg;\n\n if (message && typeof message !== 'string') {\n throw new Error('Must specify string message.');\n }\n return [message ?? undefined, data];\n }\n }\n\n return [];\n}\n"]} -\ No newline at end of file -diff --git a/dist/chunk-UMM4JLJ6.mjs b/dist/chunk-UMM4JLJ6.mjs -new file mode 100644 -index 0000000000000000000000000000000000000000..80ade1ee334f8abb99d31bbb1e3cd19240a8525a ---- /dev/null -+++ b/dist/chunk-UMM4JLJ6.mjs -@@ -0,0 +1,210 @@ -+import { -+ EthereumProviderError, -+ JsonRpcError -+} from "./chunk-O4VI6JN3.mjs"; -+import { -+ getMessageFromCode -+} from "./chunk-HHE56EX3.mjs"; -+import { -+ errorCodes -+} from "./chunk-MIW4NMY6.mjs"; -+ -+// src/errors.ts -+var rpcErrors = { -+ /** -+ * Get a JSON RPC 2.0 Parse (-32700) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link JsonRpcError} class. -+ */ -+ parse: (arg) => getJsonRpcError(errorCodes.rpc.parse, arg), -+ /** -+ * Get a JSON RPC 2.0 Invalid Request (-32600) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link JsonRpcError} class. -+ */ -+ invalidRequest: (arg) => getJsonRpcError(errorCodes.rpc.invalidRequest, arg), -+ /** -+ * Get a JSON RPC 2.0 Invalid Params (-32602) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link JsonRpcError} class. -+ */ -+ invalidParams: (arg) => getJsonRpcError(errorCodes.rpc.invalidParams, arg), -+ /** -+ * Get a JSON RPC 2.0 Method Not Found (-32601) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link JsonRpcError} class. -+ */ -+ methodNotFound: (arg) => getJsonRpcError(errorCodes.rpc.methodNotFound, arg), -+ /** -+ * Get a JSON RPC 2.0 Internal (-32603) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link JsonRpcError} class. -+ */ -+ internal: (arg) => getJsonRpcError(errorCodes.rpc.internal, arg), -+ /** -+ * Get a JSON RPC 2.0 Server error. -+ * Permits integer error codes in the [ -32099 <= -32005 ] range. -+ * Codes -32000 through -32004 are reserved by EIP-1474. -+ * -+ * @param opts - The error options bag. -+ * @returns An instance of the {@link JsonRpcError} class. -+ */ -+ server: (opts) => { -+ if (!opts || typeof opts !== "object" || Array.isArray(opts)) { -+ throw new Error( -+ "Ethereum RPC Server errors must provide single object argument." -+ ); -+ } -+ const { code } = opts; -+ if (!Number.isInteger(code) || code > -32005 || code < -32099) { -+ throw new Error( -+ '"code" must be an integer such that: -32099 <= code <= -32005' -+ ); -+ } -+ return getJsonRpcError(code, opts); -+ }, -+ /** -+ * Get an Ethereum JSON RPC Invalid Input (-32000) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link JsonRpcError} class. -+ */ -+ invalidInput: (arg) => getJsonRpcError(errorCodes.rpc.invalidInput, arg), -+ /** -+ * Get an Ethereum JSON RPC Resource Not Found (-32001) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link JsonRpcError} class. -+ */ -+ resourceNotFound: (arg) => getJsonRpcError(errorCodes.rpc.resourceNotFound, arg), -+ /** -+ * Get an Ethereum JSON RPC Resource Unavailable (-32002) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link JsonRpcError} class. -+ */ -+ resourceUnavailable: (arg) => getJsonRpcError(errorCodes.rpc.resourceUnavailable, arg), -+ /** -+ * Get an Ethereum JSON RPC Transaction Rejected (-32003) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link JsonRpcError} class. -+ */ -+ transactionRejected: (arg) => getJsonRpcError(errorCodes.rpc.transactionRejected, arg), -+ /** -+ * Get an Ethereum JSON RPC Method Not Supported (-32004) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link JsonRpcError} class. -+ */ -+ methodNotSupported: (arg) => getJsonRpcError(errorCodes.rpc.methodNotSupported, arg), -+ /** -+ * Get an Ethereum JSON RPC Limit Exceeded (-32005) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link JsonRpcError} class. -+ */ -+ limitExceeded: (arg) => getJsonRpcError(errorCodes.rpc.limitExceeded, arg) -+}; -+var providerErrors = { -+ /** -+ * Get an Ethereum Provider User Rejected Request (4001) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link EthereumProviderError} class. -+ */ -+ userRejectedRequest: (arg) => { -+ return getEthProviderError(errorCodes.provider.userRejectedRequest, arg); -+ }, -+ /** -+ * Get an Ethereum Provider Unauthorized (4100) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link EthereumProviderError} class. -+ */ -+ unauthorized: (arg) => { -+ return getEthProviderError(errorCodes.provider.unauthorized, arg); -+ }, -+ /** -+ * Get an Ethereum Provider Unsupported Method (4200) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link EthereumProviderError} class. -+ */ -+ unsupportedMethod: (arg) => { -+ return getEthProviderError(errorCodes.provider.unsupportedMethod, arg); -+ }, -+ /** -+ * Get an Ethereum Provider Not Connected (4900) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link EthereumProviderError} class. -+ */ -+ disconnected: (arg) => { -+ return getEthProviderError(errorCodes.provider.disconnected, arg); -+ }, -+ /** -+ * Get an Ethereum Provider Chain Not Connected (4901) error. -+ * -+ * @param arg - The error message or options bag. -+ * @returns An instance of the {@link EthereumProviderError} class. -+ */ -+ chainDisconnected: (arg) => { -+ return getEthProviderError(errorCodes.provider.chainDisconnected, arg); -+ }, -+ /** -+ * Get a custom Ethereum Provider error. -+ * -+ * @param opts - The error options bag. -+ * @returns An instance of the {@link EthereumProviderError} class. -+ */ -+ custom: (opts) => { -+ if (!opts || typeof opts !== "object" || Array.isArray(opts)) { -+ throw new Error( -+ "Ethereum Provider custom errors must provide single object argument." -+ ); -+ } -+ const { code, message, data } = opts; -+ if (!message || typeof message !== "string") { -+ throw new Error('"message" must be a nonempty string'); -+ } -+ return new EthereumProviderError(code, message, data); -+ } -+}; -+function getJsonRpcError(code, arg) { -+ const [message, data] = parseOpts(arg); -+ return new JsonRpcError(code, message ?? getMessageFromCode(code), data); -+} -+function getEthProviderError(code, arg) { -+ const [message, data] = parseOpts(arg); -+ return new EthereumProviderError( -+ code, -+ message ?? getMessageFromCode(code), -+ data -+ ); -+} -+function parseOpts(arg) { -+ if (arg) { -+ if (typeof arg === "string") { -+ return [arg]; -+ } else if (typeof arg === "object" && !Array.isArray(arg)) { -+ const { message, data } = arg; -+ if (message && typeof message !== "string") { -+ throw new Error("Must specify string message."); -+ } -+ return [message ?? void 0, data]; -+ } -+ } -+ return []; -+} -+ -+export { -+ rpcErrors, -+ providerErrors -+}; -+//# sourceMappingURL=chunk-UMM4JLJ6.mjs.map -\ No newline at end of file -diff --git a/dist/chunk-UMM4JLJ6.mjs.map b/dist/chunk-UMM4JLJ6.mjs.map -new file mode 100644 -index 0000000000000000000000000000000000000000..f50e06d750a8b1ea34f948fa6e53a4ae3a916489 ---- /dev/null -+++ b/dist/chunk-UMM4JLJ6.mjs.map -@@ -0,0 +1 @@ -+{"version":3,"sources":["../src/errors.ts"],"sourcesContent":["import { JsonRpcError, EthereumProviderError } from './classes';\nimport { errorCodes } from './error-constants';\nimport type { OptionalDataWithOptionalCause } from './utils';\nimport { getMessageFromCode } from './utils';\n\ntype EthereumErrorOptions = {\n message?: string;\n data?: Data;\n};\n\ntype ServerErrorOptions = {\n code: number;\n} & EthereumErrorOptions;\n\ntype CustomErrorArg =\n ServerErrorOptions;\n\ntype JsonRpcErrorsArg =\n | EthereumErrorOptions\n | string;\n\nexport const rpcErrors = {\n /**\n * Get a JSON RPC 2.0 Parse (-32700) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link JsonRpcError} class.\n */\n parse: (\n arg?: JsonRpcErrorsArg,\n ) => getJsonRpcError(errorCodes.rpc.parse, arg),\n\n /**\n * Get a JSON RPC 2.0 Invalid Request (-32600) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link JsonRpcError} class.\n */\n invalidRequest: (\n arg?: JsonRpcErrorsArg,\n ) => getJsonRpcError(errorCodes.rpc.invalidRequest, arg),\n\n /**\n * Get a JSON RPC 2.0 Invalid Params (-32602) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link JsonRpcError} class.\n */\n invalidParams: (\n arg?: JsonRpcErrorsArg,\n ) => getJsonRpcError(errorCodes.rpc.invalidParams, arg),\n\n /**\n * Get a JSON RPC 2.0 Method Not Found (-32601) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link JsonRpcError} class.\n */\n methodNotFound: (\n arg?: JsonRpcErrorsArg,\n ) => getJsonRpcError(errorCodes.rpc.methodNotFound, arg),\n\n /**\n * Get a JSON RPC 2.0 Internal (-32603) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link JsonRpcError} class.\n */\n internal: (\n arg?: JsonRpcErrorsArg,\n ) => getJsonRpcError(errorCodes.rpc.internal, arg),\n\n /**\n * Get a JSON RPC 2.0 Server error.\n * Permits integer error codes in the [ -32099 <= -32005 ] range.\n * Codes -32000 through -32004 are reserved by EIP-1474.\n *\n * @param opts - The error options bag.\n * @returns An instance of the {@link JsonRpcError} class.\n */\n server: (\n opts: ServerErrorOptions,\n ) => {\n if (!opts || typeof opts !== 'object' || Array.isArray(opts)) {\n throw new Error(\n 'Ethereum RPC Server errors must provide single object argument.',\n );\n }\n const { code } = opts;\n if (!Number.isInteger(code) || code > -32005 || code < -32099) {\n throw new Error(\n '\"code\" must be an integer such that: -32099 <= code <= -32005',\n );\n }\n return getJsonRpcError(code, opts);\n },\n\n /**\n * Get an Ethereum JSON RPC Invalid Input (-32000) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link JsonRpcError} class.\n */\n invalidInput: (\n arg?: JsonRpcErrorsArg,\n ) => getJsonRpcError(errorCodes.rpc.invalidInput, arg),\n\n /**\n * Get an Ethereum JSON RPC Resource Not Found (-32001) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link JsonRpcError} class.\n */\n resourceNotFound: (\n arg?: JsonRpcErrorsArg,\n ) => getJsonRpcError(errorCodes.rpc.resourceNotFound, arg),\n\n /**\n * Get an Ethereum JSON RPC Resource Unavailable (-32002) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link JsonRpcError} class.\n */\n resourceUnavailable: (\n arg?: JsonRpcErrorsArg,\n ) => getJsonRpcError(errorCodes.rpc.resourceUnavailable, arg),\n\n /**\n * Get an Ethereum JSON RPC Transaction Rejected (-32003) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link JsonRpcError} class.\n */\n transactionRejected: (\n arg?: JsonRpcErrorsArg,\n ) => getJsonRpcError(errorCodes.rpc.transactionRejected, arg),\n\n /**\n * Get an Ethereum JSON RPC Method Not Supported (-32004) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link JsonRpcError} class.\n */\n methodNotSupported: (\n arg?: JsonRpcErrorsArg,\n ) => getJsonRpcError(errorCodes.rpc.methodNotSupported, arg),\n\n /**\n * Get an Ethereum JSON RPC Limit Exceeded (-32005) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link JsonRpcError} class.\n */\n limitExceeded: (\n arg?: JsonRpcErrorsArg,\n ) => getJsonRpcError(errorCodes.rpc.limitExceeded, arg),\n};\n\nexport const providerErrors = {\n /**\n * Get an Ethereum Provider User Rejected Request (4001) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link EthereumProviderError} class.\n */\n userRejectedRequest: (\n arg?: JsonRpcErrorsArg,\n ) => {\n return getEthProviderError(errorCodes.provider.userRejectedRequest, arg);\n },\n\n /**\n * Get an Ethereum Provider Unauthorized (4100) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link EthereumProviderError} class.\n */\n unauthorized: (\n arg?: JsonRpcErrorsArg,\n ) => {\n return getEthProviderError(errorCodes.provider.unauthorized, arg);\n },\n\n /**\n * Get an Ethereum Provider Unsupported Method (4200) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link EthereumProviderError} class.\n */\n unsupportedMethod: (\n arg?: JsonRpcErrorsArg,\n ) => {\n return getEthProviderError(errorCodes.provider.unsupportedMethod, arg);\n },\n\n /**\n * Get an Ethereum Provider Not Connected (4900) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link EthereumProviderError} class.\n */\n disconnected: (\n arg?: JsonRpcErrorsArg,\n ) => {\n return getEthProviderError(errorCodes.provider.disconnected, arg);\n },\n\n /**\n * Get an Ethereum Provider Chain Not Connected (4901) error.\n *\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link EthereumProviderError} class.\n */\n chainDisconnected: (\n arg?: JsonRpcErrorsArg,\n ) => {\n return getEthProviderError(errorCodes.provider.chainDisconnected, arg);\n },\n\n /**\n * Get a custom Ethereum Provider error.\n *\n * @param opts - The error options bag.\n * @returns An instance of the {@link EthereumProviderError} class.\n */\n custom: (\n opts: CustomErrorArg,\n ) => {\n if (!opts || typeof opts !== 'object' || Array.isArray(opts)) {\n throw new Error(\n 'Ethereum Provider custom errors must provide single object argument.',\n );\n }\n\n const { code, message, data } = opts;\n\n if (!message || typeof message !== 'string') {\n throw new Error('\"message\" must be a nonempty string');\n }\n return new EthereumProviderError(code, message, data);\n },\n};\n\n/**\n * Get a generic JSON-RPC error class instance.\n *\n * @param code - The error code.\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link JsonRpcError} class.\n */\nfunction getJsonRpcError(\n code: number,\n arg?: JsonRpcErrorsArg,\n): JsonRpcError {\n const [message, data] = parseOpts(arg);\n return new JsonRpcError(code, message ?? getMessageFromCode(code), data);\n}\n\n/**\n * Get an Ethereum Provider error class instance.\n *\n * @param code - The error code.\n * @param arg - The error message or options bag.\n * @returns An instance of the {@link EthereumProviderError} class.\n */\nfunction getEthProviderError(\n code: number,\n arg?: JsonRpcErrorsArg,\n): EthereumProviderError {\n const [message, data] = parseOpts(arg);\n return new EthereumProviderError(\n code,\n message ?? getMessageFromCode(code),\n data,\n );\n}\n\n/**\n * Get an error message and optional data from an options bag.\n *\n * @param arg - The error message or options bag.\n * @returns A tuple containing the error message and optional data.\n */\nfunction parseOpts(\n arg?: JsonRpcErrorsArg,\n): [message?: string | undefined, data?: Data | undefined] {\n if (arg) {\n if (typeof arg === 'string') {\n return [arg];\n } else if (typeof arg === 'object' && !Array.isArray(arg)) {\n const { message, data } = arg;\n\n if (message && typeof message !== 'string') {\n throw new Error('Must specify string message.');\n }\n return [message ?? undefined, data];\n }\n }\n\n return [];\n}\n"],"mappings":";;;;;;;;;;;;AAqBO,IAAM,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOvB,OAAO,CACL,QACG,gBAAgB,WAAW,IAAI,OAAO,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ9C,gBAAgB,CACd,QACG,gBAAgB,WAAW,IAAI,gBAAgB,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQvD,eAAe,CACb,QACG,gBAAgB,WAAW,IAAI,eAAe,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQtD,gBAAgB,CACd,QACG,gBAAgB,WAAW,IAAI,gBAAgB,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQvD,UAAU,CACR,QACG,gBAAgB,WAAW,IAAI,UAAU,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUjD,QAAQ,CACN,SACG;AACH,QAAI,CAAC,QAAQ,OAAO,SAAS,YAAY,MAAM,QAAQ,IAAI,GAAG;AAC5D,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AACA,UAAM,EAAE,KAAK,IAAI;AACjB,QAAI,CAAC,OAAO,UAAU,IAAI,KAAK,OAAO,UAAU,OAAO,QAAQ;AAC7D,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AACA,WAAO,gBAAgB,MAAM,IAAI;AAAA,EACnC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,cAAc,CACZ,QACG,gBAAgB,WAAW,IAAI,cAAc,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQrD,kBAAkB,CA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AC5D,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,UAAM,EAAE,MAAM,SAAS,KAAK,IAAI;AAEhC,QAAI,CAAC,WAAW,OAAO,YAAY,UAAU;AAC3C,YAAM,IAAI,MAAM,qCAAqC;AAAA,IACvD;AACA,WAAO,IAAI,sBAAsB,MAAM,SAAS,IAAI;AAAA,EACtD;AACF;AASA,SAAS,gBACP,MACA,KACoB;AACpB,QAAM,CAAC,SAAS,IAAI,IAAI,UAAU,GAAG;AACrC,SAAO,IAAI,aAAa,MAAM,WAAW,mBAAmB,IAAI,GAAG,IAAI;AACzE;AASA,SAAS,oBACP,MACA,KAC6B;AAC7B,QAAM,CAAC,SAAS,IAAI,IAAI,UAAU,GAAG;AACrC,SAAO,IAAI;AAAA,IACT;AAAA,IACA,WAAW,mBAAmB,IAAI;AAAA,IAClC;AAAA,EACF;AACF;AAQA,SAAS,UACP,KACyD;AACzD,MAAI,KAAK;AACP,QAAI,OAAO,QAAQ,UAAU;AAC3B,aAAO,CAAC,GAAG;AAAA,IACb,WAAW,OAAO,QAAQ,YAAY,CAAC,MAAM,QAAQ,GAAG,GAAG;AACzD,YAAM,EAAE,SAAS,KAAK,IAAI;AAE1B,UAAI,WAAW,OAAO,YAAY,UAAU;AAC1C,cAAM,IAAI,MAAM,8BAA8B;AAAA,MAChD;AACA,aAAO,CAAC,WAAW,QAAW,IAAI;AAAA,IACpC;AAAA,EACF;AAEA,SAAO,CAAC;AACV;","names":[]} -\ No newline at end of file -diff --git a/dist/chunk-XOYARAPP.js b/dist/chunk-XOYARAPP.js -new file mode 100644 -index 0000000000000000000000000000000000000000..d326141a35b18b6548f31be94dc57d19fa679a63 ---- /dev/null -+++ b/dist/chunk-XOYARAPP.js -@@ -0,0 +1,106 @@ -+"use strict";Object.defineProperty(exports, "__esModule", {value: true}); -+ -+ -+var _chunkFBHPY3A4js = require('./chunk-FBHPY3A4.js'); -+ -+// src/utils.ts -+ -+ -+ -+ -+ -+var _utils = require('@metamask/utils'); -+var FALLBACK_ERROR_CODE = _chunkFBHPY3A4js.errorCodes.rpc.internal; -+var FALLBACK_MESSAGE = "Unspecified error message. This is a bug, please report it."; -+var FALLBACK_ERROR = { -+ code: FALLBACK_ERROR_CODE, -+ message: getMessageFromCode(FALLBACK_ERROR_CODE) -+}; -+var JSON_RPC_SERVER_ERROR_MESSAGE = "Unspecified server error."; -+function getMessageFromCode(code, fallbackMessage = FALLBACK_MESSAGE) { -+ if (isValidCode(code)) { -+ const codeString = code.toString(); -+ if (_utils.hasProperty.call(void 0, _chunkFBHPY3A4js.errorValues, codeString)) { -+ return _chunkFBHPY3A4js.errorValues[codeString].message; -+ } -+ if (isJsonRpcServerError(code)) { -+ return JSON_RPC_SERVER_ERROR_MESSAGE; -+ } -+ } -+ return fallbackMessage; -+} -+function isValidCode(code) { -+ return Number.isInteger(code); -+} -+function serializeError(error, { fallbackError = FALLBACK_ERROR, shouldIncludeStack = true } = {}) { -+ if (!_utils.isJsonRpcError.call(void 0, fallbackError)) { -+ throw new Error( -+ "Must provide fallback error with integer number code and string message." -+ ); -+ } -+ const serialized = buildError(error, fallbackError); -+ if (!shouldIncludeStack) { -+ delete serialized.stack; -+ } -+ return serialized; -+} -+function buildError(error, fallbackError) { -+ if (error && typeof error === "object" && "serialize" in error && typeof error.serialize === "function") { -+ return error.serialize(); -+ } -+ if (_utils.isJsonRpcError.call(void 0, error)) { -+ return error; -+ } -+ const cause = serializeCause(error); -+ const fallbackWithCause = { -+ ...fallbackError, -+ data: { cause } -+ }; -+ return fallbackWithCause; -+} -+function isJsonRpcServerError(code) { -+ return code >= -32099 && code <= -32e3; -+} -+function serializeCause(error) { -+ if (Array.isArray(error)) { -+ return error.map((entry) => { -+ if (_utils.isValidJson.call(void 0, entry)) { -+ return entry; -+ } else if (_utils.isObject.call(void 0, entry)) { -+ return serializeObject(entry); -+ } -+ return null; -+ }); -+ } else if (_utils.isObject.call(void 0, error)) { -+ return serializeObject(error); -+ } -+ if (_utils.isValidJson.call(void 0, error)) { -+ return error; -+ } -+ return null; -+} -+function serializeObject(object) { -+ return Object.getOwnPropertyNames(object).reduce( -+ (acc, key) => { -+ const value = object[key]; -+ if (_utils.isValidJson.call(void 0, value)) { -+ acc[key] = value; -+ } -+ return acc; -+ }, -+ {} -+ ); -+} -+function dataHasCause(data) { -+ return _utils.isObject.call(void 0, data) && _utils.hasProperty.call(void 0, data, "cause") && _utils.isObject.call(void 0, data.cause); -+} -+ -+ -+ -+ -+ -+ -+ -+ -+exports.JSON_RPC_SERVER_ERROR_MESSAGE = JSON_RPC_SERVER_ERROR_MESSAGE; exports.getMessageFromCode = getMessageFromCode; exports.isValidCode = isValidCode; exports.serializeError = serializeError; exports.serializeCause = serializeCause; exports.dataHasCause = dataHasCause; -+//# sourceMappingURL=chunk-XOYARAPP.js.map -\ No newline at end of file -diff --git a/dist/chunk-XOYARAPP.js.map b/dist/chunk-XOYARAPP.js.map -new file mode 100644 -index 0000000000000000000000000000000000000000..837ad06730ffd152196ecabb9c1d1bb01fc21aa6 ---- /dev/null -+++ b/dist/chunk-XOYARAPP.js.map -@@ -0,0 +1 @@ -+{"version":3,"sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;AAKA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA6BP,IAAM,sBAAsB,WAAW,IAAI;AAC3C,IAAM,mBACJ;AACF,IAAM,iBAAyC;AAAA,EAC7C,MAAM;AAAA,EACN,SAAS,mBAAmB,mBAAmB;AACjD;AAEO,IAAM,gCAAgC;AActC,SAAS,mBACd,MACA,kBAA0B,kBAClB;AACR,MAAI,YAAY,IAAI,GAAG;AACrB,UAAM,aAAa,KAAK,SAAS;AAEjC,QAAI,YAAY,aAAa,UAAU,GAAG;AACxC,aAAO,YAAY,UAA2B,EAAE;AAAA,IAClD;AAEA,QAAI,qBAAqB,IAAI,GAAG;AAC9B,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AASO,SAA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AI,YAAY,KAAK,GAAG;AACtB,YAAI,GAAG,IAAI;AAAA,MACb;AAEA,aAAO;AAAA,IACT;AAAA,IACA,CAAC;AAAA,EACH;AACF;AAQO,SAAS,aAAa,MAG3B;AACA,SAAO,SAAS,IAAI,KAAK,YAAY,MAAM,OAAO,KAAK,SAAS,KAAK,KAAK;AAC5E","sourcesContent":["import type {\n Json,\n JsonRpcError as SerializedJsonRpcError,\n RuntimeObject,\n} from '@metamask/utils';\nimport {\n hasProperty,\n isValidJson,\n isObject,\n isJsonRpcError,\n} from '@metamask/utils';\n\nimport { errorCodes, errorValues } from './error-constants';\n\n/**\n * A data object, that must be either:\n *\n * - A JSON-serializable object.\n * - An object with a `cause` property that is an error-like value, and any\n * other properties that are JSON-serializable.\n */\nexport type DataWithOptionalCause =\n | Json\n | {\n // Unfortunately we can't use just `Json` here, because all properties of\n // an object with an index signature must be assignable to the index\n // signature's type. So we have to use `Json | unknown` instead.\n [key: string]: Json | unknown;\n cause?: unknown;\n };\n\n/**\n * A data object, that must be either:\n *\n * - A valid DataWithOptionalCause value.\n * - undefined.\n */\nexport type OptionalDataWithOptionalCause = undefined | DataWithOptionalCause;\n\nconst FALLBACK_ERROR_CODE = errorCodes.rpc.internal;\nconst FALLBACK_MESSAGE =\n 'Unspecified error message. This is a bug, please report it.';\nconst FALLBACK_ERROR: SerializedJsonRpcError = {\n code: FALLBACK_ERROR_CODE,\n message: getMessageFromCode(FALLBACK_ERROR_CODE),\n};\n\nexport const JSON_RPC_SERVER_ERROR_MESSAGE = 'Unspecified server error.';\n\ntype ErrorValueKey = keyof typeof errorValues;\n\n/**\n * Gets the message for a given code, or a fallback message if the code has\n * no corresponding message.\n *\n * @param code - The error code.\n * @param fallbackMessage - The fallback message to use if the code has no\n * corresponding message.\n * @returns The message for the given code, or the fallback message if the code\n * has no corresponding message.\n */\nexport function getMessageFromCode(\n code: unknown,\n fallbackMessage: string = FALLBACK_MESSAGE,\n): string {\n if (isValidCode(code)) {\n const codeString = code.toString();\n\n if (hasProperty(errorValues, codeString)) {\n return errorValues[codeString as ErrorValueKey].message;\n }\n\n if (isJsonRpcServerError(code)) {\n return JSON_RPC_SERVER_ERROR_MESSAGE;\n }\n }\n return fallbackMessage;\n}\n\n/**\n * Returns whether the given code is valid.\n * A code is valid if it is an integer.\n *\n * @param code - The error code.\n * @returns Whether the given code is valid.\n */\nexport function isValidCode(code: unknown): code is number {\n return Number.isInteger(code);\n}\n\n/**\n * Serializes the given error to an Ethereum JSON RPC-compatible error object.\n * If the given error is not fully compatible, it will be preserved on the\n * returned object's data.cause property.\n *\n * @param error - The error to serialize.\n * @param options - Options bag.\n * @param options.fallbackError - The error to return if the given error is\n * not compatible. Should be a JSON serializable value.\n * @param options.shouldIncludeStack - Whether to include the error's stack\n * on the returned object.\n * @returns The serialized error.\n */\nexport function serializeError(\n error: unknown,\n { fallbackError = FALLBACK_ERROR, shouldIncludeStack = true } = {},\n): SerializedJsonRpcError {\n if (!isJsonRpcError(fallbackError)) {\n throw new Error(\n 'Must provide fallback error with integer number code and string message.',\n );\n }\n\n const serialized = buildError(error, fallbackError);\n\n if (!shouldIncludeStack) {\n delete serialized.stack;\n }\n\n return serialized;\n}\n\n/**\n * Construct a JSON-serializable object given an error and a JSON serializable `fallbackError`\n *\n * @param error - The error in question.\n * @param fallbackError - A JSON serializable fallback error.\n * @returns A JSON serializable error object.\n */\nfunction buildError(\n error: unknown,\n fallbackError: SerializedJsonRpcError,\n): SerializedJsonRpcError {\n // If an error specifies a `serialize` function, we call it and return the result.\n if (\n error &&\n typeof error === 'object' &&\n 'serialize' in error &&\n typeof error.serialize === 'function'\n ) {\n return error.serialize();\n }\n\n if (isJsonRpcError(error)) {\n return error;\n }\n\n // If the error does not match the JsonRpcError type, use the fallback error, but try to include the original error as `cause`.\n const cause = serializeCause(error);\n const fallbackWithCause = {\n ...fallbackError,\n data: { cause },\n };\n\n return fallbackWithCause;\n}\n\n/**\n * Check if the given code is a valid JSON-RPC server error code.\n *\n * @param code - The error code.\n * @returns Whether the given code is a valid JSON-RPC server error code.\n */\nfunction isJsonRpcServerError(code: number): boolean {\n return code >= -32099 && code <= -32000;\n}\n\n/**\n * Serializes an unknown error to be used as the `cause` in a fallback error.\n *\n * @param error - The unknown error.\n * @returns A JSON-serializable object containing as much information about the original error as possible.\n */\nexport function serializeCause(error: unknown): Json {\n if (Array.isArray(error)) {\n return error.map((entry) => {\n if (isValidJson(entry)) {\n return entry;\n } else if (isObject(entry)) {\n return serializeObject(entry);\n }\n return null;\n });\n } else if (isObject(error)) {\n return serializeObject(error);\n }\n\n if (isValidJson(error)) {\n return error;\n }\n\n return null;\n}\n\n/**\n * Extracts all JSON-serializable properties from an object.\n *\n * @param object - The object in question.\n * @returns An object containing all the JSON-serializable properties.\n */\nfunction serializeObject(object: RuntimeObject): Json {\n return Object.getOwnPropertyNames(object).reduce>(\n (acc, key) => {\n const value = object[key];\n if (isValidJson(value)) {\n acc[key] = value;\n }\n\n return acc;\n },\n {},\n );\n}\n\n/**\n * Returns true if supplied error data has a usable `cause` property; false otherwise.\n *\n * @param data - Optional data to validate.\n * @returns Whether cause property is present and an object.\n */\nexport function dataHasCause(data: unknown): data is {\n [key: string]: Json | unknown;\n cause: object;\n} {\n return isObject(data) && hasProperty(data, 'cause') && isObject(data.cause);\n}\n"]} -\ No newline at end of file -diff --git a/dist/classes.js b/dist/classes.js -index 892a9bf435cfba77bcbf30be69abaecdeefe455c..70ad8c5d1246af8bfd92139fe4e4c1f62b774199 100644 ---- a/dist/classes.js -+++ b/dist/classes.js -@@ -1,11 +1,11 @@ - "use strict";Object.defineProperty(exports, "__esModule", {value: true}); - - --var _chunk77LIU62Ijs = require('./chunk-77LIU62I.js'); --require('./chunk-LIUXO4DW.js'); -+var _chunkEI2FYNGYjs = require('./chunk-EI2FYNGY.js'); -+require('./chunk-XOYARAPP.js'); - require('./chunk-FBHPY3A4.js'); - - - --exports.EthereumProviderError = _chunk77LIU62Ijs.EthereumProviderError; exports.JsonRpcError = _chunk77LIU62Ijs.JsonRpcError; -+exports.EthereumProviderError = _chunkEI2FYNGYjs.EthereumProviderError; exports.JsonRpcError = _chunkEI2FYNGYjs.JsonRpcError; - //# sourceMappingURL=classes.js.map -\ No newline at end of file -diff --git a/dist/classes.mjs b/dist/classes.mjs -index 37fa099aa908771e89b5a87941c5e224d0a011ae..1fe2ed4fecfb28406c9c194ffdd005c5c5e51fdc 100644 ---- a/dist/classes.mjs -+++ b/dist/classes.mjs -@@ -1,8 +1,8 @@ - import { - EthereumProviderError, - JsonRpcError --} from "./chunk-XSKO3GXZ.mjs"; --import "./chunk-MPU3CVX3.mjs"; -+} from "./chunk-O4VI6JN3.mjs"; -+import "./chunk-HHE56EX3.mjs"; - import "./chunk-MIW4NMY6.mjs"; - export { - EthereumProviderError, -diff --git a/dist/errors.js b/dist/errors.js -index e7a63b249b92f2249f6233a0af375de6f92e41b9..8b5565f277267b31ae2012e04e20cf110e67e54b 100644 ---- a/dist/errors.js -+++ b/dist/errors.js -@@ -1,12 +1,12 @@ - "use strict";Object.defineProperty(exports, "__esModule", {value: true}); - - --var _chunkI3KUC4QQjs = require('./chunk-I3KUC4QQ.js'); --require('./chunk-77LIU62I.js'); --require('./chunk-LIUXO4DW.js'); -+var _chunkQQFAQUCRjs = require('./chunk-QQFAQUCR.js'); -+require('./chunk-EI2FYNGY.js'); -+require('./chunk-XOYARAPP.js'); - require('./chunk-FBHPY3A4.js'); - - - --exports.providerErrors = _chunkI3KUC4QQjs.providerErrors; exports.rpcErrors = _chunkI3KUC4QQjs.rpcErrors; -+exports.providerErrors = _chunkQQFAQUCRjs.providerErrors; exports.rpcErrors = _chunkQQFAQUCRjs.rpcErrors; - //# sourceMappingURL=errors.js.map -\ No newline at end of file -diff --git a/dist/errors.mjs b/dist/errors.mjs -index a18cb400ae988b4982abed5081281f64cd19be66..3613829a56fb0944a75e01af096c8238a9614c70 100644 ---- a/dist/errors.mjs -+++ b/dist/errors.mjs -@@ -1,9 +1,9 @@ - import { - providerErrors, - rpcErrors --} from "./chunk-KYP27U3C.mjs"; --import "./chunk-XSKO3GXZ.mjs"; --import "./chunk-MPU3CVX3.mjs"; -+} from "./chunk-UMM4JLJ6.mjs"; -+import "./chunk-O4VI6JN3.mjs"; -+import "./chunk-HHE56EX3.mjs"; - import "./chunk-MIW4NMY6.mjs"; - export { - providerErrors, -diff --git a/dist/index.js b/dist/index.js -index 9e81cfb2cbf67a03fb637d583837212ac7cf0791..e013714f12e7ecb7e3c02b626f90c9c0fa04fab4 100644 ---- a/dist/index.js -+++ b/dist/index.js -@@ -1,16 +1,17 @@ - "use strict";Object.defineProperty(exports, "__esModule", {value: true}); - - --var _chunkI3KUC4QQjs = require('./chunk-I3KUC4QQ.js'); -+var _chunkQQFAQUCRjs = require('./chunk-QQFAQUCR.js'); - - - --var _chunk77LIU62Ijs = require('./chunk-77LIU62I.js'); -+var _chunkEI2FYNGYjs = require('./chunk-EI2FYNGY.js'); - - - - --var _chunkLIUXO4DWjs = require('./chunk-LIUXO4DW.js'); -+ -+var _chunkXOYARAPPjs = require('./chunk-XOYARAPP.js'); - - - var _chunkFBHPY3A4js = require('./chunk-FBHPY3A4.js'); -@@ -23,5 +24,6 @@ var _chunkFBHPY3A4js = require('./chunk-FBHPY3A4.js'); - - - --exports.EthereumProviderError = _chunk77LIU62Ijs.EthereumProviderError; exports.JsonRpcError = _chunk77LIU62Ijs.JsonRpcError; exports.errorCodes = _chunkFBHPY3A4js.errorCodes; exports.getMessageFromCode = _chunkLIUXO4DWjs.getMessageFromCode; exports.providerErrors = _chunkI3KUC4QQjs.providerErrors; exports.rpcErrors = _chunkI3KUC4QQjs.rpcErrors; exports.serializeCause = _chunkLIUXO4DWjs.serializeCause; exports.serializeError = _chunkLIUXO4DWjs.serializeError; -+ -+exports.EthereumProviderError = _chunkEI2FYNGYjs.EthereumProviderError; exports.JsonRpcError = _chunkEI2FYNGYjs.JsonRpcError; exports.dataHasCause = _chunkXOYARAPPjs.dataHasCause; exports.errorCodes = _chunkFBHPY3A4js.errorCodes; exports.getMessageFromCode = _chunkXOYARAPPjs.getMessageFromCode; exports.providerErrors = _chunkQQFAQUCRjs.providerErrors; exports.rpcErrors = _chunkQQFAQUCRjs.rpcErrors; exports.serializeCause = _chunkXOYARAPPjs.serializeCause; exports.serializeError = _chunkXOYARAPPjs.serializeError; - //# sourceMappingURL=index.js.map -\ No newline at end of file -diff --git a/dist/index.mjs b/dist/index.mjs -index a01967e5815a2d0188a799c9ac4161f05c6b0110..94c5e04a320d38fedd4145e252091b5eb30c5b86 100644 ---- a/dist/index.mjs -+++ b/dist/index.mjs -@@ -1,22 +1,24 @@ - import { - providerErrors, - rpcErrors --} from "./chunk-KYP27U3C.mjs"; -+} from "./chunk-UMM4JLJ6.mjs"; - import { - EthereumProviderError, - JsonRpcError --} from "./chunk-XSKO3GXZ.mjs"; -+} from "./chunk-O4VI6JN3.mjs"; - import { -+ dataHasCause, - getMessageFromCode, - serializeCause, - serializeError --} from "./chunk-MPU3CVX3.mjs"; -+} from "./chunk-HHE56EX3.mjs"; - import { - errorCodes - } from "./chunk-MIW4NMY6.mjs"; - export { - EthereumProviderError, - JsonRpcError, -+ dataHasCause, - errorCodes, - getMessageFromCode, - providerErrors, -diff --git a/dist/types/classes.d.ts.map b/dist/types/classes.d.ts.map -index 6746977563e055f4328f7928d6f7e681a41e2804..20ca08be091330978e1173cbed1f93a5705aaf1c 100644 ---- a/dist/types/classes.d.ts.map -+++ b/dist/types/classes.d.ts.map -@@ -1 +1 @@ --{"version":3,"file":"classes.d.ts","sourceRoot":"","sources":["../../src/classes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,YAAY,IAAI,sBAAsB,EACvC,MAAM,iBAAiB,CAAC;AAIzB,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAG7D,YAAY,EAAE,sBAAsB,EAAE,CAAC;AAEvC;;;;;GAKG;AACH,qBAAa,YAAY,CACvB,IAAI,SAAS,6BAA6B,CAC1C,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No newline at end of file -diff --git a/dist/types/index.d.ts b/dist/types/index.d.ts -index c4f3bad6c8444846cef5e36ad37f29c4b707ca00..718fe1a1a9af93889626487c26f79343965b80da 100644 ---- a/dist/types/index.d.ts -+++ b/dist/types/index.d.ts -@@ -1,5 +1,5 @@ - export { JsonRpcError, EthereumProviderError } from './classes'; --export { serializeCause, serializeError, getMessageFromCode } from './utils'; -+export { dataHasCause, serializeCause, serializeError, getMessageFromCode, } from './utils'; - export type { DataWithOptionalCause, OptionalDataWithOptionalCause, } from './utils'; - export { rpcErrors, providerErrors } from './errors'; - export { errorCodes } from './error-constants'; -diff --git a/dist/types/index.d.ts.map b/dist/types/index.d.ts.map -index 02d562a1e120a90e5f9a860c2f9b31ba8fd90ae2..7a228c86d5b0e1faa21ffa5c898ee4dab6548650 100644 ---- a/dist/types/index.d.ts.map -+++ b/dist/types/index.d.ts.map -@@ -1 +1 @@ --{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7E,YAAY,EACV,qBAAqB,EACrB,6BAA6B,GAC9B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC"} -\ No newline at end of file -+{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd,kBAAkB,GACnB,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,qBAAqB,EACrB,6BAA6B,GAC9B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC"} -\ No newline at end of file -diff --git a/dist/types/utils.d.ts b/dist/types/utils.d.ts -index 966a909f065f7030a1767f2124586785e05fda5c..865396258856516369b6641b08922455ef1ddeca 100644 ---- a/dist/types/utils.d.ts -+++ b/dist/types/utils.d.ts -@@ -61,4 +61,14 @@ export declare function serializeError(error: unknown, { fallbackError, shouldIn - * @returns A JSON-serializable object containing as much information about the original error as possible. - */ - export declare function serializeCause(error: unknown): Json; -+/** -+ * Returns true if supplied error data has a usable `cause` property; false otherwise. -+ * -+ * @param data - Optional data to validate. -+ * @returns Whether cause property is present and an object. -+ */ -+export declare function dataHasCause(data: unknown): data is { -+ [key: string]: Json | unknown; -+ cause: object; -+}; - //# sourceMappingURL=utils.d.ts.map -\ No newline at end of file -diff --git a/dist/types/utils.d.ts.map b/dist/types/utils.d.ts.map -index 8d2f43c44c3bd237d1055742a5494a7ca392f93b..894190fa88ca40e3d0e58dacdbec58fbc9c4d5d0 100644 ---- a/dist/types/utils.d.ts.map -+++ b/dist/types/utils.d.ts.map -@@ -1 +1 @@ --{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,YAAY,IAAI,sBAAsB,EAEvC,MAAM,iBAAiB,CAAC;AAUzB;;;;;;GAMG;AACH,MAAM,MAAM,qBAAqB,GAC7B,IAAI,GACJ;IAIE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC;IAC9B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEN;;;;;GAKG;AACH,MAAM,MAAM,6BAA6B,GAAG,SAAS,GAAG,qBAAqB,CAAC;AAU9E,eAAO,MAAM,6BAA6B,8BAA8B,CAAC;AAIzE;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CACh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AAI,CAmBnD;AAsBD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI;IACnD,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;CACf,CAEA"} -\ No newline at end of file -diff --git a/dist/utils.js b/dist/utils.js -index 585a2816e77fb2c5c54084b51272300c344a97b1..43a6403470658204ea5f9d1e117eb179996dbd11 100644 ---- a/dist/utils.js -+++ b/dist/utils.js -@@ -4,7 +4,8 @@ - - - --var _chunkLIUXO4DWjs = require('./chunk-LIUXO4DW.js'); -+ -+var _chunkXOYARAPPjs = require('./chunk-XOYARAPP.js'); - require('./chunk-FBHPY3A4.js'); - - -@@ -12,5 +13,6 @@ require('./chunk-FBHPY3A4.js'); - - - --exports.JSON_RPC_SERVER_ERROR_MESSAGE = _chunkLIUXO4DWjs.JSON_RPC_SERVER_ERROR_MESSAGE; exports.getMessageFromCode = _chunkLIUXO4DWjs.getMessageFromCode; exports.isValidCode = _chunkLIUXO4DWjs.isValidCode; exports.serializeCause = _chunkLIUXO4DWjs.serializeCause; exports.serializeError = _chunkLIUXO4DWjs.serializeError; -+ -+exports.JSON_RPC_SERVER_ERROR_MESSAGE = _chunkXOYARAPPjs.JSON_RPC_SERVER_ERROR_MESSAGE; exports.dataHasCause = _chunkXOYARAPPjs.dataHasCause; exports.getMessageFromCode = _chunkXOYARAPPjs.getMessageFromCode; exports.isValidCode = _chunkXOYARAPPjs.isValidCode; exports.serializeCause = _chunkXOYARAPPjs.serializeCause; exports.serializeError = _chunkXOYARAPPjs.serializeError; - //# sourceMappingURL=utils.js.map -\ No newline at end of file -diff --git a/dist/utils.mjs b/dist/utils.mjs -index 297a0039348b906bf87edc7dea2d09f20768e2dd..1b61c68272354c576a1001bb6d3110e142ff1291 100644 ---- a/dist/utils.mjs -+++ b/dist/utils.mjs -@@ -1,13 +1,15 @@ - import { - JSON_RPC_SERVER_ERROR_MESSAGE, -+ dataHasCause, - getMessageFromCode, - isValidCode, - serializeCause, - serializeError --} from "./chunk-MPU3CVX3.mjs"; -+} from "./chunk-HHE56EX3.mjs"; - import "./chunk-MIW4NMY6.mjs"; - export { - JSON_RPC_SERVER_ERROR_MESSAGE, -+ dataHasCause, - getMessageFromCode, - isValidCode, - serializeCause, diff --git a/package.json b/package.json index c4b8dc8d1bf8..62ac2cc13870 100644 --- a/package.json +++ b/package.json @@ -248,9 +248,7 @@ "@metamask/keyring-controller@npm:^13.0.0": "patch:@metamask/keyring-controller@npm%3A15.0.0#~/.yarn/patches/@metamask-keyring-controller-npm-15.0.0-fa070ce311.patch", "@metamask/keyring-controller@npm:^12.2.0": "patch:@metamask/keyring-controller@npm%3A15.0.0#~/.yarn/patches/@metamask-keyring-controller-npm-15.0.0-fa070ce311.patch", "@metamask/keyring-controller@npm:^14.0.1": "patch:@metamask/keyring-controller@npm%3A15.0.0#~/.yarn/patches/@metamask-keyring-controller-npm-15.0.0-fa070ce311.patch", - "@metamask/rpc-errors@npm:^6.2.1": "patch:@metamask/rpc-errors@npm%3A6.2.1#~/.yarn/patches/@metamask-rpc-errors-npm-6.2.1-9f2b83a911.patch", - "@metamask/rpc-errors@npm:^6.0.0": "patch:@metamask/rpc-errors@npm%3A6.2.1#~/.yarn/patches/@metamask-rpc-errors-npm-6.2.1-9f2b83a911.patch", - "@metamask/rpc-errors@npm:^6.1.0": "patch:@metamask/rpc-errors@npm%3A6.2.1#~/.yarn/patches/@metamask-rpc-errors-npm-6.2.1-9f2b83a911.patch", + "@metamask/rpc-errors": "6.3.0-rc1", "@spruceid/siwe-parser@npm:1.1.3": "patch:@spruceid/siwe-parser@npm%3A2.1.0#~/.yarn/patches/@spruceid-siwe-parser-npm-2.1.0-060b7ede7a.patch", "@spruceid/siwe-parser@npm:2.1.0": "patch:@spruceid/siwe-parser@npm%3A2.1.0#~/.yarn/patches/@spruceid-siwe-parser-npm-2.1.0-060b7ede7a.patch", "@trezor/connect-web@npm:^9.2.2": "patch:@trezor/connect-web@npm%3A9.2.2#~/.yarn/patches/@trezor-connect-web-npm-9.2.2-a4de8e45fc.patch", @@ -331,7 +329,7 @@ "@metamask/providers": "^14.0.2", "@metamask/queued-request-controller": "^0.10.0", "@metamask/rate-limit-controller": "^5.0.1", - "@metamask/rpc-errors": "patch:@metamask/rpc-errors@npm%3A6.2.1#~/.yarn/patches/@metamask-rpc-errors-npm-6.2.1-9f2b83a911.patch", + "@metamask/rpc-errors": "6.3.0-rc1", "@metamask/safe-event-emitter": "^3.1.1", "@metamask/scure-bip39": "^2.0.3", "@metamask/selected-network-controller": "^13.0.0", diff --git a/yarn.lock b/yarn.lock index 9a93ccb09384..ce8c1fd192a7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5948,23 +5948,13 @@ __metadata: languageName: node linkType: hard -"@metamask/rpc-errors@npm:6.2.1": - version: 6.2.1 - resolution: "@metamask/rpc-errors@npm:6.2.1" - dependencies: - "@metamask/utils": "npm:^8.3.0" - fast-safe-stringify: "npm:^2.0.6" - checksum: 789f0a2090339c1aa43d45ee496f4f115e141bc55b98e4ce27498497568f9e85fb5527ecf1f113b156d88fc4f1e63a572ced74bdc1ba16826bf648391b223f7b - languageName: node - linkType: hard - -"@metamask/rpc-errors@patch:@metamask/rpc-errors@npm%3A6.2.1#~/.yarn/patches/@metamask-rpc-errors-npm-6.2.1-9f2b83a911.patch": - version: 6.2.1 - resolution: "@metamask/rpc-errors@patch:@metamask/rpc-errors@npm%3A6.2.1#~/.yarn/patches/@metamask-rpc-errors-npm-6.2.1-9f2b83a911.patch::version=6.2.1&hash=c6a40f" +"@metamask/rpc-errors@npm:6.3.0-rc1": + version: 6.3.0-rc1 + resolution: "@metamask/rpc-errors@npm:6.3.0-rc1" dependencies: "@metamask/utils": "npm:^8.3.0" fast-safe-stringify: "npm:^2.0.6" - checksum: 3db08e24c46026c3cd00d62a02367cd010b82d0310512648f09c89ebcfa534a9b06f9dd91de12db8fc4e05203fb12a9209e21de8b0e1de33287177caa19ca1ec + checksum: 35b53c713b39382e5b4bc81a0524d0e1e26f625540980e6f4548d2c38d523a46cc7c24fbadd209ee0171bd8f1440e1911079571e566a1352a86aac41e2998ea1 languageName: node linkType: hard @@ -25135,7 +25125,7 @@ __metadata: "@metamask/providers": "npm:^14.0.2" "@metamask/queued-request-controller": "npm:^0.10.0" "@metamask/rate-limit-controller": "npm:^5.0.1" - "@metamask/rpc-errors": "patch:@metamask/rpc-errors@npm%3A6.2.1#~/.yarn/patches/@metamask-rpc-errors-npm-6.2.1-9f2b83a911.patch" + "@metamask/rpc-errors": "npm:6.3.0-rc1" "@metamask/safe-event-emitter": "npm:^3.1.1" "@metamask/scure-bip39": "npm:^2.0.3" "@metamask/selected-network-controller": "npm:^13.0.0"