@injectivelabs/exceptions 1.16.38 → 1.17.2-alpha.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.
Files changed (133) hide show
  1. package/dist/cjs/index.cjs +2759 -0
  2. package/dist/cjs/index.d.cts +826 -0
  3. package/dist/cjs/package.json +2 -2
  4. package/dist/esm/index.d.ts +826 -3
  5. package/dist/esm/index.js +2712 -2
  6. package/dist/esm/package.json +2 -2
  7. package/package.json +37 -38
  8. package/dist/cjs/exceptions/base.d.ts +0 -81
  9. package/dist/cjs/exceptions/base.js +0 -179
  10. package/dist/cjs/exceptions/exceptions/BitGetException.d.ts +0 -7
  11. package/dist/cjs/exceptions/exceptions/BitGetException.js +0 -31
  12. package/dist/cjs/exceptions/exceptions/CosmosWalletException.d.ts +0 -7
  13. package/dist/cjs/exceptions/exceptions/CosmosWalletException.js +0 -16
  14. package/dist/cjs/exceptions/exceptions/GeneralException.d.ts +0 -5
  15. package/dist/cjs/exceptions/exceptions/GeneralException.js +0 -11
  16. package/dist/cjs/exceptions/exceptions/GrpcUnaryRequestException.d.ts +0 -7
  17. package/dist/cjs/exceptions/exceptions/GrpcUnaryRequestException.js +0 -21
  18. package/dist/cjs/exceptions/exceptions/HttpRequestException.d.ts +0 -11
  19. package/dist/cjs/exceptions/exceptions/HttpRequestException.js +0 -21
  20. package/dist/cjs/exceptions/exceptions/LedgerCosmosException.d.ts +0 -7
  21. package/dist/cjs/exceptions/exceptions/LedgerCosmosException.js +0 -40
  22. package/dist/cjs/exceptions/exceptions/LedgerException.d.ts +0 -7
  23. package/dist/cjs/exceptions/exceptions/LedgerException.js +0 -40
  24. package/dist/cjs/exceptions/exceptions/MetamaskException.d.ts +0 -7
  25. package/dist/cjs/exceptions/exceptions/MetamaskException.js +0 -31
  26. package/dist/cjs/exceptions/exceptions/OkxWalletException.d.ts +0 -7
  27. package/dist/cjs/exceptions/exceptions/OkxWalletException.js +0 -31
  28. package/dist/cjs/exceptions/exceptions/RabbyWalletException.d.ts +0 -7
  29. package/dist/cjs/exceptions/exceptions/RabbyWalletException.js +0 -33
  30. package/dist/cjs/exceptions/exceptions/RainbowWalletException.d.ts +0 -7
  31. package/dist/cjs/exceptions/exceptions/RainbowWalletException.js +0 -31
  32. package/dist/cjs/exceptions/exceptions/TransactionException.d.ts +0 -7
  33. package/dist/cjs/exceptions/exceptions/TransactionException.js +0 -34
  34. package/dist/cjs/exceptions/exceptions/TrezorException.d.ts +0 -7
  35. package/dist/cjs/exceptions/exceptions/TrezorException.js +0 -16
  36. package/dist/cjs/exceptions/exceptions/TrustWalletException.d.ts +0 -7
  37. package/dist/cjs/exceptions/exceptions/TrustWalletException.js +0 -33
  38. package/dist/cjs/exceptions/exceptions/TurnkeyWalletSessionException.d.ts +0 -5
  39. package/dist/cjs/exceptions/exceptions/TurnkeyWalletSessionException.js +0 -11
  40. package/dist/cjs/exceptions/exceptions/WalletConnectException.d.ts +0 -7
  41. package/dist/cjs/exceptions/exceptions/WalletConnectException.js +0 -31
  42. package/dist/cjs/exceptions/exceptions/WalletException.d.ts +0 -5
  43. package/dist/cjs/exceptions/exceptions/WalletException.js +0 -11
  44. package/dist/cjs/exceptions/exceptions/Web3Exception.d.ts +0 -7
  45. package/dist/cjs/exceptions/exceptions/Web3Exception.js +0 -16
  46. package/dist/cjs/exceptions/exceptions/index.d.ts +0 -18
  47. package/dist/cjs/exceptions/exceptions/index.js +0 -37
  48. package/dist/cjs/exceptions/index.d.ts +0 -2
  49. package/dist/cjs/exceptions/index.js +0 -18
  50. package/dist/cjs/exceptions/messages.d.ts +0 -13
  51. package/dist/cjs/exceptions/messages.js +0 -1600
  52. package/dist/cjs/exceptions/types/codes.d.ts +0 -441
  53. package/dist/cjs/exceptions/types/codes.js +0 -774
  54. package/dist/cjs/exceptions/types/context.d.ts +0 -93
  55. package/dist/cjs/exceptions/types/context.js +0 -21
  56. package/dist/cjs/exceptions/types/index.d.ts +0 -3
  57. package/dist/cjs/exceptions/types/index.js +0 -19
  58. package/dist/cjs/exceptions/types/modules.d.ts +0 -67
  59. package/dist/cjs/exceptions/types/modules.js +0 -66
  60. package/dist/cjs/exceptions/utils/grpc.d.ts +0 -3
  61. package/dist/cjs/exceptions/utils/grpc.js +0 -43
  62. package/dist/cjs/exceptions/utils/helpers.d.ts +0 -1
  63. package/dist/cjs/exceptions/utils/helpers.js +0 -24
  64. package/dist/cjs/exceptions/utils/maps.d.ts +0 -13
  65. package/dist/cjs/exceptions/utils/maps.js +0 -127
  66. package/dist/cjs/index.d.ts +0 -3
  67. package/dist/cjs/index.js +0 -18
  68. package/dist/cjs/types.d.ts +0 -2
  69. package/dist/cjs/types.js +0 -2
  70. package/dist/cjs/utils.d.ts +0 -8
  71. package/dist/cjs/utils.js +0 -49
  72. package/dist/esm/exceptions/base.d.ts +0 -81
  73. package/dist/esm/exceptions/base.js +0 -175
  74. package/dist/esm/exceptions/exceptions/BitGetException.d.ts +0 -7
  75. package/dist/esm/exceptions/exceptions/BitGetException.js +0 -27
  76. package/dist/esm/exceptions/exceptions/CosmosWalletException.d.ts +0 -7
  77. package/dist/esm/exceptions/exceptions/CosmosWalletException.js +0 -12
  78. package/dist/esm/exceptions/exceptions/GeneralException.d.ts +0 -5
  79. package/dist/esm/exceptions/exceptions/GeneralException.js +0 -7
  80. package/dist/esm/exceptions/exceptions/GrpcUnaryRequestException.d.ts +0 -7
  81. package/dist/esm/exceptions/exceptions/GrpcUnaryRequestException.js +0 -17
  82. package/dist/esm/exceptions/exceptions/HttpRequestException.d.ts +0 -11
  83. package/dist/esm/exceptions/exceptions/HttpRequestException.js +0 -17
  84. package/dist/esm/exceptions/exceptions/LedgerCosmosException.d.ts +0 -7
  85. package/dist/esm/exceptions/exceptions/LedgerCosmosException.js +0 -36
  86. package/dist/esm/exceptions/exceptions/LedgerException.d.ts +0 -7
  87. package/dist/esm/exceptions/exceptions/LedgerException.js +0 -36
  88. package/dist/esm/exceptions/exceptions/MetamaskException.d.ts +0 -7
  89. package/dist/esm/exceptions/exceptions/MetamaskException.js +0 -27
  90. package/dist/esm/exceptions/exceptions/OkxWalletException.d.ts +0 -7
  91. package/dist/esm/exceptions/exceptions/OkxWalletException.js +0 -27
  92. package/dist/esm/exceptions/exceptions/RabbyWalletException.d.ts +0 -7
  93. package/dist/esm/exceptions/exceptions/RabbyWalletException.js +0 -29
  94. package/dist/esm/exceptions/exceptions/RainbowWalletException.d.ts +0 -7
  95. package/dist/esm/exceptions/exceptions/RainbowWalletException.js +0 -27
  96. package/dist/esm/exceptions/exceptions/TransactionException.d.ts +0 -7
  97. package/dist/esm/exceptions/exceptions/TransactionException.js +0 -30
  98. package/dist/esm/exceptions/exceptions/TrezorException.d.ts +0 -7
  99. package/dist/esm/exceptions/exceptions/TrezorException.js +0 -12
  100. package/dist/esm/exceptions/exceptions/TrustWalletException.d.ts +0 -7
  101. package/dist/esm/exceptions/exceptions/TrustWalletException.js +0 -29
  102. package/dist/esm/exceptions/exceptions/TurnkeyWalletSessionException.d.ts +0 -5
  103. package/dist/esm/exceptions/exceptions/TurnkeyWalletSessionException.js +0 -7
  104. package/dist/esm/exceptions/exceptions/WalletConnectException.d.ts +0 -7
  105. package/dist/esm/exceptions/exceptions/WalletConnectException.js +0 -27
  106. package/dist/esm/exceptions/exceptions/WalletException.d.ts +0 -5
  107. package/dist/esm/exceptions/exceptions/WalletException.js +0 -7
  108. package/dist/esm/exceptions/exceptions/Web3Exception.d.ts +0 -7
  109. package/dist/esm/exceptions/exceptions/Web3Exception.js +0 -12
  110. package/dist/esm/exceptions/exceptions/index.d.ts +0 -18
  111. package/dist/esm/exceptions/exceptions/index.js +0 -18
  112. package/dist/esm/exceptions/index.d.ts +0 -2
  113. package/dist/esm/exceptions/index.js +0 -2
  114. package/dist/esm/exceptions/messages.d.ts +0 -13
  115. package/dist/esm/exceptions/messages.js +0 -1597
  116. package/dist/esm/exceptions/types/codes.d.ts +0 -441
  117. package/dist/esm/exceptions/types/codes.js +0 -770
  118. package/dist/esm/exceptions/types/context.d.ts +0 -93
  119. package/dist/esm/exceptions/types/context.js +0 -18
  120. package/dist/esm/exceptions/types/index.d.ts +0 -3
  121. package/dist/esm/exceptions/types/index.js +0 -3
  122. package/dist/esm/exceptions/types/modules.d.ts +0 -67
  123. package/dist/esm/exceptions/types/modules.js +0 -63
  124. package/dist/esm/exceptions/utils/grpc.d.ts +0 -3
  125. package/dist/esm/exceptions/utils/grpc.js +0 -6
  126. package/dist/esm/exceptions/utils/helpers.d.ts +0 -1
  127. package/dist/esm/exceptions/utils/helpers.js +0 -20
  128. package/dist/esm/exceptions/utils/maps.d.ts +0 -13
  129. package/dist/esm/exceptions/utils/maps.js +0 -120
  130. package/dist/esm/types.d.ts +0 -2
  131. package/dist/esm/types.js +0 -1
  132. package/dist/esm/utils.d.ts +0 -8
  133. package/dist/esm/utils.js +0 -44
@@ -1,93 +0,0 @@
1
- import type { ErrorCode, ErrorContextCode } from './codes.js';
2
- export declare const HttpRequestMethod: {
3
- readonly Get: "GET";
4
- readonly Post: "POST";
5
- readonly Options: "OPTIONS";
6
- };
7
- export type HttpRequestMethod = (typeof HttpRequestMethod)[keyof typeof HttpRequestMethod];
8
- export declare const ErrorType: {
9
- readonly Unspecified: "unspecified";
10
- readonly ChainError: "chain-error";
11
- readonly ExecutionError: "execution-error";
12
- readonly NotFoundError: "not-found-error";
13
- readonly ValidationError: "validation-error";
14
- readonly WalletError: "wallet-error";
15
- readonly WalletNotInstalledError: "wallet-not-installed-error";
16
- readonly GrpcUnaryRequest: "grpc-unary-request";
17
- readonly HttpRequest: "http-request";
18
- readonly Web3: "web3";
19
- readonly Web3Gateway: "web3-gateway";
20
- };
21
- export type ErrorType = (typeof ErrorType)[keyof typeof ErrorType];
22
- export interface ErrorContext {
23
- code?: ErrorCode;
24
- type?: ErrorType;
25
- /**
26
- * Additional context needed for the exception
27
- */
28
- context?: string;
29
- /**
30
- * Where is the exception thrown
31
- */
32
- contextModule?: string;
33
- /**
34
- * Needed when we get a code error from a Http/Grpc Request
35
- * and we need to specify the error code for the particular message
36
- * for example why the transaction has failed
37
- * */
38
- contextCode?: ErrorContextCode;
39
- /**
40
- * If true, skip parsing the error message and use the raw message
41
- * Useful when you want to preserve the original error message without
42
- * any transformation or mapping
43
- */
44
- skipParsing?: boolean;
45
- }
46
- export interface Exception {
47
- /**
48
- * The type of the Error
49
- */
50
- type: ErrorType;
51
- /**
52
- * Error specific code (HttpStatus, GrpcStatus, etc)
53
- */
54
- code: ErrorCode;
55
- /**
56
- * The name of the error (the name of the instance of the Exception)
57
- */
58
- name: string;
59
- /**
60
- * Providing more context as to where the exception was thrown
61
- * (ex: on-chain module, etc)
62
- */
63
- contextModule?: string;
64
- /**
65
- * Providing more context as to why the exception was thrown
66
- * (ex: on-chain error code, etc)
67
- */
68
- contextCode?: ErrorContextCode;
69
- /**
70
- * Parsed message of the exception
71
- */
72
- message: string;
73
- /**
74
- * The original stack of the error
75
- */
76
- stack?: string;
77
- /**
78
- * The original message of the error
79
- */
80
- originalMessage: string;
81
- parse?(): void;
82
- parseError(error: Error): void;
83
- parseContext(context?: ErrorContext): void;
84
- setType(type: ErrorType): void;
85
- setCode(code: ErrorCode): void;
86
- setStack(stack: string): void;
87
- setName(name: string): void;
88
- setMessage(message: string): void;
89
- setContextModule(contextModule: string): void;
90
- toOriginalError(): Error;
91
- toError(): Error;
92
- toString(): string;
93
- }
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ErrorType = exports.HttpRequestMethod = void 0;
4
- exports.HttpRequestMethod = {
5
- Get: 'GET',
6
- Post: 'POST',
7
- Options: 'OPTIONS',
8
- };
9
- exports.ErrorType = {
10
- Unspecified: 'unspecified',
11
- ChainError: 'chain-error',
12
- ExecutionError: 'execution-error',
13
- NotFoundError: 'not-found-error',
14
- ValidationError: 'validation-error',
15
- WalletError: 'wallet-error',
16
- WalletNotInstalledError: 'wallet-not-installed-error',
17
- GrpcUnaryRequest: 'grpc-unary-request',
18
- HttpRequest: 'http-request',
19
- Web3: 'web3',
20
- Web3Gateway: 'web3-gateway',
21
- };
@@ -1,3 +0,0 @@
1
- export * from './modules.js';
2
- export * from './codes.js';
3
- export * from './context.js';
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./modules.js"), exports);
18
- __exportStar(require("./codes.js"), exports);
19
- __exportStar(require("./context.js"), exports);
@@ -1,67 +0,0 @@
1
- export declare const ContractErrorModule: {
2
- readonly Peggy: "peggy-contract";
3
- readonly PeggyOld: "peggy-old-contract";
4
- readonly Erc20Contract: "erc20-contract";
5
- };
6
- export type ContractErrorModule = (typeof ContractErrorModule)[keyof typeof ContractErrorModule];
7
- export declare const ChainErrorModule: {
8
- readonly Gov: "chain-gov";
9
- readonly Ibc: "chain-ibc";
10
- readonly Evm: "chain-evm";
11
- readonly Auth: "chain-auth";
12
- readonly Bank: "chain-bank";
13
- readonly Mint: "chain-mint";
14
- readonly Wasm: "chain-wasm";
15
- readonly Authz: "chain-authz";
16
- readonly Peggy: "chain-peggy";
17
- readonly WasmX: "chain-wasmx";
18
- readonly Erc20: "chain-erc20";
19
- readonly Oracle: "chain-oracle";
20
- readonly TxFees: "chain-tx-fees";
21
- readonly Auction: "chain-auction";
22
- readonly Staking: "chain-staking";
23
- readonly Exchange: "chain-exchange";
24
- readonly Tendermint: "chain-tendermint";
25
- readonly InsuranceFund: "chain-insurance";
26
- readonly Permissions: "chain-permissions";
27
- readonly Distribution: "chain-distribution";
28
- };
29
- export type ChainErrorModule = (typeof ChainErrorModule)[keyof typeof ChainErrorModule];
30
- export declare const IndexerErrorModule: {
31
- readonly Dmm: "dmm";
32
- readonly OLP: "olp";
33
- readonly Abacus: "abacus";
34
- readonly Meta: "indexer-meta";
35
- readonly Mito: "indexer-mito";
36
- readonly Referral: "referral";
37
- readonly Spot: "indexer-spot";
38
- readonly Web3Gw: "web3-gateway";
39
- readonly Oracle: "indexer-oracle";
40
- readonly Account: "indexer-account";
41
- readonly Auction: "indexer-auction";
42
- readonly Trading: "indexer-trading";
43
- readonly Archiver: "indexer-archiver";
44
- readonly Explorer: "indexer-explorer";
45
- readonly Campaign: "indexer-campaign";
46
- readonly Portfolio: "indexer-portfolio";
47
- readonly MegaVault: "indexer-mega-vault";
48
- readonly Derivatives: "indexer-derivatives";
49
- readonly Transaction: "indexer-transaction";
50
- readonly ChronosSpot: "indexer-chronos-spot";
51
- readonly InsuranceFund: "indexer-insurance-fund";
52
- readonly ChronosMarkets: "indexer-chronos-markets";
53
- readonly ChronosDerivative: "indexer-chronos-derivative";
54
- };
55
- export type IndexerErrorModule = (typeof IndexerErrorModule)[keyof typeof IndexerErrorModule];
56
- export declare const WalletErrorActionModule: {
57
- readonly GetChainId: "get-chain-id";
58
- readonly GetAccounts: "get-accounts";
59
- readonly GetNetworkId: "get-network-id";
60
- readonly SignArbitrary: "sign-arbitrary";
61
- readonly SignTransaction: "sign-transaction";
62
- readonly SendTransaction: "send-transaction";
63
- readonly SendEvmTransaction: "send-evm-transaction";
64
- readonly SignEvmTransaction: "sign-evm-transaction";
65
- readonly GetEvmTransactionReceipt: "get-evm-transaction-receipt";
66
- };
67
- export type WalletErrorActionModule = (typeof WalletErrorActionModule)[keyof typeof WalletErrorActionModule];
@@ -1,66 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WalletErrorActionModule = exports.IndexerErrorModule = exports.ChainErrorModule = exports.ContractErrorModule = void 0;
4
- exports.ContractErrorModule = {
5
- Peggy: 'peggy-contract',
6
- PeggyOld: 'peggy-old-contract',
7
- Erc20Contract: 'erc20-contract',
8
- };
9
- exports.ChainErrorModule = {
10
- Gov: 'chain-gov',
11
- Ibc: 'chain-ibc',
12
- Evm: 'chain-evm',
13
- Auth: 'chain-auth',
14
- Bank: 'chain-bank',
15
- Mint: 'chain-mint',
16
- Wasm: 'chain-wasm',
17
- Authz: 'chain-authz',
18
- Peggy: 'chain-peggy',
19
- WasmX: 'chain-wasmx',
20
- Erc20: 'chain-erc20',
21
- Oracle: 'chain-oracle',
22
- TxFees: 'chain-tx-fees',
23
- Auction: 'chain-auction',
24
- Staking: 'chain-staking',
25
- Exchange: 'chain-exchange',
26
- Tendermint: 'chain-tendermint',
27
- InsuranceFund: 'chain-insurance',
28
- Permissions: 'chain-permissions',
29
- Distribution: 'chain-distribution',
30
- };
31
- exports.IndexerErrorModule = {
32
- Dmm: 'dmm',
33
- OLP: 'olp',
34
- Abacus: 'abacus',
35
- Meta: 'indexer-meta',
36
- Mito: 'indexer-mito',
37
- Referral: 'referral',
38
- Spot: 'indexer-spot',
39
- Web3Gw: 'web3-gateway',
40
- Oracle: 'indexer-oracle',
41
- Account: 'indexer-account',
42
- Auction: 'indexer-auction',
43
- Trading: 'indexer-trading',
44
- Archiver: 'indexer-archiver',
45
- Explorer: 'indexer-explorer',
46
- Campaign: 'indexer-campaign',
47
- Portfolio: 'indexer-portfolio',
48
- MegaVault: 'indexer-mega-vault',
49
- Derivatives: 'indexer-derivatives',
50
- Transaction: 'indexer-transaction',
51
- ChronosSpot: 'indexer-chronos-spot',
52
- InsuranceFund: 'indexer-insurance-fund',
53
- ChronosMarkets: 'indexer-chronos-markets',
54
- ChronosDerivative: 'indexer-chronos-derivative',
55
- };
56
- exports.WalletErrorActionModule = {
57
- GetChainId: 'get-chain-id',
58
- GetAccounts: 'get-accounts',
59
- GetNetworkId: 'get-network-id',
60
- SignArbitrary: 'sign-arbitrary',
61
- SignTransaction: 'sign-transaction',
62
- SendTransaction: 'send-transaction',
63
- SendEvmTransaction: 'send-evm-transaction',
64
- SignEvmTransaction: 'sign-evm-transaction',
65
- GetEvmTransactionReceipt: 'get-evm-transaction-receipt',
66
- };
@@ -1,3 +0,0 @@
1
- import * as grpcPkg from '@injectivelabs/grpc-web';
2
- declare const grpc: typeof grpcPkg.grpc;
3
- export { grpc, grpcPkg };
@@ -1,43 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.grpcPkg = exports.grpc = void 0;
37
- const grpcPkg = __importStar(require("@injectivelabs/grpc-web"));
38
- exports.grpcPkg = grpcPkg;
39
- const grpc = grpcPkg.grpc ??
40
- grpcPkg.default
41
- .grpc ??
42
- grpcPkg;
43
- exports.grpc = grpc;
@@ -1 +0,0 @@
1
- export declare const isCommonLockedError: (error: string) => boolean;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isCommonLockedError = void 0;
4
- const isCommonLockedError = (error) => {
5
- const commonMessages = [
6
- 'Ledger device: Incorrect length',
7
- 'Ledger device: INS_NOT_SUPPORTED',
8
- 'Ledger device: CLA_NOT_SUPPORTED',
9
- 'Unknown',
10
- 'Ledger device',
11
- 'CLA_NOT_SUPPORTED',
12
- 'CLA',
13
- 'Locked',
14
- 'Failed to open the device',
15
- 'Failed to open the device',
16
- 'Ledger Device is busy',
17
- 'Ledger device',
18
- 'UNKNOWN_ERROR',
19
- ];
20
- return (commonMessages.some((m) => m.includes(error)) ||
21
- commonMessages.some((m) => error.toLowerCase().includes(m)) ||
22
- commonMessages.some((m) => m.toLowerCase().includes(error.toLowerCase())));
23
- };
24
- exports.isCommonLockedError = isCommonLockedError;
@@ -1,13 +0,0 @@
1
- import type { ErrorContext, ErrorContextCode, TransactionChainErrorModule } from '../types/index.js';
2
- export declare const parseErrorMessage: (message: string) => string;
3
- export declare const mapFailedTransactionMessageFromString: (message: string) => {
4
- message: string;
5
- code: ErrorContextCode;
6
- module?: TransactionChainErrorModule;
7
- };
8
- export declare const mapFailedTransactionMessage: (message: string, context?: ErrorContext) => {
9
- message: string;
10
- code: ErrorContextCode;
11
- contextModule?: string;
12
- };
13
- export declare const mapErrorMessage: (message: string) => string;
@@ -1,127 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mapErrorMessage = exports.mapFailedTransactionMessage = exports.mapFailedTransactionMessageFromString = exports.parseErrorMessage = void 0;
4
- const index_js_1 = require("../types/index.js");
5
- const messages_js_1 = require("../messages.js");
6
- const parseErrorMessage = (message) => {
7
- const firstParse = message.split('message index: 0:');
8
- if (firstParse.length === 1) {
9
- const [firstParseString] = firstParse;
10
- const secondParse = firstParseString.split(': invalid request');
11
- const [secondParseString] = secondParse;
12
- return secondParseString.trim().trimEnd();
13
- }
14
- const [, firstParseString] = firstParse;
15
- const [actualMessage] = firstParseString.split(': invalid request');
16
- return actualMessage.trim().trimEnd();
17
- };
18
- exports.parseErrorMessage = parseErrorMessage;
19
- const mapFailedTransactionMessageFromString = (message) => {
20
- const parsedMessage = (0, exports.parseErrorMessage)(message);
21
- const messageInMapKey = Object.keys(messages_js_1.chainErrorMessagesMap).find((key) => parsedMessage.toLowerCase().includes(key.toLowerCase()));
22
- if (!messageInMapKey) {
23
- return {
24
- message: parsedMessage,
25
- code: index_js_1.UnspecifiedErrorCode,
26
- module: undefined,
27
- };
28
- }
29
- return messages_js_1.chainErrorMessagesMap[messageInMapKey];
30
- };
31
- exports.mapFailedTransactionMessageFromString = mapFailedTransactionMessageFromString;
32
- const mapFailedTransactionMessage = (message, context) => {
33
- const getWasmErrorFromMessage = (message) => {
34
- if (!message.includes('execute wasm contract failed')) {
35
- return;
36
- }
37
- const ReasonPattern = /(.*?)execute wasm contract failed(.*?)/g;
38
- const reason = ReasonPattern.exec(message);
39
- if (!reason) {
40
- return;
41
- }
42
- if (reason.length < 2) {
43
- return;
44
- }
45
- return reason[1].replace('failed to execute message; message index: 0: ', '');
46
- };
47
- const getABCICode = (message) => {
48
- const ABCICodePattern = /{key:"ABCICode"[ \t]+value:"(.*?)"}/g;
49
- const ABCICode = ABCICodePattern.exec(message);
50
- if (!ABCICode || ABCICode.length < 2) {
51
- return;
52
- }
53
- return Number(ABCICode[1]);
54
- };
55
- const getContextModule = (message) => {
56
- const codespacePattern = /{key:"Codespace"[ \t]+value:"(.*?)"}/g;
57
- const codespace = codespacePattern.exec(message);
58
- if (!codespace || codespace.length < 2) {
59
- return;
60
- }
61
- return codespace[1];
62
- };
63
- const getReason = (message) => {
64
- const ReasonPattern = /\[reason:"(.*?)"/g;
65
- const codespace = ReasonPattern.exec(message);
66
- if (!codespace || codespace.length < 2) {
67
- if (message.includes('execute wasm contract failed')) {
68
- return getWasmErrorFromMessage(message);
69
- }
70
- return;
71
- }
72
- const reason = codespace[1];
73
- if (reason === 'execute wasm contract failed') {
74
- const SubReasonPattern = /(.*?)Generic error:(.*?): execute wasm/g;
75
- const subReason = SubReasonPattern.exec(message);
76
- if (!subReason) {
77
- return reason;
78
- }
79
- return subReason[2] || reason;
80
- }
81
- return reason;
82
- };
83
- const ABCICode = context && context.code ? context.code : getABCICode(message);
84
- const contextModule = context?.contextModule || getContextModule(message);
85
- const reason = getReason(message);
86
- if (!ABCICode || !contextModule) {
87
- const failedTxMap = (0, exports.mapFailedTransactionMessageFromString)(message);
88
- return {
89
- ...failedTxMap,
90
- contextModule: failedTxMap.module || contextModule,
91
- message: reason || failedTxMap.message,
92
- };
93
- }
94
- const codespaceErrorMessages = messages_js_1.chainModuleCodeErrorMessagesMap[contextModule];
95
- if (!codespaceErrorMessages) {
96
- return {
97
- message: reason || message,
98
- code: ABCICode,
99
- contextModule,
100
- };
101
- }
102
- return {
103
- message: codespaceErrorMessages[ABCICode] || reason || message,
104
- code: ABCICode,
105
- contextModule,
106
- };
107
- };
108
- exports.mapFailedTransactionMessage = mapFailedTransactionMessage;
109
- const mapErrorMessage = (message) => {
110
- const parsedMessage = message.trim().toLowerCase();
111
- if (parsedMessage.includes('User denied message signature'.toLowerCase())) {
112
- return 'The request has been rejected';
113
- }
114
- if (parsedMessage.toLowerCase().includes('user denied'.toLowerCase())) {
115
- return 'The request has been rejected';
116
- }
117
- if (parsedMessage.toLowerCase().includes('provided chain'.toLowerCase())) {
118
- return 'Your selected network is incorrect';
119
- }
120
- if (parsedMessage
121
- .toLowerCase()
122
- .includes('Keyring Controller signTypedMessage'.toLowerCase())) {
123
- return 'Please ensure your Ledger is connected, unlocked and your Ethereum app is open.';
124
- }
125
- return message.replaceAll('Keyring Controller signTypedMessage:', '');
126
- };
127
- exports.mapErrorMessage = mapErrorMessage;
@@ -1,3 +0,0 @@
1
- export * from './exceptions/index.js';
2
- export * from './utils.js';
3
- export type * from './types.js';
package/dist/cjs/index.js DELETED
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./exceptions/index.js"), exports);
18
- __exportStar(require("./utils.js"), exports);
@@ -1,2 +0,0 @@
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;
package/dist/cjs/types.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +0,0 @@
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
- };
package/dist/cjs/utils.js DELETED
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatNotificationDescription = exports.isThrownException = exports.THROWN_EXCEPTIONS = void 0;
4
- exports.THROWN_EXCEPTIONS = [
5
- 'Web3Exception',
6
- 'LedgerException',
7
- 'TrezorException',
8
- 'WalletException',
9
- 'BitGetException',
10
- 'GeneralException',
11
- 'MetamaskException',
12
- 'OkxWalletException',
13
- 'HttpRequestException',
14
- 'TransactionException',
15
- 'TrustWalletException',
16
- 'LedgerCosmosException',
17
- 'CosmosWalletException',
18
- 'WalletConnectException',
19
- 'GrpcUnaryRequestException',
20
- 'TurnkeyWalletSessionException',
21
- ];
22
- const isThrownException = (exception) => {
23
- if (exports.THROWN_EXCEPTIONS.includes(exception.constructor.name)) {
24
- return true;
25
- }
26
- if (exports.THROWN_EXCEPTIONS.includes(exception.name)) {
27
- return true;
28
- }
29
- if ('errorClass' in exception &&
30
- exports.THROWN_EXCEPTIONS.includes(exception.errorClass)) {
31
- return true;
32
- }
33
- return false;
34
- };
35
- exports.isThrownException = isThrownException;
36
- const formatNotificationDescription = (description) => {
37
- const DESCRIPTION_CHARACTER_LIMIT = 50;
38
- if (description.length <= DESCRIPTION_CHARACTER_LIMIT) {
39
- return {
40
- description,
41
- tooltip: '',
42
- };
43
- }
44
- return {
45
- description: description.slice(0, DESCRIPTION_CHARACTER_LIMIT) + ' ...',
46
- tooltip: description,
47
- };
48
- };
49
- exports.formatNotificationDescription = formatNotificationDescription;
@@ -1,81 +0,0 @@
1
- import { ErrorType } from './types/index.js';
2
- import type { Exception, ErrorContext, ErrorCode, ErrorContextCode } from './types/index.js';
3
- export declare abstract class ConcreteException extends Error implements Exception {
4
- /**
5
- * The type of the Error
6
- */
7
- type: ErrorType;
8
- /**
9
- * Error specific code (HttpStatus, GrpcStatus, etc)
10
- */
11
- code: ErrorCode;
12
- /**
13
- * The name of the error (the name of the instance of the Exception)
14
- */
15
- name: string;
16
- /**
17
- * The name of the error (the name of the instance of the Exception)
18
- * Needed for reporting reasons, ex: bugsnag
19
- */
20
- errorClass: string;
21
- /**
22
- * Providing more context
23
- * (ex: endpoint on http request)
24
- */
25
- context?: string;
26
- /**
27
- * Providing more context as to where the exception was thrown
28
- * (ex: on-chain module, etc)
29
- */
30
- contextModule?: string;
31
- /**
32
- * Providing more context as to why the exception was thrown
33
- * (ex: on-chain error code, etc)
34
- */
35
- contextCode?: ErrorContextCode;
36
- /**
37
- * Parsed message of the exception
38
- */
39
- message: string;
40
- /**
41
- * The original stack of the error
42
- */
43
- stack?: string;
44
- /**
45
- * The original message of the error
46
- */
47
- originalMessage: string;
48
- /**
49
- * Flag to skip parsing the error message
50
- */
51
- protected skipParsing: boolean;
52
- constructor(error: Error, context?: ErrorContext);
53
- parse(): void;
54
- parseError(error: Error): void;
55
- parseContext(errorContext?: ErrorContext): void;
56
- setType(type: ErrorType): void;
57
- setCode(code: ErrorCode): void;
58
- setContext(context: string): void;
59
- setOriginalMessage(message: string): void;
60
- setStack(stack: string): void;
61
- setName(name: string): void;
62
- setMessage(message: string): void;
63
- setContextModule(contextModule: string): void;
64
- setContextCode(code: ErrorContextCode): void;
65
- toOriginalError(): Error;
66
- toError(): Error;
67
- toCompactError(): Error;
68
- toJson(): string;
69
- toObject(): {
70
- code: ErrorCode;
71
- type: ErrorType;
72
- errorClass: string;
73
- message: string;
74
- context: string | undefined;
75
- contextCode: number | undefined;
76
- contextModule: string | undefined;
77
- originalMessage: string;
78
- stack: string[];
79
- };
80
- toString(): string;
81
- }