@ercworldio/blockchain-shared 1.0.2-dev.1 → 1.0.2-dev.2

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.
@@ -15,7 +15,6 @@ export declare const ErrorMessages: {
15
15
  readonly INVALID_PAYMENT_TOKEN: "The payment token provided is not recognized";
16
16
  readonly UNEXPECTED_PAYMENT_TOKEN: "The selected payment token is not supported on this network";
17
17
  readonly NOT_FOUND: "The requested resource was not found";
18
- readonly CHAIN_CONFIG_NOT_SET: "Chain configuration is missing. Please contact support";
19
18
  readonly UNEXPECTED_ERROR: "An unexpected error occurred. Please try again later";
20
19
  readonly DATABASE_NOT_INITIALIZED: "Database connection is not available";
21
20
  readonly INVALID_USER_ID: "The provided user ID is invalid";
@@ -52,6 +51,10 @@ export declare const ErrorMessages: {
52
51
  readonly UNEXPECTED_ADDRESS_FORMAT: "The address does not match the expected format for the selected network";
53
52
  readonly EMPTY_PAYLOAD: "Request payload cannot be empty";
54
53
  readonly ONLY_STABLECOIN_WITHDRAWAL: "This network only supports stablecoin withdrawals";
54
+ /** Chain Config Related */
55
+ readonly CHAIN_CONFIG_NOT_SET: "Chain configuration is missing. Please contact support";
56
+ readonly ALLOWED_RECEIVERS_CONFIG_NOT_SET: "Allowed receiver addresses not configured. Please contact support";
57
+ readonly ACCOUNTING_CONFIG_NOT_SET: "Accounting configuration is missing. Please contact support";
55
58
  };
56
59
  export declare const ErrorCodes: {
57
60
  readonly INTERNAL_SERVER: "error.internal_server_error";
@@ -66,7 +69,6 @@ export declare const ErrorCodes: {
66
69
  readonly INVALID_PAYMENT_TOKEN: "error.invalid_payment_token";
67
70
  readonly UNEXPECTED_PAYMENT_TOKEN: "error.unexpected_payment_token";
68
71
  readonly NOT_FOUND: "error.not_found";
69
- readonly CHAIN_CONFIG_NOT_SET: "error.chain_config_not_set";
70
72
  readonly UNEXPECTED_ERROR: "error.unexpected_error";
71
73
  readonly DATABASE_NOT_INITIALIZED: "error.database_not_initialized";
72
74
  readonly INVALID_USER_ID: "error.invalid_user_id";
@@ -102,6 +104,9 @@ export declare const ErrorCodes: {
102
104
  readonly UNEXPECTED_ADDRESS_FORMAT: "error.unexpected_address_format";
103
105
  readonly EMPTY_PAYLOAD: "error.empty_payload";
104
106
  readonly ONLY_STABLECOIN_WITHDRAWAL: "error.only_stablecoin_withdrawal";
107
+ readonly CHAIN_CONFIG_NOT_SET: "error.chain_config_not_set";
108
+ readonly ACCOUNTING_CONFIG_NOT_SET: "error.accounting_config_not_set";
109
+ readonly ALLOWED_RECEIVERS_CONFIG_NOT_SET: "error.allowed_receivers_config_not_set";
105
110
  };
106
111
  export type ErrorCode = typeof ErrorCodes[keyof typeof ErrorCodes];
107
112
  export interface ErrorCodeEntry {
@@ -166,6 +171,8 @@ declare class BaseErrors {
166
171
  UnexpectedPaymentToken(_?: any): "The selected payment token is not supported on this network";
167
172
  NotFound(_?: any): "The requested resource was not found";
168
173
  ChainConfigNotSet(_?: any): "Chain configuration is missing. Please contact support";
174
+ AccountingNotSet(): "Accounting configuration is missing. Please contact support";
175
+ AllowedReceiversNotSet(): "Allowed receiver addresses not configured. Please contact support";
169
176
  UnexpectedError(_?: any): "An unexpected error occurred. Please try again later";
170
177
  NotInitializedDatabase(_?: any): "Database connection is not available";
171
178
  InvalidUserId(_?: any): "The provided user ID is invalid";
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors/errors.ts"],"names":[],"mappings":"AACA;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsFhB,CAAC;AAEX,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsDb,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,OAAO,UAAU,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAEnE,MAAM,WAAW,cAAc;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AAY,GAAI,OAAO,GAAG,EAAE,eAAe,MAAM,KAAG,oBAAoB,CAuB9E;IAEM,mBAAmB,GAAI,SAAS,MAAM,KAAG,cAAc,GAAG,IAAI,CA2BpE;CACJ;AAED,eAAe,UAAU,CAAC"}
@@ -28,7 +28,6 @@ exports.ErrorMessages = {
28
28
  UNEXPECTED_PAYMENT_TOKEN: "The selected payment token is not supported on this network",
29
29
  // 400
30
30
  NOT_FOUND: "The requested resource was not found",
31
- CHAIN_CONFIG_NOT_SET: "Chain configuration is missing. Please contact support",
32
31
  UNEXPECTED_ERROR: "An unexpected error occurred. Please try again later",
33
32
  DATABASE_NOT_INITIALIZED: "Database connection is not available",
34
33
  // 400
@@ -91,6 +90,10 @@ exports.ErrorMessages = {
91
90
  EMPTY_PAYLOAD: "Request payload cannot be empty",
92
91
  // 400
93
92
  ONLY_STABLECOIN_WITHDRAWAL: "This network only supports stablecoin withdrawals",
93
+ /** 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",
94
97
  };
95
98
  exports.ErrorCodes = {
96
99
  INTERNAL_SERVER: 'error.internal_server_error',
@@ -105,7 +108,6 @@ exports.ErrorCodes = {
105
108
  INVALID_PAYMENT_TOKEN: 'error.invalid_payment_token',
106
109
  UNEXPECTED_PAYMENT_TOKEN: 'error.unexpected_payment_token',
107
110
  NOT_FOUND: 'error.not_found',
108
- CHAIN_CONFIG_NOT_SET: 'error.chain_config_not_set',
109
111
  UNEXPECTED_ERROR: 'error.unexpected_error',
110
112
  DATABASE_NOT_INITIALIZED: 'error.database_not_initialized',
111
113
  INVALID_USER_ID: 'error.invalid_user_id',
@@ -146,6 +148,10 @@ exports.ErrorCodes = {
146
148
  UNEXPECTED_ADDRESS_FORMAT: 'error.unexpected_address_format',
147
149
  EMPTY_PAYLOAD: 'error.empty_payload',
148
150
  ONLY_STABLECOIN_WITHDRAWAL: 'error.only_stablecoin_withdrawal',
151
+ // Chain/Network Config
152
+ CHAIN_CONFIG_NOT_SET: 'error.chain_config_not_set',
153
+ ACCOUNTING_CONFIG_NOT_SET: 'error.accounting_config_not_set',
154
+ ALLOWED_RECEIVERS_CONFIG_NOT_SET: 'error.allowed_receivers_config_not_set',
149
155
  };
150
156
  class BaseErrors {
151
157
  constructor() {
@@ -229,6 +235,10 @@ class BaseErrors {
229
235
  return Object.assign(Object.assign({}, this.codes[401]), { error_code: exports.ErrorCodes.PAYMENT_REQUEST_NOT_APPROVED });
230
236
  if (message.includes("deposit address already exists"))
231
237
  return Object.assign(Object.assign({}, this.codes[409]), { error_code: exports.ErrorCodes.ADDRESS_EXISTS });
238
+ if (message.includes(exports.ErrorMessages.ACCOUNTING_CONFIG_NOT_SET))
239
+ return Object.assign(Object.assign({}, this.codes[500]), { error_code: exports.ErrorCodes.ACCOUNTING_CONFIG_NOT_SET });
240
+ if (message.includes(exports.ErrorMessages.ALLOWED_RECEIVERS_CONFIG_NOT_SET))
241
+ return Object.assign(Object.assign({}, this.codes[500]), { error_code: exports.ErrorCodes.ALLOWED_RECEIVERS_CONFIG_NOT_SET });
232
242
  return null;
233
243
  };
234
244
  }
@@ -257,6 +267,10 @@ class BaseErrors {
257
267
  ;
258
268
  ChainConfigNotSet(_) { return exports.ErrorMessages.CHAIN_CONFIG_NOT_SET; }
259
269
  ;
270
+ AccountingNotSet() { return exports.ErrorMessages.ACCOUNTING_CONFIG_NOT_SET; }
271
+ ;
272
+ AllowedReceiversNotSet() { return exports.ErrorMessages.ALLOWED_RECEIVERS_CONFIG_NOT_SET; }
273
+ ;
260
274
  UnexpectedError(_) { return exports.ErrorMessages.UNEXPECTED_ERROR; }
261
275
  ;
262
276
  NotInitializedDatabase(_) { return exports.ErrorMessages.DATABASE_NOT_INITIALIZED; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ercworldio/blockchain-shared",
3
- "version": "1.0.2-dev.1",
3
+ "version": "1.0.2-dev.2",
4
4
  "description": "Shared library for blockchain projects",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",