@injectivelabs/exceptions 1.14.5-beta.5 → 1.14.5
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/LedgerCosmosException.d.ts +8 -0
- package/dist/cjs/exceptions/LedgerCosmosException.d.ts.map +1 -0
- package/dist/cjs/exceptions/LedgerCosmosException.js +40 -0
- package/dist/cjs/exceptions/LedgerCosmosException.js.map +1 -0
- package/dist/cjs/exceptions/index.d.ts +3 -2
- package/dist/cjs/exceptions/index.d.ts.map +1 -1
- package/dist/cjs/exceptions/index.js +4 -1
- package/dist/cjs/exceptions/index.js.map +1 -1
- package/dist/cjs/utils/helpers.d.ts.map +1 -1
- package/dist/cjs/utils/helpers.js +2 -3
- package/dist/cjs/utils/helpers.js.map +1 -1
- package/dist/esm/exceptions/LedgerCosmosException.d.ts +8 -0
- package/dist/esm/exceptions/LedgerCosmosException.d.ts.map +1 -0
- package/dist/esm/exceptions/LedgerCosmosException.js +36 -0
- package/dist/esm/exceptions/LedgerCosmosException.js.map +1 -0
- package/dist/esm/exceptions/index.d.ts +3 -2
- package/dist/esm/exceptions/index.d.ts.map +1 -1
- package/dist/esm/exceptions/index.js +3 -1
- package/dist/esm/exceptions/index.js.map +1 -1
- package/dist/esm/utils/helpers.d.ts.map +1 -1
- package/dist/esm/utils/helpers.js +2 -3
- package/dist/esm/utils/helpers.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ConcreteException } from '../exception';
|
|
2
|
+
import { ErrorContext } from '../types';
|
|
3
|
+
export declare class LedgerCosmosException extends ConcreteException {
|
|
4
|
+
errorClass: string;
|
|
5
|
+
constructor(error: Error, context?: ErrorContext);
|
|
6
|
+
parse(): void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=LedgerCosmosException.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LedgerCosmosException.d.ts","sourceRoot":"","sources":["../../../src/exceptions/LedgerCosmosException.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,EAAE,YAAY,EAAa,MAAM,UAAU,CAAA;AAGlD,qBAAa,qBAAsB,SAAQ,iBAAiB;IACnD,UAAU,EAAE,MAAM,CAA0B;gBAEvC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,YAAY;IAMzC,KAAK,IAAI,IAAI;CA4CrB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LedgerCosmosException = void 0;
|
|
4
|
+
const exception_1 = require("../exception");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
|
+
const helpers_1 = require("../utils/helpers");
|
|
7
|
+
class LedgerCosmosException extends exception_1.ConcreteException {
|
|
8
|
+
constructor(error, context) {
|
|
9
|
+
super(error, context);
|
|
10
|
+
this.errorClass = 'LedgerCosmosException';
|
|
11
|
+
this.type = types_1.ErrorType.WalletError;
|
|
12
|
+
}
|
|
13
|
+
parse() {
|
|
14
|
+
const { message } = this;
|
|
15
|
+
if ((0, helpers_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
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.LedgerCosmosException = LedgerCosmosException;
|
|
40
|
+
//# sourceMappingURL=LedgerCosmosException.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LedgerCosmosException.js","sourceRoot":"","sources":["../../../src/exceptions/LedgerCosmosException.ts"],"names":[],"mappings":";;;AAAA,4CAAgD;AAChD,oCAAkD;AAClD,8CAAsD;AAEtD,MAAa,qBAAsB,SAAQ,6BAAiB;IAG1D,YAAY,KAAY,EAAE,OAAsB;QAC9C,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QAHhB,eAAU,GAAW,uBAAuB,CAAA;QAKjD,IAAI,CAAC,IAAI,GAAG,iBAAS,CAAC,WAAW,CAAA;IACnC,CAAC;IAEM,KAAK;QACV,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;QAExB,IAAI,IAAA,6BAAmB,EAAC,OAAO,CAAC,EAAE;YAChC,IAAI,CAAC,UAAU,CACb,+EAA+E,CAChF,CAAA;SACF;QAED,IAAI,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAC,EAAE;YAC3C,IAAI,CAAC,UAAU,CACb,wFAAwF,CACzF,CAAA;SACF;QAED,IAAI,OAAO,CAAC,QAAQ,CAAC,qCAAqC,CAAC,EAAE;YAC3D,IAAI,CAAC,UAAU,CACb,4DAA4D,CAC7D,CAAA;SACF;QAED,IAAI,OAAO,CAAC,QAAQ,CAAC,qCAAqC,CAAC,EAAE;YAC3D,IAAI,CAAC,UAAU,CAAC,kDAAkD,CAAC,CAAA;SACpE;QAED,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;YAC5C,IAAI,CAAC,UAAU,CACb,wFAAwF,CACzF,CAAA;SACF;QAED,IACE,OAAO,CAAC,QAAQ,CAAC,gCAAgC,CAAC;YAClD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAC1B;YACA,IAAI,CAAC,UAAU,CAAC,+BAA+B,CAAC,CAAA;SACjD;QAED,IAAI,OAAO,CAAC,QAAQ,CAAC,2CAA2C,CAAC,EAAE;YACjE,IAAI,CAAC,UAAU,CACb,0FAA0F,CAC3F,CAAA;SACF;IACH,CAAC;CACF;AArDD,sDAqDC"}
|
|
@@ -3,6 +3,7 @@ import { HttpRequestException } from './HttpRequestException';
|
|
|
3
3
|
import { Web3Exception } from './Web3Exception';
|
|
4
4
|
import { GeneralException } from './GeneralException';
|
|
5
5
|
import { LedgerException } from './LedgerException';
|
|
6
|
+
import { LedgerCosmosException } from './LedgerCosmosException';
|
|
6
7
|
import { MetamaskException } from './MetamaskException';
|
|
7
8
|
import { TrustWalletException } from './TrustWalletException';
|
|
8
9
|
import { TrezorException } from './TrezorException';
|
|
@@ -10,7 +11,7 @@ import { CosmosWalletException } from './CosmosWalletException';
|
|
|
10
11
|
import { TransactionException } from './TransactionException';
|
|
11
12
|
import { WalletException } from './WalletException';
|
|
12
13
|
import { Exception } from '../types';
|
|
13
|
-
export type ThrownException = GrpcUnaryRequestException | HttpRequestException | Web3Exception | GeneralException | LedgerException | MetamaskException | TrustWalletException | TrezorException | CosmosWalletException | TransactionException | WalletException;
|
|
14
|
+
export type ThrownException = GrpcUnaryRequestException | HttpRequestException | Web3Exception | GeneralException | LedgerException | MetamaskException | TrustWalletException | TrezorException | CosmosWalletException | TransactionException | WalletException | LedgerCosmosException;
|
|
14
15
|
export declare const isThrownException: (exception: Error | Exception) => boolean;
|
|
15
|
-
export {
|
|
16
|
+
export { Web3Exception, LedgerException, TrezorException, WalletException, GeneralException, MetamaskException, TransactionException, TrustWalletException, HttpRequestException, LedgerCosmosException, CosmosWalletException, GrpcUnaryRequestException, };
|
|
16
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exceptions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAGpC,MAAM,MAAM,eAAe,GACvB,yBAAyB,GACzB,oBAAoB,GACpB,aAAa,GACb,gBAAgB,GAChB,eAAe,GACf,iBAAiB,GACjB,oBAAoB,GACpB,eAAe,GACf,qBAAqB,GACrB,oBAAoB,GACpB,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exceptions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAGpC,MAAM,MAAM,eAAe,GACvB,yBAAyB,GACzB,oBAAoB,GACpB,aAAa,GACb,gBAAgB,GAChB,eAAe,GACf,iBAAiB,GACjB,oBAAoB,GACpB,eAAe,GACf,qBAAqB,GACrB,oBAAoB,GACpB,eAAe,GACf,qBAAqB,CAAA;AAEzB,eAAO,MAAM,iBAAiB,cAAe,KAAK,GAAG,SAAS,KAAG,OAyBhE,CAAA;AAED,OAAO,EACL,aAAa,EACb,eAAe,EACf,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,yBAAyB,GAC1B,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.GrpcUnaryRequestException = exports.CosmosWalletException = exports.LedgerCosmosException = exports.HttpRequestException = exports.TrustWalletException = exports.TransactionException = exports.MetamaskException = exports.GeneralException = exports.WalletException = exports.TrezorException = exports.LedgerException = exports.Web3Exception = exports.isThrownException = void 0;
|
|
4
4
|
const GrpcUnaryRequestException_1 = require("./GrpcUnaryRequestException");
|
|
5
5
|
Object.defineProperty(exports, "GrpcUnaryRequestException", { enumerable: true, get: function () { return GrpcUnaryRequestException_1.GrpcUnaryRequestException; } });
|
|
6
6
|
const HttpRequestException_1 = require("./HttpRequestException");
|
|
@@ -11,6 +11,8 @@ const GeneralException_1 = require("./GeneralException");
|
|
|
11
11
|
Object.defineProperty(exports, "GeneralException", { enumerable: true, get: function () { return GeneralException_1.GeneralException; } });
|
|
12
12
|
const LedgerException_1 = require("./LedgerException");
|
|
13
13
|
Object.defineProperty(exports, "LedgerException", { enumerable: true, get: function () { return LedgerException_1.LedgerException; } });
|
|
14
|
+
const LedgerCosmosException_1 = require("./LedgerCosmosException");
|
|
15
|
+
Object.defineProperty(exports, "LedgerCosmosException", { enumerable: true, get: function () { return LedgerCosmosException_1.LedgerCosmosException; } });
|
|
14
16
|
const MetamaskException_1 = require("./MetamaskException");
|
|
15
17
|
Object.defineProperty(exports, "MetamaskException", { enumerable: true, get: function () { return MetamaskException_1.MetamaskException; } });
|
|
16
18
|
const TrustWalletException_1 = require("./TrustWalletException");
|
|
@@ -34,6 +36,7 @@ const isThrownException = (exception) => {
|
|
|
34
36
|
'Web3Exception',
|
|
35
37
|
'GeneralException',
|
|
36
38
|
'LedgerException',
|
|
39
|
+
'LedgerCosmosException',
|
|
37
40
|
'MetamaskException',
|
|
38
41
|
'TrezorException',
|
|
39
42
|
'CosmosWalletException',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/exceptions/index.ts"],"names":[],"mappings":";;;AAAA,2EAAuE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/exceptions/index.ts"],"names":[],"mappings":";;;AAAA,2EAAuE;AAoErE,0GApEO,qDAAyB,OAoEP;AAnE3B,iEAA6D;AAgE3D,qGAhEO,2CAAoB,OAgEP;AA/DtB,mDAA+C;AAuD7C,8FAvDO,6BAAa,OAuDP;AAtDf,yDAAqD;AA0DnD,iGA1DO,mCAAgB,OA0DP;AAzDlB,uDAAmD;AAsDjD,gGAtDO,iCAAe,OAsDP;AArDjB,mEAA+D;AA6D7D,sGA7DO,6CAAqB,OA6DP;AA5DvB,2DAAuD;AAwDrD,kGAxDO,qCAAiB,OAwDP;AAvDnB,iEAA6D;AAyD3D,qGAzDO,2CAAoB,OAyDP;AAxDtB,uDAAmD;AAmDjD,gGAnDO,iCAAe,OAmDP;AAlDjB,mEAA+D;AA0D7D,sGA1DO,6CAAqB,OA0DP;AAzDvB,iEAA6D;AAqD3D,qGArDO,2CAAoB,OAqDP;AApDtB,uDAAmD;AAiDjD,gGAjDO,iCAAe,OAiDP;AA/CjB,4CAAgD;AAgBzC,MAAM,iBAAiB,GAAG,CAAC,SAA4B,EAAW,EAAE;IACzE,IAAI,SAAS,YAAY,6BAAiB,EAAE;QAC1C,OAAO,IAAI,CAAA;KACZ;IAED,IACE;QACE,2BAA2B;QAC3B,sBAAsB;QACtB,eAAe;QACf,kBAAkB;QAClB,iBAAiB;QACjB,uBAAuB;QACvB,mBAAmB;QACnB,iBAAiB;QACjB,uBAAuB;QACvB,sBAAsB;QACtB,iBAAiB;QACjB,sBAAsB;KACvB,CAAC,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,EACtC;QACA,OAAO,IAAI,CAAA;KACZ;IAED,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAzBY,QAAA,iBAAiB,qBAyB7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/utils/helpers.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,UAAW,MAAM,
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/utils/helpers.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,UAAW,MAAM,YAmBhD,CAAA"}
|
|
@@ -15,9 +15,8 @@ const isCommonLockedError = (error) => {
|
|
|
15
15
|
'UNKNOWN_ERROR',
|
|
16
16
|
];
|
|
17
17
|
return (commonMessages.some((m) => m.includes(error)) ||
|
|
18
|
-
commonMessages
|
|
19
|
-
|
|
20
|
-
.some((m) => m.includes(error.toLowerCase())));
|
|
18
|
+
commonMessages.some((m) => error.toLowerCase().includes(m)) ||
|
|
19
|
+
commonMessages.some((m) => m.toLowerCase().includes(error.toLowerCase())));
|
|
21
20
|
};
|
|
22
21
|
exports.isCommonLockedError = isCommonLockedError;
|
|
23
22
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/utils/helpers.ts"],"names":[],"mappings":";;;AAAO,MAAM,mBAAmB,GAAG,CAAC,KAAa,EAAE,EAAE;IACnD,MAAM,cAAc,GAAG;QACrB,iCAAiC;QACjC,kCAAkC;QAClC,kCAAkC;QAClC,mBAAmB;QACnB,KAAK;QACL,QAAQ;QACR,2BAA2B;QAC3B,2BAA2B;QAC3B,uBAAuB;QACvB,eAAe;KAChB,CAAA;IAED,OAAO,CACL,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC7C,cAAc
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/utils/helpers.ts"],"names":[],"mappings":";;;AAAO,MAAM,mBAAmB,GAAG,CAAC,KAAa,EAAE,EAAE;IACnD,MAAM,cAAc,GAAG;QACrB,iCAAiC;QACjC,kCAAkC;QAClC,kCAAkC;QAClC,mBAAmB;QACnB,KAAK;QACL,QAAQ;QACR,2BAA2B;QAC3B,2BAA2B;QAC3B,uBAAuB;QACvB,eAAe;KAChB,CAAA;IAED,OAAO,CACL,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC7C,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC3D,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAC1E,CAAA;AACH,CAAC,CAAA;AAnBY,QAAA,mBAAmB,uBAmB/B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ConcreteException } from '../exception';
|
|
2
|
+
import { ErrorContext } from '../types';
|
|
3
|
+
export declare class LedgerCosmosException extends ConcreteException {
|
|
4
|
+
errorClass: string;
|
|
5
|
+
constructor(error: Error, context?: ErrorContext);
|
|
6
|
+
parse(): void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=LedgerCosmosException.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LedgerCosmosException.d.ts","sourceRoot":"","sources":["../../../src/exceptions/LedgerCosmosException.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,EAAE,YAAY,EAAa,MAAM,UAAU,CAAA;AAGlD,qBAAa,qBAAsB,SAAQ,iBAAiB;IACnD,UAAU,EAAE,MAAM,CAA0B;gBAEvC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,YAAY;IAMzC,KAAK,IAAI,IAAI;CA4CrB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ConcreteException } from '../exception';
|
|
2
|
+
import { ErrorType } from '../types';
|
|
3
|
+
import { isCommonLockedError } from '../utils/helpers';
|
|
4
|
+
export class LedgerCosmosException extends ConcreteException {
|
|
5
|
+
errorClass = 'LedgerCosmosException';
|
|
6
|
+
constructor(error, context) {
|
|
7
|
+
super(error, context);
|
|
8
|
+
this.type = ErrorType.WalletError;
|
|
9
|
+
}
|
|
10
|
+
parse() {
|
|
11
|
+
const { message } = this;
|
|
12
|
+
if (isCommonLockedError(message)) {
|
|
13
|
+
this.setMessage('Please ensure your Ledger is connected, unlocked and your Cosmos app is open.');
|
|
14
|
+
}
|
|
15
|
+
if (message.includes('No device selected.')) {
|
|
16
|
+
this.setMessage('Please make sure your Ledger device is connected, unlocked and your Cosmos app is open');
|
|
17
|
+
}
|
|
18
|
+
if (message.includes('Unable to set device configuration.')) {
|
|
19
|
+
this.setMessage('Please restart your Ledger device and try connecting again');
|
|
20
|
+
}
|
|
21
|
+
if (message.includes('Cannot read properties of undefined')) {
|
|
22
|
+
this.setMessage('Please make sure your Ledger device is connected');
|
|
23
|
+
}
|
|
24
|
+
if (message.toLowerCase().includes('locked')) {
|
|
25
|
+
this.setMessage('Please make sure your Ledger device is connected, unlocked and your Cosmos app is open');
|
|
26
|
+
}
|
|
27
|
+
if (message.includes('Condition of use not satisfied') ||
|
|
28
|
+
message.includes('0x6985')) {
|
|
29
|
+
this.setMessage('The request has been rejected');
|
|
30
|
+
}
|
|
31
|
+
if (message.includes('U2F browser support is needed for Ledger.')) {
|
|
32
|
+
this.setMessage('Please use the latest Chrome/Firefox browser versions to connect with your Ledger device');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=LedgerCosmosException.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LedgerCosmosException.js","sourceRoot":"","sources":["../../../src/exceptions/LedgerCosmosException.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,EAAgB,SAAS,EAAE,MAAM,UAAU,CAAA;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAA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|
|
4
4
|
import { GeneralException } from './GeneralException';
|
|
5
5
|
import { LedgerException } from './LedgerException';
|
|
6
|
+
import { LedgerCosmosException } from './LedgerCosmosException';
|
|
6
7
|
import { MetamaskException } from './MetamaskException';
|
|
7
8
|
import { TrustWalletException } from './TrustWalletException';
|
|
8
9
|
import { TrezorException } from './TrezorException';
|
|
@@ -10,7 +11,7 @@ import { CosmosWalletException } from './CosmosWalletException';
|
|
|
10
11
|
import { TransactionException } from './TransactionException';
|
|
11
12
|
import { WalletException } from './WalletException';
|
|
12
13
|
import { Exception } from '../types';
|
|
13
|
-
export type ThrownException = GrpcUnaryRequestException | HttpRequestException | Web3Exception | GeneralException | LedgerException | MetamaskException | TrustWalletException | TrezorException | CosmosWalletException | TransactionException | WalletException;
|
|
14
|
+
export type ThrownException = GrpcUnaryRequestException | HttpRequestException | Web3Exception | GeneralException | LedgerException | MetamaskException | TrustWalletException | TrezorException | CosmosWalletException | TransactionException | WalletException | LedgerCosmosException;
|
|
14
15
|
export declare const isThrownException: (exception: Error | Exception) => boolean;
|
|
15
|
-
export {
|
|
16
|
+
export { Web3Exception, LedgerException, TrezorException, WalletException, GeneralException, MetamaskException, TransactionException, TrustWalletException, HttpRequestException, LedgerCosmosException, CosmosWalletException, GrpcUnaryRequestException, };
|
|
16
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exceptions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM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AAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAGpC,MAAM,MAAM,eAAe,GACvB,yBAAyB,GACzB,oBAAoB,GACpB,aAAa,GACb,gBAAgB,GAChB,eAAe,GACf,iBAAiB,GACjB,oBAAoB,GACpB,eAAe,GACf,qBAAqB,GACrB,oBAAoB,GACpB,eAAe,GACf,qBAAqB,CAAA;AAEzB,eAAO,MAAM,iBAAiB,cAAe,KAAK,GAAG,SAAS,KAAG,OAyBhE,CAAA;AAED,OAAO,EACL,aAAa,EACb,eAAe,EACf,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,yBAAyB,GAC1B,CAAA"}
|
|
@@ -3,6 +3,7 @@ import { HttpRequestException } from './HttpRequestException';
|
|
|
3
3
|
import { Web3Exception } from './Web3Exception';
|
|
4
4
|
import { GeneralException } from './GeneralException';
|
|
5
5
|
import { LedgerException } from './LedgerException';
|
|
6
|
+
import { LedgerCosmosException } from './LedgerCosmosException';
|
|
6
7
|
import { MetamaskException } from './MetamaskException';
|
|
7
8
|
import { TrustWalletException } from './TrustWalletException';
|
|
8
9
|
import { TrezorException } from './TrezorException';
|
|
@@ -20,6 +21,7 @@ export const isThrownException = (exception) => {
|
|
|
20
21
|
'Web3Exception',
|
|
21
22
|
'GeneralException',
|
|
22
23
|
'LedgerException',
|
|
24
|
+
'LedgerCosmosException',
|
|
23
25
|
'MetamaskException',
|
|
24
26
|
'TrezorException',
|
|
25
27
|
'CosmosWalletException',
|
|
@@ -31,5 +33,5 @@ export const isThrownException = (exception) => {
|
|
|
31
33
|
}
|
|
32
34
|
return false;
|
|
33
35
|
};
|
|
34
|
-
export {
|
|
36
|
+
export { Web3Exception, LedgerException, TrezorException, WalletException, GeneralException, MetamaskException, TransactionException, TrustWalletException, HttpRequestException, LedgerCosmosException, CosmosWalletException, GrpcUnaryRequestException, };
|
|
35
37
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/exceptions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/exceptions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAgBhD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,SAA4B,EAAW,EAAE;IACzE,IAAI,SAAS,YAAY,iBAAiB,EAAE;QAC1C,OAAO,IAAI,CAAA;KACZ;IAED,IACE;QACE,2BAA2B;QAC3B,sBAAsB;QACtB,eAAe;QACf,kBAAkB;QAClB,iBAAiB;QACjB,uBAAuB;QACvB,mBAAmB;QACnB,iBAAiB;QACjB,uBAAuB;QACvB,sBAAsB;QACtB,iBAAiB;QACjB,sBAAsB;KACvB,CAAC,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,EACtC;QACA,OAAO,IAAI,CAAA;KACZ;IAED,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAED,OAAO,EACL,aAAa,EACb,eAAe,EACf,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,yBAAyB,GAC1B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/utils/helpers.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,UAAW,MAAM,
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/utils/helpers.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,UAAW,MAAM,YAmBhD,CAAA"}
|
|
@@ -12,8 +12,7 @@ export const isCommonLockedError = (error) => {
|
|
|
12
12
|
'UNKNOWN_ERROR',
|
|
13
13
|
];
|
|
14
14
|
return (commonMessages.some((m) => m.includes(error)) ||
|
|
15
|
-
commonMessages
|
|
16
|
-
|
|
17
|
-
.some((m) => m.includes(error.toLowerCase())));
|
|
15
|
+
commonMessages.some((m) => error.toLowerCase().includes(m)) ||
|
|
16
|
+
commonMessages.some((m) => m.toLowerCase().includes(error.toLowerCase())));
|
|
18
17
|
};
|
|
19
18
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/utils/helpers.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAa,EAAE,EAAE;IACnD,MAAM,cAAc,GAAG;QACrB,iCAAiC;QACjC,kCAAkC;QAClC,kCAAkC;QAClC,mBAAmB;QACnB,KAAK;QACL,QAAQ;QACR,2BAA2B;QAC3B,2BAA2B;QAC3B,uBAAuB;QACvB,eAAe;KAChB,CAAA;IAED,OAAO,CACL,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC7C,cAAc
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/utils/helpers.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAa,EAAE,EAAE;IACnD,MAAM,cAAc,GAAG;QACrB,iCAAiC;QACjC,kCAAkC;QAClC,kCAAkC;QAClC,mBAAmB;QACnB,KAAK;QACL,QAAQ;QACR,2BAA2B;QAC3B,2BAA2B;QAC3B,uBAAuB;QACvB,eAAe;KAChB,CAAA;IAED,OAAO,CACL,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC7C,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC3D,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAC1E,CAAA;AACH,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@injectivelabs/exceptions",
|
|
3
3
|
"description": "List of exceptions that can be reused throughout Injective's projects.",
|
|
4
|
-
"version": "1.14.5
|
|
4
|
+
"version": "1.14.5",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs/index.js",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@injectivelabs/grpc-web": "^0.0.1",
|
|
35
|
-
"@injectivelabs/ts-types": "^1.14.5
|
|
35
|
+
"@injectivelabs/ts-types": "^1.14.5",
|
|
36
36
|
"http-status-codes": "^2.2.0",
|
|
37
37
|
"link-module-alias": "^1.2.0",
|
|
38
38
|
"shx": "^0.3.2"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "06d0f3510dca5499c9402b8d73bbf19e1953e3e9"
|
|
41
41
|
}
|