@canton-network/core-rpc-errors 0.1.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/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # rpc-errors
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Building
6
+
7
+ Run `nx build rpc-errors` to build the library.
@@ -0,0 +1,3 @@
1
+ export { rpcErrors, providerErrors, JsonRpcError } from '@metamask/rpc-errors';
2
+ export declare const toHttpErrorCode: (rpcCode: number) => number;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAE9E,eAAO,MAAM,eAAe,GAAI,SAAS,MAAM,KAAG,MAYjD,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,16 @@
1
+ // Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ 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;
16
+ };
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@canton-network/core-rpc-errors",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "description": "Wrapper for JSON-RPC error objects",
6
+ "author": "Alex Matson <alex.matson@digitalasset.com>",
7
+ "repository": "github:hyperledger-labs/splice-wallet-kernel",
8
+ "license": "Apache-2.0",
9
+ "main": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "files": [
12
+ "dist/**"
13
+ ],
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "scripts": {
18
+ "build": "tsc --build"
19
+ },
20
+ "dependencies": {
21
+ "@metamask/rpc-errors": "^7.0.3"
22
+ },
23
+ "devDependencies": {
24
+ "typescript": "^5.9.2"
25
+ }
26
+ }