@injectivelabs/exceptions 1.16.5-alpha.2 → 1.16.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/README.md +2 -1
- package/dist/cjs/exceptions/exceptions/BitGetException.js +2 -10
- package/dist/cjs/exceptions/exceptions/MetamaskException.js +1 -9
- package/dist/cjs/exceptions/exceptions/OkxWalletException.js +4 -12
- package/dist/cjs/exceptions/exceptions/RainbowWalletException.js +2 -10
- package/dist/cjs/exceptions/exceptions/TrustWalletException.js +3 -11
- package/dist/cjs/exceptions/utils/maps.d.ts +1 -1
- package/dist/cjs/exceptions/utils/maps.js +10 -5
- package/dist/esm/exceptions/exceptions/BitGetException.js +2 -10
- package/dist/esm/exceptions/exceptions/MetamaskException.js +2 -10
- package/dist/esm/exceptions/exceptions/OkxWalletException.js +4 -12
- package/dist/esm/exceptions/exceptions/RainbowWalletException.js +2 -10
- package/dist/esm/exceptions/exceptions/TrustWalletException.js +3 -11
- package/dist/esm/exceptions/utils/maps.d.ts +1 -1
- package/dist/esm/exceptions/utils/maps.js +8 -3
- package/package.json +4 -4
- package/dist/cjs/exceptions/exceptions/RabbyWalletException.d.ts +0 -7
- package/dist/cjs/exceptions/exceptions/RabbyWalletException.js +0 -33
- package/dist/esm/exceptions/exceptions/RabbyWalletException.d.ts +0 -7
- package/dist/esm/exceptions/exceptions/RabbyWalletException.js +0 -29
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ Providing rich errors and converting some vague error messages thrown from Injec
|
|
|
7
7
|
## 📚 Installation
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
|
|
10
|
+
yarn add @injectivelabs/exceptions
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
---
|
|
@@ -34,6 +34,7 @@ Apache License <br />
|
|
|
34
34
|
Version 2.0, January 2004 <br />
|
|
35
35
|
http://www.apache.org/licenses/
|
|
36
36
|
|
|
37
|
+
|
|
37
38
|
<p> </p>
|
|
38
39
|
<div align="center">
|
|
39
40
|
<sub><em>Powering the future of decentralized finance.</em></sub>
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BitGetException = void 0;
|
|
4
4
|
const base_js_1 = require("../base.js");
|
|
5
|
-
const maps_js_1 = require("../utils/maps.js");
|
|
6
5
|
const index_js_1 = require("../types/index.js");
|
|
6
|
+
const maps_js_1 = require("../utils/maps.js");
|
|
7
7
|
const removeBitGetFromErrorString = (message) => message
|
|
8
8
|
.replaceAll('BitGet', '')
|
|
9
9
|
.replaceAll('Bitget:', '')
|
|
@@ -16,16 +16,8 @@ class BitGetException extends base_js_1.ConcreteException {
|
|
|
16
16
|
}
|
|
17
17
|
parse() {
|
|
18
18
|
const { message } = this;
|
|
19
|
-
if (message
|
|
20
|
-
.trim()
|
|
21
|
-
.toLowerCase()
|
|
22
|
-
.includes('missing or invalid parameters'.toLowerCase())) {
|
|
23
|
-
this.setMessage('Please make sure you are using BitGet Wallet');
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
this.setMessage((0, maps_js_1.mapErrorMessage)(removeBitGetFromErrorString(message)));
|
|
27
|
-
}
|
|
28
19
|
this.setName(BitGetException.errorClass);
|
|
20
|
+
this.setMessage((0, maps_js_1.mapMetamaskMessage)(removeBitGetFromErrorString(message)));
|
|
29
21
|
}
|
|
30
22
|
}
|
|
31
23
|
exports.BitGetException = BitGetException;
|
|
@@ -16,15 +16,7 @@ class MetamaskException extends base_js_1.ConcreteException {
|
|
|
16
16
|
}
|
|
17
17
|
parse() {
|
|
18
18
|
const { message } = this;
|
|
19
|
-
|
|
20
|
-
.trim()
|
|
21
|
-
.toLowerCase()
|
|
22
|
-
.includes('missing or invalid parameters'.toLowerCase())) {
|
|
23
|
-
this.setMessage('Please make sure you are using Metamask Wallet');
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
this.setMessage((0, maps_js_1.mapErrorMessage)(removeMetamaskFromErrorString(message)));
|
|
27
|
-
}
|
|
19
|
+
this.setMessage((0, maps_js_1.mapMetamaskMessage)(removeMetamaskFromErrorString(message)));
|
|
28
20
|
this.setName(MetamaskException.errorClass);
|
|
29
21
|
}
|
|
30
22
|
}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OkxWalletException = void 0;
|
|
4
4
|
const base_js_1 = require("../base.js");
|
|
5
|
-
const maps_js_1 = require("../utils/maps.js");
|
|
6
5
|
const index_js_1 = require("../types/index.js");
|
|
6
|
+
const maps_js_1 = require("../utils/maps.js");
|
|
7
7
|
const removeOkxWalletFromErrorString = (message) => message
|
|
8
8
|
.replaceAll('OkxWallet', '')
|
|
9
|
-
.replaceAll('
|
|
10
|
-
.replaceAll('
|
|
9
|
+
.replaceAll('Okx', '')
|
|
10
|
+
.replaceAll('OkxWallet:', '');
|
|
11
11
|
class OkxWalletException extends base_js_1.ConcreteException {
|
|
12
12
|
static errorClass = 'OkxWalletException';
|
|
13
13
|
constructor(error, context) {
|
|
@@ -16,15 +16,7 @@ class OkxWalletException extends base_js_1.ConcreteException {
|
|
|
16
16
|
}
|
|
17
17
|
parse() {
|
|
18
18
|
const { message } = this;
|
|
19
|
-
|
|
20
|
-
.trim()
|
|
21
|
-
.toLowerCase()
|
|
22
|
-
.includes('missing or invalid parameters'.toLowerCase())) {
|
|
23
|
-
this.setMessage('Please make sure you are using Okx Wallet');
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
this.setMessage((0, maps_js_1.mapErrorMessage)(removeOkxWalletFromErrorString(message)));
|
|
27
|
-
}
|
|
19
|
+
this.setMessage((0, maps_js_1.mapMetamaskMessage)(removeOkxWalletFromErrorString(message)));
|
|
28
20
|
this.setName(OkxWalletException.errorClass);
|
|
29
21
|
}
|
|
30
22
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RainbowWalletException = void 0;
|
|
4
4
|
const base_js_1 = require("../base.js");
|
|
5
|
-
const maps_js_1 = require("../utils/maps.js");
|
|
6
5
|
const index_js_1 = require("../types/index.js");
|
|
6
|
+
const maps_js_1 = require("../utils/maps.js");
|
|
7
7
|
const removeMetamaskFromErrorString = (message) => message
|
|
8
8
|
.replaceAll('Rainbow', '')
|
|
9
9
|
.replaceAll('RainBow', '')
|
|
@@ -16,15 +16,7 @@ class RainbowWalletException extends base_js_1.ConcreteException {
|
|
|
16
16
|
}
|
|
17
17
|
parse() {
|
|
18
18
|
const { message } = this;
|
|
19
|
-
|
|
20
|
-
.trim()
|
|
21
|
-
.toLowerCase()
|
|
22
|
-
.includes('missing or invalid parameters'.toLowerCase())) {
|
|
23
|
-
this.setMessage('Please make sure you are using Rainbow Wallet');
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
this.setMessage((0, maps_js_1.mapErrorMessage)(removeMetamaskFromErrorString(message)));
|
|
27
|
-
}
|
|
19
|
+
this.setMessage((0, maps_js_1.mapMetamaskMessage)(removeMetamaskFromErrorString(message)));
|
|
28
20
|
this.setName(RainbowWalletException.errorClass);
|
|
29
21
|
}
|
|
30
22
|
}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TrustWalletException = void 0;
|
|
4
4
|
const base_js_1 = require("../base.js");
|
|
5
|
-
const maps_js_1 = require("../utils/maps.js");
|
|
6
5
|
const index_js_1 = require("../types/index.js");
|
|
6
|
+
const maps_js_1 = require("../utils/maps.js");
|
|
7
7
|
const removeTrustWalletFromErrorString = (message) => message
|
|
8
|
-
.replaceAll('Trust Wallet', '')
|
|
9
8
|
.replaceAll('TrustWallet', '')
|
|
9
|
+
.replaceAll('Trust Wallet', '')
|
|
10
10
|
.replaceAll('Trustwallet', '')
|
|
11
11
|
.replaceAll('TrustWallet:', '')
|
|
12
12
|
.replaceAll('Trust Wallet:', '');
|
|
@@ -18,15 +18,7 @@ class TrustWalletException extends base_js_1.ConcreteException {
|
|
|
18
18
|
}
|
|
19
19
|
parse() {
|
|
20
20
|
const { message } = this;
|
|
21
|
-
|
|
22
|
-
.trim()
|
|
23
|
-
.toLowerCase()
|
|
24
|
-
.includes('missing or invalid parameters'.toLowerCase())) {
|
|
25
|
-
this.setMessage('Please make sure you are using TrustWallet');
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
this.setMessage((0, maps_js_1.mapErrorMessage)(removeTrustWalletFromErrorString(message)));
|
|
29
|
-
}
|
|
21
|
+
this.setMessage((0, maps_js_1.mapMetamaskMessage)(removeTrustWalletFromErrorString(message)));
|
|
30
22
|
this.setName(TrustWalletException.errorClass);
|
|
31
23
|
}
|
|
32
24
|
}
|
|
@@ -10,4 +10,4 @@ export declare const mapFailedTransactionMessage: (message: string, context?: Er
|
|
|
10
10
|
code: ErrorContextCode;
|
|
11
11
|
contextModule?: string;
|
|
12
12
|
};
|
|
13
|
-
export declare const
|
|
13
|
+
export declare const mapMetamaskMessage: (message: string) => string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const index_js_1 = require("../types/index.js");
|
|
3
|
+
exports.mapMetamaskMessage = exports.mapFailedTransactionMessage = exports.mapFailedTransactionMessageFromString = exports.parseErrorMessage = void 0;
|
|
5
4
|
const messages_js_1 = require("../messages.js");
|
|
5
|
+
const index_js_1 = require("../types/index.js");
|
|
6
6
|
const parseErrorMessage = (message) => {
|
|
7
7
|
const firstParse = message.split('message index: 0:');
|
|
8
8
|
if (firstParse.length === 1) {
|
|
@@ -106,7 +106,7 @@ const mapFailedTransactionMessage = (message, context) => {
|
|
|
106
106
|
};
|
|
107
107
|
};
|
|
108
108
|
exports.mapFailedTransactionMessage = mapFailedTransactionMessage;
|
|
109
|
-
const
|
|
109
|
+
const mapMetamaskMessage = (message) => {
|
|
110
110
|
const parsedMessage = message.trim().toLowerCase();
|
|
111
111
|
if (parsedMessage.includes('User denied message signature'.toLowerCase())) {
|
|
112
112
|
return 'The request has been rejected';
|
|
@@ -115,7 +115,12 @@ const mapErrorMessage = (message) => {
|
|
|
115
115
|
return 'The request has been rejected';
|
|
116
116
|
}
|
|
117
117
|
if (parsedMessage.toLowerCase().includes('provided chain'.toLowerCase())) {
|
|
118
|
-
return 'Your selected network is incorrect';
|
|
118
|
+
return 'Your Metamask selected network is incorrect';
|
|
119
|
+
}
|
|
120
|
+
if (parsedMessage
|
|
121
|
+
.toLowerCase()
|
|
122
|
+
.includes('missing or invalid parameters'.toLowerCase())) {
|
|
123
|
+
return 'Please make sure you are using Metamask';
|
|
119
124
|
}
|
|
120
125
|
if (parsedMessage
|
|
121
126
|
.toLowerCase()
|
|
@@ -124,4 +129,4 @@ const mapErrorMessage = (message) => {
|
|
|
124
129
|
}
|
|
125
130
|
return message.replaceAll('Keyring Controller signTypedMessage:', '');
|
|
126
131
|
};
|
|
127
|
-
exports.
|
|
132
|
+
exports.mapMetamaskMessage = mapMetamaskMessage;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ConcreteException } from '../base.js';
|
|
2
|
-
import { mapErrorMessage } from '../utils/maps.js';
|
|
3
2
|
import { ErrorType } from '../types/index.js';
|
|
3
|
+
import { mapMetamaskMessage } from '../utils/maps.js';
|
|
4
4
|
const removeBitGetFromErrorString = (message) => message
|
|
5
5
|
.replaceAll('BitGet', '')
|
|
6
6
|
.replaceAll('Bitget:', '')
|
|
@@ -13,15 +13,7 @@ export class BitGetException extends ConcreteException {
|
|
|
13
13
|
}
|
|
14
14
|
parse() {
|
|
15
15
|
const { message } = this;
|
|
16
|
-
if (message
|
|
17
|
-
.trim()
|
|
18
|
-
.toLowerCase()
|
|
19
|
-
.includes('missing or invalid parameters'.toLowerCase())) {
|
|
20
|
-
this.setMessage('Please make sure you are using BitGet Wallet');
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
this.setMessage(mapErrorMessage(removeBitGetFromErrorString(message)));
|
|
24
|
-
}
|
|
25
16
|
this.setName(BitGetException.errorClass);
|
|
17
|
+
this.setMessage(mapMetamaskMessage(removeBitGetFromErrorString(message)));
|
|
26
18
|
}
|
|
27
19
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ConcreteException } from '../base.js';
|
|
2
2
|
import { ErrorType } from '../types/index.js';
|
|
3
|
-
import {
|
|
3
|
+
import { mapMetamaskMessage } from '../utils/maps.js';
|
|
4
4
|
const removeMetamaskFromErrorString = (message) => message
|
|
5
5
|
.replaceAll('Metamask', '')
|
|
6
6
|
.replaceAll('MetaMask', '')
|
|
@@ -13,15 +13,7 @@ export class MetamaskException extends ConcreteException {
|
|
|
13
13
|
}
|
|
14
14
|
parse() {
|
|
15
15
|
const { message } = this;
|
|
16
|
-
|
|
17
|
-
.trim()
|
|
18
|
-
.toLowerCase()
|
|
19
|
-
.includes('missing or invalid parameters'.toLowerCase())) {
|
|
20
|
-
this.setMessage('Please make sure you are using Metamask Wallet');
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
this.setMessage(mapErrorMessage(removeMetamaskFromErrorString(message)));
|
|
24
|
-
}
|
|
16
|
+
this.setMessage(mapMetamaskMessage(removeMetamaskFromErrorString(message)));
|
|
25
17
|
this.setName(MetamaskException.errorClass);
|
|
26
18
|
}
|
|
27
19
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ConcreteException } from '../base.js';
|
|
2
|
-
import { mapErrorMessage } from '../utils/maps.js';
|
|
3
2
|
import { ErrorType } from '../types/index.js';
|
|
3
|
+
import { mapMetamaskMessage } from '../utils/maps.js';
|
|
4
4
|
const removeOkxWalletFromErrorString = (message) => message
|
|
5
5
|
.replaceAll('OkxWallet', '')
|
|
6
|
-
.replaceAll('
|
|
7
|
-
.replaceAll('
|
|
6
|
+
.replaceAll('Okx', '')
|
|
7
|
+
.replaceAll('OkxWallet:', '');
|
|
8
8
|
export class OkxWalletException extends ConcreteException {
|
|
9
9
|
static errorClass = 'OkxWalletException';
|
|
10
10
|
constructor(error, context) {
|
|
@@ -13,15 +13,7 @@ export class OkxWalletException extends ConcreteException {
|
|
|
13
13
|
}
|
|
14
14
|
parse() {
|
|
15
15
|
const { message } = this;
|
|
16
|
-
|
|
17
|
-
.trim()
|
|
18
|
-
.toLowerCase()
|
|
19
|
-
.includes('missing or invalid parameters'.toLowerCase())) {
|
|
20
|
-
this.setMessage('Please make sure you are using Okx Wallet');
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
this.setMessage(mapErrorMessage(removeOkxWalletFromErrorString(message)));
|
|
24
|
-
}
|
|
16
|
+
this.setMessage(mapMetamaskMessage(removeOkxWalletFromErrorString(message)));
|
|
25
17
|
this.setName(OkxWalletException.errorClass);
|
|
26
18
|
}
|
|
27
19
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ConcreteException } from '../base.js';
|
|
2
|
-
import { mapErrorMessage } from '../utils/maps.js';
|
|
3
2
|
import { ErrorType } from '../types/index.js';
|
|
3
|
+
import { mapMetamaskMessage } from '../utils/maps.js';
|
|
4
4
|
const removeMetamaskFromErrorString = (message) => message
|
|
5
5
|
.replaceAll('Rainbow', '')
|
|
6
6
|
.replaceAll('RainBow', '')
|
|
@@ -13,15 +13,7 @@ export class RainbowWalletException extends ConcreteException {
|
|
|
13
13
|
}
|
|
14
14
|
parse() {
|
|
15
15
|
const { message } = this;
|
|
16
|
-
|
|
17
|
-
.trim()
|
|
18
|
-
.toLowerCase()
|
|
19
|
-
.includes('missing or invalid parameters'.toLowerCase())) {
|
|
20
|
-
this.setMessage('Please make sure you are using Rainbow Wallet');
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
this.setMessage(mapErrorMessage(removeMetamaskFromErrorString(message)));
|
|
24
|
-
}
|
|
16
|
+
this.setMessage(mapMetamaskMessage(removeMetamaskFromErrorString(message)));
|
|
25
17
|
this.setName(RainbowWalletException.errorClass);
|
|
26
18
|
}
|
|
27
19
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ConcreteException } from '../base.js';
|
|
2
|
-
import { mapErrorMessage } from '../utils/maps.js';
|
|
3
2
|
import { ErrorType } from '../types/index.js';
|
|
3
|
+
import { mapMetamaskMessage } from '../utils/maps.js';
|
|
4
4
|
const removeTrustWalletFromErrorString = (message) => message
|
|
5
|
-
.replaceAll('Trust Wallet', '')
|
|
6
5
|
.replaceAll('TrustWallet', '')
|
|
6
|
+
.replaceAll('Trust Wallet', '')
|
|
7
7
|
.replaceAll('Trustwallet', '')
|
|
8
8
|
.replaceAll('TrustWallet:', '')
|
|
9
9
|
.replaceAll('Trust Wallet:', '');
|
|
@@ -15,15 +15,7 @@ export class TrustWalletException extends ConcreteException {
|
|
|
15
15
|
}
|
|
16
16
|
parse() {
|
|
17
17
|
const { message } = this;
|
|
18
|
-
|
|
19
|
-
.trim()
|
|
20
|
-
.toLowerCase()
|
|
21
|
-
.includes('missing or invalid parameters'.toLowerCase())) {
|
|
22
|
-
this.setMessage('Please make sure you are using TrustWallet');
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
this.setMessage(mapErrorMessage(removeTrustWalletFromErrorString(message)));
|
|
26
|
-
}
|
|
18
|
+
this.setMessage(mapMetamaskMessage(removeTrustWalletFromErrorString(message)));
|
|
27
19
|
this.setName(TrustWalletException.errorClass);
|
|
28
20
|
}
|
|
29
21
|
}
|
|
@@ -10,4 +10,4 @@ export declare const mapFailedTransactionMessage: (message: string, context?: Er
|
|
|
10
10
|
code: ErrorContextCode;
|
|
11
11
|
contextModule?: string;
|
|
12
12
|
};
|
|
13
|
-
export declare const
|
|
13
|
+
export declare const mapMetamaskMessage: (message: string) => string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UnspecifiedErrorCode, } from '../types/index.js';
|
|
2
1
|
import { chainErrorMessagesMap, chainModuleCodeErrorMessagesMap, } from '../messages.js';
|
|
2
|
+
import { UnspecifiedErrorCode, } from '../types/index.js';
|
|
3
3
|
export const parseErrorMessage = (message) => {
|
|
4
4
|
const firstParse = message.split('message index: 0:');
|
|
5
5
|
if (firstParse.length === 1) {
|
|
@@ -100,7 +100,7 @@ export const mapFailedTransactionMessage = (message, context) => {
|
|
|
100
100
|
contextModule,
|
|
101
101
|
};
|
|
102
102
|
};
|
|
103
|
-
export const
|
|
103
|
+
export const mapMetamaskMessage = (message) => {
|
|
104
104
|
const parsedMessage = message.trim().toLowerCase();
|
|
105
105
|
if (parsedMessage.includes('User denied message signature'.toLowerCase())) {
|
|
106
106
|
return 'The request has been rejected';
|
|
@@ -109,7 +109,12 @@ export const mapErrorMessage = (message) => {
|
|
|
109
109
|
return 'The request has been rejected';
|
|
110
110
|
}
|
|
111
111
|
if (parsedMessage.toLowerCase().includes('provided chain'.toLowerCase())) {
|
|
112
|
-
return 'Your selected network is incorrect';
|
|
112
|
+
return 'Your Metamask selected network is incorrect';
|
|
113
|
+
}
|
|
114
|
+
if (parsedMessage
|
|
115
|
+
.toLowerCase()
|
|
116
|
+
.includes('missing or invalid parameters'.toLowerCase())) {
|
|
117
|
+
return 'Please make sure you are using Metamask';
|
|
113
118
|
}
|
|
114
119
|
if (parsedMessage
|
|
115
120
|
.toLowerCase()
|
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.16.5
|
|
4
|
+
"version": "1.16.5",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"type": "module",
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
|
-
"build": "
|
|
44
|
+
"build": "yarn build:cjs && yarn build:esm && yarn build:post",
|
|
45
45
|
"build:cjs": "tsc --build --force tsconfig.build.json",
|
|
46
46
|
"build:esm": "tsc --build --force tsconfig.build.esm.json",
|
|
47
|
-
"build:watch": "tsc --build -w tsconfig.build.json && tsc -w --build tsconfig.build.esm.json &&
|
|
47
|
+
"build:watch": "tsc --build -w tsconfig.build.json && tsc -w --build tsconfig.build.esm.json && yarn build:post",
|
|
48
48
|
"build:post": "shx cp ../../etc/stub/package.json.stub dist/cjs/package.json && shx cp ../../etc/stub/package.esm.json.stub dist/esm/package.json",
|
|
49
49
|
"clean": "tsc --build tsconfig.build.json --clean && tsc --build tsconfig.build.esm.json --clean && shx rm -rf coverage *.log junit.xml dist && jest --clearCache && shx mkdir -p dist",
|
|
50
50
|
"test": "jest",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"shx": "^0.3.4"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "59378cbaf7f09e97bd0c8c157fd03abdd0ea35d5"
|
|
65
65
|
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ConcreteException } from '../base.js';
|
|
2
|
-
import { ErrorContext } from '../types/index.js';
|
|
3
|
-
export declare class RabbyWalletException extends ConcreteException {
|
|
4
|
-
static errorClass: string;
|
|
5
|
-
constructor(error: Error, context?: ErrorContext);
|
|
6
|
-
parse(): void;
|
|
7
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RabbyWalletException = void 0;
|
|
4
|
-
const base_js_1 = require("../base.js");
|
|
5
|
-
const maps_js_1 = require("../utils/maps.js");
|
|
6
|
-
const index_js_1 = require("../types/index.js");
|
|
7
|
-
const removeRabbyWalletFromErrorString = (message) => message
|
|
8
|
-
.replaceAll('RabbyWallet', '')
|
|
9
|
-
.replaceAll('Rabby Wallet', '')
|
|
10
|
-
.replaceAll('Rabbywallet', '')
|
|
11
|
-
.replaceAll('RabbyWallet:', '')
|
|
12
|
-
.replaceAll('Rabby Wallet:', '');
|
|
13
|
-
class RabbyWalletException extends base_js_1.ConcreteException {
|
|
14
|
-
static errorClass = 'RabbyWalletException';
|
|
15
|
-
constructor(error, context) {
|
|
16
|
-
super(error, context);
|
|
17
|
-
this.type = index_js_1.ErrorType.WalletError;
|
|
18
|
-
}
|
|
19
|
-
parse() {
|
|
20
|
-
const { message } = this;
|
|
21
|
-
if (message
|
|
22
|
-
.trim()
|
|
23
|
-
.toLowerCase()
|
|
24
|
-
.includes('missing or invalid parameters'.toLowerCase())) {
|
|
25
|
-
this.setMessage('Please make sure you are using Rabby Wallet');
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
this.setMessage((0, maps_js_1.mapErrorMessage)(removeRabbyWalletFromErrorString(message)));
|
|
29
|
-
}
|
|
30
|
-
this.setName(RabbyWalletException.errorClass);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.RabbyWalletException = RabbyWalletException;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ConcreteException } from '../base.js';
|
|
2
|
-
import { ErrorContext } from '../types/index.js';
|
|
3
|
-
export declare class RabbyWalletException extends ConcreteException {
|
|
4
|
-
static errorClass: string;
|
|
5
|
-
constructor(error: Error, context?: ErrorContext);
|
|
6
|
-
parse(): void;
|
|
7
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { ConcreteException } from '../base.js';
|
|
2
|
-
import { mapErrorMessage } from '../utils/maps.js';
|
|
3
|
-
import { ErrorType } from '../types/index.js';
|
|
4
|
-
const removeRabbyWalletFromErrorString = (message) => message
|
|
5
|
-
.replaceAll('RabbyWallet', '')
|
|
6
|
-
.replaceAll('Rabby Wallet', '')
|
|
7
|
-
.replaceAll('Rabbywallet', '')
|
|
8
|
-
.replaceAll('RabbyWallet:', '')
|
|
9
|
-
.replaceAll('Rabby Wallet:', '');
|
|
10
|
-
export class RabbyWalletException extends ConcreteException {
|
|
11
|
-
static errorClass = 'RabbyWalletException';
|
|
12
|
-
constructor(error, context) {
|
|
13
|
-
super(error, context);
|
|
14
|
-
this.type = ErrorType.WalletError;
|
|
15
|
-
}
|
|
16
|
-
parse() {
|
|
17
|
-
const { message } = this;
|
|
18
|
-
if (message
|
|
19
|
-
.trim()
|
|
20
|
-
.toLowerCase()
|
|
21
|
-
.includes('missing or invalid parameters'.toLowerCase())) {
|
|
22
|
-
this.setMessage('Please make sure you are using Rabby Wallet');
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
this.setMessage(mapErrorMessage(removeRabbyWalletFromErrorString(message)));
|
|
26
|
-
}
|
|
27
|
-
this.setName(RabbyWalletException.errorClass);
|
|
28
|
-
}
|
|
29
|
-
}
|