@canton-network/core-rpc-errors 0.5.0 → 0.7.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 ADDED
@@ -0,0 +1,33 @@
1
+ 'use strict';
2
+
3
+ var rpcErrors = require('@metamask/rpc-errors');
4
+
5
+ // src/index.ts
6
+ var toHttpErrorCode = (rpcCode) => {
7
+ const errorMap = {
8
+ [rpcErrors.errorCodes.rpc.parse]: 400,
9
+ [rpcErrors.errorCodes.rpc.invalidRequest]: 400,
10
+ [rpcErrors.errorCodes.rpc.methodNotFound]: 404,
11
+ [rpcErrors.errorCodes.rpc.invalidParams]: 400,
12
+ [rpcErrors.errorCodes.rpc.invalidInput]: 400,
13
+ [rpcErrors.errorCodes.provider.unauthorized]: 401,
14
+ [rpcErrors.errorCodes.rpc.internal]: 500
15
+ };
16
+ return errorMap[rpcCode] || 500;
17
+ };
18
+
19
+ Object.defineProperty(exports, "JsonRpcError", {
20
+ enumerable: true,
21
+ get: function () { return rpcErrors.JsonRpcError; }
22
+ });
23
+ Object.defineProperty(exports, "providerErrors", {
24
+ enumerable: true,
25
+ get: function () { return rpcErrors.providerErrors; }
26
+ });
27
+ Object.defineProperty(exports, "rpcErrors", {
28
+ enumerable: true,
29
+ get: function () { return rpcErrors.rpcErrors; }
30
+ });
31
+ exports.toHttpErrorCode = toHttpErrorCode;
32
+ //# sourceMappingURL=index.cjs.map
33
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":["errorCodes"],"mappings":";;;;;AAOO,IAAM,eAAA,GAAkB,CAAC,OAAA,KAA4B;AACxD,EAAA,MAAM,QAAA,GAAW;AAAA,IACb,CAACA,oBAAA,CAAW,GAAA,CAAI,KAAK,GAAG,GAAA;AAAA,IACxB,CAACA,oBAAA,CAAW,GAAA,CAAI,cAAc,GAAG,GAAA;AAAA,IACjC,CAACA,oBAAA,CAAW,GAAA,CAAI,cAAc,GAAG,GAAA;AAAA,IACjC,CAACA,oBAAA,CAAW,GAAA,CAAI,aAAa,GAAG,GAAA;AAAA,IAChC,CAACA,oBAAA,CAAW,GAAA,CAAI,YAAY,GAAG,GAAA;AAAA,IAC/B,CAACA,oBAAA,CAAW,QAAA,CAAS,YAAY,GAAG,GAAA;AAAA,IACpC,CAACA,oBAAA,CAAW,GAAA,CAAI,QAAQ,GAAG;AAAA,GAC/B;AAEA,EAAA,OAAO,QAAA,CAAS,OAAO,CAAA,IAAK,GAAA;AAChC","file":"index.cjs","sourcesContent":["// Copyright (c) 2025 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"]}
package/dist/index.js CHANGED
@@ -1,16 +1,20 @@
1
- // Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
1
  import { errorCodes } from '@metamask/rpc-errors';
4
- export { rpcErrors, providerErrors, JsonRpcError } from '@metamask/rpc-errors';
5
- export const toHttpErrorCode = (rpcCode) => {
6
- const errorMap = {
7
- [errorCodes.rpc.parse]: 400,
8
- [errorCodes.rpc.invalidRequest]: 400,
9
- [errorCodes.rpc.methodNotFound]: 404,
10
- [errorCodes.rpc.invalidParams]: 400,
11
- [errorCodes.rpc.invalidInput]: 400,
12
- [errorCodes.provider.unauthorized]: 401,
13
- [errorCodes.rpc.internal]: 500,
14
- };
15
- return errorMap[rpcCode] || 500;
2
+ export { JsonRpcError, providerErrors, rpcErrors } from '@metamask/rpc-errors';
3
+
4
+ // src/index.ts
5
+ var toHttpErrorCode = (rpcCode) => {
6
+ const errorMap = {
7
+ [errorCodes.rpc.parse]: 400,
8
+ [errorCodes.rpc.invalidRequest]: 400,
9
+ [errorCodes.rpc.methodNotFound]: 404,
10
+ [errorCodes.rpc.invalidParams]: 400,
11
+ [errorCodes.rpc.invalidInput]: 400,
12
+ [errorCodes.provider.unauthorized]: 401,
13
+ [errorCodes.rpc.internal]: 500
14
+ };
15
+ return errorMap[rpcCode] || 500;
16
16
  };
17
+
18
+ export { toHttpErrorCode };
19
+ //# sourceMappingURL=index.js.map
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;AAOO,IAAM,eAAA,GAAkB,CAAC,OAAA,KAA4B;AACxD,EAAA,MAAM,QAAA,GAAW;AAAA,IACb,CAAC,UAAA,CAAW,GAAA,CAAI,KAAK,GAAG,GAAA;AAAA,IACxB,CAAC,UAAA,CAAW,GAAA,CAAI,cAAc,GAAG,GAAA;AAAA,IACjC,CAAC,UAAA,CAAW,GAAA,CAAI,cAAc,GAAG,GAAA;AAAA,IACjC,CAAC,UAAA,CAAW,GAAA,CAAI,aAAa,GAAG,GAAA;AAAA,IAChC,CAAC,UAAA,CAAW,GAAA,CAAI,YAAY,GAAG,GAAA;AAAA,IAC/B,CAAC,UAAA,CAAW,QAAA,CAAS,YAAY,GAAG,GAAA;AAAA,IACpC,CAAC,UAAA,CAAW,GAAA,CAAI,QAAQ,GAAG;AAAA,GAC/B;AAEA,EAAA,OAAO,QAAA,CAAS,OAAO,CAAA,IAAK,GAAA;AAChC","file":"index.js","sourcesContent":["// Copyright (c) 2025 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"]}
package/package.json CHANGED
@@ -1,14 +1,23 @@
1
1
  {
2
2
  "name": "@canton-network/core-rpc-errors",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "description": "Wrapper for JSON-RPC error objects",
6
6
  "author": "Alex Matson <alex.matson@digitalasset.com>",
7
7
  "repository": "github:hyperledger-labs/splice-wallet-kernel",
8
8
  "packageManager": "yarn@4.9.4",
9
9
  "license": "Apache-2.0",
10
- "main": "./dist/index.js",
11
- "types": "./dist/index.d.ts",
10
+ "main": "dist/index.cjs",
11
+ "module": "dist/index.js",
12
+ "types": "dist/index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.js",
17
+ "require": "./dist/index.cjs",
18
+ "default": "./dist/index.js"
19
+ }
20
+ },
12
21
  "files": [
13
22
  "dist/**"
14
23
  ],
@@ -16,7 +25,8 @@
16
25
  "access": "public"
17
26
  },
18
27
  "scripts": {
19
- "build": "tsc --build",
28
+ "build": "tsup && tsc -p tsconfig.types.json",
29
+ "dev": "tsup --watch --onSuccess \"tsc -p tsconfig.types.json\"",
20
30
  "flatpack": "yarn pack --out \"$FLATPACK_OUTDIR\"",
21
31
  "clean": "tsc -b --clean; rm -rf dist"
22
32
  },
@@ -24,6 +34,7 @@
24
34
  "@metamask/rpc-errors": "^7.0.3"
25
35
  },
26
36
  "devDependencies": {
37
+ "tsup": "^8.5.0",
27
38
  "typescript": "^5.9.2"
28
39
  }
29
40
  }