@ultrade/shared 1.0.1 → 1.0.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/dist/common/index.d.ts +0 -5
- package/dist/common/index.js +0 -643
- package/dist/constants/index.d.ts +0 -1
- package/dist/constants/index.js +0 -78
- package/dist/helpers/assert.helper.js +0 -78
- package/dist/helpers/atomic.helper.js +0 -78
- package/dist/helpers/balance.helper.js +0 -78
- package/dist/helpers/codex/common.helper.js +0 -78
- package/dist/helpers/codex/index.js +0 -78
- package/dist/helpers/codex/mbr.helper.js +0 -78
- package/dist/helpers/codex/mna.helper.js +0 -78
- package/dist/helpers/codex/order.helper.js +0 -78
- package/dist/helpers/codex/setGlobal.helper.js +0 -78
- package/dist/helpers/codex/transfer.helper.js +0 -78
- package/dist/helpers/codex/txn.helper.js +0 -78
- package/dist/helpers/codex.helper.js +0 -78
- package/dist/helpers/eth.helper.js +0 -78
- package/dist/helpers/vaa.helper.js +0 -78
- package/dist/helpers/withdraw.helper.js +0 -78
- package/package.json +3 -9
- package/dist/common/awsKms.d.ts +0 -2
- package/dist/common/awsKms.js +0 -255
- package/dist/common/indexer.helper.d.ts +0 -2
- package/dist/common/indexer.helper.js +0 -377
- package/dist/common/logger.d.ts +0 -32
- package/dist/common/logger.js +0 -178
- package/dist/common/migration.helpers.d.ts +0 -4
- package/dist/common/migration.helpers.js +0 -33
- package/dist/common/redis.helper.d.ts +0 -27
- package/dist/common/redis.helper.js +0 -249
- package/dist/constants/queue.d.ts +0 -39
- package/dist/helpers/hummingbots.helper.d.ts +0 -2
- package/dist/helpers/hummingbots.helper.js +0 -152
- package/dist/interfaces/controller.interface.d.ts +0 -6
|
@@ -2986,7 +2986,6 @@ __exportStar(__webpack_require__(2806), exports);
|
|
|
2986
2986
|
__exportStar(__webpack_require__(661), exports);
|
|
2987
2987
|
__exportStar(__webpack_require__(9862), exports);
|
|
2988
2988
|
__exportStar(__webpack_require__(935), exports);
|
|
2989
|
-
__exportStar(__webpack_require__(7801), exports);
|
|
2990
2989
|
__exportStar(__webpack_require__(2169), exports);
|
|
2991
2990
|
__exportStar(__webpack_require__(4574), exports);
|
|
2992
2991
|
|
|
@@ -3382,83 +3381,6 @@ function mapOrderTypeShortToLong(value) {
|
|
|
3382
3381
|
}
|
|
3383
3382
|
|
|
3384
3383
|
|
|
3385
|
-
/***/ }),
|
|
3386
|
-
|
|
3387
|
-
/***/ 7801:
|
|
3388
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3392
|
-
exports.QueueOptions = exports.QueueNames = void 0;
|
|
3393
|
-
var QueueNames;
|
|
3394
|
-
(function (QueueNames) {
|
|
3395
|
-
QueueNames["CANCELLATION_TRADE"] = "cancellation_trade";
|
|
3396
|
-
QueueNames["CANCEL_ORDER"] = "cancelOrder";
|
|
3397
|
-
QueueNames["MAINTENANCE"] = "maintenance";
|
|
3398
|
-
QueueNames["SYSTEM"] = "system";
|
|
3399
|
-
QueueNames["NEW_ORDER"] = "newOrder";
|
|
3400
|
-
QueueNames["PROCESS_WALLET_TRANSACTION"] = "wallet_transaction";
|
|
3401
|
-
QueueNames["LAST_LOOK_TRADE"] = "last_look_trade";
|
|
3402
|
-
QueueNames["SEND_TRADE_TO_SETTLE"] = "send_trade_to_settle";
|
|
3403
|
-
QueueNames["TRADE_FIRE"] = "trade_fire";
|
|
3404
|
-
QueueNames["TRADE_CONFIRMED"] = "trade_confirmed";
|
|
3405
|
-
QueueNames["ORDER_OPERATION"] = "order_operation";
|
|
3406
|
-
QueueNames["ORDER_RESULT"] = "order_result";
|
|
3407
|
-
QueueNames["TRADES_QUEUE"] = "trades_q";
|
|
3408
|
-
QueueNames["OPEN_ORDER_BOOK"] = "open_order_book";
|
|
3409
|
-
QueueNames["SOCKET_WALLET_TRANSACTION"] = "socket_wallet_transaction";
|
|
3410
|
-
QueueNames["STREAM_UPDATE_QUOTE"] = "stream_update_quote";
|
|
3411
|
-
QueueNames["STREAM_UPDATE_LAST_PRICE"] = "stream_update_last_price";
|
|
3412
|
-
QueueNames["STREAM_UPDATE_DEPTH"] = "stream_update_depth";
|
|
3413
|
-
QueueNames["STREAM_UPDATE_LAST_CANDLESTICK"] = "stream_update_last_candlestick";
|
|
3414
|
-
QueueNames["STREAM_UPDATE_ORDERS"] = "stream_update_orders";
|
|
3415
|
-
QueueNames["STREAM_UPDATE_TRADES"] = "stream_update_trades";
|
|
3416
|
-
QueueNames["STREAM_UPDATE_ORDER_BOOK"] = "stream_update_order_book";
|
|
3417
|
-
QueueNames["CODEX_DEPOSIT"] = "codex_deposit";
|
|
3418
|
-
QueueNames["CODEX_TRANSFER"] = "codex_transfer";
|
|
3419
|
-
QueueNames["CODEX_WITHDRAWAL"] = "codex_withdrawal";
|
|
3420
|
-
QueueNames["CODEX_BALANCES"] = "codex_balances";
|
|
3421
|
-
QueueNames["CODEX_TRADE"] = "codex_trade";
|
|
3422
|
-
QueueNames["VAA_LOG"] = "vaa_log";
|
|
3423
|
-
QueueNames["SETTINGS_UPDATE"] = "settings_update";
|
|
3424
|
-
QueueNames["POINT_SYSTEM_SETTINGS_UPDATE"] = "point_system_settings_update";
|
|
3425
|
-
QueueNames["NEW_NOTIFICATION"] = "new_notification";
|
|
3426
|
-
})(QueueNames || (exports.QueueNames = QueueNames = {}));
|
|
3427
|
-
exports.QueueOptions = {
|
|
3428
|
-
[QueueNames.CANCELLATION_TRADE]: { options: { durable: true } },
|
|
3429
|
-
[QueueNames.CANCEL_ORDER]: { options: { durable: true } },
|
|
3430
|
-
[QueueNames.CODEX_BALANCES]: { options: { durable: true } },
|
|
3431
|
-
[QueueNames.CODEX_DEPOSIT]: { options: { durable: true } },
|
|
3432
|
-
[QueueNames.CODEX_TRANSFER]: { options: { durable: true } },
|
|
3433
|
-
[QueueNames.CODEX_TRADE]: { options: { durable: true } },
|
|
3434
|
-
[QueueNames.CODEX_WITHDRAWAL]: { options: { durable: true } },
|
|
3435
|
-
[QueueNames.LAST_LOOK_TRADE]: { options: { durable: true } },
|
|
3436
|
-
[QueueNames.MAINTENANCE]: { options: { durable: true } },
|
|
3437
|
-
[QueueNames.SYSTEM]: { options: { durable: true } },
|
|
3438
|
-
[QueueNames.NEW_ORDER]: { options: { durable: true } },
|
|
3439
|
-
[QueueNames.OPEN_ORDER_BOOK]: { options: { durable: true } },
|
|
3440
|
-
[QueueNames.ORDER_OPERATION]: { options: { durable: true, maxPriority: 5 } },
|
|
3441
|
-
[QueueNames.ORDER_RESULT]: { options: { durable: true } },
|
|
3442
|
-
[QueueNames.PROCESS_WALLET_TRANSACTION]: { options: { durable: true } },
|
|
3443
|
-
[QueueNames.SEND_TRADE_TO_SETTLE]: { options: { durable: true } },
|
|
3444
|
-
[QueueNames.SOCKET_WALLET_TRANSACTION]: { options: { durable: true } },
|
|
3445
|
-
[QueueNames.STREAM_UPDATE_DEPTH]: { options: { durable: true } },
|
|
3446
|
-
[QueueNames.STREAM_UPDATE_LAST_CANDLESTICK]: { options: { durable: true } },
|
|
3447
|
-
[QueueNames.STREAM_UPDATE_LAST_PRICE]: { options: { durable: true } },
|
|
3448
|
-
[QueueNames.STREAM_UPDATE_ORDERS]: { options: { durable: true } },
|
|
3449
|
-
[QueueNames.STREAM_UPDATE_ORDER_BOOK]: { options: { durable: true } },
|
|
3450
|
-
[QueueNames.STREAM_UPDATE_QUOTE]: { options: { durable: true } },
|
|
3451
|
-
[QueueNames.STREAM_UPDATE_TRADES]: { options: { durable: true } },
|
|
3452
|
-
[QueueNames.TRADES_QUEUE]: { options: { durable: true } },
|
|
3453
|
-
[QueueNames.TRADE_CONFIRMED]: { options: { durable: true } },
|
|
3454
|
-
[QueueNames.TRADE_FIRE]: { options: { durable: true } },
|
|
3455
|
-
[QueueNames.VAA_LOG]: { options: { durable: true } },
|
|
3456
|
-
[QueueNames.SETTINGS_UPDATE]: { options: { durable: true } },
|
|
3457
|
-
[QueueNames.POINT_SYSTEM_SETTINGS_UPDATE]: { options: { durable: true } },
|
|
3458
|
-
[QueueNames.NEW_NOTIFICATION]: { options: { durable: true } },
|
|
3459
|
-
};
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
3384
|
/***/ }),
|
|
3463
3385
|
|
|
3464
3386
|
/***/ 7835:
|
|
@@ -3283,7 +3283,6 @@ __exportStar(__webpack_require__(2806), exports);
|
|
|
3283
3283
|
__exportStar(__webpack_require__(661), exports);
|
|
3284
3284
|
__exportStar(__webpack_require__(9862), exports);
|
|
3285
3285
|
__exportStar(__webpack_require__(935), exports);
|
|
3286
|
-
__exportStar(__webpack_require__(7801), exports);
|
|
3287
3286
|
__exportStar(__webpack_require__(2169), exports);
|
|
3288
3287
|
__exportStar(__webpack_require__(4574), exports);
|
|
3289
3288
|
|
|
@@ -3737,83 +3736,6 @@ function mapOrderTypeShortToLong(value) {
|
|
|
3737
3736
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3738
3737
|
|
|
3739
3738
|
|
|
3740
|
-
/***/ }),
|
|
3741
|
-
|
|
3742
|
-
/***/ 7801:
|
|
3743
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3747
|
-
exports.QueueOptions = exports.QueueNames = void 0;
|
|
3748
|
-
var QueueNames;
|
|
3749
|
-
(function (QueueNames) {
|
|
3750
|
-
QueueNames["CANCELLATION_TRADE"] = "cancellation_trade";
|
|
3751
|
-
QueueNames["CANCEL_ORDER"] = "cancelOrder";
|
|
3752
|
-
QueueNames["MAINTENANCE"] = "maintenance";
|
|
3753
|
-
QueueNames["SYSTEM"] = "system";
|
|
3754
|
-
QueueNames["NEW_ORDER"] = "newOrder";
|
|
3755
|
-
QueueNames["PROCESS_WALLET_TRANSACTION"] = "wallet_transaction";
|
|
3756
|
-
QueueNames["LAST_LOOK_TRADE"] = "last_look_trade";
|
|
3757
|
-
QueueNames["SEND_TRADE_TO_SETTLE"] = "send_trade_to_settle";
|
|
3758
|
-
QueueNames["TRADE_FIRE"] = "trade_fire";
|
|
3759
|
-
QueueNames["TRADE_CONFIRMED"] = "trade_confirmed";
|
|
3760
|
-
QueueNames["ORDER_OPERATION"] = "order_operation";
|
|
3761
|
-
QueueNames["ORDER_RESULT"] = "order_result";
|
|
3762
|
-
QueueNames["TRADES_QUEUE"] = "trades_q";
|
|
3763
|
-
QueueNames["OPEN_ORDER_BOOK"] = "open_order_book";
|
|
3764
|
-
QueueNames["SOCKET_WALLET_TRANSACTION"] = "socket_wallet_transaction";
|
|
3765
|
-
QueueNames["STREAM_UPDATE_QUOTE"] = "stream_update_quote";
|
|
3766
|
-
QueueNames["STREAM_UPDATE_LAST_PRICE"] = "stream_update_last_price";
|
|
3767
|
-
QueueNames["STREAM_UPDATE_DEPTH"] = "stream_update_depth";
|
|
3768
|
-
QueueNames["STREAM_UPDATE_LAST_CANDLESTICK"] = "stream_update_last_candlestick";
|
|
3769
|
-
QueueNames["STREAM_UPDATE_ORDERS"] = "stream_update_orders";
|
|
3770
|
-
QueueNames["STREAM_UPDATE_TRADES"] = "stream_update_trades";
|
|
3771
|
-
QueueNames["STREAM_UPDATE_ORDER_BOOK"] = "stream_update_order_book";
|
|
3772
|
-
QueueNames["CODEX_DEPOSIT"] = "codex_deposit";
|
|
3773
|
-
QueueNames["CODEX_TRANSFER"] = "codex_transfer";
|
|
3774
|
-
QueueNames["CODEX_WITHDRAWAL"] = "codex_withdrawal";
|
|
3775
|
-
QueueNames["CODEX_BALANCES"] = "codex_balances";
|
|
3776
|
-
QueueNames["CODEX_TRADE"] = "codex_trade";
|
|
3777
|
-
QueueNames["VAA_LOG"] = "vaa_log";
|
|
3778
|
-
QueueNames["SETTINGS_UPDATE"] = "settings_update";
|
|
3779
|
-
QueueNames["POINT_SYSTEM_SETTINGS_UPDATE"] = "point_system_settings_update";
|
|
3780
|
-
QueueNames["NEW_NOTIFICATION"] = "new_notification";
|
|
3781
|
-
})(QueueNames || (exports.QueueNames = QueueNames = {}));
|
|
3782
|
-
exports.QueueOptions = {
|
|
3783
|
-
[QueueNames.CANCELLATION_TRADE]: { options: { durable: true } },
|
|
3784
|
-
[QueueNames.CANCEL_ORDER]: { options: { durable: true } },
|
|
3785
|
-
[QueueNames.CODEX_BALANCES]: { options: { durable: true } },
|
|
3786
|
-
[QueueNames.CODEX_DEPOSIT]: { options: { durable: true } },
|
|
3787
|
-
[QueueNames.CODEX_TRANSFER]: { options: { durable: true } },
|
|
3788
|
-
[QueueNames.CODEX_TRADE]: { options: { durable: true } },
|
|
3789
|
-
[QueueNames.CODEX_WITHDRAWAL]: { options: { durable: true } },
|
|
3790
|
-
[QueueNames.LAST_LOOK_TRADE]: { options: { durable: true } },
|
|
3791
|
-
[QueueNames.MAINTENANCE]: { options: { durable: true } },
|
|
3792
|
-
[QueueNames.SYSTEM]: { options: { durable: true } },
|
|
3793
|
-
[QueueNames.NEW_ORDER]: { options: { durable: true } },
|
|
3794
|
-
[QueueNames.OPEN_ORDER_BOOK]: { options: { durable: true } },
|
|
3795
|
-
[QueueNames.ORDER_OPERATION]: { options: { durable: true, maxPriority: 5 } },
|
|
3796
|
-
[QueueNames.ORDER_RESULT]: { options: { durable: true } },
|
|
3797
|
-
[QueueNames.PROCESS_WALLET_TRANSACTION]: { options: { durable: true } },
|
|
3798
|
-
[QueueNames.SEND_TRADE_TO_SETTLE]: { options: { durable: true } },
|
|
3799
|
-
[QueueNames.SOCKET_WALLET_TRANSACTION]: { options: { durable: true } },
|
|
3800
|
-
[QueueNames.STREAM_UPDATE_DEPTH]: { options: { durable: true } },
|
|
3801
|
-
[QueueNames.STREAM_UPDATE_LAST_CANDLESTICK]: { options: { durable: true } },
|
|
3802
|
-
[QueueNames.STREAM_UPDATE_LAST_PRICE]: { options: { durable: true } },
|
|
3803
|
-
[QueueNames.STREAM_UPDATE_ORDERS]: { options: { durable: true } },
|
|
3804
|
-
[QueueNames.STREAM_UPDATE_ORDER_BOOK]: { options: { durable: true } },
|
|
3805
|
-
[QueueNames.STREAM_UPDATE_QUOTE]: { options: { durable: true } },
|
|
3806
|
-
[QueueNames.STREAM_UPDATE_TRADES]: { options: { durable: true } },
|
|
3807
|
-
[QueueNames.TRADES_QUEUE]: { options: { durable: true } },
|
|
3808
|
-
[QueueNames.TRADE_CONFIRMED]: { options: { durable: true } },
|
|
3809
|
-
[QueueNames.TRADE_FIRE]: { options: { durable: true } },
|
|
3810
|
-
[QueueNames.VAA_LOG]: { options: { durable: true } },
|
|
3811
|
-
[QueueNames.SETTINGS_UPDATE]: { options: { durable: true } },
|
|
3812
|
-
[QueueNames.POINT_SYSTEM_SETTINGS_UPDATE]: { options: { durable: true } },
|
|
3813
|
-
[QueueNames.NEW_NOTIFICATION]: { options: { durable: true } },
|
|
3814
|
-
};
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
3739
|
/***/ }),
|
|
3818
3740
|
|
|
3819
3741
|
/***/ 7835:
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultrade/shared",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "This package contains shared code for the projects.",
|
|
5
5
|
"exports": {
|
|
6
|
-
"./common"
|
|
6
|
+
"./common": {
|
|
7
7
|
"import": "./dist/common/index.js",
|
|
8
8
|
"types": "./dist/common/index.d.ts",
|
|
9
9
|
"require": "./dist/common/index.js"
|
|
@@ -65,22 +65,16 @@
|
|
|
65
65
|
"webpack-cli": "^6.0.1"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"@aws-sdk/client-kms": "^3.576.0",
|
|
69
68
|
"@aws-sdk/client-secrets-manager": "^3.282.0",
|
|
70
69
|
"@aws-sdk/client-ses": "^3.525.0",
|
|
71
70
|
"@certusone/wormhole-sdk": "^0.10.15",
|
|
72
71
|
"@solana/web3.js": "^1.87.6",
|
|
73
72
|
"algosdk": "^2.0.0",
|
|
74
|
-
"amqplib": "^0.10.0",
|
|
75
73
|
"axios": "^0.27.2",
|
|
76
74
|
"bignumber.js": "^9.1.2",
|
|
77
75
|
"bs58": "^5.0.0",
|
|
78
76
|
"buffer": "^6.0.3",
|
|
79
77
|
"crypto-js": "^4.1.1",
|
|
80
|
-
"ethereumjs-util": "^7.1.5"
|
|
81
|
-
"express": "^4.18.1",
|
|
82
|
-
"ioredis": "^5.3.2",
|
|
83
|
-
"typeorm": "^0.3.10",
|
|
84
|
-
"yaml": "^2.4.1"
|
|
78
|
+
"ethereumjs-util": "^7.1.5"
|
|
85
79
|
}
|
|
86
80
|
}
|
package/dist/common/awsKms.d.ts
DELETED
package/dist/common/awsKms.js
DELETED
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
/******/ (() => { // webpackBootstrap
|
|
2
|
-
/******/ "use strict";
|
|
3
|
-
/******/ var __webpack_modules__ = ({
|
|
4
|
-
|
|
5
|
-
/***/ 298:
|
|
6
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
10
|
-
exports.Logger = void 0;
|
|
11
|
-
const node_process_1 = __webpack_require__(1708);
|
|
12
|
-
class Logger {
|
|
13
|
-
_timeLabels = new Map();
|
|
14
|
-
_prefix;
|
|
15
|
-
disabled;
|
|
16
|
-
constructor(prefix, disabled) {
|
|
17
|
-
this._prefix = prefix;
|
|
18
|
-
this.disabled = disabled;
|
|
19
|
-
}
|
|
20
|
-
log(...args) {
|
|
21
|
-
if (this.disabled) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
try {
|
|
25
|
-
this._prefix
|
|
26
|
-
? console.log(this.prefixLabel(this._prefix), ...this.formatArgs(args))
|
|
27
|
-
: console.log(...this.formatArgs(args));
|
|
28
|
-
}
|
|
29
|
-
catch (error) {
|
|
30
|
-
console.log('Error on formating args', error);
|
|
31
|
-
console.log('Args =>', ...args);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
logWarning(message) {
|
|
35
|
-
console.log(this.toYellow(message));
|
|
36
|
-
}
|
|
37
|
-
getUniqueTimeLabel(label) {
|
|
38
|
-
const timeLabel = `[${Math.random() * Math.pow(10, 18)}] ${label}`;
|
|
39
|
-
return timeLabel;
|
|
40
|
-
}
|
|
41
|
-
time(label) {
|
|
42
|
-
if (this._timeLabels.has(label)) {
|
|
43
|
-
console.warn(`Label '${label}' already exists for logger.time()`);
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
const start = node_process_1.hrtime.bigint();
|
|
47
|
-
this._timeLabels.set(label, start);
|
|
48
|
-
}
|
|
49
|
-
timeEnd(label) {
|
|
50
|
-
if (!this._timeLabels.has(label)) {
|
|
51
|
-
console.warn(`Label '${label}' does not exist for logger.time()`);
|
|
52
|
-
return 0;
|
|
53
|
-
}
|
|
54
|
-
const start = this._timeLabels.get(label);
|
|
55
|
-
const end = node_process_1.hrtime.bigint();
|
|
56
|
-
const diff = +(Number(end - start) / 1000000).toFixed(2);
|
|
57
|
-
const color = process.env.LOGGING_OBJECT_INLINE !== "false"
|
|
58
|
-
? this.noColor
|
|
59
|
-
: (diff > 100 ? this.toRed : this.toYellow);
|
|
60
|
-
if (diff > 100 || (label.includes('update24hStat') && diff > 25)) {
|
|
61
|
-
this.log(`Benchmark took ${color(diff)} milliseconds for ${color(label)}`);
|
|
62
|
-
}
|
|
63
|
-
this._timeLabels.delete(label);
|
|
64
|
-
return +diff;
|
|
65
|
-
}
|
|
66
|
-
logRabbit(...args) {
|
|
67
|
-
this.log(...this.formatArgs(["[Rabbit]", ...args]));
|
|
68
|
-
}
|
|
69
|
-
logPair(...args) {
|
|
70
|
-
this.log(...this.formatArgs(args, "Pair"));
|
|
71
|
-
}
|
|
72
|
-
logPairTime(pair, label) {
|
|
73
|
-
this.time(`${this.prefixLabel("Pair", pair)} ${label}`);
|
|
74
|
-
}
|
|
75
|
-
logPairTimeEnd(pair, label) {
|
|
76
|
-
this.timeEnd(`${this.prefixLabel("Pair", pair)} ${label}`);
|
|
77
|
-
}
|
|
78
|
-
logOrder(...args) {
|
|
79
|
-
this.log(...this.formatArgs(args, "OrderID"));
|
|
80
|
-
}
|
|
81
|
-
logOrderTime(id, label) {
|
|
82
|
-
this.time(`${this.prefixLabel("OrderID", id)} ${label}`);
|
|
83
|
-
}
|
|
84
|
-
logOrderTimeEnd(id, label) {
|
|
85
|
-
this.timeEnd(`${this.prefixLabel("OrderID", id)} ${label}`);
|
|
86
|
-
}
|
|
87
|
-
logTrade(...args) {
|
|
88
|
-
this.log(...this.formatArgs(args, "TradeID"));
|
|
89
|
-
}
|
|
90
|
-
logCompany(...args) {
|
|
91
|
-
this.log(...this.formatArgs(args, "CompanyID"));
|
|
92
|
-
}
|
|
93
|
-
logTradeTime(id, label) {
|
|
94
|
-
this.time(`${this.prefixLabel("TradeID", id)} ${label}`);
|
|
95
|
-
}
|
|
96
|
-
logTradeTimeEnd(id, label) {
|
|
97
|
-
this.timeEnd(`${this.prefixLabel("TradeID", id)} ${label}`);
|
|
98
|
-
}
|
|
99
|
-
logOperation(...args) {
|
|
100
|
-
this.log(...this.formatArgs(args, "OperationID"));
|
|
101
|
-
}
|
|
102
|
-
logVaa(...args) {
|
|
103
|
-
this.log(...this.formatArgs(args, "VaaId"));
|
|
104
|
-
}
|
|
105
|
-
logRequest(event, maskFunction = (_, body) => body) {
|
|
106
|
-
const { httpMethod, path, queryStringParameters, body } = event;
|
|
107
|
-
this.log(httpMethod, path, { queryStringParameters, body: maskFunction(path, body) });
|
|
108
|
-
}
|
|
109
|
-
formatArgs(args, prefix = null) {
|
|
110
|
-
return args.map((value, index) => {
|
|
111
|
-
if (index === 0 && typeof value === "string" && prefix === "Pair") {
|
|
112
|
-
return `[${value}]`;
|
|
113
|
-
}
|
|
114
|
-
if (index === 0 && !!prefix) {
|
|
115
|
-
return this.prefixLabel(prefix, typeof value === "object" ? JSON.stringify(value) : value);
|
|
116
|
-
}
|
|
117
|
-
if (typeof value === "object" && process.env.LOGGING_OBJECT_INLINE !== "false") {
|
|
118
|
-
return JSON.stringify(value);
|
|
119
|
-
}
|
|
120
|
-
return value;
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
prefixLabel(prefix, value) {
|
|
124
|
-
return value ? `[${prefix}: ${value}]` : `[${prefix}]`;
|
|
125
|
-
}
|
|
126
|
-
toYellow(value) {
|
|
127
|
-
return `\x1b[33m${value}\x1b[0m`;
|
|
128
|
-
}
|
|
129
|
-
toRed(value) {
|
|
130
|
-
return `\x1b[31m${value}\x1b[0m`;
|
|
131
|
-
}
|
|
132
|
-
noColor(value) {
|
|
133
|
-
return value;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
exports.Logger = Logger;
|
|
137
|
-
exports["default"] = new Logger();
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
/***/ }),
|
|
141
|
-
|
|
142
|
-
/***/ 1708:
|
|
143
|
-
/***/ ((module) => {
|
|
144
|
-
|
|
145
|
-
module.exports = require("node:process");
|
|
146
|
-
|
|
147
|
-
/***/ }),
|
|
148
|
-
|
|
149
|
-
/***/ 3780:
|
|
150
|
-
/***/ ((module) => {
|
|
151
|
-
|
|
152
|
-
module.exports = require("@aws-sdk/client-kms");
|
|
153
|
-
|
|
154
|
-
/***/ }),
|
|
155
|
-
|
|
156
|
-
/***/ 8980:
|
|
157
|
-
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
161
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
162
|
-
};
|
|
163
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
164
|
-
exports.decrypt = exports.encrypt = void 0;
|
|
165
|
-
const client_kms_1 = __webpack_require__(3780);
|
|
166
|
-
const logger_1 = __importDefault(__webpack_require__(298));
|
|
167
|
-
const encrypt = async (string) => {
|
|
168
|
-
if (process.env.ENVIRONMENT === 'LOCAL') {
|
|
169
|
-
logger_1.default.logWarning('WARNING: AWS KMS encryption is bypassed in local environment.');
|
|
170
|
-
return string;
|
|
171
|
-
}
|
|
172
|
-
const input = {
|
|
173
|
-
KeyId: process.env.SOCIAL_SECRET_KEY_ID,
|
|
174
|
-
Plaintext: Buffer.from(string),
|
|
175
|
-
};
|
|
176
|
-
const command = new client_kms_1.EncryptCommand(input);
|
|
177
|
-
const result = await sendKmsCommand(command);
|
|
178
|
-
return Buffer.from(result.CiphertextBlob).toString('base64');
|
|
179
|
-
};
|
|
180
|
-
exports.encrypt = encrypt;
|
|
181
|
-
const decrypt = async (encryptedString) => {
|
|
182
|
-
if (process.env.ENVIRONMENT === 'LOCAL') {
|
|
183
|
-
logger_1.default.logWarning('WARNING: AWS KMS decryption is bypassed in local environment.');
|
|
184
|
-
return encryptedString;
|
|
185
|
-
}
|
|
186
|
-
const input = {
|
|
187
|
-
KeyId: process.env.SOCIAL_SECRET_KEY_ID,
|
|
188
|
-
CiphertextBlob: Buffer.from(encryptedString, 'base64'),
|
|
189
|
-
};
|
|
190
|
-
const command = new client_kms_1.DecryptCommand(input);
|
|
191
|
-
const result = await sendKmsCommand(command);
|
|
192
|
-
return new TextDecoder().decode(result.Plaintext);
|
|
193
|
-
};
|
|
194
|
-
exports.decrypt = decrypt;
|
|
195
|
-
const sendKmsCommand = async (command) => {
|
|
196
|
-
return new Promise((resolve, reject) => {
|
|
197
|
-
try {
|
|
198
|
-
const client = new client_kms_1.KMSClient({ region: 'us-east-1' });
|
|
199
|
-
client.send(command, (err, data) => {
|
|
200
|
-
if (err) {
|
|
201
|
-
console.log('-----error in KMS operation---------', err);
|
|
202
|
-
reject(err);
|
|
203
|
-
}
|
|
204
|
-
else {
|
|
205
|
-
console.log('KMS command was successfully sent');
|
|
206
|
-
resolve(data);
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
catch (error) {
|
|
211
|
-
console.log('KMSClient error', error);
|
|
212
|
-
reject(error);
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
/***/ })
|
|
219
|
-
|
|
220
|
-
/******/ });
|
|
221
|
-
/************************************************************************/
|
|
222
|
-
/******/ // The module cache
|
|
223
|
-
/******/ var __webpack_module_cache__ = {};
|
|
224
|
-
/******/
|
|
225
|
-
/******/ // The require function
|
|
226
|
-
/******/ function __webpack_require__(moduleId) {
|
|
227
|
-
/******/ // Check if module is in cache
|
|
228
|
-
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
229
|
-
/******/ if (cachedModule !== undefined) {
|
|
230
|
-
/******/ return cachedModule.exports;
|
|
231
|
-
/******/ }
|
|
232
|
-
/******/ // Create a new module (and put it into the cache)
|
|
233
|
-
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
234
|
-
/******/ // no module.id needed
|
|
235
|
-
/******/ // no module.loaded needed
|
|
236
|
-
/******/ exports: {}
|
|
237
|
-
/******/ };
|
|
238
|
-
/******/
|
|
239
|
-
/******/ // Execute the module function
|
|
240
|
-
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
241
|
-
/******/
|
|
242
|
-
/******/ // Return the exports of the module
|
|
243
|
-
/******/ return module.exports;
|
|
244
|
-
/******/ }
|
|
245
|
-
/******/
|
|
246
|
-
/************************************************************************/
|
|
247
|
-
/******/
|
|
248
|
-
/******/ // startup
|
|
249
|
-
/******/ // Load entry module and return exports
|
|
250
|
-
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
251
|
-
/******/ var __webpack_exports__ = __webpack_require__(8980);
|
|
252
|
-
/******/ module.exports = __webpack_exports__;
|
|
253
|
-
/******/
|
|
254
|
-
/******/ })()
|
|
255
|
-
;
|