@ercworldio/blockchain-shared 1.0.2-dev.2 → 1.0.2-dev.3
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/build/errors/errors.d.ts
CHANGED
|
@@ -55,6 +55,10 @@ export declare const ErrorMessages: {
|
|
|
55
55
|
readonly CHAIN_CONFIG_NOT_SET: "Chain configuration is missing. Please contact support";
|
|
56
56
|
readonly ALLOWED_RECEIVERS_CONFIG_NOT_SET: "Allowed receiver addresses not configured. Please contact support";
|
|
57
57
|
readonly ACCOUNTING_CONFIG_NOT_SET: "Accounting configuration is missing. Please contact support";
|
|
58
|
+
/** BO Admin Errors */
|
|
59
|
+
readonly ZERO_VALUE_TX: "Withdrawal amount cannot be zero";
|
|
60
|
+
readonly UNSUPPORTED_BLOCKCHAIN: "The selected blockchain is not supported";
|
|
61
|
+
readonly NOT_WHITELISTED: "The provided wallet address is not whitelisted";
|
|
58
62
|
};
|
|
59
63
|
export declare const ErrorCodes: {
|
|
60
64
|
readonly INTERNAL_SERVER: "error.internal_server_error";
|
|
@@ -107,6 +111,9 @@ export declare const ErrorCodes: {
|
|
|
107
111
|
readonly CHAIN_CONFIG_NOT_SET: "error.chain_config_not_set";
|
|
108
112
|
readonly ACCOUNTING_CONFIG_NOT_SET: "error.accounting_config_not_set";
|
|
109
113
|
readonly ALLOWED_RECEIVERS_CONFIG_NOT_SET: "error.allowed_receivers_config_not_set";
|
|
114
|
+
readonly ZERO_VALUE_TX: "error.zero_value_tx";
|
|
115
|
+
readonly UNSUPPORTED_BLOCKCHAIN: "error.unsupported_blockchain";
|
|
116
|
+
readonly NOT_WHITELISTED: "error.not_whitelisted_wallet_address";
|
|
110
117
|
};
|
|
111
118
|
export type ErrorCode = typeof ErrorCodes[keyof typeof ErrorCodes];
|
|
112
119
|
export interface ErrorCodeEntry {
|
|
@@ -183,6 +190,9 @@ declare class BaseErrors {
|
|
|
183
190
|
NotApprovedPaymentRequest(_?: any): "Payment request has not been approved";
|
|
184
191
|
RequirePaymentId(_?: any): "Payment ID is required";
|
|
185
192
|
AddressExists(_?: any): "A deposit address already exists for this account";
|
|
193
|
+
UnsupportedBlockchainType(): "The selected blockchain is not supported";
|
|
194
|
+
ZeroValueTx(): "Withdrawal amount cannot be zero";
|
|
195
|
+
NotWhitelisted(): "The provided wallet address is not whitelisted";
|
|
186
196
|
/** Handler methods */
|
|
187
197
|
handle_error: (error: any, source_method: string) => ErrorHandlerResponse;
|
|
188
198
|
get_error_code_base: (message: string) => ErrorCodeEntry | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors/errors.ts"],"names":[],"mappings":"AACA;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors/errors.ts"],"names":[],"mappings":"AACA;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAqFtB,2BAA2B;;;;IAK3B,sBAAsB;;;;CAKhB,CAAC;AAEX,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgEb,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,OAAO,UAAU,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAEnE,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,SAAS,CAAC;CACzB;AAED,UAAU,oBAAoB;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,cAAc,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;CACzB;AAED,UAAU,cAAc;IACpB,MAAM,EAAE,OAAO,CAAC;IA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CAAC,CAAC,EAAE,GAAG;IACxB,aAAa,CAAC,CAAC,CAAC,EAAE,GAAG;IACrB,yBAAyB;IACzB,WAAW;IACX,cAAc;IAErB,sBAAsB;IACf,YAAY,GAAI,OAAO,GAAG,EAAE,eAAe,MAAM,KAAG,oBAAoB,CAuB9E;IAEM,mBAAmB,GAAI,SAAS,MAAM,KAAG,cAAc,GAAG,IAAI,CA8BpE;CACJ;AAED,eAAe,UAAU,CAAC"}
|
package/build/errors/errors.js
CHANGED
|
@@ -73,8 +73,7 @@ exports.ErrorMessages = {
|
|
|
73
73
|
// 400
|
|
74
74
|
UNEXPECTED_RECEIVER: "Please use the wallet address associated with your deposit",
|
|
75
75
|
// 409
|
|
76
|
-
DUPLICATE_CLAIM_JOB: "A claim for this request is already in progress. Please check back in a few minutes",
|
|
77
|
-
// 400
|
|
76
|
+
DUPLICATE_CLAIM_JOB: "A claim for this request is already in progress. Please check back in a few minutes", // 400
|
|
78
77
|
INVALID_WALLET_ADDRESS: "The wallet address provided is invalid",
|
|
79
78
|
// 409
|
|
80
79
|
REQUEST_FULFILLED: "This request has already been fulfilled",
|
|
@@ -91,9 +90,13 @@ exports.ErrorMessages = {
|
|
|
91
90
|
// 400
|
|
92
91
|
ONLY_STABLECOIN_WITHDRAWAL: "This network only supports stablecoin withdrawals",
|
|
93
92
|
/** Chain Config Related */
|
|
94
|
-
CHAIN_CONFIG_NOT_SET: "Chain configuration is missing. Please contact support",
|
|
95
|
-
ALLOWED_RECEIVERS_CONFIG_NOT_SET: "Allowed receiver addresses not configured. Please contact support",
|
|
96
|
-
ACCOUNTING_CONFIG_NOT_SET: "Accounting configuration is missing. Please contact support",
|
|
93
|
+
CHAIN_CONFIG_NOT_SET: "Chain configuration is missing. Please contact support", // 500
|
|
94
|
+
ALLOWED_RECEIVERS_CONFIG_NOT_SET: "Allowed receiver addresses not configured. Please contact support", //500
|
|
95
|
+
ACCOUNTING_CONFIG_NOT_SET: "Accounting configuration is missing. Please contact support", //500
|
|
96
|
+
/** BO Admin Errors */
|
|
97
|
+
ZERO_VALUE_TX: `Withdrawal amount cannot be zero`, // 400
|
|
98
|
+
UNSUPPORTED_BLOCKCHAIN: `The selected blockchain is not supported`, // 400
|
|
99
|
+
NOT_WHITELISTED: `The provided wallet address is not whitelisted`, // 400
|
|
97
100
|
};
|
|
98
101
|
exports.ErrorCodes = {
|
|
99
102
|
INTERNAL_SERVER: 'error.internal_server_error',
|
|
@@ -152,6 +155,9 @@ exports.ErrorCodes = {
|
|
|
152
155
|
CHAIN_CONFIG_NOT_SET: 'error.chain_config_not_set',
|
|
153
156
|
ACCOUNTING_CONFIG_NOT_SET: 'error.accounting_config_not_set',
|
|
154
157
|
ALLOWED_RECEIVERS_CONFIG_NOT_SET: 'error.allowed_receivers_config_not_set',
|
|
158
|
+
ZERO_VALUE_TX: `error.zero_value_tx`,
|
|
159
|
+
UNSUPPORTED_BLOCKCHAIN: `error.unsupported_blockchain`,
|
|
160
|
+
NOT_WHITELISTED: `error.not_whitelisted_wallet_address`
|
|
155
161
|
};
|
|
156
162
|
class BaseErrors {
|
|
157
163
|
constructor() {
|
|
@@ -239,6 +245,12 @@ class BaseErrors {
|
|
|
239
245
|
return Object.assign(Object.assign({}, this.codes[500]), { error_code: exports.ErrorCodes.ACCOUNTING_CONFIG_NOT_SET });
|
|
240
246
|
if (message.includes(exports.ErrorMessages.ALLOWED_RECEIVERS_CONFIG_NOT_SET))
|
|
241
247
|
return Object.assign(Object.assign({}, this.codes[500]), { error_code: exports.ErrorCodes.ALLOWED_RECEIVERS_CONFIG_NOT_SET });
|
|
248
|
+
if (message.includes(exports.ErrorMessages.NOT_WHITELISTED))
|
|
249
|
+
return Object.assign(Object.assign({}, this.codes[400]), { error_code: exports.ErrorCodes.NOT_WHITELISTED });
|
|
250
|
+
if (message.includes(exports.ErrorMessages.UNSUPPORTED_BLOCKCHAIN))
|
|
251
|
+
return Object.assign(Object.assign({}, this.codes[400]), { error_code: exports.ErrorCodes.UNSUPPORTED_BLOCKCHAIN });
|
|
252
|
+
if (message.includes(exports.ErrorMessages.ZERO_VALUE_TX))
|
|
253
|
+
return Object.assign(Object.assign({}, this.codes[400]), { error_code: exports.ErrorCodes.ZERO_VALUE_TX });
|
|
242
254
|
return null;
|
|
243
255
|
};
|
|
244
256
|
}
|
|
@@ -291,5 +303,11 @@ class BaseErrors {
|
|
|
291
303
|
;
|
|
292
304
|
AddressExists(_) { return exports.ErrorMessages.ADDRESS_EXISTS; }
|
|
293
305
|
;
|
|
306
|
+
UnsupportedBlockchainType() { return exports.ErrorMessages.UNSUPPORTED_BLOCKCHAIN; }
|
|
307
|
+
;
|
|
308
|
+
ZeroValueTx() { return exports.ErrorMessages.ZERO_VALUE_TX; }
|
|
309
|
+
;
|
|
310
|
+
NotWhitelisted() { return exports.ErrorMessages.NOT_WHITELISTED; }
|
|
311
|
+
;
|
|
294
312
|
}
|
|
295
313
|
exports.default = BaseErrors;
|