@injectivelabs/exceptions 1.16.25-alpha.1 → 1.16.25
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/cjs/exceptions/base.d.ts +81 -0
- package/dist/cjs/exceptions/base.js +179 -0
- package/dist/cjs/exceptions/exceptions/BitGetException.d.ts +7 -0
- package/dist/cjs/exceptions/exceptions/BitGetException.js +31 -0
- package/dist/cjs/exceptions/exceptions/CosmosWalletException.d.ts +7 -0
- package/dist/cjs/exceptions/exceptions/CosmosWalletException.js +16 -0
- package/dist/cjs/exceptions/exceptions/GeneralException.d.ts +5 -0
- package/dist/cjs/exceptions/exceptions/GeneralException.js +11 -0
- package/dist/cjs/exceptions/exceptions/GrpcUnaryRequestException.d.ts +7 -0
- package/dist/cjs/exceptions/exceptions/GrpcUnaryRequestException.js +21 -0
- package/dist/cjs/exceptions/exceptions/HttpRequestException.d.ts +11 -0
- package/dist/cjs/exceptions/exceptions/HttpRequestException.js +21 -0
- package/dist/cjs/exceptions/exceptions/LedgerCosmosException.d.ts +7 -0
- package/dist/cjs/exceptions/exceptions/LedgerCosmosException.js +40 -0
- package/dist/cjs/exceptions/exceptions/LedgerException.d.ts +7 -0
- package/dist/cjs/exceptions/exceptions/LedgerException.js +40 -0
- package/dist/cjs/exceptions/exceptions/MetamaskException.d.ts +7 -0
- package/dist/cjs/exceptions/exceptions/MetamaskException.js +31 -0
- package/dist/cjs/exceptions/exceptions/OkxWalletException.d.ts +7 -0
- package/dist/cjs/exceptions/exceptions/OkxWalletException.js +31 -0
- package/dist/cjs/exceptions/exceptions/RabbyWalletException.d.ts +7 -0
- package/dist/cjs/exceptions/exceptions/RabbyWalletException.js +33 -0
- package/dist/cjs/exceptions/exceptions/RainbowWalletException.d.ts +7 -0
- package/dist/cjs/exceptions/exceptions/RainbowWalletException.js +31 -0
- package/dist/cjs/exceptions/exceptions/TransactionException.d.ts +7 -0
- package/dist/cjs/exceptions/exceptions/TransactionException.js +34 -0
- package/dist/cjs/exceptions/exceptions/TrezorException.d.ts +7 -0
- package/dist/cjs/exceptions/exceptions/TrezorException.js +16 -0
- package/dist/cjs/exceptions/exceptions/TrustWalletException.d.ts +7 -0
- package/dist/cjs/exceptions/exceptions/TrustWalletException.js +33 -0
- package/dist/cjs/exceptions/exceptions/TurnkeyWalletSessionException.d.ts +5 -0
- package/dist/cjs/exceptions/exceptions/TurnkeyWalletSessionException.js +11 -0
- package/dist/cjs/exceptions/exceptions/WalletConnectException.d.ts +7 -0
- package/dist/cjs/exceptions/exceptions/WalletConnectException.js +31 -0
- package/dist/cjs/exceptions/exceptions/WalletException.d.ts +5 -0
- package/dist/cjs/exceptions/exceptions/WalletException.js +11 -0
- package/dist/cjs/exceptions/exceptions/Web3Exception.d.ts +7 -0
- package/dist/cjs/exceptions/exceptions/Web3Exception.js +16 -0
- package/dist/cjs/exceptions/exceptions/index.d.ts +18 -0
- package/dist/cjs/exceptions/exceptions/index.js +37 -0
- package/dist/cjs/exceptions/index.d.ts +2 -0
- package/dist/cjs/exceptions/index.js +18 -0
- package/dist/cjs/exceptions/messages.d.ts +13 -0
- package/dist/cjs/exceptions/messages.js +1600 -0
- package/dist/cjs/exceptions/types/codes.d.ts +441 -0
- package/dist/cjs/exceptions/types/codes.js +774 -0
- package/dist/cjs/exceptions/types/context.d.ts +93 -0
- package/dist/cjs/exceptions/types/context.js +21 -0
- package/dist/cjs/exceptions/types/index.d.ts +3 -0
- package/dist/cjs/exceptions/types/index.js +19 -0
- package/dist/cjs/exceptions/types/modules.d.ts +67 -0
- package/dist/cjs/exceptions/types/modules.js +66 -0
- package/dist/cjs/exceptions/utils/grpc.d.ts +3 -0
- package/dist/cjs/exceptions/utils/grpc.js +43 -0
- package/dist/cjs/exceptions/utils/helpers.d.ts +1 -0
- package/dist/cjs/exceptions/utils/helpers.js +24 -0
- package/dist/cjs/exceptions/utils/maps.d.ts +13 -0
- package/dist/cjs/exceptions/utils/maps.js +127 -0
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/index.js +18 -0
- package/dist/cjs/package.json +2 -2
- package/dist/cjs/types.d.ts +2 -0
- package/dist/cjs/types.js +2 -0
- package/dist/cjs/utils.d.ts +8 -0
- package/dist/cjs/utils.js +49 -0
- package/dist/esm/exceptions/base.d.ts +81 -0
- package/dist/esm/exceptions/base.js +175 -0
- package/dist/esm/exceptions/exceptions/BitGetException.d.ts +7 -0
- package/dist/esm/exceptions/exceptions/BitGetException.js +27 -0
- package/dist/esm/exceptions/exceptions/CosmosWalletException.d.ts +7 -0
- package/dist/esm/exceptions/exceptions/CosmosWalletException.js +12 -0
- package/dist/esm/exceptions/exceptions/GeneralException.d.ts +5 -0
- package/dist/esm/exceptions/exceptions/GeneralException.js +7 -0
- package/dist/esm/exceptions/exceptions/GrpcUnaryRequestException.d.ts +7 -0
- package/dist/esm/exceptions/exceptions/GrpcUnaryRequestException.js +17 -0
- package/dist/esm/exceptions/exceptions/HttpRequestException.d.ts +11 -0
- package/dist/esm/exceptions/exceptions/HttpRequestException.js +17 -0
- package/dist/esm/exceptions/exceptions/LedgerCosmosException.d.ts +7 -0
- package/dist/esm/exceptions/exceptions/LedgerCosmosException.js +36 -0
- package/dist/esm/exceptions/exceptions/LedgerException.d.ts +7 -0
- package/dist/esm/exceptions/exceptions/LedgerException.js +36 -0
- package/dist/esm/exceptions/exceptions/MetamaskException.d.ts +7 -0
- package/dist/esm/exceptions/exceptions/MetamaskException.js +27 -0
- package/dist/esm/exceptions/exceptions/OkxWalletException.d.ts +7 -0
- package/dist/esm/exceptions/exceptions/OkxWalletException.js +27 -0
- package/dist/esm/exceptions/exceptions/RabbyWalletException.d.ts +7 -0
- package/dist/esm/exceptions/exceptions/RabbyWalletException.js +29 -0
- package/dist/esm/exceptions/exceptions/RainbowWalletException.d.ts +7 -0
- package/dist/esm/exceptions/exceptions/RainbowWalletException.js +27 -0
- package/dist/esm/exceptions/exceptions/TransactionException.d.ts +7 -0
- package/dist/esm/exceptions/exceptions/TransactionException.js +30 -0
- package/dist/esm/exceptions/exceptions/TrezorException.d.ts +7 -0
- package/dist/esm/exceptions/exceptions/TrezorException.js +12 -0
- package/dist/esm/exceptions/exceptions/TrustWalletException.d.ts +7 -0
- package/dist/esm/exceptions/exceptions/TrustWalletException.js +29 -0
- package/dist/esm/exceptions/exceptions/TurnkeyWalletSessionException.d.ts +5 -0
- package/dist/esm/exceptions/exceptions/TurnkeyWalletSessionException.js +7 -0
- package/dist/esm/exceptions/exceptions/WalletConnectException.d.ts +7 -0
- package/dist/esm/exceptions/exceptions/WalletConnectException.js +27 -0
- package/dist/esm/exceptions/exceptions/WalletException.d.ts +5 -0
- package/dist/esm/exceptions/exceptions/WalletException.js +7 -0
- package/dist/esm/exceptions/exceptions/Web3Exception.d.ts +7 -0
- package/dist/esm/exceptions/exceptions/Web3Exception.js +12 -0
- package/dist/esm/exceptions/exceptions/index.d.ts +18 -0
- package/dist/esm/exceptions/exceptions/index.js +18 -0
- package/dist/esm/exceptions/index.d.ts +2 -0
- package/dist/esm/exceptions/index.js +2 -0
- package/dist/esm/exceptions/messages.d.ts +13 -0
- package/dist/esm/exceptions/messages.js +1597 -0
- package/dist/esm/exceptions/types/codes.d.ts +441 -0
- package/dist/esm/exceptions/types/codes.js +770 -0
- package/dist/esm/exceptions/types/context.d.ts +93 -0
- package/dist/esm/exceptions/types/context.js +18 -0
- package/dist/esm/exceptions/types/index.d.ts +3 -0
- package/dist/esm/exceptions/types/index.js +3 -0
- package/dist/esm/exceptions/types/modules.d.ts +67 -0
- package/dist/esm/exceptions/types/modules.js +63 -0
- package/dist/esm/exceptions/utils/grpc.d.ts +3 -0
- package/dist/esm/exceptions/utils/grpc.js +6 -0
- package/dist/esm/exceptions/utils/helpers.d.ts +1 -0
- package/dist/esm/exceptions/utils/helpers.js +20 -0
- package/dist/esm/exceptions/utils/maps.d.ts +13 -0
- package/dist/esm/exceptions/utils/maps.js +120 -0
- package/dist/esm/index.d.ts +3 -819
- package/dist/esm/index.js +2 -2695
- package/dist/esm/package.json +2 -2
- package/dist/esm/types.d.ts +2 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/utils.d.ts +8 -0
- package/dist/esm/utils.js +44 -0
- package/package.json +22 -22
- package/dist/cjs/index.cjs +0 -2741
- package/dist/cjs/index.d.cts +0 -819
package/dist/esm/package.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
}
|
|
2
|
+
"type": "module"
|
|
3
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { Web3Exception, WalletException, TrezorException, BitGetException, LedgerException, GeneralException, MetamaskException, OkxWalletException, HttpRequestException, TrustWalletException, TransactionException, LedgerCosmosException, CosmosWalletException, GrpcUnaryRequestException } from './exceptions/exceptions/index.js';
|
|
2
|
+
export type ThrownException = Web3Exception | LedgerException | TrezorException | WalletException | BitGetException | GeneralException | MetamaskException | OkxWalletException | HttpRequestException | TrustWalletException | TransactionException | CosmosWalletException | LedgerCosmosException | GrpcUnaryRequestException;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ThrownException } from './types.js';
|
|
2
|
+
import type { Exception } from './exceptions/types/index.js';
|
|
3
|
+
export declare const THROWN_EXCEPTIONS: string[];
|
|
4
|
+
export declare const isThrownException: (exception: Error | Exception | ThrownException) => boolean;
|
|
5
|
+
export declare const formatNotificationDescription: (description: string) => {
|
|
6
|
+
description: string;
|
|
7
|
+
tooltip: string;
|
|
8
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export const THROWN_EXCEPTIONS = [
|
|
2
|
+
'Web3Exception',
|
|
3
|
+
'LedgerException',
|
|
4
|
+
'TrezorException',
|
|
5
|
+
'WalletException',
|
|
6
|
+
'BitGetException',
|
|
7
|
+
'GeneralException',
|
|
8
|
+
'MetamaskException',
|
|
9
|
+
'OkxWalletException',
|
|
10
|
+
'HttpRequestException',
|
|
11
|
+
'TransactionException',
|
|
12
|
+
'TrustWalletException',
|
|
13
|
+
'LedgerCosmosException',
|
|
14
|
+
'CosmosWalletException',
|
|
15
|
+
'WalletConnectException',
|
|
16
|
+
'GrpcUnaryRequestException',
|
|
17
|
+
'TurnkeyWalletSessionException',
|
|
18
|
+
];
|
|
19
|
+
export const isThrownException = (exception) => {
|
|
20
|
+
if (THROWN_EXCEPTIONS.includes(exception.constructor.name)) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
if (THROWN_EXCEPTIONS.includes(exception.name)) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
if ('errorClass' in exception &&
|
|
27
|
+
THROWN_EXCEPTIONS.includes(exception.errorClass)) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
31
|
+
};
|
|
32
|
+
export const formatNotificationDescription = (description) => {
|
|
33
|
+
const DESCRIPTION_CHARACTER_LIMIT = 50;
|
|
34
|
+
if (description.length <= DESCRIPTION_CHARACTER_LIMIT) {
|
|
35
|
+
return {
|
|
36
|
+
description,
|
|
37
|
+
tooltip: '',
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
description: description.slice(0, DESCRIPTION_CHARACTER_LIMIT) + ' ...',
|
|
42
|
+
tooltip: description,
|
|
43
|
+
};
|
|
44
|
+
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@injectivelabs/exceptions",
|
|
3
3
|
"description": "List of exceptions that can be reused throughout Injective's projects.",
|
|
4
|
-
"version": "1.16.25
|
|
4
|
+
"version": "1.16.25",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"type": "module",
|
|
8
|
-
"types": "dist/
|
|
9
|
-
"main": "dist/cjs/index.
|
|
8
|
+
"types": "dist/cjs/index.d.ts",
|
|
9
|
+
"main": "dist/cjs/index.js",
|
|
10
10
|
"module": "dist/esm/index.js",
|
|
11
11
|
"author": {
|
|
12
12
|
"name": "InjectiveLabs",
|
|
@@ -22,38 +22,38 @@
|
|
|
22
22
|
".": {
|
|
23
23
|
"react-native": {
|
|
24
24
|
"import": "./dist/esm/index.js",
|
|
25
|
-
"require": "./dist/cjs/index.
|
|
26
|
-
"types": "./dist/cjs/index.d.
|
|
27
|
-
"default": "./dist/cjs/index.
|
|
25
|
+
"require": "./dist/cjs/index.js",
|
|
26
|
+
"types": "./dist/cjs/index.d.ts",
|
|
27
|
+
"default": "./dist/cjs/index.js"
|
|
28
28
|
},
|
|
29
29
|
"require": {
|
|
30
|
-
"types": "./dist/cjs/index.d.
|
|
31
|
-
"default": "./dist/cjs/index.
|
|
30
|
+
"types": "./dist/cjs/index.d.ts",
|
|
31
|
+
"default": "./dist/cjs/index.js"
|
|
32
32
|
},
|
|
33
33
|
"import": {
|
|
34
34
|
"types": "./dist/esm/index.d.ts",
|
|
35
35
|
"default": "./dist/esm/index.js"
|
|
36
36
|
},
|
|
37
37
|
"default": {
|
|
38
|
-
"types": "./dist/cjs/index.d.
|
|
39
|
-
"default": "./dist/cjs/index.
|
|
38
|
+
"types": "./dist/cjs/index.d.ts",
|
|
39
|
+
"default": "./dist/cjs/index.js"
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
|
-
"build": "pnpm
|
|
45
|
-
"build:
|
|
46
|
-
"build:
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"test
|
|
51
|
-
"test:
|
|
52
|
-
"
|
|
44
|
+
"build": "pnpm build:cjs && pnpm build:esm && pnpm build:post",
|
|
45
|
+
"build:cjs": "tsc --build --force tsconfig.build.json",
|
|
46
|
+
"build:esm": "tsc --build --force tsconfig.build.esm.json",
|
|
47
|
+
"build:watch": "tsc --build -w tsconfig.build.json && tsc -w --build tsconfig.build.esm.json && pnpm build:post",
|
|
48
|
+
"build:post": "shx cp ../../etc/stub/package.json.stub dist/cjs/package.json && shx cp ../../etc/stub/package.esm.json.stub dist/esm/package.json",
|
|
49
|
+
"clean": "tsc --build tsconfig.build.json --clean && tsc --build tsconfig.build.esm.json --clean && shx rm -rf coverage *.log junit.xml dist && jest --clearCache && shx mkdir -p dist",
|
|
50
|
+
"test": "jest",
|
|
51
|
+
"test:watch": "jest --watch",
|
|
52
|
+
"test:ci": "jest --coverage --ci --reporters='jest-junit'",
|
|
53
|
+
"coverage": "jest --coverage",
|
|
53
54
|
"coverage:show": "live-server coverage",
|
|
54
55
|
"dev": "ts-node -r tsconfig-paths/register src/index.ts",
|
|
55
|
-
"start": "node dist/index.js"
|
|
56
|
-
"lint": "eslint . --ext .ts,.js"
|
|
56
|
+
"start": "node dist/index.js"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"http-status-codes": "^2.3.0"
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"shx": "^0.3.4"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "8d76833757d81a27d05410ddab96bd9f513d6f5b"
|
|
65
65
|
}
|