@canton-network/core-rpc-errors 1.7.0 → 1.8.0
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.
- package/dist/index.cjs +27 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -17
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -1,33 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
[rpcErrors.errorCodes.rpc.internal]: 500
|
|
15
|
-
};
|
|
16
|
-
return errorMap[rpcCode] || 500;
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let _metamask_rpc_errors = require("@metamask/rpc-errors");
|
|
3
|
+
//#region src/index.ts
|
|
4
|
+
const toHttpErrorCode = (rpcCode) => {
|
|
5
|
+
return {
|
|
6
|
+
[_metamask_rpc_errors.errorCodes.rpc.parse]: 400,
|
|
7
|
+
[_metamask_rpc_errors.errorCodes.rpc.invalidRequest]: 400,
|
|
8
|
+
[_metamask_rpc_errors.errorCodes.rpc.methodNotFound]: 404,
|
|
9
|
+
[_metamask_rpc_errors.errorCodes.rpc.invalidParams]: 400,
|
|
10
|
+
[_metamask_rpc_errors.errorCodes.rpc.invalidInput]: 400,
|
|
11
|
+
[_metamask_rpc_errors.errorCodes.provider.unauthorized]: 401,
|
|
12
|
+
[_metamask_rpc_errors.errorCodes.rpc.internal]: 500
|
|
13
|
+
}[rpcCode] || 500;
|
|
17
14
|
};
|
|
18
|
-
|
|
15
|
+
//#endregion
|
|
19
16
|
Object.defineProperty(exports, "JsonRpcError", {
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function() {
|
|
19
|
+
return _metamask_rpc_errors.JsonRpcError;
|
|
20
|
+
}
|
|
22
21
|
});
|
|
23
22
|
Object.defineProperty(exports, "providerErrors", {
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function() {
|
|
25
|
+
return _metamask_rpc_errors.providerErrors;
|
|
26
|
+
}
|
|
26
27
|
});
|
|
27
28
|
Object.defineProperty(exports, "rpcErrors", {
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function() {
|
|
31
|
+
return _metamask_rpc_errors.rpcErrors;
|
|
32
|
+
}
|
|
30
33
|
});
|
|
31
34
|
exports.toHttpErrorCode = toHttpErrorCode;
|
|
32
|
-
|
|
35
|
+
|
|
33
36
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["errorCodes"],"sources":["../src/index.ts"],"sourcesContent":["// Copyright (c) 2025-2026 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { errorCodes } from '@metamask/rpc-errors'\n\nexport { rpcErrors, providerErrors, JsonRpcError } from '@metamask/rpc-errors'\n\nexport const toHttpErrorCode = (rpcCode: number): number => {\n const errorMap = {\n [errorCodes.rpc.parse]: 400,\n [errorCodes.rpc.invalidRequest]: 400,\n [errorCodes.rpc.methodNotFound]: 404,\n [errorCodes.rpc.invalidParams]: 400,\n [errorCodes.rpc.invalidInput]: 400,\n [errorCodes.provider.unauthorized]: 401,\n [errorCodes.rpc.internal]: 500,\n }\n\n return errorMap[rpcCode] || 500\n}\n"],"mappings":";;;AAOA,MAAa,mBAAmB,YAA4B;CAWxD,OAAO;GATFA,qBAAAA,WAAW,IAAI,QAAQ;GACvBA,qBAAAA,WAAW,IAAI,iBAAiB;GAChCA,qBAAAA,WAAW,IAAI,iBAAiB;GAChCA,qBAAAA,WAAW,IAAI,gBAAgB;GAC/BA,qBAAAA,WAAW,IAAI,eAAe;GAC9BA,qBAAAA,WAAW,SAAS,eAAe;GACnCA,qBAAAA,WAAW,IAAI,WAAW;CAGjB,EAAE,YAAY;AAChC"}
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import { errorCodes } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
[errorCodes.rpc.internal]: 500
|
|
14
|
-
};
|
|
15
|
-
return errorMap[rpcCode] || 500;
|
|
1
|
+
import { JsonRpcError, errorCodes, providerErrors, rpcErrors } from "@metamask/rpc-errors";
|
|
2
|
+
//#region src/index.ts
|
|
3
|
+
const toHttpErrorCode = (rpcCode) => {
|
|
4
|
+
return {
|
|
5
|
+
[errorCodes.rpc.parse]: 400,
|
|
6
|
+
[errorCodes.rpc.invalidRequest]: 400,
|
|
7
|
+
[errorCodes.rpc.methodNotFound]: 404,
|
|
8
|
+
[errorCodes.rpc.invalidParams]: 400,
|
|
9
|
+
[errorCodes.rpc.invalidInput]: 400,
|
|
10
|
+
[errorCodes.provider.unauthorized]: 401,
|
|
11
|
+
[errorCodes.rpc.internal]: 500
|
|
12
|
+
}[rpcCode] || 500;
|
|
16
13
|
};
|
|
14
|
+
//#endregion
|
|
15
|
+
export { JsonRpcError, providerErrors, rpcErrors, toHttpErrorCode };
|
|
17
16
|
|
|
18
|
-
export { toHttpErrorCode };
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
|
20
17
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["// Copyright (c) 2025-2026 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { errorCodes } from '@metamask/rpc-errors'\n\nexport { rpcErrors, providerErrors, JsonRpcError } from '@metamask/rpc-errors'\n\nexport const toHttpErrorCode = (rpcCode: number): number => {\n const errorMap = {\n [errorCodes.rpc.parse]: 400,\n [errorCodes.rpc.invalidRequest]: 400,\n [errorCodes.rpc.methodNotFound]: 404,\n [errorCodes.rpc.invalidParams]: 400,\n [errorCodes.rpc.invalidInput]: 400,\n [errorCodes.provider.unauthorized]: 401,\n [errorCodes.rpc.internal]: 500,\n }\n\n return errorMap[rpcCode] || 500\n}\n"],"mappings":";;AAOA,MAAa,mBAAmB,YAA4B;CAWxD,OAAO;GATF,WAAW,IAAI,QAAQ;GACvB,WAAW,IAAI,iBAAiB;GAChC,WAAW,IAAI,iBAAiB;GAChC,WAAW,IAAI,gBAAgB;GAC/B,WAAW,IAAI,eAAe;GAC9B,WAAW,SAAS,eAAe;GACnC,WAAW,IAAI,WAAW;CAGjB,EAAE,YAAY;AAChC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canton-network/core-rpc-errors",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Wrapper for JSON-RPC error objects",
|
|
6
6
|
"author": "Alex Matson <alex.matson@digitalasset.com>",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
|
-
"build": "
|
|
27
|
-
"dev": "
|
|
26
|
+
"build": "tsdown --onSuccess \"tsc\"",
|
|
27
|
+
"dev": "tsdown --watch --onSuccess \"tsc\"",
|
|
28
28
|
"flatpack": "yarn pack --out \"$FLATPACK_OUTDIR\"",
|
|
29
29
|
"clean": "tsc -b --clean; rm -rf dist",
|
|
30
30
|
"test": "vitest run --project node --passWithNoTests",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"@metamask/rpc-errors": "^7.0.3"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@vitest/coverage-v8": "^4.1.
|
|
38
|
-
"
|
|
37
|
+
"@vitest/coverage-v8": "^4.1.10",
|
|
38
|
+
"tsdown": "^0.22.9",
|
|
39
39
|
"typescript": "^5.9.3",
|
|
40
|
-
"vitest": "^4.1.
|
|
40
|
+
"vitest": "^4.1.10"
|
|
41
41
|
},
|
|
42
42
|
"repository": {
|
|
43
43
|
"type": "git",
|