@injectivelabs/exceptions 1.15.0 → 1.15.1

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 (171) hide show
  1. package/dist/cjs/exceptions/base.d.ts +76 -0
  2. package/dist/cjs/exceptions/base.js +176 -0
  3. package/dist/cjs/exceptions/base.js.map +1 -0
  4. package/dist/cjs/exceptions/exceptions/BitGetException.d.ts +7 -0
  5. package/dist/cjs/exceptions/exceptions/BitGetException.js +24 -0
  6. package/dist/cjs/exceptions/exceptions/BitGetException.js.map +1 -0
  7. package/dist/cjs/exceptions/exceptions/CosmosWalletException.d.ts +7 -0
  8. package/dist/cjs/exceptions/exceptions/CosmosWalletException.js +17 -0
  9. package/dist/cjs/exceptions/exceptions/CosmosWalletException.js.map +1 -0
  10. package/dist/cjs/exceptions/exceptions/GeneralException.d.ts +5 -0
  11. package/dist/cjs/exceptions/exceptions/GeneralException.js +12 -0
  12. package/dist/cjs/exceptions/exceptions/GeneralException.js.map +1 -0
  13. package/dist/cjs/exceptions/exceptions/GrpcUnaryRequestException.d.ts +7 -0
  14. package/dist/cjs/exceptions/exceptions/GrpcUnaryRequestException.js +22 -0
  15. package/dist/cjs/exceptions/exceptions/GrpcUnaryRequestException.js.map +1 -0
  16. package/dist/cjs/exceptions/exceptions/HttpRequestException.d.ts +10 -0
  17. package/dist/cjs/exceptions/exceptions/HttpRequestException.js +22 -0
  18. package/dist/cjs/exceptions/exceptions/HttpRequestException.js.map +1 -0
  19. package/dist/cjs/exceptions/exceptions/LedgerCosmosException.d.ts +7 -0
  20. package/dist/cjs/exceptions/exceptions/LedgerCosmosException.js +41 -0
  21. package/dist/cjs/exceptions/exceptions/LedgerCosmosException.js.map +1 -0
  22. package/dist/cjs/exceptions/exceptions/LedgerException.d.ts +7 -0
  23. package/dist/cjs/exceptions/exceptions/LedgerException.js +41 -0
  24. package/dist/cjs/exceptions/exceptions/LedgerException.js.map +1 -0
  25. package/dist/cjs/exceptions/exceptions/MetamaskException.d.ts +7 -0
  26. package/dist/cjs/exceptions/exceptions/MetamaskException.js +24 -0
  27. package/dist/cjs/exceptions/exceptions/MetamaskException.js.map +1 -0
  28. package/dist/cjs/exceptions/exceptions/OkxWalletException.d.ts +7 -0
  29. package/dist/cjs/exceptions/exceptions/OkxWalletException.js +24 -0
  30. package/dist/cjs/exceptions/exceptions/OkxWalletException.js.map +1 -0
  31. package/dist/cjs/exceptions/exceptions/TransactionException.d.ts +7 -0
  32. package/dist/cjs/exceptions/exceptions/TransactionException.js +27 -0
  33. package/dist/cjs/exceptions/exceptions/TransactionException.js.map +1 -0
  34. package/dist/cjs/exceptions/exceptions/TrezorException.d.ts +7 -0
  35. package/dist/cjs/exceptions/exceptions/TrezorException.js +17 -0
  36. package/dist/cjs/exceptions/exceptions/TrezorException.js.map +1 -0
  37. package/dist/cjs/exceptions/exceptions/TrustWalletException.d.ts +7 -0
  38. package/dist/cjs/exceptions/exceptions/TrustWalletException.js +26 -0
  39. package/dist/cjs/exceptions/exceptions/TrustWalletException.js.map +1 -0
  40. package/dist/cjs/exceptions/exceptions/WalletException.d.ts +5 -0
  41. package/dist/cjs/exceptions/exceptions/WalletException.js +12 -0
  42. package/dist/cjs/exceptions/exceptions/WalletException.js.map +1 -0
  43. package/dist/cjs/exceptions/exceptions/Web3Exception.d.ts +7 -0
  44. package/dist/cjs/exceptions/exceptions/Web3Exception.js +17 -0
  45. package/dist/cjs/exceptions/exceptions/Web3Exception.js.map +1 -0
  46. package/dist/cjs/exceptions/exceptions/index.d.ts +15 -0
  47. package/dist/cjs/exceptions/exceptions/index.js +32 -0
  48. package/dist/cjs/exceptions/exceptions/index.js.map +1 -0
  49. package/dist/cjs/exceptions/index.d.ts +2 -0
  50. package/dist/cjs/exceptions/index.js +19 -0
  51. package/dist/cjs/exceptions/index.js.map +1 -0
  52. package/dist/cjs/exceptions/messages.d.ts +12 -0
  53. package/dist/cjs/exceptions/messages.js +1601 -0
  54. package/dist/cjs/exceptions/messages.js.map +1 -0
  55. package/dist/cjs/exceptions/types/codes.d.ts +424 -0
  56. package/dist/cjs/exceptions/types/codes.js +792 -0
  57. package/dist/cjs/exceptions/types/codes.js.map +1 -0
  58. package/dist/cjs/exceptions/types/context.d.ts +85 -0
  59. package/dist/cjs/exceptions/types/context.js +24 -0
  60. package/dist/cjs/exceptions/types/context.js.map +1 -0
  61. package/dist/cjs/exceptions/types/index.d.ts +3 -0
  62. package/dist/cjs/exceptions/types/index.js +20 -0
  63. package/dist/cjs/exceptions/types/index.js.map +1 -0
  64. package/dist/cjs/exceptions/types/modules.d.ts +59 -0
  65. package/dist/cjs/exceptions/types/modules.js +67 -0
  66. package/dist/cjs/exceptions/types/modules.js.map +1 -0
  67. package/dist/cjs/exceptions/utils/grpc.d.ts +3 -0
  68. package/dist/cjs/exceptions/utils/grpc.js +41 -0
  69. package/dist/cjs/exceptions/utils/grpc.js.map +1 -0
  70. package/dist/cjs/exceptions/utils/helpers.d.ts +1 -0
  71. package/dist/cjs/exceptions/utils/helpers.js +25 -0
  72. package/dist/cjs/exceptions/utils/helpers.js.map +1 -0
  73. package/dist/cjs/exceptions/utils/maps.d.ts +13 -0
  74. package/dist/cjs/exceptions/utils/maps.js +133 -0
  75. package/dist/cjs/exceptions/utils/maps.js.map +1 -0
  76. package/dist/cjs/index.d.ts +3 -0
  77. package/dist/cjs/index.js +20 -0
  78. package/dist/cjs/index.js.map +1 -0
  79. package/dist/cjs/package.json +3 -0
  80. package/dist/cjs/types.d.ts +2 -0
  81. package/dist/cjs/types.js +3 -0
  82. package/dist/cjs/types.js.map +1 -0
  83. package/dist/cjs/utils.d.ts +8 -0
  84. package/dist/cjs/utils.js +48 -0
  85. package/dist/cjs/utils.js.map +1 -0
  86. package/dist/esm/exceptions/base.d.ts +76 -0
  87. package/dist/esm/exceptions/base.js +172 -0
  88. package/dist/esm/exceptions/base.js.map +1 -0
  89. package/dist/esm/exceptions/exceptions/BitGetException.d.ts +7 -0
  90. package/dist/esm/exceptions/exceptions/BitGetException.js +20 -0
  91. package/dist/esm/exceptions/exceptions/BitGetException.js.map +1 -0
  92. package/dist/esm/exceptions/exceptions/CosmosWalletException.d.ts +7 -0
  93. package/dist/esm/exceptions/exceptions/CosmosWalletException.js +13 -0
  94. package/dist/esm/exceptions/exceptions/CosmosWalletException.js.map +1 -0
  95. package/dist/esm/exceptions/exceptions/GeneralException.d.ts +5 -0
  96. package/dist/esm/exceptions/exceptions/GeneralException.js +8 -0
  97. package/dist/esm/exceptions/exceptions/GeneralException.js.map +1 -0
  98. package/dist/esm/exceptions/exceptions/GrpcUnaryRequestException.d.ts +7 -0
  99. package/dist/esm/exceptions/exceptions/GrpcUnaryRequestException.js +18 -0
  100. package/dist/esm/exceptions/exceptions/GrpcUnaryRequestException.js.map +1 -0
  101. package/dist/esm/exceptions/exceptions/HttpRequestException.d.ts +10 -0
  102. package/dist/esm/exceptions/exceptions/HttpRequestException.js +18 -0
  103. package/dist/esm/exceptions/exceptions/HttpRequestException.js.map +1 -0
  104. package/dist/esm/exceptions/exceptions/LedgerCosmosException.d.ts +7 -0
  105. package/dist/esm/exceptions/exceptions/LedgerCosmosException.js +37 -0
  106. package/dist/esm/exceptions/exceptions/LedgerCosmosException.js.map +1 -0
  107. package/dist/esm/exceptions/exceptions/LedgerException.d.ts +7 -0
  108. package/dist/esm/exceptions/exceptions/LedgerException.js +37 -0
  109. package/dist/esm/exceptions/exceptions/LedgerException.js.map +1 -0
  110. package/dist/esm/exceptions/exceptions/MetamaskException.d.ts +7 -0
  111. package/dist/esm/exceptions/exceptions/MetamaskException.js +20 -0
  112. package/dist/esm/exceptions/exceptions/MetamaskException.js.map +1 -0
  113. package/dist/esm/exceptions/exceptions/OkxWalletException.d.ts +7 -0
  114. package/dist/esm/exceptions/exceptions/OkxWalletException.js +20 -0
  115. package/dist/esm/exceptions/exceptions/OkxWalletException.js.map +1 -0
  116. package/dist/esm/exceptions/exceptions/TransactionException.d.ts +7 -0
  117. package/dist/esm/exceptions/exceptions/TransactionException.js +23 -0
  118. package/dist/esm/exceptions/exceptions/TransactionException.js.map +1 -0
  119. package/dist/esm/exceptions/exceptions/TrezorException.d.ts +7 -0
  120. package/dist/esm/exceptions/exceptions/TrezorException.js +13 -0
  121. package/dist/esm/exceptions/exceptions/TrezorException.js.map +1 -0
  122. package/dist/esm/exceptions/exceptions/TrustWalletException.d.ts +7 -0
  123. package/dist/esm/exceptions/exceptions/TrustWalletException.js +22 -0
  124. package/dist/esm/exceptions/exceptions/TrustWalletException.js.map +1 -0
  125. package/dist/esm/exceptions/exceptions/WalletException.d.ts +5 -0
  126. package/dist/esm/exceptions/exceptions/WalletException.js +8 -0
  127. package/dist/esm/exceptions/exceptions/WalletException.js.map +1 -0
  128. package/dist/esm/exceptions/exceptions/Web3Exception.d.ts +7 -0
  129. package/dist/esm/exceptions/exceptions/Web3Exception.js +13 -0
  130. package/dist/esm/exceptions/exceptions/Web3Exception.js.map +1 -0
  131. package/dist/esm/exceptions/exceptions/index.d.ts +15 -0
  132. package/dist/esm/exceptions/exceptions/index.js +16 -0
  133. package/dist/esm/exceptions/exceptions/index.js.map +1 -0
  134. package/dist/esm/exceptions/index.d.ts +2 -0
  135. package/dist/esm/exceptions/index.js +3 -0
  136. package/dist/esm/exceptions/index.js.map +1 -0
  137. package/dist/esm/exceptions/messages.d.ts +12 -0
  138. package/dist/esm/exceptions/messages.js +1598 -0
  139. package/dist/esm/exceptions/messages.js.map +1 -0
  140. package/dist/esm/exceptions/types/codes.d.ts +424 -0
  141. package/dist/esm/exceptions/types/codes.js +788 -0
  142. package/dist/esm/exceptions/types/codes.js.map +1 -0
  143. package/dist/esm/exceptions/types/context.d.ts +85 -0
  144. package/dist/esm/exceptions/types/context.js +21 -0
  145. package/dist/esm/exceptions/types/context.js.map +1 -0
  146. package/dist/esm/exceptions/types/index.d.ts +3 -0
  147. package/dist/esm/exceptions/types/index.js +4 -0
  148. package/dist/esm/exceptions/types/index.js.map +1 -0
  149. package/dist/esm/exceptions/types/modules.d.ts +59 -0
  150. package/dist/esm/exceptions/types/modules.js +64 -0
  151. package/dist/esm/exceptions/types/modules.js.map +1 -0
  152. package/dist/esm/exceptions/utils/grpc.d.ts +3 -0
  153. package/dist/esm/exceptions/utils/grpc.js +4 -0
  154. package/dist/esm/exceptions/utils/grpc.js.map +1 -0
  155. package/dist/esm/exceptions/utils/helpers.d.ts +1 -0
  156. package/dist/esm/exceptions/utils/helpers.js +21 -0
  157. package/dist/esm/exceptions/utils/helpers.js.map +1 -0
  158. package/dist/esm/exceptions/utils/maps.d.ts +13 -0
  159. package/dist/esm/exceptions/utils/maps.js +126 -0
  160. package/dist/esm/exceptions/utils/maps.js.map +1 -0
  161. package/dist/esm/index.d.ts +3 -0
  162. package/dist/esm/index.js +4 -0
  163. package/dist/esm/index.js.map +1 -0
  164. package/dist/esm/package.json +3 -0
  165. package/dist/esm/types.d.ts +2 -0
  166. package/dist/esm/types.js +2 -0
  167. package/dist/esm/types.js.map +1 -0
  168. package/dist/esm/utils.d.ts +8 -0
  169. package/dist/esm/utils.js +43 -0
  170. package/dist/esm/utils.js.map +1 -0
  171. package/package.json +2 -2
@@ -0,0 +1,76 @@
1
+ import { Exception, ErrorType, ErrorContext, ErrorCode, ErrorContextCode } from './types/index.js';
2
+ export declare abstract class ConcreteException extends Error implements Exception {
3
+ /**
4
+ * The type of the Error
5
+ */
6
+ type: ErrorType;
7
+ /**
8
+ * Error specific code (HttpStatus, GrpcStatus, etc)
9
+ */
10
+ code: ErrorCode;
11
+ /**
12
+ * The name of the error (the name of the instance of the Exception)
13
+ */
14
+ name: string;
15
+ /**
16
+ * The name of the error (the name of the instance of the Exception)
17
+ * Needed for reporting reasons, ex: bugsnag
18
+ */
19
+ errorClass: string;
20
+ /**
21
+ * Providing more context
22
+ * (ex: endpoint on http request)
23
+ */
24
+ context?: string;
25
+ /**
26
+ * Providing more context as to where the exception was thrown
27
+ * (ex: on-chain module, etc)
28
+ */
29
+ contextModule?: string;
30
+ /**
31
+ * Providing more context as to why the exception was thrown
32
+ * (ex: on-chain error code, etc)
33
+ */
34
+ contextCode?: ErrorContextCode;
35
+ /**
36
+ * Parsed message of the exception
37
+ */
38
+ message: string;
39
+ /**
40
+ * The original stack of the error
41
+ */
42
+ stack?: string;
43
+ /**
44
+ * The original message of the error
45
+ */
46
+ originalMessage: string;
47
+ constructor(error: Error, context?: ErrorContext);
48
+ parse(): void;
49
+ parseError(error: Error): void;
50
+ parseContext(errorContext?: ErrorContext): void;
51
+ setType(type: ErrorType): void;
52
+ setCode(code: ErrorCode): void;
53
+ setContext(context: string): void;
54
+ setOriginalMessage(message: string): void;
55
+ setStack(stack: string): void;
56
+ setName(name: string): void;
57
+ setMessage(message: string): void;
58
+ setContextModule(contextModule: string): void;
59
+ setContextCode(code: ErrorContextCode): void;
60
+ toOriginalError(): Error;
61
+ toError(): Error;
62
+ toCompactError(): Error;
63
+ toJson(): string;
64
+ toObject(): {
65
+ code: ErrorCode;
66
+ type: ErrorType;
67
+ errorClass: string;
68
+ message: string;
69
+ context: string | undefined;
70
+ contextCode: ErrorContextCode | undefined;
71
+ contextModule: string | undefined;
72
+ originalMessage: string;
73
+ stack: string[];
74
+ };
75
+ toString(): string;
76
+ }
@@ -0,0 +1,176 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConcreteException = void 0;
4
+ /* eslint-disable class-methods-use-this */
5
+ const index_js_1 = require("./types/index.js");
6
+ /**
7
+ * we have to define it here as
8
+ * well as in @injectivelabs/utils as that package is
9
+ * importing the exceptions package
10
+ * */
11
+ const toPascalCase = (str) => {
12
+ return `${str}`
13
+ .toLowerCase()
14
+ .replace(new RegExp(/[-_]+/, 'g'), ' ')
15
+ .replace(new RegExp(/[^\w\s]/, 'g'), '')
16
+ .replace(new RegExp(/\s+(.)(\w*)/, 'g'), (_$1, $2, $3) => `${$2.toUpperCase() + $3}`)
17
+ .replace(new RegExp(/\w/), (s) => s.toUpperCase());
18
+ };
19
+ class ConcreteException extends Error {
20
+ /**
21
+ * The type of the Error
22
+ */
23
+ type = index_js_1.ErrorType.Unspecified;
24
+ /**
25
+ * Error specific code (HttpStatus, GrpcStatus, etc)
26
+ */
27
+ code = index_js_1.UnspecifiedErrorCode;
28
+ /**
29
+ * The name of the error (the name of the instance of the Exception)
30
+ */
31
+ name;
32
+ /**
33
+ * The name of the error (the name of the instance of the Exception)
34
+ * Needed for reporting reasons, ex: bugsnag
35
+ */
36
+ errorClass;
37
+ /**
38
+ * Providing more context
39
+ * (ex: endpoint on http request)
40
+ */
41
+ context;
42
+ /**
43
+ * Providing more context as to where the exception was thrown
44
+ * (ex: on-chain module, etc)
45
+ */
46
+ contextModule;
47
+ /**
48
+ * Providing more context as to why the exception was thrown
49
+ * (ex: on-chain error code, etc)
50
+ */
51
+ contextCode;
52
+ /**
53
+ * Parsed message of the exception
54
+ */
55
+ message = '';
56
+ /**
57
+ * The original stack of the error
58
+ */
59
+ stack = '';
60
+ /**
61
+ * The original message of the error
62
+ */
63
+ originalMessage = '';
64
+ constructor(error, context) {
65
+ super(error.message);
66
+ this.parseError(error);
67
+ this.parseContext(context);
68
+ this.parse();
69
+ }
70
+ parse() {
71
+ //
72
+ }
73
+ parseError(error) {
74
+ this.setStack(error.stack || '');
75
+ this.setMessage(error.message);
76
+ this.originalMessage = error.message;
77
+ }
78
+ parseContext(errorContext) {
79
+ const { contextModule, type, code, context } = errorContext || {
80
+ contextModule: 'Unknown',
81
+ context: 'Unknown',
82
+ code: index_js_1.UnspecifiedErrorCode,
83
+ type: index_js_1.ErrorType.Unspecified,
84
+ };
85
+ this.context = context;
86
+ this.contextModule = contextModule;
87
+ this.type = type || index_js_1.ErrorType.Unspecified;
88
+ this.code = code || index_js_1.UnspecifiedErrorCode;
89
+ }
90
+ setType(type) {
91
+ this.type = type;
92
+ }
93
+ setCode(code) {
94
+ this.code = code;
95
+ }
96
+ setContext(context) {
97
+ this.context = context;
98
+ }
99
+ setOriginalMessage(message) {
100
+ this.originalMessage = message;
101
+ }
102
+ setStack(stack) {
103
+ try {
104
+ this.stack = stack;
105
+ }
106
+ catch (e) {
107
+ // throw nothing here
108
+ }
109
+ }
110
+ setName(name) {
111
+ this.name = name;
112
+ this.errorClass = name;
113
+ super.name = name;
114
+ }
115
+ setMessage(message) {
116
+ this.message = message;
117
+ super.message = message;
118
+ }
119
+ setContextModule(contextModule) {
120
+ this.contextModule = contextModule;
121
+ }
122
+ setContextCode(code) {
123
+ this.contextCode = code;
124
+ }
125
+ toOriginalError() {
126
+ const error = new Error(this.originalMessage);
127
+ error.stack = this.stack;
128
+ error.name = this.name || '';
129
+ return error;
130
+ }
131
+ toError() {
132
+ const error = new Error(this.message);
133
+ error.stack = this.stack;
134
+ error.name = this.name || '';
135
+ return error;
136
+ }
137
+ toCompactError() {
138
+ const name = this.name || toPascalCase(this.type);
139
+ const error = new Error(`${this.message} | ${JSON.stringify({
140
+ type: this.type,
141
+ code: this.code,
142
+ errorClass: name,
143
+ message: this.message,
144
+ context: this.context,
145
+ contextCode: this.contextCode,
146
+ contextModule: this.contextModule,
147
+ originalMessage: this.originalMessage,
148
+ stack: (this.stack || '').split('\n').map((line) => line.trim()),
149
+ })}`);
150
+ error.stack = this.stack;
151
+ error.name = this.name || toPascalCase(this.type);
152
+ return error;
153
+ }
154
+ toJson() {
155
+ return JSON.stringify({ error: this.message, stack: this.stack });
156
+ }
157
+ toObject() {
158
+ const name = this.name || toPascalCase(this.type);
159
+ return {
160
+ code: this.code,
161
+ type: this.type,
162
+ errorClass: name,
163
+ message: this.message,
164
+ context: this.context,
165
+ contextCode: this.contextCode,
166
+ contextModule: this.contextModule,
167
+ originalMessage: this.originalMessage,
168
+ stack: (this.stack || '').split('\n').map((line) => line.trim()),
169
+ };
170
+ }
171
+ toString() {
172
+ return this.message;
173
+ }
174
+ }
175
+ exports.ConcreteException = ConcreteException;
176
+ //# sourceMappingURL=base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../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AAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;SACjE,CAAA;IACH,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;CACF;AA9LD,8CA8LC"}
@@ -0,0 +1,7 @@
1
+ import { ConcreteException } from '../base.js';
2
+ import { ErrorContext } from '../types/index.js';
3
+ export declare class BitGetException extends ConcreteException {
4
+ static errorClass: string;
5
+ constructor(error: Error, context?: ErrorContext);
6
+ parse(): void;
7
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BitGetException = void 0;
4
+ const base_js_1 = require("../base.js");
5
+ const index_js_1 = require("../types/index.js");
6
+ const maps_js_1 = require("../utils/maps.js");
7
+ const removeBitGetFromErrorString = (message) => message
8
+ .replaceAll('BitGet', '')
9
+ .replaceAll('Bitget:', '')
10
+ .replaceAll('Bitkeep:', '');
11
+ class BitGetException extends base_js_1.ConcreteException {
12
+ static errorClass = 'BitGetException';
13
+ constructor(error, context) {
14
+ super(error, context);
15
+ this.type = index_js_1.ErrorType.WalletError;
16
+ }
17
+ parse() {
18
+ const { message } = this;
19
+ this.setName(BitGetException.errorClass);
20
+ this.setMessage((0, maps_js_1.mapMetamaskMessage)(removeBitGetFromErrorString(message)));
21
+ }
22
+ }
23
+ exports.BitGetException = BitGetException;
24
+ //# sourceMappingURL=BitGetException.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BitGetException.js","sourceRoot":"","sources":["../../../../src/exceptions/exceptions/BitGetException.ts"],"names":[],"mappings":";;;AAAA,wCAA8C;AAC9C,gDAA2D;AAC3D,8CAAqD;AAErD,MAAM,2BAA2B,GAAG,CAAC,OAAe,EAAU,EAAE,CAC9D,OAAO;KACJ,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC;KACxB,UAAU,CAAC,SAAS,EAAE,EAAE,CAAC;KACzB,UAAU,CAAC,UAAU,EAAE,EAAE,CAAC,CAAA;AAE/B,MAAa,eAAgB,SAAQ,2BAAiB;IAC7C,MAAM,CAAC,UAAU,GAAW,iBAAiB,CAAA;IAEpD,YAAY,KAAY,EAAE,OAAsB;QAC9C,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QAErB,IAAI,CAAC,IAAI,GAAG,oBAAS,CAAC,WAAW,CAAA;IACnC,CAAC;IAEM,KAAK;QACV,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;QAExB,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,UAAU,CAAC,CAAA;QACxC,IAAI,CAAC,UAAU,CAAC,IAAA,4BAAkB,EAAC,2BAA2B,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IAC3E,CAAC;;AAdH,0CAeC"}
@@ -0,0 +1,7 @@
1
+ import { ConcreteException } from '../base.js';
2
+ import { ErrorContext } from '../types/index.js';
3
+ export declare class CosmosWalletException extends ConcreteException {
4
+ static errorClass: string;
5
+ constructor(error: Error, context?: ErrorContext);
6
+ parse(): void;
7
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CosmosWalletException = void 0;
4
+ const base_js_1 = require("../base.js");
5
+ const index_js_1 = require("../types/index.js");
6
+ class CosmosWalletException extends base_js_1.ConcreteException {
7
+ static errorClass = 'CosmosWalletException';
8
+ constructor(error, context) {
9
+ super(error, context);
10
+ this.type = index_js_1.ErrorType.WalletError;
11
+ }
12
+ parse() {
13
+ this.setName(CosmosWalletException.errorClass);
14
+ }
15
+ }
16
+ exports.CosmosWalletException = CosmosWalletException;
17
+ //# sourceMappingURL=CosmosWalletException.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CosmosWalletException.js","sourceRoot":"","sources":["../../../../src/exceptions/exceptions/CosmosWalletException.ts"],"names":[],"mappings":";;;AAAA,wCAA8C;AAC9C,gDAA2D;AAE3D,MAAa,qBAAsB,SAAQ,2BAAiB;IACnD,MAAM,CAAC,UAAU,GAAW,uBAAuB,CAAA;IAE1D,YAAY,KAAY,EAAE,OAAsB;QAC9C,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QAErB,IAAI,CAAC,IAAI,GAAG,oBAAS,CAAC,WAAW,CAAA;IACnC,CAAC;IAEM,KAAK;QACV,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAA;IAChD,CAAC;;AAXH,sDAYC"}
@@ -0,0 +1,5 @@
1
+ import { ConcreteException } from '../base.js';
2
+ export declare class GeneralException extends ConcreteException {
3
+ static errorClass: string;
4
+ parse(): void;
5
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GeneralException = void 0;
4
+ const base_js_1 = require("../base.js");
5
+ class GeneralException extends base_js_1.ConcreteException {
6
+ static errorClass = 'GeneralException';
7
+ parse() {
8
+ this.setName(GeneralException.errorClass);
9
+ }
10
+ }
11
+ exports.GeneralException = GeneralException;
12
+ //# sourceMappingURL=GeneralException.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GeneralException.js","sourceRoot":"","sources":["../../../../src/exceptions/exceptions/GeneralException.ts"],"names":[],"mappings":";;;AAAA,wCAA8C;AAE9C,MAAa,gBAAiB,SAAQ,2BAAiB;IAC9C,MAAM,CAAC,UAAU,GAAW,kBAAkB,CAAA;IAE9C,KAAK;QACV,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAA;IAC3C,CAAC;;AALH,4CAMC"}
@@ -0,0 +1,7 @@
1
+ import { ConcreteException } from '../base.js';
2
+ import { ErrorContext } from '../types/index.js';
3
+ export declare class GrpcUnaryRequestException extends ConcreteException {
4
+ static errorClass: string;
5
+ constructor(error: Error, context?: ErrorContext);
6
+ parse(): void;
7
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GrpcUnaryRequestException = void 0;
4
+ const base_js_1 = require("../base.js");
5
+ const index_js_1 = require("../types/index.js");
6
+ class GrpcUnaryRequestException extends base_js_1.ConcreteException {
7
+ static errorClass = 'GrpcUnaryRequestException';
8
+ constructor(error, context) {
9
+ super(error, context);
10
+ this.type = index_js_1.ErrorType.GrpcUnaryRequest;
11
+ }
12
+ parse() {
13
+ const { message } = this;
14
+ if (message.toLowerCase().includes('response closed without headers')) {
15
+ this.setMessage('The request has failed. The server has closed the connection without sending any headers.');
16
+ this.setContextCode(index_js_1.GRPC_REQUEST_FAILED);
17
+ }
18
+ this.setName(GrpcUnaryRequestException.errorClass);
19
+ }
20
+ }
21
+ exports.GrpcUnaryRequestException = GrpcUnaryRequestException;
22
+ //# sourceMappingURL=GrpcUnaryRequestException.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GrpcUnaryRequestException.js","sourceRoot":"","sources":["../../../../src/exceptions/exceptions/GrpcUnaryRequestException.ts"],"names":[],"mappings":";;;AAAA,wCAA8C;AAC9C,gDAAgF;AAEhF,MAAa,yBAA0B,SAAQ,2BAAiB;IACvD,MAAM,CAAC,UAAU,GAAW,2BAA2B,CAAA;IAE9D,YAAY,KAAY,EAAE,OAAsB;QAC9C,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QAErB,IAAI,CAAC,IAAI,GAAG,oBAAS,CAAC,gBAAgB,CAAA;IACxC,CAAC;IAEM,KAAK;QACV,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;QAExB,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC,EAAE,CAAC;YACtE,IAAI,CAAC,UAAU,CACb,2FAA2F,CAC5F,CAAA;YACD,IAAI,CAAC,cAAc,CAAC,8BAAmB,CAAC,CAAA;QAC1C,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,yBAAyB,CAAC,UAAU,CAAC,CAAA;IACpD,CAAC;;AApBH,8DAqBC"}
@@ -0,0 +1,10 @@
1
+ import { ConcreteException } from '../base.js';
2
+ import { ErrorContext, HttpRequestMethod } from '../types/index.js';
3
+ export declare class HttpRequestException extends ConcreteException {
4
+ static errorClass: string;
5
+ method: HttpRequestMethod;
6
+ constructor(error: Error, context?: ErrorContext & {
7
+ method?: HttpRequestMethod;
8
+ });
9
+ parse(): void;
10
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HttpRequestException = void 0;
4
+ const base_js_1 = require("../base.js");
5
+ const index_js_1 = require("../types/index.js");
6
+ class HttpRequestException extends base_js_1.ConcreteException {
7
+ static errorClass = 'HttpRequestException';
8
+ method = index_js_1.HttpRequestMethod.Get;
9
+ constructor(error, context) {
10
+ super(error, context);
11
+ this.type = index_js_1.ErrorType.HttpRequest;
12
+ this.method = context
13
+ ? context.method || index_js_1.HttpRequestMethod.Get
14
+ : index_js_1.HttpRequestMethod.Get;
15
+ this.context = context?.context || 'Unknown';
16
+ }
17
+ parse() {
18
+ this.setName(HttpRequestException.errorClass);
19
+ }
20
+ }
21
+ exports.HttpRequestException = HttpRequestException;
22
+ //# sourceMappingURL=HttpRequestException.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpRequestException.js","sourceRoot":"","sources":["../../../../src/exceptions/exceptions/HttpRequestException.ts"],"names":[],"mappings":";;;AAAA,wCAA8C;AAC9C,gDAA8E;AAE9E,MAAa,oBAAqB,SAAQ,2BAAiB;IAClD,MAAM,CAAC,UAAU,GAAW,sBAAsB,CAAA;IAElD,MAAM,GAAsB,4BAAiB,CAAC,GAAG,CAAA;IAExD,YACE,KAAY,EACZ,OAAuD;QAEvD,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QAErB,IAAI,CAAC,IAAI,GAAG,oBAAS,CAAC,WAAW,CAAA;QACjC,IAAI,CAAC,MAAM,GAAG,OAAO;YACnB,CAAC,CAAC,OAAO,CAAC,MAAM,IAAI,4BAAiB,CAAC,GAAG;YACzC,CAAC,CAAC,4BAAiB,CAAC,GAAG,CAAA;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,EAAE,OAAO,IAAI,SAAS,CAAA;IAC9C,CAAC;IAEM,KAAK;QACV,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAA;IAC/C,CAAC;;AApBH,oDAqBC"}
@@ -0,0 +1,7 @@
1
+ import { ConcreteException } from '../base.js';
2
+ import { ErrorContext } from '../types/index.js';
3
+ export declare class LedgerCosmosException extends ConcreteException {
4
+ static errorClass: string;
5
+ constructor(error: Error, context?: ErrorContext);
6
+ parse(): void;
7
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LedgerCosmosException = void 0;
4
+ const base_js_1 = require("../base.js");
5
+ const index_js_1 = require("../types/index.js");
6
+ const helpers_js_1 = require("../utils/helpers.js");
7
+ class LedgerCosmosException extends base_js_1.ConcreteException {
8
+ static errorClass = 'LedgerCosmosException';
9
+ constructor(error, context) {
10
+ super(error, context);
11
+ this.type = index_js_1.ErrorType.WalletError;
12
+ }
13
+ parse() {
14
+ const { message } = this;
15
+ if ((0, helpers_js_1.isCommonLockedError)(message)) {
16
+ this.setMessage('Please ensure your Ledger is connected, unlocked and your Cosmos app is open.');
17
+ }
18
+ if (message.includes('No device selected.')) {
19
+ this.setMessage('Please make sure your Ledger device is connected, unlocked and your Cosmos app is open');
20
+ }
21
+ if (message.includes('Unable to set device configuration.')) {
22
+ this.setMessage('Please restart your Ledger device and try connecting again');
23
+ }
24
+ if (message.includes('Cannot read properties of undefined')) {
25
+ this.setMessage('Please make sure your Ledger device is connected');
26
+ }
27
+ if (message.toLowerCase().includes('locked')) {
28
+ this.setMessage('Please make sure your Ledger device is connected, unlocked and your Cosmos app is open');
29
+ }
30
+ if (message.includes('Condition of use not satisfied') ||
31
+ message.includes('0x6985')) {
32
+ this.setMessage('The request has been rejected');
33
+ }
34
+ if (message.includes('U2F browser support is needed for Ledger.')) {
35
+ this.setMessage('Please use the latest Chrome/Firefox browser versions to connect with your Ledger device');
36
+ }
37
+ this.setName(LedgerCosmosException.errorClass);
38
+ }
39
+ }
40
+ exports.LedgerCosmosException = LedgerCosmosException;
41
+ //# sourceMappingURL=LedgerCosmosException.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LedgerCosmosException.js","sourceRoot":"","sources":["../../../../src/exceptions/exceptions/LedgerCosmosException.ts"],"names":[],"mappings":";;;AAAA,wCAA8C;AAC9C,gDAA2D;AAC3D,oDAAyD;AAEzD,MAAa,qBAAsB,SAAQ,2BAAiB;IACnD,MAAM,CAAC,UAAU,GAAW,uBAAuB,CAAA;IAE1D,YAAY,KAAY,EAAE,OAAsB;QAC9C,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QAErB,IAAI,CAAC,IAAI,GAAG,oBAAS,CAAC,WAAW,CAAA;IACnC,CAAC;IAEM,KAAK;QACV,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;QAExB,IAAI,IAAA,gCAAmB,EAAC,OAAO,CAAC,EAAE,CAAC;YACjC,IAAI,CAAC,UAAU,CACb,+EAA+E,CAChF,CAAA;QACH,CAAC;QAED,IAAI,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAC,EAAE,CAAC;YAC5C,IAAI,CAAC,UAAU,CACb,wFAAwF,CACzF,CAAA;QACH,CAAC;QAED,IAAI,OAAO,CAAC,QAAQ,CAAC,qCAAqC,CAAC,EAAE,CAAC;YAC5D,IAAI,CAAC,UAAU,CACb,4DAA4D,CAC7D,CAAA;QACH,CAAC;QAED,IAAI,OAAO,CAAC,QAAQ,CAAC,qCAAqC,CAAC,EAAE,CAAC;YAC5D,IAAI,CAAC,UAAU,CAAC,kDAAkD,CAAC,CAAA;QACrE,CAAC;QAED,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC7C,IAAI,CAAC,UAAU,CACb,wFAAwF,CACzF,CAAA;QACH,CAAC;QAED,IACE,OAAO,CAAC,QAAQ,CAAC,gCAAgC,CAAC;YAClD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAC1B,CAAC;YACD,IAAI,CAAC,UAAU,CAAC,+BAA+B,CAAC,CAAA;QAClD,CAAC;QAED,IAAI,OAAO,CAAC,QAAQ,CAAC,2CAA2C,CAAC,EAAE,CAAC;YAClE,IAAI,CAAC,UAAU,CACb,0FAA0F,CAC3F,CAAA;QACH,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAA;IAChD,CAAC;;AAtDH,sDAuDC"}
@@ -0,0 +1,7 @@
1
+ import { ConcreteException } from '../base.js';
2
+ import { ErrorContext } from '../types/index.js';
3
+ export declare class LedgerException extends ConcreteException {
4
+ static errorClass: string;
5
+ constructor(error: Error, context?: ErrorContext);
6
+ parse(): void;
7
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LedgerException = void 0;
4
+ const base_js_1 = require("../base.js");
5
+ const index_js_1 = require("../types/index.js");
6
+ const helpers_js_1 = require("../utils/helpers.js");
7
+ class LedgerException extends base_js_1.ConcreteException {
8
+ static errorClass = 'LedgerException';
9
+ constructor(error, context) {
10
+ super(error, context);
11
+ this.type = index_js_1.ErrorType.WalletError;
12
+ }
13
+ parse() {
14
+ const { message } = this;
15
+ if ((0, helpers_js_1.isCommonLockedError)(message)) {
16
+ this.setMessage('Please ensure your Ledger is connected, unlocked and your Ethereum app is open.');
17
+ }
18
+ if (message.includes('No device selected.')) {
19
+ this.setMessage('Please make sure your Ledger device is connected, unlocked and your Ethereum app is open');
20
+ }
21
+ if (message.includes('Unable to set device configuration.')) {
22
+ this.setMessage('Please restart your Ledger device and try connecting again');
23
+ }
24
+ if (message.includes('Cannot read properties of undefined')) {
25
+ this.setMessage('Please make sure your Ledger device is connected');
26
+ }
27
+ if (message.toLowerCase().includes('locked')) {
28
+ this.setMessage('Please make sure your Ledger device is connected, unlocked and your Ethereum app is open');
29
+ }
30
+ if (message.includes('Condition of use not satisfied') ||
31
+ message.includes('0x6985')) {
32
+ this.setMessage('The request has been rejected');
33
+ }
34
+ if (message.includes('U2F browser support is needed for Ledger.')) {
35
+ this.setMessage('Please use the latest Chrome/Firefox browser versions to connect with your Ledger device');
36
+ }
37
+ this.setName(LedgerException.errorClass);
38
+ }
39
+ }
40
+ exports.LedgerException = LedgerException;
41
+ //# sourceMappingURL=LedgerException.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LedgerException.js","sourceRoot":"","sources":["../../../../src/exceptions/exceptions/LedgerException.ts"],"names":[],"mappings":";;;AAAA,wCAA8C;AAC9C,gDAA2D;AAC3D,oDAAyD;AAEzD,MAAa,eAAgB,SAAQ,2BAAiB;IAC7C,MAAM,CAAC,UAAU,GAAW,iBAAiB,CAAA;IAEpD,YAAY,KAAY,EAAE,OAAsB;QAC9C,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QAErB,IAAI,CAAC,IAAI,GAAG,oBAAS,CAAC,WAAW,CAAA;IACnC,CAAC;IAEM,KAAK;QACV,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;QAExB,IAAI,IAAA,gCAAmB,EAAC,OAAO,CAAC,EAAE,CAAC;YACjC,IAAI,CAAC,UAAU,CACb,iFAAiF,CAClF,CAAA;QACH,CAAC;QAED,IAAI,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAC,EAAE,CAAC;YAC5C,IAAI,CAAC,UAAU,CACb,0FAA0F,CAC3F,CAAA;QACH,CAAC;QAED,IAAI,OAAO,CAAC,QAAQ,CAAC,qCAAqC,CAAC,EAAE,CAAC;YAC5D,IAAI,CAAC,UAAU,CACb,4DAA4D,CAC7D,CAAA;QACH,CAAC;QAED,IAAI,OAAO,CAAC,QAAQ,CAAC,qCAAqC,CAAC,EAAE,CAAC;YAC5D,IAAI,CAAC,UAAU,CAAC,kDAAkD,CAAC,CAAA;QACrE,CAAC;QAED,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC7C,IAAI,CAAC,UAAU,CACb,0FAA0F,CAC3F,CAAA;QACH,CAAC;QAED,IACE,OAAO,CAAC,QAAQ,CAAC,gCAAgC,CAAC;YAClD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAC1B,CAAC;YACD,IAAI,CAAC,UAAU,CAAC,+BAA+B,CAAC,CAAA;QAClD,CAAC;QAED,IAAI,OAAO,CAAC,QAAQ,CAAC,2CAA2C,CAAC,EAAE,CAAC;YAClE,IAAI,CAAC,UAAU,CACb,0FAA0F,CAC3F,CAAA;QACH,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,UAAU,CAAC,CAAA;IAC1C,CAAC;;AAtDH,0CAuDC"}
@@ -0,0 +1,7 @@
1
+ import { ConcreteException } from '../base.js';
2
+ import { ErrorContext } from '../types/index.js';
3
+ export declare class MetamaskException extends ConcreteException {
4
+ static errorClass: string;
5
+ constructor(error: Error, context?: ErrorContext);
6
+ parse(): void;
7
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MetamaskException = void 0;
4
+ const base_js_1 = require("../base.js");
5
+ const index_js_1 = require("../types/index.js");
6
+ const maps_js_1 = require("../utils/maps.js");
7
+ const removeMetamaskFromErrorString = (message) => message
8
+ .replaceAll('Metamask', '')
9
+ .replaceAll('MetaMask', '')
10
+ .replaceAll('Metamask:', '');
11
+ class MetamaskException extends base_js_1.ConcreteException {
12
+ static errorClass = 'MetamaskException';
13
+ constructor(error, context) {
14
+ super(error, context);
15
+ this.type = index_js_1.ErrorType.WalletError;
16
+ }
17
+ parse() {
18
+ const { message } = this;
19
+ this.setMessage((0, maps_js_1.mapMetamaskMessage)(removeMetamaskFromErrorString(message)));
20
+ this.setName(MetamaskException.errorClass);
21
+ }
22
+ }
23
+ exports.MetamaskException = MetamaskException;
24
+ //# sourceMappingURL=MetamaskException.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MetamaskException.js","sourceRoot":"","sources":["../../../../src/exceptions/exceptions/MetamaskException.ts"],"names":[],"mappings":";;;AAAA,wCAA8C;AAC9C,gDAA2D;AAC3D,8CAAqD;AAErD,MAAM,6BAA6B,GAAG,CAAC,OAAe,EAAU,EAAE,CAChE,OAAO;KACJ,UAAU,CAAC,UAAU,EAAE,EAAE,CAAC;KAC1B,UAAU,CAAC,UAAU,EAAE,EAAE,CAAC;KAC1B,UAAU,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AAEhC,MAAa,iBAAkB,SAAQ,2BAAiB;IAC/C,MAAM,CAAC,UAAU,GAAW,mBAAmB,CAAA;IAEtD,YAAY,KAAY,EAAE,OAAsB;QAC9C,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QAErB,IAAI,CAAC,IAAI,GAAG,oBAAS,CAAC,WAAW,CAAA;IACnC,CAAC;IAEM,KAAK;QACV,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;QAExB,IAAI,CAAC,UAAU,CAAC,IAAA,4BAAkB,EAAC,6BAA6B,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;QAE3E,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAA;IAC5C,CAAC;;AAfH,8CAgBC"}
@@ -0,0 +1,7 @@
1
+ import { ConcreteException } from '../base.js';
2
+ import { ErrorContext } from '../types/index.js';
3
+ export declare class OkxWalletException extends ConcreteException {
4
+ static errorClass: string;
5
+ constructor(error: Error, context?: ErrorContext);
6
+ parse(): void;
7
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OkxWalletException = void 0;
4
+ const base_js_1 = require("../base.js");
5
+ const index_js_1 = require("../types/index.js");
6
+ const maps_js_1 = require("../utils/maps.js");
7
+ const removeOkxWalletFromErrorString = (message) => message
8
+ .replaceAll('OkxWallet', '')
9
+ .replaceAll('Okx', '')
10
+ .replaceAll('OkxWallet:', '');
11
+ class OkxWalletException extends base_js_1.ConcreteException {
12
+ static errorClass = 'OkxWalletException';
13
+ constructor(error, context) {
14
+ super(error, context);
15
+ this.type = index_js_1.ErrorType.WalletError;
16
+ }
17
+ parse() {
18
+ const { message } = this;
19
+ this.setMessage((0, maps_js_1.mapMetamaskMessage)(removeOkxWalletFromErrorString(message)));
20
+ this.setName(OkxWalletException.errorClass);
21
+ }
22
+ }
23
+ exports.OkxWalletException = OkxWalletException;
24
+ //# sourceMappingURL=OkxWalletException.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OkxWalletException.js","sourceRoot":"","sources":["../../../../src/exceptions/exceptions/OkxWalletException.ts"],"names":[],"mappings":";;;AAAA,wCAA8C;AAC9C,gDAA2D;AAC3D,8CAAqD;AAErD,MAAM,8BAA8B,GAAG,CAAC,OAAe,EAAU,EAAE,CACjE,OAAO;KACJ,UAAU,CAAC,WAAW,EAAE,EAAE,CAAC;KAC3B,UAAU,CAAC,KAAK,EAAE,EAAE,CAAC;KACrB,UAAU,CAAC,YAAY,EAAE,EAAE,CAAC,CAAA;AAEjC,MAAa,kBAAmB,SAAQ,2BAAiB;IAChD,MAAM,CAAC,UAAU,GAAW,oBAAoB,CAAA;IAEvD,YAAY,KAAY,EAAE,OAAsB;QAC9C,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QAErB,IAAI,CAAC,IAAI,GAAG,oBAAS,CAAC,WAAW,CAAA;IACnC,CAAC;IAEM,KAAK;QACV,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;QAExB,IAAI,CAAC,UAAU,CAAC,IAAA,4BAAkB,EAAC,8BAA8B,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;QAE5E,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAA;IAC7C,CAAC;;AAfH,gDAgBC"}
@@ -0,0 +1,7 @@
1
+ import { ConcreteException } from '../base.js';
2
+ import { ErrorContext } from '../types/index.js';
3
+ export declare class TransactionException extends ConcreteException {
4
+ static errorClass: string;
5
+ constructor(error: Error, context?: ErrorContext);
6
+ parse(): void;
7
+ }