@ercworldio/blockchain-shared 1.0.2-dev.5 → 1.0.2-dev.6
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
|
@@ -61,7 +61,8 @@ export declare const ErrorMessages: {
|
|
|
61
61
|
readonly NOT_WHITELISTED: "The provided wallet address is not whitelisted";
|
|
62
62
|
readonly INVALID_WALLET_TYPE: "WalletType is invalid. Use \"funding\", \"rent-energy\" or \"escrow\"";
|
|
63
63
|
readonly ONLY_NATIVE_WITHDRAWAL: "Only native tokens can be withdrawn";
|
|
64
|
-
readonly RENT_ENERGY_API_ERROR: "Encountered error when calling rent API
|
|
64
|
+
readonly RENT_ENERGY_API_ERROR: "Encountered error when calling rent API";
|
|
65
|
+
readonly INSUFFICIENT_ENERGY_WALLET_BALANCE: "Rent energy wallet has insufficient balance";
|
|
65
66
|
};
|
|
66
67
|
export declare const ErrorCodes: {
|
|
67
68
|
readonly INTERNAL_SERVER: "error.internal_server_error";
|
|
@@ -120,6 +121,7 @@ export declare const ErrorCodes: {
|
|
|
120
121
|
readonly INVALID_WALLET_TYPE: "error.invalid_wallet_type";
|
|
121
122
|
readonly ONLY_NATIVE_WITHDRAWAL: "error.only_native_withdrawal";
|
|
122
123
|
readonly RENT_ENERGY_API_ERROR: "error.rent_enegy_api_error";
|
|
124
|
+
readonly INSUFFICIENT_ENERGY_WALLET_BALANCE: "error.insufficient_energy_wallet_balance";
|
|
123
125
|
};
|
|
124
126
|
export type ErrorCode = typeof ErrorCodes[keyof typeof ErrorCodes];
|
|
125
127
|
export interface ErrorCodeEntry {
|
|
@@ -201,7 +203,8 @@ declare class BaseErrors {
|
|
|
201
203
|
NotWhitelisted(): "The provided wallet address is not whitelisted";
|
|
202
204
|
InvalidWalletType(): "WalletType is invalid. Use \"funding\", \"rent-energy\" or \"escrow\"";
|
|
203
205
|
OnlyNativeWithdrawal(): "Only native tokens can be withdrawn";
|
|
204
|
-
RentEnergyApiError(): "Encountered error when calling rent API
|
|
206
|
+
RentEnergyApiError(): "Encountered error when calling rent API";
|
|
207
|
+
InsufficientRentEnergyWalletBalance(): "Rent energy wallet has insufficient balance";
|
|
205
208
|
/** Handler methods */
|
|
206
209
|
handle_error: (error: any, source_method: string) => ErrorHandlerResponse;
|
|
207
210
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAqFtB,2BAA2B;;;;IAK3B,sBAAsB
|
|
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;;;;;;;;CAUhB,CAAC;AAEX,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmEb,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;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,yEAAyE;IACzE,UA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AC,EAAE,GAAG;IACrB,yBAAyB;IACzB,WAAW;IACX,cAAc;IACd,iBAAiB;IACjB,oBAAoB;IACpB,kBAAkB;IAClB,mCAAmC;IAE1C,sBAAsB;IACf,YAAY,GAAI,OAAO,GAAG,EAAE,eAAe,MAAM,KAAG,oBAAoB,CAuB9E;IAEM,mBAAmB,GAAI,SAAS,MAAM,KAAG,cAAc,GAAG,IAAI,CAkCpE;CACJ;AAED,eAAe,UAAU,CAAC"}
|
package/build/errors/errors.js
CHANGED
|
@@ -99,7 +99,8 @@ exports.ErrorMessages = {
|
|
|
99
99
|
NOT_WHITELISTED: `The provided wallet address is not whitelisted`, // 400
|
|
100
100
|
INVALID_WALLET_TYPE: `WalletType is invalid. Use "funding", "rent-energy" or "escrow"`, // 400
|
|
101
101
|
ONLY_NATIVE_WITHDRAWAL: `Only native tokens can be withdrawn`, // 400
|
|
102
|
-
RENT_ENERGY_API_ERROR: `Encountered error when calling rent API
|
|
102
|
+
RENT_ENERGY_API_ERROR: `Encountered error when calling rent API`, // 500
|
|
103
|
+
INSUFFICIENT_ENERGY_WALLET_BALANCE: `Rent energy wallet has insufficient balance`,
|
|
103
104
|
};
|
|
104
105
|
exports.ErrorCodes = {
|
|
105
106
|
INTERNAL_SERVER: 'error.internal_server_error',
|
|
@@ -164,6 +165,7 @@ exports.ErrorCodes = {
|
|
|
164
165
|
INVALID_WALLET_TYPE: `error.invalid_wallet_type`,
|
|
165
166
|
ONLY_NATIVE_WITHDRAWAL: `error.only_native_withdrawal`,
|
|
166
167
|
RENT_ENERGY_API_ERROR: `error.rent_enegy_api_error`,
|
|
168
|
+
INSUFFICIENT_ENERGY_WALLET_BALANCE: `error.insufficient_energy_wallet_balance`,
|
|
167
169
|
};
|
|
168
170
|
class BaseErrors {
|
|
169
171
|
constructor() {
|
|
@@ -263,6 +265,8 @@ class BaseErrors {
|
|
|
263
265
|
return Object.assign(Object.assign({}, this.codes[400]), { error_code: exports.ErrorCodes.ONLY_NATIVE_WITHDRAWAL });
|
|
264
266
|
if (message.includes(exports.ErrorMessages.RENT_ENERGY_API_ERROR))
|
|
265
267
|
return Object.assign(Object.assign({}, this.codes[400]), { error_code: exports.ErrorCodes.RENT_ENERGY_API_ERROR });
|
|
268
|
+
if (message.includes(exports.ErrorMessages.INSUFFICIENT_ENERGY_WALLET_BALANCE))
|
|
269
|
+
return Object.assign(Object.assign({}, this.codes[400]), { error_code: exports.ErrorCodes.INSUFFICIENT_ENERGY_WALLET_BALANCE });
|
|
266
270
|
return null;
|
|
267
271
|
};
|
|
268
272
|
}
|
|
@@ -327,5 +331,7 @@ class BaseErrors {
|
|
|
327
331
|
;
|
|
328
332
|
RentEnergyApiError() { return exports.ErrorMessages.RENT_ENERGY_API_ERROR; }
|
|
329
333
|
;
|
|
334
|
+
InsufficientRentEnergyWalletBalance() { return exports.ErrorMessages.INSUFFICIENT_ENERGY_WALLET_BALANCE; }
|
|
335
|
+
;
|
|
330
336
|
}
|
|
331
337
|
exports.default = BaseErrors;
|