@ercworldio/blockchain-shared 1.0.1-dev.9 → 1.0.2-dev-PROJ-1265.0
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 +26 -0
- package/build/chains/networks_dev.json +116 -25
- package/build/chains/networks_prod-bu.json +116 -8
- package/build/chains/networks_prod-dz.json +216 -13
- package/build/chains/networks_stg-bu.json +36 -9
- package/build/chains/networks_stg-dz.json +82 -22
- package/build/chains/networks_stg-sh.json +534 -0
- package/build/chains/networks_stg-yb.json +435 -0
- package/build/chains/stg-sh.json +93 -0
- package/build/contracts/Escrow.d.ts +1 -1
- package/build/contracts/Escrow.d.ts.map +1 -1
- package/build/contracts/Escrow.js +2 -2
- package/build/contracts/typechain-types/@openzeppelin/contracts/interfaces/IERC1363.d.ts +232 -0
- package/build/contracts/typechain-types/@openzeppelin/contracts/interfaces/IERC1363.d.ts.map +1 -0
- package/build/contracts/typechain-types/@openzeppelin/contracts/interfaces/IERC1363.js +2 -0
- package/build/contracts/typechain-types/@openzeppelin/contracts/interfaces/index.d.ts +1 -0
- package/build/contracts/typechain-types/@openzeppelin/contracts/interfaces/index.d.ts.map +1 -1
- package/build/contracts/typechain-types/@openzeppelin/contracts/token/ERC20/index.d.ts +2 -0
- package/build/contracts/typechain-types/@openzeppelin/contracts/token/ERC20/index.d.ts.map +1 -1
- package/build/contracts/typechain-types/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.d.ts +21 -0
- package/build/contracts/typechain-types/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.d.ts.map +1 -0
- package/build/contracts/typechain-types/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.js +2 -0
- package/build/contracts/typechain-types/@openzeppelin/contracts/token/ERC20/utils/index.d.ts +2 -0
- package/build/contracts/typechain-types/@openzeppelin/contracts/token/ERC20/utils/index.d.ts.map +1 -0
- package/build/contracts/typechain-types/@openzeppelin/contracts/token/ERC20/utils/index.js +2 -0
- package/build/contracts/typechain-types/contracts/escrow/Escrow.d.ts +5 -3
- package/build/contracts/typechain-types/contracts/escrow/Escrow.d.ts.map +1 -1
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/interfaces/IERC1363__factory.d.ts +290 -0
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/interfaces/IERC1363__factory.d.ts.map +1 -0
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/interfaces/IERC1363__factory.js +390 -0
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/interfaces/index.d.ts +1 -0
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/interfaces/index.d.ts.map +1 -1
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/interfaces/index.js +3 -1
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/token/ERC20/index.d.ts +1 -0
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/token/ERC20/index.d.ts.map +1 -1
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/token/ERC20/index.js +2 -1
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/token/ERC20/utils/SafeERC20__factory.d.ts +47 -0
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/token/ERC20/utils/SafeERC20__factory.d.ts.map +1 -0
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/token/ERC20/utils/SafeERC20__factory.js +71 -0
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/token/ERC20/utils/index.d.ts +2 -0
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/token/ERC20/utils/index.d.ts.map +1 -0
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/token/ERC20/utils/index.js +8 -0
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/utils/ShortStrings__factory.d.ts +1 -1
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/utils/ShortStrings__factory.d.ts.map +1 -1
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/utils/ShortStrings__factory.js +1 -1
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/utils/Strings__factory.d.ts +1 -1
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/utils/Strings__factory.d.ts.map +1 -1
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/utils/Strings__factory.js +1 -1
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/utils/math/SafeCast__factory.d.ts +1 -1
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/utils/math/SafeCast__factory.d.ts.map +1 -1
- package/build/contracts/typechain-types/factories/@openzeppelin/contracts/utils/math/SafeCast__factory.js +1 -1
- package/build/contracts/typechain-types/factories/contracts/escrow/EscrowAccessControl__factory.d.ts +1 -1
- package/build/contracts/typechain-types/factories/contracts/escrow/EscrowAccessControl__factory.d.ts.map +1 -1
- package/build/contracts/typechain-types/factories/contracts/escrow/EscrowAccessControl__factory.js +1 -1
- package/build/contracts/typechain-types/factories/contracts/escrow/EscrowErrors__factory.d.ts +1 -1
- package/build/contracts/typechain-types/factories/contracts/escrow/EscrowErrors__factory.d.ts.map +1 -1
- package/build/contracts/typechain-types/factories/contracts/escrow/EscrowErrors__factory.js +1 -1
- package/build/contracts/typechain-types/factories/contracts/escrow/EscrowSignature__factory.d.ts +1 -1
- package/build/contracts/typechain-types/factories/contracts/escrow/EscrowSignature__factory.d.ts.map +1 -1
- package/build/contracts/typechain-types/factories/contracts/escrow/EscrowSignature__factory.js +1 -1
- package/build/contracts/typechain-types/factories/contracts/escrow/Escrow__factory.d.ts +13 -1
- package/build/contracts/typechain-types/factories/contracts/escrow/Escrow__factory.d.ts.map +1 -1
- package/build/contracts/typechain-types/factories/contracts/escrow/Escrow__factory.js +17 -1
- package/build/contracts/typechain-types/factories/contracts/escrow/TokensWhitelist__factory.d.ts +1 -1
- package/build/contracts/typechain-types/factories/contracts/escrow/TokensWhitelist__factory.d.ts.map +1 -1
- package/build/contracts/typechain-types/factories/contracts/escrow/TokensWhitelist__factory.js +1 -1
- package/build/contracts/typechain-types/index.d.ts +4 -0
- package/build/contracts/typechain-types/index.d.ts.map +1 -1
- package/build/contracts/typechain-types/index.js +5 -1
- package/build/errors/AdminErrors.d.ts +5 -9
- package/build/errors/AdminErrors.d.ts.map +1 -1
- package/build/errors/AdminErrors.js +49 -24
- package/build/errors/AlchemyErrors.d.ts +14 -18
- package/build/errors/AlchemyErrors.d.ts.map +1 -1
- package/build/errors/AlchemyErrors.js +76 -49
- package/build/errors/BalanceErrors.d.ts +3 -7
- package/build/errors/BalanceErrors.d.ts.map +1 -1
- package/build/errors/BalanceErrors.js +47 -26
- package/build/errors/DatabaseErrors.d.ts +5 -9
- package/build/errors/DatabaseErrors.d.ts.map +1 -1
- package/build/errors/DatabaseErrors.js +49 -28
- package/build/errors/TransactionsErrors.d.ts +15 -20
- package/build/errors/TransactionsErrors.d.ts.map +1 -1
- package/build/errors/TransactionsErrors.js +81 -66
- package/build/errors/VoltageErrors.d.ts +8 -13
- package/build/errors/VoltageErrors.d.ts.map +1 -1
- package/build/errors/VoltageErrors.js +58 -45
- package/build/errors/WalletErrors.d.ts +6 -12
- package/build/errors/WalletErrors.d.ts.map +1 -1
- package/build/errors/WalletErrors.js +48 -37
- package/build/errors/errors.d.ts +169 -27
- package/build/errors/errors.d.ts.map +1 -1
- package/build/errors/errors.js +292 -66
- package/build/errors/index.d.ts +37 -36
- package/build/errors/index.d.ts.map +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +4 -2
- package/build/interfaces.d.ts +5 -1
- package/build/interfaces.d.ts.map +1 -1
- package/build/interfaces.js +1 -0
- package/build/services/AlchemyWebhookAddressManager.d.ts.map +1 -1
- package/build/services/AlchemyWebhookAddressManager.js +3 -1
- package/build/services/quicknode-notifications/QnWebhookAddressManager.d.ts +1 -2
- package/build/services/quicknode-notifications/QnWebhookAddressManager.d.ts.map +1 -1
- package/build/services/quicknode-notifications/QnWebhookAddressManager.js +25 -42
- package/build/services/quicknode-notifications/SetupNotifications.d.ts +1 -0
- package/build/services/quicknode-notifications/SetupNotifications.d.ts.map +1 -1
- package/build/services/quicknode-notifications/SetupNotifications.js +29 -2
- package/build/services/solana/escrow/SolanaEscrowAdmin.d.ts +1 -1
- package/build/services/solana/escrow/SolanaEscrowAdmin.d.ts.map +1 -1
- package/build/services/solana/escrow/SolanaEscrowAdmin.js +8 -4
- package/build/services/solana/escrow/services/EscrowAdminUtility.d.ts.map +1 -1
- package/build/services/solana/escrow/services/EscrowAdminUtility.js +5 -2
- package/build/services/solana/escrow/services/SolanaTokenProgramCache.d.ts +9 -0
- package/build/services/solana/escrow/services/SolanaTokenProgramCache.d.ts.map +1 -0
- package/build/services/solana/escrow/services/SolanaTokenProgramCache.js +38 -0
- package/build/services/types/bo_withdrawal.d.ts +17 -0
- package/build/services/types/bo_withdrawal.d.ts.map +1 -0
- package/build/services/types/bo_withdrawal.js +9 -0
- package/build/services/types/chain_manager.d.ts +7 -0
- package/build/services/types/chain_manager.d.ts.map +1 -1
- package/build/services/types/index.d.ts +1 -0
- package/build/services/types/index.d.ts.map +1 -1
- package/build/services/types/index.js +1 -0
- package/build/utils/Logger.d.ts.map +1 -1
- package/build/utils/Logger.js +13 -2
- package/build/utils/RpcLimiter.d.ts +1 -0
- package/build/utils/RpcLimiter.d.ts.map +1 -1
- package/build/utils/RpcLimiter.js +1 -0
- package/build/utils/solana.d.ts +2 -1
- package/build/utils/solana.d.ts.map +1 -1
- package/build/utils/solana.js +28 -3
- package/package.json +1 -1
|
@@ -1,79 +1,106 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
5
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const errors_1 =
|
|
36
|
+
const errors_1 = __importStar(require("./errors"));
|
|
7
37
|
class AlchemyErrors extends errors_1.default {
|
|
8
38
|
constructor() {
|
|
9
|
-
/** Error Definition */
|
|
10
|
-
// public RequirePaymentId() { return "'paymentId' is required" };
|
|
11
39
|
super(...arguments);
|
|
12
|
-
/** Handler methods */
|
|
13
|
-
// Return status code, error, and message
|
|
14
40
|
this.handle_alchemy_error = (error, source_method) => {
|
|
15
|
-
|
|
16
|
-
|
|
41
|
+
const status = this.get_error_code(error.message);
|
|
42
|
+
return {
|
|
17
43
|
status_code: status.code,
|
|
44
|
+
source_method,
|
|
18
45
|
response: {
|
|
19
46
|
status: false,
|
|
20
|
-
message: status.code
|
|
47
|
+
message: status.code === 500 && !error.message ? "An unexpected error occurred. Please try again later." : error.message,
|
|
48
|
+
error_code: status.error_code,
|
|
21
49
|
data: {},
|
|
22
50
|
error: status.error
|
|
23
51
|
}
|
|
24
52
|
};
|
|
25
|
-
return Object.assign(Object.assign({}, result), { source_method });
|
|
26
53
|
};
|
|
27
|
-
// Get the status code and error message
|
|
28
54
|
this.get_error_code = (message) => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
const base = this.get_error_code_base(message);
|
|
56
|
+
if (base)
|
|
57
|
+
return base;
|
|
58
|
+
if (message.includes("Failed to subscribe to the invoice"))
|
|
59
|
+
return Object.assign(Object.assign({}, this.codes[500]), { error_code: errors_1.ErrorCodes.INVOICE_SUBSCRIBER_ERROR });
|
|
60
|
+
if (message.includes("amount is below the minimum required"))
|
|
61
|
+
return Object.assign(Object.assign({}, this.codes[400]), { error_code: errors_1.ErrorCodes.REQUIRE_MIN_AMOUNT });
|
|
62
|
+
if (message.includes("Invoice not found or expired"))
|
|
63
|
+
return Object.assign(Object.assign({}, this.codes[400]), { error_code: errors_1.ErrorCodes.PAYMENT_ID_NOT_FOUND });
|
|
64
|
+
if (message.includes("already been paid"))
|
|
65
|
+
return Object.assign(Object.assign({}, this.codes[409]), { error_code: errors_1.ErrorCodes.ALREADY_PAID_INVOICE });
|
|
66
|
+
if (message.includes("Payment could not be processed"))
|
|
67
|
+
return Object.assign(Object.assign({}, this.codes[500]), { error_code: errors_1.ErrorCodes.PAYMENT_FAILED });
|
|
68
|
+
if (message.includes("webhook operation failed"))
|
|
69
|
+
return Object.assign(Object.assign({}, this.codes[500]), { error_code: errors_1.ErrorCodes.FAILED_WEBHOOK_ACTION });
|
|
70
|
+
if (message.includes("database repository is not initialized"))
|
|
71
|
+
return Object.assign(Object.assign({}, this.codes[500]), { error_code: errors_1.ErrorCodes.ORM_REPO_NOT_INITIALIZED });
|
|
72
|
+
if (message.includes("No webhooks found for this subscription"))
|
|
73
|
+
return Object.assign(Object.assign({}, this.codes[500]), { error_code: errors_1.ErrorCodes.NO_WEBHOOKS });
|
|
74
|
+
if (message.includes("Failed to retrieve webhook addresses"))
|
|
75
|
+
return Object.assign(Object.assign({}, this.codes[500]), { error_code: errors_1.ErrorCodes.FAILED_GET_WEBHOOK_ADDRESSES });
|
|
76
|
+
if (message.includes("not supported by Alchemy"))
|
|
77
|
+
return Object.assign(Object.assign({}, this.codes[500]), { error_code: errors_1.ErrorCodes.UNSUPPORTED_ALCHEMY_NETWORK });
|
|
78
|
+
if (message.includes("Failed to initialize webhooks"))
|
|
79
|
+
return Object.assign(Object.assign({}, this.codes[500]), { error_code: errors_1.ErrorCodes.FAILED_INITIALIZE_WEBHOOKS });
|
|
80
|
+
return Object.assign(Object.assign({}, this.codes[500]), { error_code: errors_1.ErrorCodes.UNEXPECTED_ERROR });
|
|
53
81
|
};
|
|
54
82
|
}
|
|
55
|
-
InvoiceSubscriberError(
|
|
83
|
+
InvoiceSubscriberError(_) { return errors_1.ErrorMessages.INVOICE_SUBSCRIBER_ERROR; }
|
|
56
84
|
;
|
|
57
|
-
RequireMinAmount(
|
|
85
|
+
RequireMinAmount(_) { return errors_1.ErrorMessages.REQUIRE_MIN_AMOUNT; }
|
|
58
86
|
;
|
|
59
|
-
PaymentIdNotFound(
|
|
87
|
+
PaymentIdNotFound(_) { return errors_1.ErrorMessages.PAYMENT_ID_NOT_FOUND; }
|
|
60
88
|
;
|
|
61
|
-
AlreadyPaidInvoice() { return
|
|
89
|
+
AlreadyPaidInvoice(_) { return errors_1.ErrorMessages.ALREADY_PAID_INVOICE; }
|
|
62
90
|
;
|
|
63
|
-
PaymentFailed(
|
|
91
|
+
PaymentFailed(_) { return errors_1.ErrorMessages.PAYMENT_FAILED; }
|
|
64
92
|
;
|
|
65
|
-
|
|
66
|
-
FailedWebhookAction(action_type, success_count, expected_success_count) { return `AlchemyActionError: Failed to ${action_type}. Success count: ${success_count} out of ${expected_success_count}`; }
|
|
93
|
+
FailedWebhookAction(_, __, ___) { return errors_1.ErrorMessages.FAILED_WEBHOOK_ACTION; }
|
|
67
94
|
;
|
|
68
|
-
NotInitializedOrmRepo(
|
|
95
|
+
NotInitializedOrmRepo(_) { return errors_1.ErrorMessages.ORM_REPO_NOT_INITIALIZED; }
|
|
69
96
|
;
|
|
70
|
-
NoWebhooks(
|
|
97
|
+
NoWebhooks(_) { return errors_1.ErrorMessages.NO_WEBHOOKS; }
|
|
71
98
|
;
|
|
72
|
-
FailedGetWebhookAddresses(
|
|
99
|
+
FailedGetWebhookAddresses(_, __) { return errors_1.ErrorMessages.FAILED_GET_WEBHOOK_ADDRESSES; }
|
|
73
100
|
;
|
|
74
|
-
UnsupportedAlchemyNetwork(
|
|
101
|
+
UnsupportedAlchemyNetwork(_) { return errors_1.ErrorMessages.UNSUPPORTED_ALCHEMY_NETWORK; }
|
|
75
102
|
;
|
|
76
|
-
FailedInitializeWebhooks(
|
|
103
|
+
FailedInitializeWebhooks(_) { return errors_1.ErrorMessages.FAILED_INITIALIZE_WEBHOOKS; }
|
|
77
104
|
;
|
|
78
105
|
}
|
|
79
106
|
exports.default = AlchemyErrors;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import BaseErrors from "./errors";
|
|
1
|
+
import BaseErrors, { ErrorCodeEntry, ErrorCode } from "./errors";
|
|
2
2
|
interface ErrorHandlerResponse {
|
|
3
3
|
status_code: number;
|
|
4
4
|
response: ResponseObject;
|
|
@@ -7,17 +7,13 @@ interface ErrorHandlerResponse {
|
|
|
7
7
|
interface ResponseObject {
|
|
8
8
|
status: boolean;
|
|
9
9
|
message: string;
|
|
10
|
+
error_code: ErrorCode | null;
|
|
10
11
|
data: any;
|
|
11
12
|
error: string;
|
|
12
13
|
}
|
|
13
14
|
declare class BalanceErrors extends BaseErrors {
|
|
14
|
-
/** Error Definition */
|
|
15
|
-
/** Handler methods */
|
|
16
15
|
handle_balance_error: (error: any, source_method: string) => ErrorHandlerResponse;
|
|
17
|
-
get_error_code: (message: string) =>
|
|
18
|
-
code: number;
|
|
19
|
-
error: string;
|
|
20
|
-
};
|
|
16
|
+
get_error_code: (message: string) => ErrorCodeEntry;
|
|
21
17
|
}
|
|
22
18
|
export default BalanceErrors;
|
|
23
19
|
//# sourceMappingURL=BalanceErrors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BalanceErrors.d.ts","sourceRoot":"","sources":["../../src/errors/BalanceErrors.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"BalanceErrors.d.ts","sourceRoot":"","sources":["../../src/errors/BalanceErrors.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,EAAE,EAAE,cAAc,EAAc,SAAS,EAAE,MAAM,UAAU,CAAC;AAE7E,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,UAAU,EAAE,SAAS,GAAG,IAAI,CAAC;IAC7B,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,cAAM,aAAc,SAAQ,UAAU;IAC3B,oBAAoB,GAAI,OAAO,GAAG,EAAE,eAAe,MAAM,KAAG,oBAAoB,CAatF;IAEM,cAAc,GAAI,SAAS,MAAM,KAAG,cAAc,CAQxD;CACJ;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -1,44 +1,65 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
5
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const errors_1 =
|
|
36
|
+
const errors_1 = __importStar(require("./errors"));
|
|
7
37
|
class BalanceErrors extends errors_1.default {
|
|
8
38
|
constructor() {
|
|
9
|
-
/** Error Definition */
|
|
10
39
|
super(...arguments);
|
|
11
|
-
/** Handler methods */
|
|
12
|
-
// Return status code, error, and message
|
|
13
40
|
this.handle_balance_error = (error, source_method) => {
|
|
14
|
-
|
|
15
|
-
|
|
41
|
+
const status = this.get_error_code(error.message);
|
|
42
|
+
return {
|
|
16
43
|
status_code: status.code,
|
|
44
|
+
source_method,
|
|
17
45
|
response: {
|
|
18
46
|
status: false,
|
|
19
|
-
message: status.code
|
|
47
|
+
message: status.code === 500 && !error.message ? "An unexpected error occurred. Please try again later." : error.message,
|
|
48
|
+
error_code: status.error_code,
|
|
20
49
|
data: {},
|
|
21
50
|
error: status.error
|
|
22
51
|
}
|
|
23
52
|
};
|
|
24
|
-
return Object.assign(Object.assign({}, result), { source_method });
|
|
25
53
|
};
|
|
26
|
-
// Get the status code and error message
|
|
27
54
|
this.get_error_code = (message) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (message.includes("Failed to get transactions count from db for chain"))
|
|
37
|
-
return this.codes[500];
|
|
38
|
-
return {
|
|
39
|
-
code: 500,
|
|
40
|
-
error: "Internal Server Error"
|
|
41
|
-
};
|
|
55
|
+
const base = this.get_error_code_base(message);
|
|
56
|
+
if (base)
|
|
57
|
+
return base;
|
|
58
|
+
if (message.includes("Service is temporarily unavailable"))
|
|
59
|
+
return Object.assign(Object.assign({}, this.codes[500]), { error_code: errors_1.ErrorCodes.SERVER_UNAVAILABLE });
|
|
60
|
+
if (message.includes("Failed to retrieve transaction count"))
|
|
61
|
+
return Object.assign(Object.assign({}, this.codes[500]), { error_code: errors_1.ErrorCodes.FAILED_GET_TRANSACTIONS });
|
|
62
|
+
return Object.assign(Object.assign({}, this.codes[500]), { error_code: errors_1.ErrorCodes.UNEXPECTED_ERROR });
|
|
42
63
|
};
|
|
43
64
|
}
|
|
44
65
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import BaseErrors from "./errors";
|
|
1
|
+
import BaseErrors, { ErrorCodeEntry, ErrorCode } from "./errors";
|
|
2
2
|
interface ErrorHandlerResponse {
|
|
3
3
|
status_code: number;
|
|
4
4
|
response: ResponseObject;
|
|
@@ -7,19 +7,15 @@ interface ErrorHandlerResponse {
|
|
|
7
7
|
interface ResponseObject {
|
|
8
8
|
status: boolean;
|
|
9
9
|
message: string;
|
|
10
|
+
error_code: ErrorCode | null;
|
|
10
11
|
data: any;
|
|
11
12
|
error: string;
|
|
12
13
|
}
|
|
13
14
|
declare class DatabaseErrors extends BaseErrors {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
FailedGetTransactions(chainId: string, address: string): string;
|
|
17
|
-
/** Handler methods */
|
|
15
|
+
ServerUnavailable(_?: any): "Service is temporarily unavailable. Please try again later";
|
|
16
|
+
FailedGetTransactions(_?: any, __?: any): "Failed to retrieve transaction count. Please try again later";
|
|
18
17
|
handle_database_error: (error: any, source_method: string) => ErrorHandlerResponse;
|
|
19
|
-
get_error_code: (message: string) =>
|
|
20
|
-
code: number;
|
|
21
|
-
error: string;
|
|
22
|
-
};
|
|
18
|
+
get_error_code: (message: string) => ErrorCodeEntry;
|
|
23
19
|
}
|
|
24
20
|
export default DatabaseErrors;
|
|
25
21
|
//# sourceMappingURL=DatabaseErrors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatabaseErrors.d.ts","sourceRoot":"","sources":["../../src/errors/DatabaseErrors.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"DatabaseErrors.d.ts","sourceRoot":"","sources":["../../src/errors/DatabaseErrors.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,EAAE,EAAE,cAAc,EAAc,SAAS,EAAiB,MAAM,UAAU,CAAC;AAE5F,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,UAAU,EAAE,SAAS,GAAG,IAAI,CAAC;IAC7B,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,cAAM,cAAe,SAAQ,UAAU;IAC5B,iBAAiB,CAAC,CAAC,CAAC,EAAE,GAAG;IACzB,qBAAqB,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,GAAG;IAEvC,qBAAqB,GAAI,OAAO,GAAG,EAAE,eAAe,MAAM,KAAG,oBAAoB,CAavF;IAEM,cAAc,GAAI,SAAS,MAAM,KAAG,cAAc,CAQxD;CACJ;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -1,49 +1,70 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
5
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const errors_1 =
|
|
36
|
+
const errors_1 = __importStar(require("./errors"));
|
|
7
37
|
class DatabaseErrors extends errors_1.default {
|
|
8
38
|
constructor() {
|
|
9
39
|
super(...arguments);
|
|
10
|
-
/** Handler methods */
|
|
11
|
-
// Return status code, error, and message
|
|
12
40
|
this.handle_database_error = (error, source_method) => {
|
|
13
|
-
|
|
14
|
-
|
|
41
|
+
const status = this.get_error_code(error.message);
|
|
42
|
+
return {
|
|
15
43
|
status_code: status.code,
|
|
44
|
+
source_method,
|
|
16
45
|
response: {
|
|
17
46
|
status: false,
|
|
18
|
-
message: status.code
|
|
47
|
+
message: status.code === 500 && !error.message ? "An unexpected error occurred. Please try again later." : error.message,
|
|
48
|
+
error_code: status.error_code,
|
|
19
49
|
data: {},
|
|
20
50
|
error: status.error
|
|
21
51
|
}
|
|
22
52
|
};
|
|
23
|
-
return Object.assign(Object.assign({}, result), { source_method });
|
|
24
53
|
};
|
|
25
|
-
// Get the status code and error message
|
|
26
54
|
this.get_error_code = (message) => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if (message.includes("Failed to get transactions count from db for chain"))
|
|
36
|
-
return this.codes[500];
|
|
37
|
-
return {
|
|
38
|
-
code: 500,
|
|
39
|
-
error: "Internal Server Error"
|
|
40
|
-
};
|
|
55
|
+
const base = this.get_error_code_base(message);
|
|
56
|
+
if (base)
|
|
57
|
+
return base;
|
|
58
|
+
if (message.includes("Service is temporarily unavailable"))
|
|
59
|
+
return Object.assign(Object.assign({}, this.codes[500]), { error_code: errors_1.ErrorCodes.SERVER_UNAVAILABLE });
|
|
60
|
+
if (message.includes("Failed to retrieve transaction count"))
|
|
61
|
+
return Object.assign(Object.assign({}, this.codes[500]), { error_code: errors_1.ErrorCodes.FAILED_GET_TRANSACTIONS });
|
|
62
|
+
return Object.assign(Object.assign({}, this.codes[500]), { error_code: errors_1.ErrorCodes.UNEXPECTED_ERROR });
|
|
41
63
|
};
|
|
42
64
|
}
|
|
43
|
-
|
|
44
|
-
ServerUnavailable() { return `Server currently unavailable. Please try again later`; }
|
|
65
|
+
ServerUnavailable(_) { return errors_1.ErrorMessages.SERVER_UNAVAILABLE; }
|
|
45
66
|
;
|
|
46
|
-
FailedGetTransactions(
|
|
67
|
+
FailedGetTransactions(_, __) { return errors_1.ErrorMessages.FAILED_GET_TRANSACTIONS; }
|
|
47
68
|
;
|
|
48
69
|
}
|
|
49
70
|
exports.default = DatabaseErrors;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RequestStatus } from "../services/types/claim";
|
|
2
|
-
import BaseErrors from "./errors";
|
|
2
|
+
import BaseErrors, { ErrorCodeEntry, ErrorCode } from "./errors";
|
|
3
3
|
interface ErrorHandlerResponse {
|
|
4
4
|
status_code: number;
|
|
5
5
|
response: ResponseObject;
|
|
@@ -8,30 +8,25 @@ interface ErrorHandlerResponse {
|
|
|
8
8
|
interface ResponseObject {
|
|
9
9
|
status: boolean;
|
|
10
10
|
message: string;
|
|
11
|
+
error_code: ErrorCode | null;
|
|
11
12
|
data: any;
|
|
12
13
|
error: string;
|
|
13
14
|
}
|
|
14
15
|
declare class TransactionsErrors extends BaseErrors {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
EmptyPayload(action: string): string;
|
|
28
|
-
OnlyStablecoinWithdrawal(): string;
|
|
29
|
-
/** Handler methods */
|
|
16
|
+
RequestNotApproved(_?: RequestStatus): "Withdrawal request has not been approved";
|
|
17
|
+
ReceiverRequired(_?: any): "Receiver address is missing. Please contact support";
|
|
18
|
+
UnexpectedReceiver(_?: any): "Please use the wallet address associated with your deposit";
|
|
19
|
+
DuplicateClaimJob(_?: any): "A claim for this request is already in progress. Please check back in a few minutes";
|
|
20
|
+
InvalidAddress(_?: any): "The wallet address provided is invalid";
|
|
21
|
+
RequestFulfilled(_?: any): "This request has already been fulfilled";
|
|
22
|
+
NotExistWithdrawRequest(_?: any): "Withdrawal request not found";
|
|
23
|
+
UnsupportedNetwork(_?: any): "The selected network is not supported";
|
|
24
|
+
UnsupportedAddress(_?: any, __?: any): "The address format is not compatible with the selected network";
|
|
25
|
+
UnexpectedAddressFormat(_?: any, __?: any): "The address does not match the expected format for the selected network";
|
|
26
|
+
EmptyPayload(_?: any): "Request payload cannot be empty";
|
|
27
|
+
OnlyStablecoinWithdrawal(_?: any): "This network only supports stablecoin withdrawals";
|
|
30
28
|
handle_transactions_error: (error: any, source_method: string) => ErrorHandlerResponse;
|
|
31
|
-
get_error_code: (message: string) =>
|
|
32
|
-
code: number;
|
|
33
|
-
error: string;
|
|
34
|
-
};
|
|
29
|
+
get_error_code: (message: string) => ErrorCodeEntry;
|
|
35
30
|
}
|
|
36
31
|
export default TransactionsErrors;
|
|
37
32
|
//# sourceMappingURL=TransactionsErrors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionsErrors.d.ts","sourceRoot":"","sources":["../../src/errors/TransactionsErrors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TransactionsErrors.d.ts","sourceRoot":"","sources":["../../src/errors/TransactionsErrors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,UAAU,EAAE,EAAE,cAAc,EAAc,SAAS,EAAiB,MAAM,UAAU,CAAC;AAE5F,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,UAAU,EAAE,SAAS,GAAG,IAAI,CAAC;IAC7B,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,cAAM,kBAAmB,SAAQ,UAAU;IAChC,kBAAkB,CAAC,CAAC,CAAC,EAAE,aAAa;IACpC,gBAAgB,CAAC,CAAC,CAAC,EAAE,GAAG;IACxB,kBAAkB,CAAC,CAAC,CAAC,EAAE,GAAG;IAC1B,iBAAiB,CAAC,CAAC,CAAC,EAAE,GAAG;IACzB,cAAc,CAAC,CAAC,CAAC,EAAE,GAAG;IACtB,gBAAgB,CAAC,CAAC,CAAC,EAAE,GAAG;IACxB,uBAAuB,CAAC,CAAC,CAAC,EAAE,GAAG;IAC/B,kBAAkB,CAAC,CAAC,CAAC,EAAE,GAAG;IAC1B,kBAAkB,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,GAAG;IACpC,uBAAuB,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,GAAG;IACzC,YAAY,CAAC,CAAC,CAAC,EAAE,GAAG;IACpB,wBAAwB,CAAC,CAAC,CAAC,EAAE,GAAG;IAEhC,yBAAyB,GAAI,OAAO,GAAG,EAAE,eAAe,MAAM,KAAG,oBAAoB,CAa3F;IAEM,cAAc,GAAI,SAAS,MAAM,KAAG,cAAc,CAkBxD;CACJ;AAED,eAAe,kBAAkB,CAAC"}
|