@ultrade/shared 1.0.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/dist/baseModel/base.model.d.ts +26 -0
- package/dist/baseModel/index.d.ts +2 -0
- package/dist/common/auth.helper.d.ts +4 -0
- package/dist/common/auth.helper.js +367 -0
- package/dist/common/awsKms.d.ts +2 -0
- package/dist/common/awsKms.js +265 -0
- package/dist/common/big-number.helper.d.ts +38 -0
- package/dist/common/big-number.helper.js +263 -0
- package/dist/common/index.d.ts +11 -0
- package/dist/common/index.js +2541 -0
- package/dist/common/indexer.helper.d.ts +2 -0
- package/dist/common/indexer.helper.js +387 -0
- package/dist/common/logger.d.ts +32 -0
- package/dist/common/logger.js +188 -0
- package/dist/common/mappers/codexAsset.mapper.d.ts +2 -0
- package/dist/common/mappers/codexAsset.mapper.js +40 -0
- package/dist/common/mappers/codexBalance.mapper.d.ts +2 -0
- package/dist/common/mappers/codexBalance.mapper.js +38 -0
- package/dist/common/mappers/index.d.ts +3 -0
- package/dist/common/mappers/index.js +1421 -0
- package/dist/common/mappers/trade.mapper.d.ts +6 -0
- package/dist/common/mappers/trade.mapper.js +1343 -0
- package/dist/common/migration.helpers.d.ts +4 -0
- package/dist/common/migration.helpers.js +44 -0
- package/dist/common/redis.helper.d.ts +27 -0
- package/dist/common/redis.helper.js +269 -0
- package/dist/common/secret.helper.d.ts +28 -0
- package/dist/common/secret.helper.js +144 -0
- package/dist/common/timestamp.helper.d.ts +1 -0
- package/dist/common/timestamp.helper.js +41 -0
- package/dist/common/utils/assert.d.ts +1 -0
- package/dist/common/utils/assert.js +32 -0
- package/dist/common/utils/decode.d.ts +5 -0
- package/dist/common/utils/decode.js +206 -0
- package/dist/common/utils/index.d.ts +9 -0
- package/dist/common/utils/index.js +122 -0
- package/dist/common/utils/social.d.ts +1 -0
- package/dist/common/utils/social.js +30 -0
- package/dist/common/utils/stat.d.ts +1 -0
- package/dist/common/utils/stat.js +274 -0
- package/dist/constants/allowedUrls.d.ts +1 -0
- package/dist/constants/auth.d.ts +2 -0
- package/dist/constants/cctp.d.ts +3 -0
- package/dist/constants/codex.d.ts +11 -0
- package/dist/constants/env.d.ts +6 -0
- package/dist/constants/index.d.ts +7 -0
- package/dist/constants/index.js +455 -0
- package/dist/constants/queue.d.ts +39 -0
- package/dist/constants/response.d.ts +82 -0
- package/dist/constants/settings.d.ts +2 -0
- package/dist/constants/social.d.ts +3 -0
- package/dist/constants/withdrawalWalletsMessage.d.ts +1 -0
- package/dist/enums/chains.enum.d.ts +50 -0
- package/dist/enums/db/account/index.d.ts +19 -0
- package/dist/enums/db/affiliate.enum.d.ts +7 -0
- package/dist/enums/db/available-pair-settings.enum.d.ts +12 -0
- package/dist/enums/db/chains.d.ts +30 -0
- package/dist/enums/db/common.enum.d.ts +4 -0
- package/dist/enums/db/component/index.d.ts +22 -0
- package/dist/enums/db/index.d.ts +21 -0
- package/dist/enums/db/market-maker.enum.d.ts +15 -0
- package/dist/enums/db/notification-center/userNotification.enum.d.ts +36 -0
- package/dist/enums/db/order-side.enum.d.ts +5 -0
- package/dist/enums/db/order-status.enum.d.ts +8 -0
- package/dist/enums/db/order-type.enum.d.ts +7 -0
- package/dist/enums/db/pending-actions.enum.d.ts +6 -0
- package/dist/enums/db/relayer.enum.d.ts +23 -0
- package/dist/enums/db/setting-type.enum.d.ts +8 -0
- package/dist/enums/db/social-action.enum.d.ts +24 -0
- package/dist/enums/db/social-prompt.enum.d.ts +8 -0
- package/dist/enums/db/social.enum.d.ts +10 -0
- package/dist/enums/db/state-type.enum.d.ts +9 -0
- package/dist/enums/db/trade.enums.d.ts +10 -0
- package/dist/enums/db/tradingKeyType.enum.d.ts +4 -0
- package/dist/enums/db/upgrade.enum.d.ts +5 -0
- package/dist/enums/db/withdrawal-wallet.enum.d.ts +5 -0
- package/dist/enums/index.d.ts +5 -0
- package/dist/enums/index.js +893 -0
- package/dist/enums/maintenanceMode.enum.d.ts +10 -0
- package/dist/enums/notification.enum.d.ts +7 -0
- package/dist/enums/social.enum.d.ts +10 -0
- package/dist/helpers/Encoding.d.ts +33 -0
- package/dist/helpers/Encoding.js +318 -0
- package/dist/helpers/algo.helper.d.ts +14 -0
- package/dist/helpers/algo.helper.js +1211 -0
- package/dist/helpers/api.helper.d.ts +16 -0
- package/dist/helpers/api.helper.js +1652 -0
- package/dist/helpers/assert.helper.d.ts +10 -0
- package/dist/helpers/assert.helper.js +1677 -0
- package/dist/helpers/atomic.helper.d.ts +21 -0
- package/dist/helpers/atomic.helper.js +712 -0
- package/dist/helpers/balance.helper.d.ts +13 -0
- package/dist/helpers/balance.helper.js +4330 -0
- package/dist/helpers/codex/common.helper.d.ts +24 -0
- package/dist/helpers/codex/common.helper.js +4246 -0
- package/dist/helpers/codex/index.d.ts +6 -0
- package/dist/helpers/codex/index.js +4246 -0
- package/dist/helpers/codex/mbr.helper.d.ts +6 -0
- package/dist/helpers/codex/mbr.helper.js +4246 -0
- package/dist/helpers/codex/mna.helper.d.ts +2 -0
- package/dist/helpers/codex/mna.helper.js +4246 -0
- package/dist/helpers/codex/order.helper.d.ts +6 -0
- package/dist/helpers/codex/order.helper.js +4246 -0
- package/dist/helpers/codex/setGlobal.helper.d.ts +27 -0
- package/dist/helpers/codex/setGlobal.helper.js +4312 -0
- package/dist/helpers/codex/transfer.helper.d.ts +21 -0
- package/dist/helpers/codex/transfer.helper.js +4246 -0
- package/dist/helpers/codex/txn.helper.d.ts +13 -0
- package/dist/helpers/codex/txn.helper.js +4246 -0
- package/dist/helpers/codex.helper.d.ts +106 -0
- package/dist/helpers/codex.helper.js +4246 -0
- package/dist/helpers/email.helper.d.ts +5 -0
- package/dist/helpers/email.helper.js +112 -0
- package/dist/helpers/eth.helper.d.ts +12 -0
- package/dist/helpers/eth.helper.js +4246 -0
- package/dist/helpers/hummingbots.helper.d.ts +2 -0
- package/dist/helpers/hummingbots.helper.js +163 -0
- package/dist/helpers/index.d.ts +5 -0
- package/dist/helpers/index.js +837 -0
- package/dist/helpers/interval.helpers.d.ts +9 -0
- package/dist/helpers/interval.helpers.js +110 -0
- package/dist/helpers/liquidity.helper.d.ts +6 -0
- package/dist/helpers/liquidity.helper.js +81 -0
- package/dist/helpers/order.helper.d.ts +7 -0
- package/dist/helpers/order.helper.js +946 -0
- package/dist/helpers/pair.helper.d.ts +9 -0
- package/dist/helpers/pair.helper.js +938 -0
- package/dist/helpers/pointSystem.helper.d.ts +14 -0
- package/dist/helpers/pointSystem.helper.js +392 -0
- package/dist/helpers/ticker.helpers.d.ts +8 -0
- package/dist/helpers/ticker.helpers.js +358 -0
- package/dist/helpers/vaa.helper.d.ts +2 -0
- package/dist/helpers/vaa.helper.js +4350 -0
- package/dist/helpers/withdraw.helper.d.ts +14 -0
- package/dist/helpers/withdraw.helper.js +4784 -0
- package/dist/interfaces/accountInfo.interface.d.ts +15 -0
- package/dist/interfaces/algostreamer/index.d.ts +49 -0
- package/dist/interfaces/api/affiliate.interface.d.ts +71 -0
- package/dist/interfaces/cache.interface.d.ts +25 -0
- package/dist/interfaces/confirmed-txn.interface.d.ts +46 -0
- package/dist/interfaces/controller.interface.d.ts +6 -0
- package/dist/interfaces/db/baseModel.interface.d.ts +5 -0
- package/dist/interfaces/db/hummingbot/index.d.ts +18 -0
- package/dist/interfaces/db/index.d.ts +10 -0
- package/dist/interfaces/db/market/index.d.ts +313 -0
- package/dist/interfaces/db/marketing/index.d.ts +48 -0
- package/dist/interfaces/db/notification_center/index.d.ts +33 -0
- package/dist/interfaces/db/relayer/index.d.ts +56 -0
- package/dist/interfaces/db/social/index.d.ts +188 -0
- package/dist/interfaces/db/softDeleteModel.interface.d.ts +4 -0
- package/dist/interfaces/db/white_label/index.d.ts +161 -0
- package/dist/interfaces/db/withdrawal_wallets/index.d.ts +12 -0
- package/dist/interfaces/dto/index.d.ts +62 -0
- package/dist/interfaces/emailService.interface.d.ts +4 -0
- package/dist/interfaces/index.d.ts +17 -0
- package/dist/interfaces/index.js +1319 -0
- package/dist/interfaces/kmsService.interface.d.ts +4 -0
- package/dist/interfaces/last-look-trade.interface.d.ts +10 -0
- package/dist/interfaces/market.interface.d.ts +17 -0
- package/dist/interfaces/order.interface.d.ts +162 -0
- package/dist/interfaces/pair.interface.d.ts +10 -0
- package/dist/interfaces/query.interface.d.ts +6 -0
- package/dist/interfaces/services/accountCache.interface.d.ts +15 -0
- package/dist/interfaces/services/algod.interface.d.ts +5 -0
- package/dist/interfaces/services/balances.interface.d.ts +11 -0
- package/dist/interfaces/services/coin-market-cap.interface.d.ts +124 -0
- package/dist/interfaces/services/index.d.ts +8 -0
- package/dist/interfaces/services/price-model.interface.d.ts +4 -0
- package/dist/interfaces/services/price-service.interface.d.ts +8 -0
- package/dist/interfaces/services/socialActivity.interface.d.ts +48 -0
- package/dist/interfaces/services/tmc.interface.d.ts +9 -0
- package/dist/interfaces/streaming.interface.d.ts +95 -0
- package/dist/interfaces/timestream.interface.d.ts +29 -0
- package/dist/interfaces/trading.interface.d.ts +235 -0
- package/dist/interfaces/tradingKey.interface.d.ts +26 -0
- package/dist/interfaces/transfer.interface.d.ts +12 -0
- package/dist/interfaces/wallet.interface.d.ts +89 -0
- package/dist/interfaces/withdrawalWallets.interface.d.ts +14 -0
- package/dist/types/algo-order.type.d.ts +10 -0
- package/dist/types/amm/amm.d.ts +163 -0
- package/dist/types/api/request.types.d.ts +99 -0
- package/dist/types/codex.types.d.ts +28 -0
- package/dist/types/hummingbots.types.d.ts +23 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.js +362 -0
- package/dist/types/notification.type.d.ts +10 -0
- package/dist/types/settings.type.d.ts +162 -0
- package/dist/types/state.type.d.ts +4 -0
- package/package.json +78 -0
|
@@ -0,0 +1,2541 @@
|
|
|
1
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
+
module.exports = factory(require("buffer"), require("@aws-sdk/client-secrets-manager"), require("bignumber.js"), require("ioredis"), require("@aws-sdk/client-kms"), require("algosdk"));
|
|
4
|
+
else if(typeof define === 'function' && define.amd)
|
|
5
|
+
define(["buffer", "@aws-sdk/client-secrets-manager", "bignumber.js", "ioredis", "@aws-sdk/client-kms", "algosdk"], factory);
|
|
6
|
+
else {
|
|
7
|
+
var a = typeof exports === 'object' ? factory(require("buffer"), require("@aws-sdk/client-secrets-manager"), require("bignumber.js"), require("ioredis"), require("@aws-sdk/client-kms"), require("algosdk")) : factory(root["buffer"], root["@aws-sdk/client-secrets-manager"], root["bignumber.js"], root["ioredis"], root["@aws-sdk/client-kms"], root["algosdk"]);
|
|
8
|
+
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
9
|
+
}
|
|
10
|
+
})(global, (__WEBPACK_EXTERNAL_MODULE__18__, __WEBPACK_EXTERNAL_MODULE__2216__, __WEBPACK_EXTERNAL_MODULE__6168__, __WEBPACK_EXTERNAL_MODULE__6615__, __WEBPACK_EXTERNAL_MODULE__7818__, __WEBPACK_EXTERNAL_MODULE__9709__) => {
|
|
11
|
+
return /******/ (() => { // webpackBootstrap
|
|
12
|
+
/******/ "use strict";
|
|
13
|
+
/******/ var __webpack_modules__ = ({
|
|
14
|
+
|
|
15
|
+
/***/ 18:
|
|
16
|
+
/***/ ((module) => {
|
|
17
|
+
|
|
18
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__18__;
|
|
19
|
+
|
|
20
|
+
/***/ }),
|
|
21
|
+
|
|
22
|
+
/***/ 180:
|
|
23
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
27
|
+
exports.timestamp = timestamp;
|
|
28
|
+
const startTime = BigInt(Date.now());
|
|
29
|
+
const startHrTime = process.hrtime.bigint();
|
|
30
|
+
function timestamp(accuracy = 'micro') {
|
|
31
|
+
const elapsedNano = process.hrtime.bigint() - startHrTime;
|
|
32
|
+
const baseTimestampNano = startTime * 10n ** 6n + elapsedNano;
|
|
33
|
+
const baseString = baseTimestampNano.toString();
|
|
34
|
+
let result;
|
|
35
|
+
if (accuracy === "micro") {
|
|
36
|
+
result = `${baseString.slice(0, -6)}.${baseString.slice(-6, -3)}`;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
result = `${baseString.slice(0, -6)}.${baseString.slice(-6)}`;
|
|
40
|
+
}
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
/***/ }),
|
|
46
|
+
|
|
47
|
+
/***/ 221:
|
|
48
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
52
|
+
exports.mapToCodexAssetDto = mapToCodexAssetDto;
|
|
53
|
+
function mapToCodexAssetDto(o, isArchived) {
|
|
54
|
+
return {
|
|
55
|
+
id: o.id,
|
|
56
|
+
address: o.address,
|
|
57
|
+
chainId: o.chainId,
|
|
58
|
+
name: o.name,
|
|
59
|
+
unitName: o.unitName,
|
|
60
|
+
decimals: o.decimals,
|
|
61
|
+
isGas: o.isGas,
|
|
62
|
+
img: o.img,
|
|
63
|
+
cmcLink: o.cmcLink,
|
|
64
|
+
isArchived: isArchived ? isArchived(o) : false,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
/***/ }),
|
|
70
|
+
|
|
71
|
+
/***/ 298:
|
|
72
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
76
|
+
exports.Logger = void 0;
|
|
77
|
+
const node_process_1 = __webpack_require__(1708);
|
|
78
|
+
class Logger {
|
|
79
|
+
constructor(prefix, disabled) {
|
|
80
|
+
this._timeLabels = new Map();
|
|
81
|
+
this._prefix = prefix;
|
|
82
|
+
this.disabled = disabled;
|
|
83
|
+
}
|
|
84
|
+
log(...args) {
|
|
85
|
+
if (this.disabled) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
try {
|
|
89
|
+
this._prefix
|
|
90
|
+
? console.log(this.prefixLabel(this._prefix), ...this.formatArgs(args))
|
|
91
|
+
: console.log(...this.formatArgs(args));
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
console.log('Error on formating args', error);
|
|
95
|
+
console.log('Args =>', ...args);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
logWarning(message) {
|
|
99
|
+
console.log(this.toYellow(message));
|
|
100
|
+
}
|
|
101
|
+
getUniqueTimeLabel(label) {
|
|
102
|
+
const timeLabel = `[${Math.random() * Math.pow(10, 18)}] ${label}`;
|
|
103
|
+
return timeLabel;
|
|
104
|
+
}
|
|
105
|
+
time(label) {
|
|
106
|
+
if (this._timeLabels.has(label)) {
|
|
107
|
+
console.warn(`Label '${label}' already exists for logger.time()`);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const start = node_process_1.hrtime.bigint();
|
|
111
|
+
this._timeLabels.set(label, start);
|
|
112
|
+
}
|
|
113
|
+
timeEnd(label) {
|
|
114
|
+
if (!this._timeLabels.has(label)) {
|
|
115
|
+
console.warn(`Label '${label}' does not exist for logger.time()`);
|
|
116
|
+
return 0;
|
|
117
|
+
}
|
|
118
|
+
const start = this._timeLabels.get(label);
|
|
119
|
+
const end = node_process_1.hrtime.bigint();
|
|
120
|
+
const diff = +(Number(end - start) / 1000000).toFixed(2);
|
|
121
|
+
const color = process.env.LOGGING_OBJECT_INLINE !== "false"
|
|
122
|
+
? this.noColor
|
|
123
|
+
: (diff > 100 ? this.toRed : this.toYellow);
|
|
124
|
+
// console.log(' ');
|
|
125
|
+
if (diff > 100 || (label.includes('update24hStat') && diff > 25)) {
|
|
126
|
+
this.log(`Benchmark took ${color(diff)} milliseconds for ${color(label)}`);
|
|
127
|
+
}
|
|
128
|
+
this._timeLabels.delete(label);
|
|
129
|
+
return +diff;
|
|
130
|
+
}
|
|
131
|
+
logRabbit(...args) {
|
|
132
|
+
this.log(...this.formatArgs(["[Rabbit]", ...args]));
|
|
133
|
+
}
|
|
134
|
+
logPair(...args) {
|
|
135
|
+
this.log(...this.formatArgs(args, "Pair"));
|
|
136
|
+
}
|
|
137
|
+
logPairTime(pair, label) {
|
|
138
|
+
this.time(`${this.prefixLabel("Pair", pair)} ${label}`);
|
|
139
|
+
}
|
|
140
|
+
logPairTimeEnd(pair, label) {
|
|
141
|
+
this.timeEnd(`${this.prefixLabel("Pair", pair)} ${label}`);
|
|
142
|
+
}
|
|
143
|
+
logOrder(...args) {
|
|
144
|
+
this.log(...this.formatArgs(args, "OrderID"));
|
|
145
|
+
}
|
|
146
|
+
logOrderTime(id, label) {
|
|
147
|
+
this.time(`${this.prefixLabel("OrderID", id)} ${label}`);
|
|
148
|
+
}
|
|
149
|
+
logOrderTimeEnd(id, label) {
|
|
150
|
+
this.timeEnd(`${this.prefixLabel("OrderID", id)} ${label}`);
|
|
151
|
+
}
|
|
152
|
+
logTrade(...args) {
|
|
153
|
+
this.log(...this.formatArgs(args, "TradeID"));
|
|
154
|
+
}
|
|
155
|
+
logCompany(...args) {
|
|
156
|
+
this.log(...this.formatArgs(args, "CompanyID"));
|
|
157
|
+
}
|
|
158
|
+
logTradeTime(id, label) {
|
|
159
|
+
this.time(`${this.prefixLabel("TradeID", id)} ${label}`);
|
|
160
|
+
}
|
|
161
|
+
logTradeTimeEnd(id, label) {
|
|
162
|
+
this.timeEnd(`${this.prefixLabel("TradeID", id)} ${label}`);
|
|
163
|
+
}
|
|
164
|
+
logOperation(...args) {
|
|
165
|
+
this.log(...this.formatArgs(args, "OperationID"));
|
|
166
|
+
}
|
|
167
|
+
logVaa(...args) {
|
|
168
|
+
this.log(...this.formatArgs(args, "VaaId"));
|
|
169
|
+
}
|
|
170
|
+
logRequest(event, maskFunction = (_, body) => body) {
|
|
171
|
+
const { httpMethod, path, queryStringParameters, body } = event;
|
|
172
|
+
this.log(httpMethod, path, { queryStringParameters, body: maskFunction(path, body) });
|
|
173
|
+
}
|
|
174
|
+
formatArgs(args, prefix = null) {
|
|
175
|
+
return args.map((value, index) => {
|
|
176
|
+
if (index === 0 && typeof value === "string" && prefix === "Pair") {
|
|
177
|
+
return `[${value}]`;
|
|
178
|
+
}
|
|
179
|
+
if (index === 0 && !!prefix) {
|
|
180
|
+
return this.prefixLabel(prefix, typeof value === "object" ? JSON.stringify(value) : value);
|
|
181
|
+
}
|
|
182
|
+
if (typeof value === "object" && process.env.LOGGING_OBJECT_INLINE !== "false") {
|
|
183
|
+
return JSON.stringify(value);
|
|
184
|
+
}
|
|
185
|
+
return value;
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
prefixLabel(prefix, value) {
|
|
189
|
+
return value ? `[${prefix}: ${value}]` : `[${prefix}]`;
|
|
190
|
+
}
|
|
191
|
+
toYellow(value) {
|
|
192
|
+
return `\x1b[33m${value}\x1b[0m`;
|
|
193
|
+
}
|
|
194
|
+
toRed(value) {
|
|
195
|
+
return `\x1b[31m${value}\x1b[0m`;
|
|
196
|
+
}
|
|
197
|
+
noColor(value) {
|
|
198
|
+
return value;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
exports.Logger = Logger;
|
|
202
|
+
exports["default"] = new Logger();
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
/***/ }),
|
|
206
|
+
|
|
207
|
+
/***/ 696:
|
|
208
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
212
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
213
|
+
};
|
|
214
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
215
|
+
exports.encodeMessage = encodeMessage;
|
|
216
|
+
exports.generateTxnForSign = generateTxnForSign;
|
|
217
|
+
exports.signTxn = signTxn;
|
|
218
|
+
const algosdk_1 = __importDefault(__webpack_require__(9709));
|
|
219
|
+
const Encoding_1 = __webpack_require__(8593);
|
|
220
|
+
function encodeMessage(msg) {
|
|
221
|
+
return (0, Encoding_1.encodeString)(msg);
|
|
222
|
+
// removed by dead control flow
|
|
223
|
+
|
|
224
|
+
// removed by dead control flow
|
|
225
|
+
|
|
226
|
+
}
|
|
227
|
+
function generateTxnForSign(addr, note, encoding) {
|
|
228
|
+
return algosdk_1.default.makePaymentTxnWithSuggestedParamsFromObject({
|
|
229
|
+
from: addr,
|
|
230
|
+
to: addr,
|
|
231
|
+
amount: 0,
|
|
232
|
+
note: note && new Uint8Array(Buffer.from(note, encoding)),
|
|
233
|
+
suggestedParams: {
|
|
234
|
+
fee: 0,
|
|
235
|
+
firstRound: 1,
|
|
236
|
+
lastRound: 2,
|
|
237
|
+
genesisHash: 'SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=',
|
|
238
|
+
genesisID: 'testnet-v1.0',
|
|
239
|
+
},
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
function signTxn(activeAddress, data, encoding, signTransactions) {
|
|
243
|
+
return signTransaction(generateTxnForSign(activeAddress, data, encoding), signTransactions);
|
|
244
|
+
}
|
|
245
|
+
async function signTransaction(rawTxn, signTransactions) {
|
|
246
|
+
const encodedTransaction = algosdk_1.default.encodeUnsignedTransaction(rawTxn);
|
|
247
|
+
const signedTransactions = await signTransactions([encodedTransaction]);
|
|
248
|
+
const decodedTxns = algosdk_1.default.decodeSignedTransaction(signedTransactions[0]);
|
|
249
|
+
const signature = new Uint8Array(decodedTxns.sig);
|
|
250
|
+
return signature;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
/***/ }),
|
|
255
|
+
|
|
256
|
+
/***/ 835:
|
|
257
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
261
|
+
var OrderSide;
|
|
262
|
+
(function (OrderSide) {
|
|
263
|
+
OrderSide[OrderSide["Buy"] = 0] = "Buy";
|
|
264
|
+
OrderSide[OrderSide["Sell"] = 1] = "Sell";
|
|
265
|
+
})(OrderSide || (OrderSide = {}));
|
|
266
|
+
exports["default"] = OrderSide;
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
/***/ }),
|
|
270
|
+
|
|
271
|
+
/***/ 892:
|
|
272
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
276
|
+
exports.PairComponentStatusType = exports.ComponentType = exports.ComponentStatusType = void 0;
|
|
277
|
+
var ComponentStatusType;
|
|
278
|
+
(function (ComponentStatusType) {
|
|
279
|
+
ComponentStatusType["ACTIVE"] = "ACTIVE";
|
|
280
|
+
ComponentStatusType["FAILED"] = "FAILED";
|
|
281
|
+
ComponentStatusType["STARTING"] = "STARTING";
|
|
282
|
+
ComponentStatusType["DRAINING"] = "DRAINING";
|
|
283
|
+
ComponentStatusType["TERMINATING"] = "TERMINATING";
|
|
284
|
+
ComponentStatusType["TERMINATED"] = "TERMINATED";
|
|
285
|
+
})(ComponentStatusType || (exports.ComponentStatusType = ComponentStatusType = {}));
|
|
286
|
+
var ComponentType;
|
|
287
|
+
(function (ComponentType) {
|
|
288
|
+
ComponentType["MATCHING_ENGINE"] = "me";
|
|
289
|
+
ComponentType["ORDER_SERVICE"] = "ors";
|
|
290
|
+
ComponentType["API"] = "api";
|
|
291
|
+
ComponentType["SOCKET_SERVICE"] = "ws";
|
|
292
|
+
ComponentType["TRANSACTION_SERVICE"] = "tns";
|
|
293
|
+
})(ComponentType || (exports.ComponentType = ComponentType = {}));
|
|
294
|
+
var PairComponentStatusType;
|
|
295
|
+
(function (PairComponentStatusType) {
|
|
296
|
+
PairComponentStatusType["ACTIVE"] = "ACTIVE";
|
|
297
|
+
PairComponentStatusType["FAILED"] = "FAILED";
|
|
298
|
+
PairComponentStatusType["UNASSIGNED"] = "UNASSIGNED";
|
|
299
|
+
PairComponentStatusType["ASSIGNED"] = "ASSIGNED";
|
|
300
|
+
PairComponentStatusType["STARTING"] = "STARTING";
|
|
301
|
+
})(PairComponentStatusType || (exports.PairComponentStatusType = PairComponentStatusType = {}));
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
/***/ }),
|
|
305
|
+
|
|
306
|
+
/***/ 893:
|
|
307
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
311
|
+
exports.NON_REPEATABLE_ACTIONS = exports.ActionEnum = exports.ActionSource = void 0;
|
|
312
|
+
var ActionSource;
|
|
313
|
+
(function (ActionSource) {
|
|
314
|
+
ActionSource["COMPANY"] = "COMPANY";
|
|
315
|
+
ActionSource["TWITTER"] = "TWITTER";
|
|
316
|
+
ActionSource["DISCORD"] = "DISCORD";
|
|
317
|
+
ActionSource["TELEGRAM"] = "TELEGRAM";
|
|
318
|
+
})(ActionSource || (exports.ActionSource = ActionSource = {}));
|
|
319
|
+
var ActionEnum;
|
|
320
|
+
(function (ActionEnum) {
|
|
321
|
+
ActionEnum[ActionEnum["TWITTER_FOLLOW"] = 1] = "TWITTER_FOLLOW";
|
|
322
|
+
ActionEnum[ActionEnum["TWITTER_REPLY"] = 2] = "TWITTER_REPLY";
|
|
323
|
+
ActionEnum[ActionEnum["TWITTER_RETWEET"] = 3] = "TWITTER_RETWEET";
|
|
324
|
+
ActionEnum[ActionEnum["TWITTER_LIKE"] = 4] = "TWITTER_LIKE";
|
|
325
|
+
ActionEnum[ActionEnum["COMPANY_FIRST_LOGIN"] = 5] = "COMPANY_FIRST_LOGIN";
|
|
326
|
+
ActionEnum[ActionEnum["COMPANY_CONFIRM_EMAIL"] = 6] = "COMPANY_CONFIRM_EMAIL";
|
|
327
|
+
ActionEnum[ActionEnum["COMPANY_DEPOSIT"] = 7] = "COMPANY_DEPOSIT";
|
|
328
|
+
ActionEnum[ActionEnum["COMPANY_TRADE"] = 8] = "COMPANY_TRADE";
|
|
329
|
+
ActionEnum[ActionEnum["TELEGRAM_JOIN_GROUP"] = 9] = "TELEGRAM_JOIN_GROUP";
|
|
330
|
+
ActionEnum[ActionEnum["DISCORD_JOIN_SERVER"] = 10] = "DISCORD_JOIN_SERVER";
|
|
331
|
+
ActionEnum[ActionEnum["AFFILIATE_POINTS_REWARD"] = 11] = "AFFILIATE_POINTS_REWARD";
|
|
332
|
+
})(ActionEnum || (exports.ActionEnum = ActionEnum = {}));
|
|
333
|
+
exports.NON_REPEATABLE_ACTIONS = [
|
|
334
|
+
ActionEnum.TWITTER_FOLLOW,
|
|
335
|
+
ActionEnum.TELEGRAM_JOIN_GROUP,
|
|
336
|
+
ActionEnum.DISCORD_JOIN_SERVER,
|
|
337
|
+
ActionEnum.COMPANY_CONFIRM_EMAIL,
|
|
338
|
+
ActionEnum.COMPANY_FIRST_LOGIN,
|
|
339
|
+
];
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
/***/ }),
|
|
343
|
+
|
|
344
|
+
/***/ 1048:
|
|
345
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
349
|
+
exports.WithdrawalWalletType = void 0;
|
|
350
|
+
var WithdrawalWalletType;
|
|
351
|
+
(function (WithdrawalWalletType) {
|
|
352
|
+
WithdrawalWalletType["SOLANA"] = "SOLANA";
|
|
353
|
+
WithdrawalWalletType["ALGORAND"] = "ALGORAND";
|
|
354
|
+
WithdrawalWalletType["EVM"] = "EVM";
|
|
355
|
+
})(WithdrawalWalletType || (exports.WithdrawalWalletType = WithdrawalWalletType = {}));
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
/***/ }),
|
|
359
|
+
|
|
360
|
+
/***/ 1134:
|
|
361
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
365
|
+
var OrderType;
|
|
366
|
+
(function (OrderType) {
|
|
367
|
+
OrderType[OrderType["Limit"] = 0] = "Limit";
|
|
368
|
+
OrderType[OrderType["IOC"] = 1] = "IOC";
|
|
369
|
+
OrderType[OrderType["POST"] = 2] = "POST";
|
|
370
|
+
OrderType[OrderType["Market"] = 3] = "Market";
|
|
371
|
+
})(OrderType || (OrderType = {}));
|
|
372
|
+
exports["default"] = OrderType;
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
/***/ }),
|
|
376
|
+
|
|
377
|
+
/***/ 1174:
|
|
378
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
382
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
383
|
+
};
|
|
384
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
385
|
+
exports.Operations = void 0;
|
|
386
|
+
exports.absolute = absolute;
|
|
387
|
+
exports.ceil = ceil;
|
|
388
|
+
exports.toFixed = toFixed;
|
|
389
|
+
exports.floor = floor;
|
|
390
|
+
exports.round = round;
|
|
391
|
+
exports.plus = plus;
|
|
392
|
+
exports.minus = minus;
|
|
393
|
+
exports.multiply = multiply;
|
|
394
|
+
exports.toUsd = toUsd;
|
|
395
|
+
exports.divide = divide;
|
|
396
|
+
exports.greaterThanOrEqual = greaterThanOrEqual;
|
|
397
|
+
exports.greaterThan = greaterThan;
|
|
398
|
+
exports.lessThanOrEqual = lessThanOrEqual;
|
|
399
|
+
exports.lessThan = lessThan;
|
|
400
|
+
exports.equal = equal;
|
|
401
|
+
exports.mod = mod;
|
|
402
|
+
exports.modZero = modZero;
|
|
403
|
+
exports.bn_operation = bn_operation;
|
|
404
|
+
exports.roundNumber = roundNumber;
|
|
405
|
+
exports.convertFromBaseUnits = convertFromBaseUnits;
|
|
406
|
+
exports.convertToBaseUnits = convertToBaseUnits;
|
|
407
|
+
const bignumber_js_1 = __importDefault(__webpack_require__(6168));
|
|
408
|
+
bignumber_js_1.default.config({ DECIMAL_PLACES: 40, EXPONENTIAL_AT: 45 });
|
|
409
|
+
var Operations;
|
|
410
|
+
(function (Operations) {
|
|
411
|
+
Operations["MINUS"] = "-";
|
|
412
|
+
Operations["PLUS"] = "+";
|
|
413
|
+
Operations["MULTIPLY"] = "*";
|
|
414
|
+
Operations["DIVIDE"] = "/";
|
|
415
|
+
Operations["GREATER_THAN_OR_EQUAL"] = ">=";
|
|
416
|
+
Operations["GREATER_THAN"] = ">";
|
|
417
|
+
Operations["LESS_THAN_OR_EQUAL"] = "<=";
|
|
418
|
+
Operations["LESS_THAN"] = "<";
|
|
419
|
+
Operations["EQUAL"] = "==";
|
|
420
|
+
Operations["MOD"] = "mod";
|
|
421
|
+
})(Operations || (exports.Operations = Operations = {}));
|
|
422
|
+
function absolute(value) {
|
|
423
|
+
let x = new bignumber_js_1.default(value);
|
|
424
|
+
const res = x.abs().toString();
|
|
425
|
+
// console.log('Absolute value', { value, res })
|
|
426
|
+
return res;
|
|
427
|
+
}
|
|
428
|
+
function ceil(value) {
|
|
429
|
+
let x = new bignumber_js_1.default(String(value));
|
|
430
|
+
const res = x.integerValue(bignumber_js_1.default.ROUND_CEIL).toString();
|
|
431
|
+
if (!equal(value, res)) {
|
|
432
|
+
console.log('Ceil value', { value, res });
|
|
433
|
+
}
|
|
434
|
+
return res;
|
|
435
|
+
}
|
|
436
|
+
function toFixed(value, decimalPlaces, roundUpToFirstSignificant = false) {
|
|
437
|
+
const x = new bignumber_js_1.default(String(value));
|
|
438
|
+
let res;
|
|
439
|
+
if (roundUpToFirstSignificant) {
|
|
440
|
+
const valueStr = x.toFixed();
|
|
441
|
+
const decimalIndex = valueStr.indexOf('.');
|
|
442
|
+
if (decimalIndex >= 0) {
|
|
443
|
+
const fractionalPart = valueStr.slice(decimalIndex + 1);
|
|
444
|
+
let leadingZeros = 0;
|
|
445
|
+
for (let char of fractionalPart) {
|
|
446
|
+
if (char === '0') {
|
|
447
|
+
leadingZeros++;
|
|
448
|
+
}
|
|
449
|
+
else {
|
|
450
|
+
break;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
const totalDecimalPlaces = leadingZeros + 1;
|
|
454
|
+
res = x.toFixed(totalDecimalPlaces, bignumber_js_1.default.ROUND_UP);
|
|
455
|
+
}
|
|
456
|
+
else {
|
|
457
|
+
res = x.toFixed(0);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
else {
|
|
461
|
+
res = x.toFixed(decimalPlaces);
|
|
462
|
+
}
|
|
463
|
+
console.log('Fixed value', { value, res });
|
|
464
|
+
return res;
|
|
465
|
+
}
|
|
466
|
+
function floor(value) {
|
|
467
|
+
let x = new bignumber_js_1.default(String(value));
|
|
468
|
+
const res = x.integerValue(bignumber_js_1.default.ROUND_FLOOR).toString();
|
|
469
|
+
console.log('Floor value', { value, res });
|
|
470
|
+
return res;
|
|
471
|
+
}
|
|
472
|
+
function round(value) {
|
|
473
|
+
let x = new bignumber_js_1.default(String(value));
|
|
474
|
+
const res = x.integerValue(bignumber_js_1.default.ROUND_HALF_UP).toString();
|
|
475
|
+
console.log('Round value', { value, res });
|
|
476
|
+
return res;
|
|
477
|
+
}
|
|
478
|
+
function plus(value1, value2) {
|
|
479
|
+
return bn_operation(value1, value2, Operations.PLUS);
|
|
480
|
+
}
|
|
481
|
+
function minus(value1, value2) {
|
|
482
|
+
return bn_operation(value1, value2, Operations.MINUS);
|
|
483
|
+
}
|
|
484
|
+
function multiply(value1, value2) {
|
|
485
|
+
return bn_operation(value1, value2, Operations.MULTIPLY);
|
|
486
|
+
}
|
|
487
|
+
function toUsd(amount, price) {
|
|
488
|
+
return multiply(amount, price || 0);
|
|
489
|
+
}
|
|
490
|
+
;
|
|
491
|
+
function divide(value1, value2) {
|
|
492
|
+
return bn_operation(value1, value2, Operations.DIVIDE);
|
|
493
|
+
}
|
|
494
|
+
function greaterThanOrEqual(value1, value2) {
|
|
495
|
+
return Boolean(bn_operation(value1, value2, Operations.GREATER_THAN_OR_EQUAL));
|
|
496
|
+
}
|
|
497
|
+
function greaterThan(value1, value2) {
|
|
498
|
+
return Boolean(bn_operation(value1, value2, Operations.GREATER_THAN));
|
|
499
|
+
}
|
|
500
|
+
function lessThanOrEqual(value1, value2) {
|
|
501
|
+
return Boolean(bn_operation(value1, value2, Operations.LESS_THAN_OR_EQUAL));
|
|
502
|
+
}
|
|
503
|
+
function lessThan(value1, value2) {
|
|
504
|
+
return Boolean(bn_operation(value1, value2, Operations.LESS_THAN));
|
|
505
|
+
}
|
|
506
|
+
function equal(value1, value2) {
|
|
507
|
+
return Boolean(bn_operation(value1, value2, Operations.EQUAL));
|
|
508
|
+
}
|
|
509
|
+
function mod(value1, value2) {
|
|
510
|
+
return bn_operation(value1, value2, Operations.MOD);
|
|
511
|
+
}
|
|
512
|
+
function modZero(value1, value2) {
|
|
513
|
+
return equal(mod(value1, value2), 0);
|
|
514
|
+
}
|
|
515
|
+
function bn_operation(a, b, operation) {
|
|
516
|
+
a = new bignumber_js_1.default(String(a));
|
|
517
|
+
b = new bignumber_js_1.default(String(b));
|
|
518
|
+
switch (operation.toLowerCase()) {
|
|
519
|
+
case '-':
|
|
520
|
+
return a.minus(b).toString();
|
|
521
|
+
case '+':
|
|
522
|
+
return a.plus(b).toString();
|
|
523
|
+
case '*':
|
|
524
|
+
case 'x':
|
|
525
|
+
return a.multipliedBy(b).toString();
|
|
526
|
+
case '÷':
|
|
527
|
+
case '/':
|
|
528
|
+
return a.dividedBy(b).toString();
|
|
529
|
+
case '>=':
|
|
530
|
+
return a.isGreaterThanOrEqualTo(b);
|
|
531
|
+
case '>':
|
|
532
|
+
return a.isGreaterThan(b);
|
|
533
|
+
case '<=':
|
|
534
|
+
return a.isLessThanOrEqualTo(b);
|
|
535
|
+
case '<':
|
|
536
|
+
return a.isLessThan(b);
|
|
537
|
+
case '==':
|
|
538
|
+
return a.isEqualTo(b);
|
|
539
|
+
case 'mod':
|
|
540
|
+
return a.modulo(b);
|
|
541
|
+
default:
|
|
542
|
+
break;
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
function getExponentialNumberComponents(x) {
|
|
546
|
+
if (x.toString().includes('e')) {
|
|
547
|
+
const parts = x.toString().split('e');
|
|
548
|
+
return [parseFloat(parts[0]), parseFloat(parts[1])];
|
|
549
|
+
}
|
|
550
|
+
return [x, 0];
|
|
551
|
+
}
|
|
552
|
+
function generateExponentialNumberFromComponents(decimalPart, exponent) {
|
|
553
|
+
return decimalPart + (exponent < 0 ? `e${exponent}` : `e+${exponent}`);
|
|
554
|
+
}
|
|
555
|
+
function roundNumber({ decimalPlaces = 0 }, x) {
|
|
556
|
+
if (decimalPlaces > 0) {
|
|
557
|
+
const [decimal, decimalExponentialPart] = getExponentialNumberComponents(x);
|
|
558
|
+
const [rounded, roundedExponentialPart] = getExponentialNumberComponents(Math.round(Number(generateExponentialNumberFromComponents(decimal, decimalExponentialPart + decimalPlaces))));
|
|
559
|
+
return Number(generateExponentialNumberFromComponents(rounded, roundedExponentialPart - decimalPlaces));
|
|
560
|
+
}
|
|
561
|
+
return Math.round(x);
|
|
562
|
+
}
|
|
563
|
+
function convertFromBaseUnits(assetDecimals, quantity) {
|
|
564
|
+
const decimals = Number(assetDecimals);
|
|
565
|
+
return roundNumber({ decimalPlaces: decimals },
|
|
566
|
+
// eslint-disable-next-line no-magic-numbers
|
|
567
|
+
Math.pow(10, -decimals) * Number(quantity));
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Computs quantity * 10^(assetDecimals) and rounds the result
|
|
571
|
+
*/
|
|
572
|
+
function convertToBaseUnits(assetDecimals, quantity) {
|
|
573
|
+
// eslint-disable-next-line no-magic-numbers
|
|
574
|
+
const baseAmount = Math.pow(10, Number(assetDecimals)) * Number(quantity);
|
|
575
|
+
// make sure the final value is an integer. This prevents this kind of computation errors: 0.0012 * 100000 = 119.99999999999999 and rounds this result into 120
|
|
576
|
+
return roundNumber({ decimalPlaces: 0 }, baseAmount);
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
/***/ }),
|
|
581
|
+
|
|
582
|
+
/***/ 1283:
|
|
583
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
587
|
+
exports.StateType = void 0;
|
|
588
|
+
var StateType;
|
|
589
|
+
(function (StateType) {
|
|
590
|
+
StateType["VERSION"] = "version";
|
|
591
|
+
StateType["LAST_ALGO_BLOCK"] = "last_algo_block";
|
|
592
|
+
StateType["PRICES_PROVIDER_API_KEY"] = "prices_provider_api_key";
|
|
593
|
+
StateType["DEFAULT_API_DOMAIN"] = "default_api_domain";
|
|
594
|
+
StateType["NONCE_ACCOUNTS_SOLANA"] = "nonce_accounts_solana";
|
|
595
|
+
StateType["ARCHIVE_DATA_BATCH_SIZE"] = "archive_data_batch_size";
|
|
596
|
+
StateType["ARCHIVE_TASK_LOCK"] = "archive_task_lock";
|
|
597
|
+
})(StateType || (exports.StateType = StateType = {}));
|
|
598
|
+
|
|
599
|
+
|
|
600
|
+
/***/ }),
|
|
601
|
+
|
|
602
|
+
/***/ 1492:
|
|
603
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
607
|
+
var OrderStatus;
|
|
608
|
+
(function (OrderStatus) {
|
|
609
|
+
OrderStatus[OrderStatus["Open"] = 1] = "Open";
|
|
610
|
+
OrderStatus[OrderStatus["Canceled"] = 2] = "Canceled";
|
|
611
|
+
OrderStatus[OrderStatus["Matched"] = 3] = "Matched";
|
|
612
|
+
OrderStatus[OrderStatus["SelfMatched"] = 4] = "SelfMatched";
|
|
613
|
+
OrderStatus[OrderStatus["Expired"] = 5] = "Expired";
|
|
614
|
+
})(OrderStatus || (OrderStatus = {}));
|
|
615
|
+
exports["default"] = OrderStatus;
|
|
616
|
+
|
|
617
|
+
|
|
618
|
+
/***/ }),
|
|
619
|
+
|
|
620
|
+
/***/ 1682:
|
|
621
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
622
|
+
|
|
623
|
+
|
|
624
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
625
|
+
exports.SettingTypeColumn = void 0;
|
|
626
|
+
var SettingTypeColumn;
|
|
627
|
+
(function (SettingTypeColumn) {
|
|
628
|
+
SettingTypeColumn["STRING"] = "string";
|
|
629
|
+
SettingTypeColumn["BOOLEAN"] = "boolean";
|
|
630
|
+
SettingTypeColumn["INT"] = "int";
|
|
631
|
+
SettingTypeColumn["FLOAT"] = "float";
|
|
632
|
+
SettingTypeColumn["SINGLE_CHOICE"] = "single-choice";
|
|
633
|
+
SettingTypeColumn["MULTI_CHOICE"] = "multi-choice";
|
|
634
|
+
})(SettingTypeColumn || (exports.SettingTypeColumn = SettingTypeColumn = {}));
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
/***/ }),
|
|
638
|
+
|
|
639
|
+
/***/ 1708:
|
|
640
|
+
/***/ ((module) => {
|
|
641
|
+
|
|
642
|
+
module.exports = require("node:process");
|
|
643
|
+
|
|
644
|
+
/***/ }),
|
|
645
|
+
|
|
646
|
+
/***/ 2137:
|
|
647
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
648
|
+
|
|
649
|
+
|
|
650
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
651
|
+
exports.mapToCodexBalanceDto = mapToCodexBalanceDto;
|
|
652
|
+
function mapToCodexBalanceDto(o) {
|
|
653
|
+
return {
|
|
654
|
+
hash: o.hash,
|
|
655
|
+
loginAddress: o.loginAddress,
|
|
656
|
+
loginChainId: o.loginChainId,
|
|
657
|
+
tokenId: o.token?.id,
|
|
658
|
+
tokenAddress: o.tokenId,
|
|
659
|
+
tokenChainId: o.tokenChainId,
|
|
660
|
+
amount: o.amount,
|
|
661
|
+
lockedAmount: o.lockedAmount
|
|
662
|
+
};
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
/***/ }),
|
|
667
|
+
|
|
668
|
+
/***/ 2216:
|
|
669
|
+
/***/ ((module) => {
|
|
670
|
+
|
|
671
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__2216__;
|
|
672
|
+
|
|
673
|
+
/***/ }),
|
|
674
|
+
|
|
675
|
+
/***/ 2224:
|
|
676
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
677
|
+
|
|
678
|
+
|
|
679
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
680
|
+
exports.AffiliateSortByEnum = void 0;
|
|
681
|
+
var AffiliateSortByEnum;
|
|
682
|
+
(function (AffiliateSortByEnum) {
|
|
683
|
+
AffiliateSortByEnum["INVITED_ACCOUNTS_COUNT"] = "invitedAccountsCount";
|
|
684
|
+
AffiliateSortByEnum["CREATED_AT"] = "createdAt";
|
|
685
|
+
AffiliateSortByEnum["FEE_SHARE"] = "feeShare";
|
|
686
|
+
AffiliateSortByEnum["ADDRESS"] = "address";
|
|
687
|
+
AffiliateSortByEnum["REFERRAL_TRADING_VOLUME"] = "referralTradingVolume";
|
|
688
|
+
})(AffiliateSortByEnum || (exports.AffiliateSortByEnum = AffiliateSortByEnum = {}));
|
|
689
|
+
|
|
690
|
+
|
|
691
|
+
/***/ }),
|
|
692
|
+
|
|
693
|
+
/***/ 2228:
|
|
694
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
695
|
+
|
|
696
|
+
|
|
697
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
698
|
+
exports.HTTPSRPC_MAINNET = exports.HTTPSRPC_TESTNET = exports.ChainNames = exports.Chains = void 0;
|
|
699
|
+
var Chains;
|
|
700
|
+
(function (Chains) {
|
|
701
|
+
Chains[Chains["Solana"] = 1] = "Solana";
|
|
702
|
+
Chains[Chains["Algorand"] = 8] = "Algorand";
|
|
703
|
+
Chains[Chains["Polygon"] = 5] = "Polygon";
|
|
704
|
+
Chains[Chains["Bsc"] = 4] = "Bsc";
|
|
705
|
+
Chains[Chains["Avalanche"] = 6] = "Avalanche";
|
|
706
|
+
Chains[Chains["Arbitrum"] = 23] = "Arbitrum";
|
|
707
|
+
Chains[Chains["Optimism"] = 24] = "Optimism";
|
|
708
|
+
Chains[Chains["Base"] = 30] = "Base";
|
|
709
|
+
Chains[Chains["Ethereum"] = 2] = "Ethereum";
|
|
710
|
+
Chains[Chains["Sepolia"] = 10002] = "Sepolia";
|
|
711
|
+
Chains[Chains["ArbitrumSepolia"] = 10003] = "ArbitrumSepolia";
|
|
712
|
+
Chains[Chains["BaseSepolia"] = 10004] = "BaseSepolia";
|
|
713
|
+
Chains[Chains["OptimismSepolia"] = 10005] = "OptimismSepolia";
|
|
714
|
+
Chains[Chains["PolygonAmoy"] = 10007] = "PolygonAmoy";
|
|
715
|
+
})(Chains || (exports.Chains = Chains = {}));
|
|
716
|
+
exports.ChainNames = {
|
|
717
|
+
[Chains.Solana]: "Solana",
|
|
718
|
+
[Chains.Ethereum]: "Ethereum",
|
|
719
|
+
[Chains.Polygon]: "Polygon",
|
|
720
|
+
[Chains.Bsc]: "BNB Chain",
|
|
721
|
+
[Chains.Avalanche]: "Avalanche",
|
|
722
|
+
[Chains.Algorand]: "Algorand",
|
|
723
|
+
[Chains.Arbitrum]: "Arbitrum",
|
|
724
|
+
[Chains.Optimism]: "Optimism",
|
|
725
|
+
[Chains.Base]: "Base",
|
|
726
|
+
[Chains.Sepolia]: "Ethereum Sepolia",
|
|
727
|
+
[Chains.ArbitrumSepolia]: "Arbitrum Sepolia",
|
|
728
|
+
[Chains.BaseSepolia]: "Base Sepolia",
|
|
729
|
+
[Chains.OptimismSepolia]: "Optimism Sepolia",
|
|
730
|
+
[Chains.PolygonAmoy]: "Polygon Amoy",
|
|
731
|
+
};
|
|
732
|
+
exports.HTTPSRPC_TESTNET = {
|
|
733
|
+
[Chains.Bsc]: [
|
|
734
|
+
'',
|
|
735
|
+
'https://bsc-testnet.public.blastapi.io',
|
|
736
|
+
'https://bsc-testnet.blockpi.network/v1/rpc/private',
|
|
737
|
+
'https://bsc-testnet-rpc.publicnode.com',
|
|
738
|
+
'https://api.zan.top/bsc-testnet',
|
|
739
|
+
'https://data-seed-prebsc-2-s1.bnbchain.org:8545',
|
|
740
|
+
'https://data-seed-prebsc-2-s2.bnbchain.org:8545',
|
|
741
|
+
'https://data-seed-prebsc-2-s3.bnbchain.org:8545',
|
|
742
|
+
'https://data-seed-prebsc-1-s1.bnbchain.org:8545',
|
|
743
|
+
'https://data-seed-prebsc-1-s2.bnbchain.org:8545',
|
|
744
|
+
'https://data-seed-prebsc-1-s3.bnbchain.org:8545',
|
|
745
|
+
'https://endpoints.omniatech.io/v1/bsc/testnet/public',
|
|
746
|
+
],
|
|
747
|
+
[Chains.Avalanche]: [
|
|
748
|
+
'',
|
|
749
|
+
'https://rpc.ankr.com/avalanche_fuji',
|
|
750
|
+
'https://rpc.ankr.com/avalanche_fuji-c',
|
|
751
|
+
'https://api.avax-test.network/ext/bc/C/rpc',
|
|
752
|
+
'https://ava-testnet.public.blastapi.io/ext/bc/C/rpc',
|
|
753
|
+
'https://endpoints.omniatech.io/v1/avax/fuji/public',
|
|
754
|
+
'https://avalanche-fuji.blockpi.network/v1/rpc/private',
|
|
755
|
+
'https://avalanche-fuji-c-chain-rpc.publicnode.com',
|
|
756
|
+
'https://avalanche-fuji.blockpi.network/v1/rpc/private',
|
|
757
|
+
],
|
|
758
|
+
[Chains.Sepolia]: [
|
|
759
|
+
'https://ethereum-sepolia-rpc.publicnode.com',
|
|
760
|
+
'https://sepolia.gateway.tenderly.co',
|
|
761
|
+
'https://eth-sepolia.public.blastapi.io',
|
|
762
|
+
'https://ethereum-sepolia.blockpi.network/v1/rpc/private',
|
|
763
|
+
'https://sepolia.drpc.org',
|
|
764
|
+
'https://endpoints.omniatech.io/v1/eth/sepolia/public',
|
|
765
|
+
'https://1rpc.io/sepolia',
|
|
766
|
+
'https://gateway.tenderly.co/public/sepolia',
|
|
767
|
+
'https://sepolia.gateway.tenderly.co',
|
|
768
|
+
'https://api.zan.top/eth-sepolia',
|
|
769
|
+
'https://ethereum-sepolia.rpc.subquery.network/public',
|
|
770
|
+
],
|
|
771
|
+
[Chains.ArbitrumSepolia]: [
|
|
772
|
+
'',
|
|
773
|
+
'https://arbitrum-sepolia.blockpi.network/v1/rpc/private ',
|
|
774
|
+
'https://arbitrum-sepolia.gateway.tenderly.co',
|
|
775
|
+
'https://endpoints.omniatech.io/v1/arbitrum/sepolia/public',
|
|
776
|
+
'https://api.zan.top/arb-sepolia',
|
|
777
|
+
'https://sepolia-rollup.arbitrum.io/rpc',
|
|
778
|
+
],
|
|
779
|
+
[Chains.BaseSepolia]: [
|
|
780
|
+
'',
|
|
781
|
+
'https://sepolia.base.org',
|
|
782
|
+
'https://base-sepolia-rpc.publicnode.com',
|
|
783
|
+
'https://base-sepolia.gateway.tenderly.co',
|
|
784
|
+
'https://base-sepolia.blockpi.network/v1/rpc/private',
|
|
785
|
+
'https://node.histori.xyz/base-sepolia/8ry9f6t9dct1se2hlagxnd9n2a',
|
|
786
|
+
],
|
|
787
|
+
[Chains.OptimismSepolia]: [
|
|
788
|
+
'',
|
|
789
|
+
'https://optimism-sepolia.blockpi.network/v1/rpc/private',
|
|
790
|
+
'https://sepolia.optimism.io',
|
|
791
|
+
'https://api.zan.top/opt-sepolia',
|
|
792
|
+
'https://optimism-sepolia.gateway.tenderly.co',
|
|
793
|
+
'https://optimism-sepolia.drpc.org',
|
|
794
|
+
'https://endpoints.omniatech.io/v1/op/sepolia/public',
|
|
795
|
+
],
|
|
796
|
+
[Chains.PolygonAmoy]: [
|
|
797
|
+
'https://rpc-amoy.polygon.technology',
|
|
798
|
+
'https://polygon-amoy-bor-rpc.publicnode.com',
|
|
799
|
+
'https://rpc.ankr.com/polygon_amoy',
|
|
800
|
+
'https://polygon-amoy.drpc.org',
|
|
801
|
+
'https://api.zan.top/polygon-amoy',
|
|
802
|
+
'https://polygon-amoy.gateway.tenderly.co',
|
|
803
|
+
],
|
|
804
|
+
};
|
|
805
|
+
exports.HTTPSRPC_MAINNET = {
|
|
806
|
+
[Chains.Ethereum]: [
|
|
807
|
+
'',
|
|
808
|
+
'https://eth.llamarpc.com',
|
|
809
|
+
'https://ethereum.blockpi.network/v1/rpc/public',
|
|
810
|
+
'https://eth-mainnet.nodereal.io/v1/1659dfb40aa24bbb8153a677b98064d7',
|
|
811
|
+
'https://uk.rpc.blxrbdn.com',
|
|
812
|
+
'https://singapore.rpc.blxrbdn.com',
|
|
813
|
+
'https://virginia.rpc.blxrbdn.com',
|
|
814
|
+
'https://eth-mainnet.public.blastapi.io',
|
|
815
|
+
'https://api.securerpc.com/v1',
|
|
816
|
+
'https://mainnet.gateway.tenderly.co',
|
|
817
|
+
'https://eth-pokt.nodies.app',
|
|
818
|
+
'https://eth.blockrazor.xyz',
|
|
819
|
+
'https://eth.merkle.io',
|
|
820
|
+
'https://gateway.tenderly.co/public/mainnet',
|
|
821
|
+
'https://eth.rpc.blxrbdn.com',
|
|
822
|
+
],
|
|
823
|
+
[Chains.Bsc]: [
|
|
824
|
+
'',
|
|
825
|
+
'https://bsc.blockrazor.xyz',
|
|
826
|
+
'https://bscrpc.com',
|
|
827
|
+
'https://bsc-mainnet.public.blastapi.io',
|
|
828
|
+
'https://binance.llamarpc.com',
|
|
829
|
+
'https://go.getblock.io/cc778cdbdf5c4b028ec9456e0e6c0cf3',
|
|
830
|
+
'https://bsc-pokt.nodies.app',
|
|
831
|
+
'https://56.rpc.thirdweb.com',
|
|
832
|
+
'https://bsc.blockpi.network/v1/rpc/private',
|
|
833
|
+
'https://bsc.rpc.blxrbdn.com',
|
|
834
|
+
'https://bsc-dataseed.bnbchain.org',
|
|
835
|
+
'https://endpoints.omniatech.io/v1/bsc/mainnet/public',
|
|
836
|
+
'https://bsc-dataseed1.ninicoin.io',
|
|
837
|
+
'https://bsc-dataseed2.defibit.io',
|
|
838
|
+
'https://bsc-dataseed2.ninicoin.io',
|
|
839
|
+
'https://0.48.club',
|
|
840
|
+
'https://bsc-dataseed3.defibit.io',
|
|
841
|
+
],
|
|
842
|
+
[Chains.Polygon]: [
|
|
843
|
+
'',
|
|
844
|
+
'https://polygon.llamarpc.com',
|
|
845
|
+
'https://polygon-rpc.com',
|
|
846
|
+
'https://rpc-mainnet.matic.quiknode.pro',
|
|
847
|
+
'https://endpoints.omniatech.io/v1/matic/mainnet/public',
|
|
848
|
+
'https://polygon-pokt.nodies.app',
|
|
849
|
+
'https://polygon-bor-rpc.publicnode.com',
|
|
850
|
+
'https://polygon.rpc.subquery.network/public',
|
|
851
|
+
'https://polygon-bor-rpc.publicnode.com',
|
|
852
|
+
'https://polygon.blockpi.network/v1/rpc/private',
|
|
853
|
+
'https://polygon.api.onfinality.io/public',
|
|
854
|
+
'https://polygon.lava.build',
|
|
855
|
+
'https://api.zan.top/polygon-mainnet',
|
|
856
|
+
'https://polygon.meowrpc.com',
|
|
857
|
+
],
|
|
858
|
+
[Chains.Avalanche]: [
|
|
859
|
+
'',
|
|
860
|
+
'https://avalanche-c-chain-rpc.publicnode.com',
|
|
861
|
+
'https://ava-mainnet.public.blastapi.io/ext/bc/C/rpc',
|
|
862
|
+
'https://endpoints.omniatech.io/v1/avax/mainnet/public',
|
|
863
|
+
'https://avalanche-c-chain-rpc.publicnode.com',
|
|
864
|
+
'https://avalanche.blockpi.network/v1/rpc/private',
|
|
865
|
+
'https://avalanche.public-rpc.com',
|
|
866
|
+
'https://avalanche.drpc.org',
|
|
867
|
+
'https://avax.meowrpc.com',
|
|
868
|
+
'https://endpoints.omniatech.io/v1/avax/mainnet/public',
|
|
869
|
+
'https://api.avax.network/ext/bc/C/rpc',
|
|
870
|
+
'https://1rpc.io/avax/c',
|
|
871
|
+
'https://avax-pokt.nodies.app/ext/bc/C/rpc',
|
|
872
|
+
'https://endpoints.omniatech.io/v1/avax/mainnet/public',
|
|
873
|
+
'https://api.zan.top/avax-mainnet/ext/bc/C/rpc',
|
|
874
|
+
],
|
|
875
|
+
[Chains.Arbitrum]: [
|
|
876
|
+
'',
|
|
877
|
+
'https://arbitrum.llamarpc.com',
|
|
878
|
+
'https://arbitrum.rpc.subquery.network/public',
|
|
879
|
+
'https://endpoints.omniatech.io/v1/arbitrum/one/public',
|
|
880
|
+
'https://arbitrum.meowrpc.com',
|
|
881
|
+
'https://arbitrum.gateway.tenderly.co',
|
|
882
|
+
'https://arbitrum-one.public.blastapi.io',
|
|
883
|
+
'https://arb1.lava.build',
|
|
884
|
+
'https://arbitrum-one.publicnode.com',
|
|
885
|
+
'https://arbitrum.blockpi.network/v1/rpc/public',
|
|
886
|
+
'https://arb-pokt.nodies.app',
|
|
887
|
+
'https://api.zan.top/arb-one',
|
|
888
|
+
'https://arb1.arbitrum.io/rpc',
|
|
889
|
+
'https://arbitrum.drpc.org',
|
|
890
|
+
'https://1rpc.io/arb',
|
|
891
|
+
],
|
|
892
|
+
[Chains.Optimism]: [
|
|
893
|
+
'',
|
|
894
|
+
'https://optimism.llamarpc.com',
|
|
895
|
+
'https://op-pokt.nodies.app',
|
|
896
|
+
'https://optimism-mainnet.public.blastapi.io',
|
|
897
|
+
'https://optimism.blockpi.network/v1/rpc/public',
|
|
898
|
+
'https://endpoints.omniatech.io/v1/op/mainnet/public',
|
|
899
|
+
'https://optimism-rpc.publicnode.com',
|
|
900
|
+
'https://optimism.drpc.org',
|
|
901
|
+
'https://1rpc.io/op',
|
|
902
|
+
'https://optimism.gateway.tenderly.co',
|
|
903
|
+
'https://optimism.lava.build',
|
|
904
|
+
'https://optimism.rpc.subquery.network/public',
|
|
905
|
+
'https://mainnet.optimism.io',
|
|
906
|
+
'https://optimism-rpc.publicnode.com',
|
|
907
|
+
'https://gateway.tenderly.co/public/optimism',
|
|
908
|
+
],
|
|
909
|
+
[Chains.Base]: [
|
|
910
|
+
'',
|
|
911
|
+
'https://base.llamarpc.com',
|
|
912
|
+
'https://base-mainnet.public.blastapi.io',
|
|
913
|
+
'https://base-rpc.publicnode.com',
|
|
914
|
+
'https://base.blockpi.network/v1/rpc/public',
|
|
915
|
+
'https://base.drpc.org',
|
|
916
|
+
'https://mainnet.base.org',
|
|
917
|
+
'https://base.api.onfinality.io/public',
|
|
918
|
+
'https://base-pokt.nodies.app',
|
|
919
|
+
'https://1rpc.io/base',
|
|
920
|
+
'https://developer-access-mainnet.base.org',
|
|
921
|
+
'https://endpoints.omniatech.io/v1/base/mainnet/public',
|
|
922
|
+
'https://base.rpc.subquery.network/public',
|
|
923
|
+
'https://base.api.onfinality.io/public',
|
|
924
|
+
'https://base.meowrpc.com',
|
|
925
|
+
'https://base.gateway.tenderly.co',
|
|
926
|
+
],
|
|
927
|
+
};
|
|
928
|
+
|
|
929
|
+
|
|
930
|
+
/***/ }),
|
|
931
|
+
|
|
932
|
+
/***/ 2623:
|
|
933
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
934
|
+
|
|
935
|
+
|
|
936
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
937
|
+
exports.TransactionType = exports.CCTPStatus = exports.ActionTypeEnum = exports.OperationStatusEnum = void 0;
|
|
938
|
+
var OperationStatusEnum;
|
|
939
|
+
(function (OperationStatusEnum) {
|
|
940
|
+
OperationStatusEnum["Pending"] = "pending";
|
|
941
|
+
OperationStatusEnum["Completed"] = "completed";
|
|
942
|
+
OperationStatusEnum["Failed"] = "failed";
|
|
943
|
+
OperationStatusEnum["Received"] = "received";
|
|
944
|
+
})(OperationStatusEnum || (exports.OperationStatusEnum = OperationStatusEnum = {}));
|
|
945
|
+
var ActionTypeEnum;
|
|
946
|
+
(function (ActionTypeEnum) {
|
|
947
|
+
ActionTypeEnum["Deposit"] = "deposit";
|
|
948
|
+
ActionTypeEnum["Withdraw"] = "withdraw";
|
|
949
|
+
ActionTypeEnum["Rebalance"] = "rebalance";
|
|
950
|
+
})(ActionTypeEnum || (exports.ActionTypeEnum = ActionTypeEnum = {}));
|
|
951
|
+
var CCTPStatus;
|
|
952
|
+
(function (CCTPStatus) {
|
|
953
|
+
CCTPStatus["PENDING"] = "pending";
|
|
954
|
+
CCTPStatus["COMPLETED"] = "completed";
|
|
955
|
+
CCTPStatus["FAILED"] = "failed";
|
|
956
|
+
})(CCTPStatus || (exports.CCTPStatus = CCTPStatus = {}));
|
|
957
|
+
var TransactionType;
|
|
958
|
+
(function (TransactionType) {
|
|
959
|
+
TransactionType["USER_TO_TMC"] = "user_to_tmc";
|
|
960
|
+
TransactionType["TMC_TO_USER"] = "tmc_to_user";
|
|
961
|
+
TransactionType["RELAYER_TO_TMC"] = "relayer_to_tmc";
|
|
962
|
+
TransactionType["RELAYER_TO_CODEX"] = "relayer_to_codex";
|
|
963
|
+
TransactionType["RELAYER_TO_CIRCLE"] = "relayer_to_circle";
|
|
964
|
+
})(TransactionType || (exports.TransactionType = TransactionType = {}));
|
|
965
|
+
|
|
966
|
+
|
|
967
|
+
/***/ }),
|
|
968
|
+
|
|
969
|
+
/***/ 2739:
|
|
970
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
971
|
+
|
|
972
|
+
|
|
973
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
974
|
+
exports.Notification = void 0;
|
|
975
|
+
var Notification;
|
|
976
|
+
(function (Notification) {
|
|
977
|
+
Notification[Notification["SELF_TRADE"] = 1] = "SELF_TRADE";
|
|
978
|
+
Notification[Notification["FULL_FILLED"] = 2] = "FULL_FILLED";
|
|
979
|
+
Notification[Notification["FULL_CANCELLED"] = 3] = "FULL_CANCELLED";
|
|
980
|
+
Notification[Notification["PARTIALLY_CANCELLED"] = 4] = "PARTIALLY_CANCELLED";
|
|
981
|
+
Notification[Notification["CREATED"] = 5] = "CREATED";
|
|
982
|
+
})(Notification || (exports.Notification = Notification = {}));
|
|
983
|
+
|
|
984
|
+
|
|
985
|
+
/***/ }),
|
|
986
|
+
|
|
987
|
+
/***/ 2797:
|
|
988
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
989
|
+
|
|
990
|
+
|
|
991
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
992
|
+
var AvailablePairSettings;
|
|
993
|
+
(function (AvailablePairSettings) {
|
|
994
|
+
AvailablePairSettings["MFT_AUDIO_LINK"] = "mft.audioLink";
|
|
995
|
+
AvailablePairSettings["MFT_TITLE"] = "mft.title";
|
|
996
|
+
AvailablePairSettings["MODE_PRE_SALE"] = "mode.preSale";
|
|
997
|
+
AvailablePairSettings["MAKER_FEE"] = "makerFee";
|
|
998
|
+
AvailablePairSettings["TAKER_FEE"] = "takerFee";
|
|
999
|
+
AvailablePairSettings["VIEW_BASE_COIN_ICON_LINK"] = "view.baseCoinIconLink";
|
|
1000
|
+
AvailablePairSettings["VIEW_BASE_COIN_MARKET_LINK"] = "view.baseCoinMarketLink";
|
|
1001
|
+
AvailablePairSettings["VIEW_PRICE_COIN_ICON_LINK"] = "view.priceCoinIconLink";
|
|
1002
|
+
AvailablePairSettings["VIEW_PRICE_COIN_MARKET_LINK"] = "view.priceCoinMarketLink";
|
|
1003
|
+
})(AvailablePairSettings || (AvailablePairSettings = {}));
|
|
1004
|
+
exports["default"] = AvailablePairSettings;
|
|
1005
|
+
|
|
1006
|
+
|
|
1007
|
+
/***/ }),
|
|
1008
|
+
|
|
1009
|
+
/***/ 3004:
|
|
1010
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
1011
|
+
|
|
1012
|
+
|
|
1013
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
1014
|
+
if (k2 === undefined) k2 = k;
|
|
1015
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1016
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1017
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
1018
|
+
}
|
|
1019
|
+
Object.defineProperty(o, k2, desc);
|
|
1020
|
+
}) : (function(o, m, k, k2) {
|
|
1021
|
+
if (k2 === undefined) k2 = k;
|
|
1022
|
+
o[k2] = m[k];
|
|
1023
|
+
}));
|
|
1024
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
1025
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1026
|
+
};
|
|
1027
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
1028
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1029
|
+
};
|
|
1030
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1031
|
+
exports.TradingKeyType = exports.OrderType = exports.OrderStatus = exports.OrderSide = exports.AvailablePairSettings = void 0;
|
|
1032
|
+
const available_pair_settings_enum_1 = __importDefault(__webpack_require__(2797));
|
|
1033
|
+
exports.AvailablePairSettings = available_pair_settings_enum_1.default;
|
|
1034
|
+
const order_side_enum_1 = __importDefault(__webpack_require__(835));
|
|
1035
|
+
exports.OrderSide = order_side_enum_1.default;
|
|
1036
|
+
const order_status_enum_1 = __importDefault(__webpack_require__(1492));
|
|
1037
|
+
exports.OrderStatus = order_status_enum_1.default;
|
|
1038
|
+
const order_type_enum_1 = __importDefault(__webpack_require__(1134));
|
|
1039
|
+
exports.OrderType = order_type_enum_1.default;
|
|
1040
|
+
const tradingKeyType_enum_1 = __webpack_require__(3487);
|
|
1041
|
+
Object.defineProperty(exports, "TradingKeyType", ({ enumerable: true, get: function () { return tradingKeyType_enum_1.TradingKeyType; } }));
|
|
1042
|
+
__exportStar(__webpack_require__(893), exports);
|
|
1043
|
+
__exportStar(__webpack_require__(3338), exports);
|
|
1044
|
+
__exportStar(__webpack_require__(3245), exports);
|
|
1045
|
+
__exportStar(__webpack_require__(6828), exports);
|
|
1046
|
+
__exportStar(__webpack_require__(2224), exports);
|
|
1047
|
+
__exportStar(__webpack_require__(892), exports);
|
|
1048
|
+
__exportStar(__webpack_require__(2623), exports);
|
|
1049
|
+
__exportStar(__webpack_require__(3854), exports);
|
|
1050
|
+
__exportStar(__webpack_require__(4132), exports);
|
|
1051
|
+
__exportStar(__webpack_require__(3516), exports);
|
|
1052
|
+
__exportStar(__webpack_require__(4199), exports);
|
|
1053
|
+
__exportStar(__webpack_require__(1682), exports);
|
|
1054
|
+
__exportStar(__webpack_require__(1283), exports);
|
|
1055
|
+
__exportStar(__webpack_require__(5237), exports);
|
|
1056
|
+
__exportStar(__webpack_require__(1048), exports);
|
|
1057
|
+
|
|
1058
|
+
|
|
1059
|
+
/***/ }),
|
|
1060
|
+
|
|
1061
|
+
/***/ 3245:
|
|
1062
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
1063
|
+
|
|
1064
|
+
|
|
1065
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1066
|
+
exports.PromptTypeEnum = void 0;
|
|
1067
|
+
var PromptTypeEnum;
|
|
1068
|
+
(function (PromptTypeEnum) {
|
|
1069
|
+
PromptTypeEnum["INSTRUCTIONS"] = "INSTRUCTIONS";
|
|
1070
|
+
PromptTypeEnum["TEXT_STYLE"] = "TEXT_STYLE";
|
|
1071
|
+
PromptTypeEnum["TEXT_TONE"] = "TEXT_TONE";
|
|
1072
|
+
PromptTypeEnum["REACTION_TYPE"] = "REACTION_TYPE";
|
|
1073
|
+
PromptTypeEnum["COMMENT_LENGTH"] = "COMMENT_LENGTH";
|
|
1074
|
+
PromptTypeEnum["CONTEXT"] = "CONTEXT";
|
|
1075
|
+
})(PromptTypeEnum || (exports.PromptTypeEnum = PromptTypeEnum = {}));
|
|
1076
|
+
|
|
1077
|
+
|
|
1078
|
+
/***/ }),
|
|
1079
|
+
|
|
1080
|
+
/***/ 3298:
|
|
1081
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1082
|
+
|
|
1083
|
+
|
|
1084
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1085
|
+
const client_secrets_manager_1 = __webpack_require__(2216);
|
|
1086
|
+
class SecretHelper {
|
|
1087
|
+
constructor() {
|
|
1088
|
+
this.creatorMnemonicSecretName = process.env.CreatorSecret;
|
|
1089
|
+
this.dispenserMnemonicSecretName = process.env.DispenserSecret;
|
|
1090
|
+
this.transactionMnemonicSecretName = process.env.TransactionSecret;
|
|
1091
|
+
this.relayerMnemonicSecretName = process.env.RelayerSecret;
|
|
1092
|
+
this.ondatoCredentialsSecretName = process.env.OndatoSecret;
|
|
1093
|
+
}
|
|
1094
|
+
async getCreatorMnemonic() {
|
|
1095
|
+
const creatorMnemonic = await this.getSecrets(this.creatorMnemonicSecretName);
|
|
1096
|
+
return JSON.parse(creatorMnemonic).creator;
|
|
1097
|
+
}
|
|
1098
|
+
async getDispenserMnemonic() {
|
|
1099
|
+
const dispenserMnemonic = await this.getSecrets(this.dispenserMnemonicSecretName);
|
|
1100
|
+
return JSON.parse(dispenserMnemonic).dispenser;
|
|
1101
|
+
}
|
|
1102
|
+
async getTransactionMnemonic() {
|
|
1103
|
+
const transactionMnemonic = await this.getSecrets(this.transactionMnemonicSecretName);
|
|
1104
|
+
return JSON.parse(transactionMnemonic).txs;
|
|
1105
|
+
}
|
|
1106
|
+
async getRelayerMnemonics() {
|
|
1107
|
+
const relayerMnemonic = await this.getSecrets(this.relayerMnemonicSecretName);
|
|
1108
|
+
return JSON.parse(relayerMnemonic);
|
|
1109
|
+
}
|
|
1110
|
+
async getOndatoSecrets() {
|
|
1111
|
+
const ondatoSecrets = await this.getSecrets(this.ondatoCredentialsSecretName);
|
|
1112
|
+
return JSON.parse(ondatoSecrets);
|
|
1113
|
+
}
|
|
1114
|
+
getClient() {
|
|
1115
|
+
return new client_secrets_manager_1.SecretsManager({ region: 'us-east-1' });
|
|
1116
|
+
}
|
|
1117
|
+
getSecrets(secretName) {
|
|
1118
|
+
// console.log(`Getting secrets by name: ${secretName}`);
|
|
1119
|
+
return new Promise((resolve, reject) => {
|
|
1120
|
+
try {
|
|
1121
|
+
const command = new client_secrets_manager_1.GetSecretValueCommand({ SecretId: secretName });
|
|
1122
|
+
const client = this.getClient();
|
|
1123
|
+
client.send(command, (err, data) => {
|
|
1124
|
+
if (err) {
|
|
1125
|
+
console.log('-----error in secrets---------', err);
|
|
1126
|
+
reject(err);
|
|
1127
|
+
}
|
|
1128
|
+
else {
|
|
1129
|
+
// console.log('secrets successfully received');
|
|
1130
|
+
resolve(data.SecretString);
|
|
1131
|
+
}
|
|
1132
|
+
});
|
|
1133
|
+
}
|
|
1134
|
+
catch (error) {
|
|
1135
|
+
console.log('error curl', error);
|
|
1136
|
+
reject(error);
|
|
1137
|
+
}
|
|
1138
|
+
});
|
|
1139
|
+
}
|
|
1140
|
+
saveSecret(secretName, secretValue) {
|
|
1141
|
+
console.log(`Saving secret with name: ${secretName}`);
|
|
1142
|
+
return new Promise((resolve, reject) => {
|
|
1143
|
+
try {
|
|
1144
|
+
const command = new client_secrets_manager_1.PutSecretValueCommand({
|
|
1145
|
+
SecretId: secretName,
|
|
1146
|
+
SecretString: secretValue,
|
|
1147
|
+
});
|
|
1148
|
+
const client = this.getClient();
|
|
1149
|
+
client.send(command, (err, data) => {
|
|
1150
|
+
if (err) {
|
|
1151
|
+
console.log('-----error in saving secret---------', err);
|
|
1152
|
+
reject(err);
|
|
1153
|
+
}
|
|
1154
|
+
else {
|
|
1155
|
+
console.log('secret successfully saved');
|
|
1156
|
+
resolve();
|
|
1157
|
+
}
|
|
1158
|
+
});
|
|
1159
|
+
}
|
|
1160
|
+
catch (error) {
|
|
1161
|
+
console.log('error curl', error);
|
|
1162
|
+
reject(error);
|
|
1163
|
+
}
|
|
1164
|
+
});
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
exports["default"] = new SecretHelper();
|
|
1168
|
+
|
|
1169
|
+
|
|
1170
|
+
/***/ }),
|
|
1171
|
+
|
|
1172
|
+
/***/ 3338:
|
|
1173
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
1174
|
+
|
|
1175
|
+
|
|
1176
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1177
|
+
exports.TweetType = exports.SeasonStatusEnum = void 0;
|
|
1178
|
+
var SeasonStatusEnum;
|
|
1179
|
+
(function (SeasonStatusEnum) {
|
|
1180
|
+
SeasonStatusEnum["CREATED"] = "created";
|
|
1181
|
+
SeasonStatusEnum["STARTED"] = "started";
|
|
1182
|
+
SeasonStatusEnum["PAUSED"] = "paused";
|
|
1183
|
+
SeasonStatusEnum["CLOSED"] = "closed";
|
|
1184
|
+
})(SeasonStatusEnum || (exports.SeasonStatusEnum = SeasonStatusEnum = {}));
|
|
1185
|
+
var TweetType;
|
|
1186
|
+
(function (TweetType) {
|
|
1187
|
+
TweetType["Post"] = "POST";
|
|
1188
|
+
TweetType["Comment"] = "COMMENT";
|
|
1189
|
+
})(TweetType || (exports.TweetType = TweetType = {}));
|
|
1190
|
+
|
|
1191
|
+
|
|
1192
|
+
/***/ }),
|
|
1193
|
+
|
|
1194
|
+
/***/ 3450:
|
|
1195
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
1196
|
+
|
|
1197
|
+
|
|
1198
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
1199
|
+
if (k2 === undefined) k2 = k;
|
|
1200
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1201
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1202
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
1203
|
+
}
|
|
1204
|
+
Object.defineProperty(o, k2, desc);
|
|
1205
|
+
}) : (function(o, m, k, k2) {
|
|
1206
|
+
if (k2 === undefined) k2 = k;
|
|
1207
|
+
o[k2] = m[k];
|
|
1208
|
+
}));
|
|
1209
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
1210
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
1211
|
+
}) : function(o, v) {
|
|
1212
|
+
o["default"] = v;
|
|
1213
|
+
});
|
|
1214
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
1215
|
+
var ownKeys = function(o) {
|
|
1216
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
1217
|
+
var ar = [];
|
|
1218
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
1219
|
+
return ar;
|
|
1220
|
+
};
|
|
1221
|
+
return ownKeys(o);
|
|
1222
|
+
};
|
|
1223
|
+
return function (mod) {
|
|
1224
|
+
if (mod && mod.__esModule) return mod;
|
|
1225
|
+
var result = {};
|
|
1226
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
1227
|
+
__setModuleDefault(result, mod);
|
|
1228
|
+
return result;
|
|
1229
|
+
};
|
|
1230
|
+
})();
|
|
1231
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1232
|
+
exports.printUnpackedLocalData = exports.getAccounInfoFormLocalStorage = void 0;
|
|
1233
|
+
exports.unpackData = unpackData;
|
|
1234
|
+
exports.decodeString = decodeString;
|
|
1235
|
+
const algosdk_1 = __importStar(__webpack_require__(9709));
|
|
1236
|
+
const orderByteSize = 28;
|
|
1237
|
+
const getAccounInfoFormLocalStorage = (localState) => {
|
|
1238
|
+
const uintArray = Buffer.from(localState, 'base64');
|
|
1239
|
+
const unpackedData = unpackData(uintArray, {
|
|
1240
|
+
"priceCoin_locked": {
|
|
1241
|
+
type: "uint",
|
|
1242
|
+
},
|
|
1243
|
+
"priceCoin_available": {
|
|
1244
|
+
type: "uint",
|
|
1245
|
+
},
|
|
1246
|
+
"baseCoin_locked": {
|
|
1247
|
+
type: "uint",
|
|
1248
|
+
},
|
|
1249
|
+
"baseCoin_available": {
|
|
1250
|
+
type: "uint",
|
|
1251
|
+
},
|
|
1252
|
+
"companyId": {
|
|
1253
|
+
type: "uint",
|
|
1254
|
+
},
|
|
1255
|
+
"WLFeeShare": {
|
|
1256
|
+
type: "uint",
|
|
1257
|
+
},
|
|
1258
|
+
"WLCustomFee": {
|
|
1259
|
+
type: "uint",
|
|
1260
|
+
},
|
|
1261
|
+
"slotMap": {
|
|
1262
|
+
type: "uint",
|
|
1263
|
+
},
|
|
1264
|
+
});
|
|
1265
|
+
return unpackedData;
|
|
1266
|
+
};
|
|
1267
|
+
exports.getAccounInfoFormLocalStorage = getAccounInfoFormLocalStorage;
|
|
1268
|
+
function unpackData(data, format) {
|
|
1269
|
+
const result = new Map();
|
|
1270
|
+
let index = 0;
|
|
1271
|
+
for (const [name, type] of Object.entries(format)) {
|
|
1272
|
+
if (index >= data.length) {
|
|
1273
|
+
throw new Error('Array index out of bounds');
|
|
1274
|
+
}
|
|
1275
|
+
let value;
|
|
1276
|
+
switch (type.type) {
|
|
1277
|
+
case 'address':
|
|
1278
|
+
value = (0, algosdk_1.encodeAddress)(data.slice(index, index + 32));
|
|
1279
|
+
index += 32;
|
|
1280
|
+
break;
|
|
1281
|
+
case 'bytes':
|
|
1282
|
+
value = data.slice(index, index + type.size);
|
|
1283
|
+
value = algosdk_1.default.decodeUint64(value, "mixed");
|
|
1284
|
+
index += type.size;
|
|
1285
|
+
break;
|
|
1286
|
+
case 'uint':
|
|
1287
|
+
value = algosdk_1.default.decodeUint64(data.slice(index, index + 8), "mixed");
|
|
1288
|
+
index += 8;
|
|
1289
|
+
break;
|
|
1290
|
+
case 'string':
|
|
1291
|
+
value = decodeString(data.slice(index, index + type.size));
|
|
1292
|
+
index += type.size;
|
|
1293
|
+
break;
|
|
1294
|
+
}
|
|
1295
|
+
result.set(name, value);
|
|
1296
|
+
}
|
|
1297
|
+
return Object.fromEntries(result);
|
|
1298
|
+
}
|
|
1299
|
+
function decodeString(value) {
|
|
1300
|
+
return Buffer.from(value).toString('utf-8');
|
|
1301
|
+
}
|
|
1302
|
+
const printUnpackedLocalData = (localState) => {
|
|
1303
|
+
const uintArray = Buffer.from(localState, 'base64');
|
|
1304
|
+
const unpackedData = [];
|
|
1305
|
+
for (let i = 0; i < 4; i++) {
|
|
1306
|
+
let data = unpackData(uintArray.subarray(orderByteSize * i, orderByteSize * (i + 1)), {
|
|
1307
|
+
"orderID": {
|
|
1308
|
+
type: "uint",
|
|
1309
|
+
},
|
|
1310
|
+
"side": {
|
|
1311
|
+
type: "string",
|
|
1312
|
+
size: 1
|
|
1313
|
+
},
|
|
1314
|
+
"price": {
|
|
1315
|
+
type: "uint",
|
|
1316
|
+
},
|
|
1317
|
+
"amount": {
|
|
1318
|
+
type: "uint",
|
|
1319
|
+
},
|
|
1320
|
+
"type": {
|
|
1321
|
+
type: "string",
|
|
1322
|
+
size: 1
|
|
1323
|
+
},
|
|
1324
|
+
"directSettle": {
|
|
1325
|
+
type: "string",
|
|
1326
|
+
size: 1
|
|
1327
|
+
},
|
|
1328
|
+
"storageSlot": {
|
|
1329
|
+
type: "bytes",
|
|
1330
|
+
size: 1
|
|
1331
|
+
}
|
|
1332
|
+
});
|
|
1333
|
+
unpackedData.push(data);
|
|
1334
|
+
}
|
|
1335
|
+
return unpackedData;
|
|
1336
|
+
};
|
|
1337
|
+
exports.printUnpackedLocalData = printUnpackedLocalData;
|
|
1338
|
+
|
|
1339
|
+
|
|
1340
|
+
/***/ }),
|
|
1341
|
+
|
|
1342
|
+
/***/ 3487:
|
|
1343
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
1344
|
+
|
|
1345
|
+
|
|
1346
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1347
|
+
exports.TradingKeyType = void 0;
|
|
1348
|
+
var TradingKeyType;
|
|
1349
|
+
(function (TradingKeyType) {
|
|
1350
|
+
TradingKeyType["User"] = "User";
|
|
1351
|
+
TradingKeyType["Api"] = "API";
|
|
1352
|
+
})(TradingKeyType || (exports.TradingKeyType = TradingKeyType = {}));
|
|
1353
|
+
|
|
1354
|
+
|
|
1355
|
+
/***/ }),
|
|
1356
|
+
|
|
1357
|
+
/***/ 3516:
|
|
1358
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
1359
|
+
|
|
1360
|
+
|
|
1361
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1362
|
+
exports.SortDirectionEnum = void 0;
|
|
1363
|
+
var SortDirectionEnum;
|
|
1364
|
+
(function (SortDirectionEnum) {
|
|
1365
|
+
SortDirectionEnum["ASCENDING"] = "ASC";
|
|
1366
|
+
SortDirectionEnum["DESCENDING"] = "DESC";
|
|
1367
|
+
})(SortDirectionEnum || (exports.SortDirectionEnum = SortDirectionEnum = {}));
|
|
1368
|
+
|
|
1369
|
+
|
|
1370
|
+
/***/ }),
|
|
1371
|
+
|
|
1372
|
+
/***/ 3528:
|
|
1373
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
1374
|
+
|
|
1375
|
+
|
|
1376
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
1377
|
+
if (k2 === undefined) k2 = k;
|
|
1378
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1379
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1380
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
1381
|
+
}
|
|
1382
|
+
Object.defineProperty(o, k2, desc);
|
|
1383
|
+
}) : (function(o, m, k, k2) {
|
|
1384
|
+
if (k2 === undefined) k2 = k;
|
|
1385
|
+
o[k2] = m[k];
|
|
1386
|
+
}));
|
|
1387
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
1388
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1389
|
+
};
|
|
1390
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1391
|
+
__exportStar(__webpack_require__(9321), exports);
|
|
1392
|
+
__exportStar(__webpack_require__(8398), exports);
|
|
1393
|
+
__exportStar(__webpack_require__(696), exports);
|
|
1394
|
+
__exportStar(__webpack_require__(8980), exports);
|
|
1395
|
+
__exportStar(__webpack_require__(1174), exports);
|
|
1396
|
+
__exportStar(__webpack_require__(7413), exports);
|
|
1397
|
+
__exportStar(__webpack_require__(298), exports);
|
|
1398
|
+
__exportStar(__webpack_require__(7639), exports);
|
|
1399
|
+
__exportStar(__webpack_require__(5281), exports);
|
|
1400
|
+
__exportStar(__webpack_require__(3298), exports);
|
|
1401
|
+
__exportStar(__webpack_require__(180), exports);
|
|
1402
|
+
|
|
1403
|
+
|
|
1404
|
+
/***/ }),
|
|
1405
|
+
|
|
1406
|
+
/***/ 3854:
|
|
1407
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
1408
|
+
|
|
1409
|
+
|
|
1410
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1411
|
+
exports.TradeSubStatus = exports.TradeStatus = void 0;
|
|
1412
|
+
var TradeStatus;
|
|
1413
|
+
(function (TradeStatus) {
|
|
1414
|
+
TradeStatus["Unconfirmed"] = "UNCONFIRMED";
|
|
1415
|
+
TradeStatus["Confirmed"] = "CONFIRMED";
|
|
1416
|
+
TradeStatus["Rejected"] = "REJECTED";
|
|
1417
|
+
})(TradeStatus || (exports.TradeStatus = TradeStatus = {}));
|
|
1418
|
+
var TradeSubStatus;
|
|
1419
|
+
(function (TradeSubStatus) {
|
|
1420
|
+
TradeSubStatus["RESUBMITTED"] = "RESUBMITTED";
|
|
1421
|
+
TradeSubStatus["PROCESSED"] = "PROCESSED";
|
|
1422
|
+
TradeSubStatus["REMATCHED"] = "REMATCHED";
|
|
1423
|
+
})(TradeSubStatus || (exports.TradeSubStatus = TradeSubStatus = {}));
|
|
1424
|
+
|
|
1425
|
+
|
|
1426
|
+
/***/ }),
|
|
1427
|
+
|
|
1428
|
+
/***/ 4132:
|
|
1429
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
1430
|
+
|
|
1431
|
+
|
|
1432
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1433
|
+
exports.MarketMakerSortByEnum = exports.MarketMakerRebateTier = void 0;
|
|
1434
|
+
var MarketMakerRebateTier;
|
|
1435
|
+
(function (MarketMakerRebateTier) {
|
|
1436
|
+
MarketMakerRebateTier[MarketMakerRebateTier["FIRST"] = 1] = "FIRST";
|
|
1437
|
+
MarketMakerRebateTier[MarketMakerRebateTier["SECOND"] = 2] = "SECOND";
|
|
1438
|
+
MarketMakerRebateTier[MarketMakerRebateTier["THIRD"] = 3] = "THIRD";
|
|
1439
|
+
MarketMakerRebateTier[MarketMakerRebateTier["FOURTH"] = 4] = "FOURTH";
|
|
1440
|
+
})(MarketMakerRebateTier || (exports.MarketMakerRebateTier = MarketMakerRebateTier = {}));
|
|
1441
|
+
var MarketMakerSortByEnum;
|
|
1442
|
+
(function (MarketMakerSortByEnum) {
|
|
1443
|
+
MarketMakerSortByEnum["REBATE_TIER"] = "rebateTier";
|
|
1444
|
+
MarketMakerSortByEnum["CREATED_AT"] = "createdAt";
|
|
1445
|
+
MarketMakerSortByEnum["NAME"] = "name";
|
|
1446
|
+
MarketMakerSortByEnum["TAKER_FEE"] = "takerFee";
|
|
1447
|
+
MarketMakerSortByEnum["ENABLED"] = "enabled";
|
|
1448
|
+
MarketMakerSortByEnum["ADDRESS"] = "address";
|
|
1449
|
+
MarketMakerSortByEnum["CHAIN"] = "chainId";
|
|
1450
|
+
})(MarketMakerSortByEnum || (exports.MarketMakerSortByEnum = MarketMakerSortByEnum = {}));
|
|
1451
|
+
|
|
1452
|
+
|
|
1453
|
+
/***/ }),
|
|
1454
|
+
|
|
1455
|
+
/***/ 4199:
|
|
1456
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
1457
|
+
|
|
1458
|
+
|
|
1459
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1460
|
+
exports.ScheduledNotificationStatusEnum = exports.NotificationStatusEnum = exports.NotificationPriorityEnum = exports.CombinedNotificationEnum = exports.AccountNotificationEnum = exports.GlobalNotificationEnum = void 0;
|
|
1461
|
+
var GlobalNotificationEnum;
|
|
1462
|
+
(function (GlobalNotificationEnum) {
|
|
1463
|
+
GlobalNotificationEnum["GLOBAL_PAIR_DELISTING"] = "GLOBAL_PAIR_DELISTING";
|
|
1464
|
+
GlobalNotificationEnum["GLOBAL_NEW_PAIR_LISTING"] = "GLOBAL_NEW_PAIR_LISTING";
|
|
1465
|
+
GlobalNotificationEnum["GLOBAL_SYSTEM_MAINTENANCE"] = "GLOBAL_SYSTEM_MAINTENANCE";
|
|
1466
|
+
GlobalNotificationEnum["GLOBAL_SMART_CONTRACT_UPDATE"] = "GLOBAL_SMART_CONTRACT_UPDATE";
|
|
1467
|
+
})(GlobalNotificationEnum || (exports.GlobalNotificationEnum = GlobalNotificationEnum = {}));
|
|
1468
|
+
var AccountNotificationEnum;
|
|
1469
|
+
(function (AccountNotificationEnum) {
|
|
1470
|
+
AccountNotificationEnum["ACCOUNT_POINTS_UNLOCK_ACHIEVEMENT"] = "ACCOUNT_POINTS_UNLOCK_ACHIEVEMENT";
|
|
1471
|
+
AccountNotificationEnum["ACCOUNT_KYC_STATUS_CHANGED"] = "ACCOUNT_KYC_STATUS_CHANGED";
|
|
1472
|
+
AccountNotificationEnum["ACCOUNT_AFFILIATE_DASHBOARD_UNLOCKED"] = "ACCOUNT_AFFILIATE_DASHBOARD_UNLOCKED";
|
|
1473
|
+
})(AccountNotificationEnum || (exports.AccountNotificationEnum = AccountNotificationEnum = {}));
|
|
1474
|
+
exports.CombinedNotificationEnum = {
|
|
1475
|
+
...GlobalNotificationEnum,
|
|
1476
|
+
...AccountNotificationEnum,
|
|
1477
|
+
};
|
|
1478
|
+
var NotificationPriorityEnum;
|
|
1479
|
+
(function (NotificationPriorityEnum) {
|
|
1480
|
+
NotificationPriorityEnum["CRITICAL"] = "CRITICAL";
|
|
1481
|
+
NotificationPriorityEnum["IMPORTANT"] = "IMPORTANT";
|
|
1482
|
+
NotificationPriorityEnum["INFO"] = "INFO";
|
|
1483
|
+
})(NotificationPriorityEnum || (exports.NotificationPriorityEnum = NotificationPriorityEnum = {}));
|
|
1484
|
+
var NotificationStatusEnum;
|
|
1485
|
+
(function (NotificationStatusEnum) {
|
|
1486
|
+
NotificationStatusEnum["UNREAD"] = "UNREAD";
|
|
1487
|
+
NotificationStatusEnum["READ"] = "READ";
|
|
1488
|
+
})(NotificationStatusEnum || (exports.NotificationStatusEnum = NotificationStatusEnum = {}));
|
|
1489
|
+
var ScheduledNotificationStatusEnum;
|
|
1490
|
+
(function (ScheduledNotificationStatusEnum) {
|
|
1491
|
+
ScheduledNotificationStatusEnum["PENDING"] = "PENDING";
|
|
1492
|
+
ScheduledNotificationStatusEnum["PROCESSED"] = "PROCESSED";
|
|
1493
|
+
ScheduledNotificationStatusEnum["FAILED"] = "FAILED";
|
|
1494
|
+
})(ScheduledNotificationStatusEnum || (exports.ScheduledNotificationStatusEnum = ScheduledNotificationStatusEnum = {}));
|
|
1495
|
+
|
|
1496
|
+
|
|
1497
|
+
/***/ }),
|
|
1498
|
+
|
|
1499
|
+
/***/ 5237:
|
|
1500
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
1501
|
+
|
|
1502
|
+
|
|
1503
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1504
|
+
exports.UpgradeStatus = void 0;
|
|
1505
|
+
var UpgradeStatus;
|
|
1506
|
+
(function (UpgradeStatus) {
|
|
1507
|
+
UpgradeStatus["SUCCESS"] = "success";
|
|
1508
|
+
UpgradeStatus["FAILED"] = "failed";
|
|
1509
|
+
UpgradeStatus["PENDING"] = "pending";
|
|
1510
|
+
})(UpgradeStatus || (exports.UpgradeStatus = UpgradeStatus = {}));
|
|
1511
|
+
|
|
1512
|
+
|
|
1513
|
+
/***/ }),
|
|
1514
|
+
|
|
1515
|
+
/***/ 5281:
|
|
1516
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
1517
|
+
|
|
1518
|
+
|
|
1519
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
1520
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1521
|
+
};
|
|
1522
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1523
|
+
const ioredis_1 = __importDefault(__webpack_require__(6615));
|
|
1524
|
+
class RedisHelper {
|
|
1525
|
+
constructor() {
|
|
1526
|
+
this.host = process.env.REDIS_HOSTNAME;
|
|
1527
|
+
this.port = process.env.REDIS_PORT;
|
|
1528
|
+
this.client = new ioredis_1.default({
|
|
1529
|
+
host: this.host,
|
|
1530
|
+
port: Number(this.port),
|
|
1531
|
+
lazyConnect: true,
|
|
1532
|
+
});
|
|
1533
|
+
this.operationQueue = [];
|
|
1534
|
+
this.runningOperations = false;
|
|
1535
|
+
this.client.on('connect', () => {
|
|
1536
|
+
// console.log('Redis Connected');
|
|
1537
|
+
});
|
|
1538
|
+
this.client.on('ready', () => {
|
|
1539
|
+
// console.log('Redis Ready');
|
|
1540
|
+
this.performPendingOperations();
|
|
1541
|
+
});
|
|
1542
|
+
this.client.on('error', (err) => {
|
|
1543
|
+
console.error('Redis error:', err.message);
|
|
1544
|
+
});
|
|
1545
|
+
this.client.on('close', () => {
|
|
1546
|
+
console.log('Redis connection closed');
|
|
1547
|
+
});
|
|
1548
|
+
}
|
|
1549
|
+
async performPendingOperations() {
|
|
1550
|
+
this.runningOperations = true;
|
|
1551
|
+
while (this.operationQueue.length > 0) {
|
|
1552
|
+
const operation = this.operationQueue.shift();
|
|
1553
|
+
if (operation) {
|
|
1554
|
+
try {
|
|
1555
|
+
await operation();
|
|
1556
|
+
}
|
|
1557
|
+
catch (err) {
|
|
1558
|
+
console.error('Error performing Redis operation:', err);
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
this.runningOperations = false;
|
|
1563
|
+
}
|
|
1564
|
+
async setString(key, value, expires = 0, database = '') {
|
|
1565
|
+
const operation = async () => {
|
|
1566
|
+
if (database !== '') {
|
|
1567
|
+
this.client.select(Number(database));
|
|
1568
|
+
}
|
|
1569
|
+
await this.client.set(key, value);
|
|
1570
|
+
if (expires !== 0) {
|
|
1571
|
+
await this.client.expire(key, expires * 60);
|
|
1572
|
+
}
|
|
1573
|
+
};
|
|
1574
|
+
await this.performOperation(operation);
|
|
1575
|
+
}
|
|
1576
|
+
async incrementKey(key, expires = 0, database = '') {
|
|
1577
|
+
const operation = async () => {
|
|
1578
|
+
if (database !== '') {
|
|
1579
|
+
this.client.select(Number(database));
|
|
1580
|
+
}
|
|
1581
|
+
await this.client.incr(key);
|
|
1582
|
+
if (expires !== 0) {
|
|
1583
|
+
const ttl = await this.client.ttl(key);
|
|
1584
|
+
if (ttl === -1) {
|
|
1585
|
+
await this.client.expire(key, expires * 60);
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
};
|
|
1589
|
+
await this.performOperation(operation);
|
|
1590
|
+
}
|
|
1591
|
+
async scanKeys(pattern, database = '') {
|
|
1592
|
+
const matchedKeys = [];
|
|
1593
|
+
const operation = async () => {
|
|
1594
|
+
if (database !== '') {
|
|
1595
|
+
this.client.select(Number(database));
|
|
1596
|
+
}
|
|
1597
|
+
let cursor = '0';
|
|
1598
|
+
do {
|
|
1599
|
+
const [nextCursor, keys] = await this.client.scan(cursor, 'MATCH', pattern, 'COUNT', 100);
|
|
1600
|
+
cursor = nextCursor;
|
|
1601
|
+
matchedKeys.push(...keys);
|
|
1602
|
+
} while (cursor !== '0');
|
|
1603
|
+
};
|
|
1604
|
+
await this.performOperation(operation);
|
|
1605
|
+
return matchedKeys;
|
|
1606
|
+
}
|
|
1607
|
+
getString(key, database = '') {
|
|
1608
|
+
return new Promise(async (resolve, reject) => {
|
|
1609
|
+
const operation = async () => {
|
|
1610
|
+
try {
|
|
1611
|
+
if (database !== '') {
|
|
1612
|
+
await this.client.select(Number(database));
|
|
1613
|
+
}
|
|
1614
|
+
const value = await this.client.get(key);
|
|
1615
|
+
resolve(value);
|
|
1616
|
+
}
|
|
1617
|
+
catch (err) {
|
|
1618
|
+
reject(err);
|
|
1619
|
+
}
|
|
1620
|
+
};
|
|
1621
|
+
this.performOperation(operation);
|
|
1622
|
+
});
|
|
1623
|
+
}
|
|
1624
|
+
async deleteString(key, database = '') {
|
|
1625
|
+
const operation = async () => {
|
|
1626
|
+
if (database !== '') {
|
|
1627
|
+
this.client.select(Number(database));
|
|
1628
|
+
}
|
|
1629
|
+
await this.client.del(key);
|
|
1630
|
+
};
|
|
1631
|
+
await this.performOperation(operation);
|
|
1632
|
+
}
|
|
1633
|
+
async deleteByKeyPattern(pattern, database = '') {
|
|
1634
|
+
const operation = async () => {
|
|
1635
|
+
if (database !== '') {
|
|
1636
|
+
this.client.select(Number(database));
|
|
1637
|
+
}
|
|
1638
|
+
const keys = await this.client.keys(pattern);
|
|
1639
|
+
if (keys.length > 0) {
|
|
1640
|
+
await this.client.unlink(keys);
|
|
1641
|
+
console.log(`Deleted ${keys.length} keys`);
|
|
1642
|
+
}
|
|
1643
|
+
else {
|
|
1644
|
+
console.log('No keys for delete');
|
|
1645
|
+
}
|
|
1646
|
+
};
|
|
1647
|
+
await this.performOperation(operation);
|
|
1648
|
+
}
|
|
1649
|
+
async destroyDb(dbKey) {
|
|
1650
|
+
const response = await this.client.del(dbKey);
|
|
1651
|
+
return response === 1;
|
|
1652
|
+
}
|
|
1653
|
+
async performOperation(operation) {
|
|
1654
|
+
this.operationQueue.push(operation);
|
|
1655
|
+
if (!this.runningOperations) {
|
|
1656
|
+
try {
|
|
1657
|
+
await this.performPendingOperations();
|
|
1658
|
+
}
|
|
1659
|
+
catch (error) {
|
|
1660
|
+
console.error('Error during performing Redis operation', error);
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
async close() {
|
|
1665
|
+
console.log('Closing Redis client for graceful shutdown...');
|
|
1666
|
+
try {
|
|
1667
|
+
while (this.operationQueue.length > 0 || this.runningOperations) {
|
|
1668
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
1669
|
+
}
|
|
1670
|
+
await this.client.quit();
|
|
1671
|
+
console.log('Redis client closed successfully');
|
|
1672
|
+
}
|
|
1673
|
+
catch (error) {
|
|
1674
|
+
console.error('Error during Redis client shutdown:', error);
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
async createStream(key) {
|
|
1678
|
+
// console.log(`[Stream '${key}'] Creating...`);
|
|
1679
|
+
await this.client.xgroup('CREATE', key, 'group', '$', 'MKSTREAM');
|
|
1680
|
+
}
|
|
1681
|
+
async writeToStream(key, message) {
|
|
1682
|
+
try {
|
|
1683
|
+
// console.log(`[Stream '${key}']`, `Try write to stream`);
|
|
1684
|
+
if (await this.streamExists(key)) {
|
|
1685
|
+
// console.log(`[Stream '${key}']`, `Writing the message`, JSON.stringify(message));
|
|
1686
|
+
await this.client.xadd(key, '*', 'message', JSON.stringify(message));
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
catch (error) {
|
|
1690
|
+
console.log(`[Stream '${key}']`, 'Error while writing to stream', error);
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
async readStream(key, timeout) {
|
|
1694
|
+
// console.log(`[Stream '${key}'] Reading with timeout ${timeout}s...`);
|
|
1695
|
+
const results = await this.client.xreadgroup('GROUP', 'group', 'consumer', 'COUNT', 1, 'BLOCK', timeout * 1000, 'STREAMS', key, '>');
|
|
1696
|
+
if (results && results.length > 0) {
|
|
1697
|
+
const [, entries] = results[0];
|
|
1698
|
+
if (entries && entries.length > 0) {
|
|
1699
|
+
const [, [, message]] = entries[0];
|
|
1700
|
+
return JSON.parse(message);
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1703
|
+
return null;
|
|
1704
|
+
}
|
|
1705
|
+
async deleteStream(key) {
|
|
1706
|
+
// console.log(`[Stream '${key}']`, `Try delete stream`);
|
|
1707
|
+
if (await this.streamExists(key)) {
|
|
1708
|
+
// console.log(`[Stream '${key}']`, `Deleting...`);
|
|
1709
|
+
await this.client.del(key);
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
async setTTL(key, ttlSeconds) {
|
|
1713
|
+
await this.client.expire(key, ttlSeconds);
|
|
1714
|
+
}
|
|
1715
|
+
async streamExists(key) {
|
|
1716
|
+
const exists = await this.client.exists(key);
|
|
1717
|
+
// console.log(`Key '${key}' in redis exists: ${exists}`);
|
|
1718
|
+
return exists === 1;
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
exports["default"] = new RedisHelper();
|
|
1722
|
+
|
|
1723
|
+
|
|
1724
|
+
/***/ }),
|
|
1725
|
+
|
|
1726
|
+
/***/ 5320:
|
|
1727
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1728
|
+
|
|
1729
|
+
|
|
1730
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1731
|
+
exports.mapToUserTradeDto = mapToUserTradeDto;
|
|
1732
|
+
exports.mapToOrderTradeDto = mapToOrderTradeDto;
|
|
1733
|
+
exports.isMaker = isMaker;
|
|
1734
|
+
const order_helper_1 = __webpack_require__(7542);
|
|
1735
|
+
const utils_1 = __webpack_require__(8398);
|
|
1736
|
+
const big_number_helper_1 = __webpack_require__(1174);
|
|
1737
|
+
const _enums_1 = __webpack_require__(9965);
|
|
1738
|
+
function mapToUserTradeDto(t, baseAsset, priceAsset) {
|
|
1739
|
+
const o = t.buyOrder && t.sellOrder
|
|
1740
|
+
? (t.buyOrderId > t.sellOrderId ? t.buyOrder : t.sellOrder) // which order is self order
|
|
1741
|
+
: (t.buyOrder || t.sellOrder); // user order
|
|
1742
|
+
return {
|
|
1743
|
+
pairId: t.pairId,
|
|
1744
|
+
orderId: o?.id,
|
|
1745
|
+
orderSide: (o && (0, order_helper_1.mapOrderSideToShort)(o.side)),
|
|
1746
|
+
...mapAssets(baseAsset, priceAsset),
|
|
1747
|
+
...mapTrade(t, o),
|
|
1748
|
+
};
|
|
1749
|
+
}
|
|
1750
|
+
function mapToOrderTradeDto(order, trades, pairKey, baseAsset, priceAsset) {
|
|
1751
|
+
return {
|
|
1752
|
+
id: order.id,
|
|
1753
|
+
pairId: order.pairId,
|
|
1754
|
+
// @ts-ignore
|
|
1755
|
+
pair: pairKey || order.pair?.pairKey,
|
|
1756
|
+
...mapAssets(baseAsset, priceAsset),
|
|
1757
|
+
amount: order.amount,
|
|
1758
|
+
price: order.price,
|
|
1759
|
+
total: order.total,
|
|
1760
|
+
filledAmount: order.filledAmount,
|
|
1761
|
+
filledTotal: order.filledTotal,
|
|
1762
|
+
avgPrice: order.excutedPrice,
|
|
1763
|
+
status: order.status,
|
|
1764
|
+
side: order.side,
|
|
1765
|
+
type: order.type,
|
|
1766
|
+
userId: order.userId,
|
|
1767
|
+
createdAt: order.createdAt?.getTime(),
|
|
1768
|
+
completedAt: order.completedAt?.getTime() || null,
|
|
1769
|
+
updatedAt: order.updatedAt?.getTime(),
|
|
1770
|
+
trades: trades && trades.map((t) => mapTrade(t, order)),
|
|
1771
|
+
};
|
|
1772
|
+
}
|
|
1773
|
+
function mapAssets(baseAsset, priceAsset) {
|
|
1774
|
+
return {
|
|
1775
|
+
baseTokenId: baseAsset?.id,
|
|
1776
|
+
baseTokenDecimal: baseAsset?.decimals,
|
|
1777
|
+
quoteTokenId: priceAsset?.id,
|
|
1778
|
+
quoteTokenDecimal: priceAsset?.decimals,
|
|
1779
|
+
};
|
|
1780
|
+
}
|
|
1781
|
+
function mapTrade(t, o) {
|
|
1782
|
+
return {
|
|
1783
|
+
tradeId: t.tradeId,
|
|
1784
|
+
status: t.txStatus,
|
|
1785
|
+
amount: t.amount,
|
|
1786
|
+
total: t.total,
|
|
1787
|
+
price: t.price,
|
|
1788
|
+
fee: o && t.tradeFees
|
|
1789
|
+
.filter(f => (0, utils_1.equalIgnoreCase)(f.address, o.userId))
|
|
1790
|
+
.reduce((acc, cur) => (0, big_number_helper_1.plus)(acc, cur.fee), '0'),
|
|
1791
|
+
createdAt: t.createdAt?.getTime(),
|
|
1792
|
+
updatedAt: t.updatedAt?.getTime(),
|
|
1793
|
+
isBuyer: o && o.side === _enums_1.OrderSide.Buy,
|
|
1794
|
+
isMaker: o && isMaker(o.side, t.tradeSide),
|
|
1795
|
+
};
|
|
1796
|
+
}
|
|
1797
|
+
function isMaker(oSide, tSide) {
|
|
1798
|
+
return oSide === _enums_1.OrderSide.Buy && tSide === _enums_1.OrderSide.Sell
|
|
1799
|
+
|| oSide === _enums_1.OrderSide.Sell && tSide === _enums_1.OrderSide.Buy;
|
|
1800
|
+
}
|
|
1801
|
+
|
|
1802
|
+
|
|
1803
|
+
/***/ }),
|
|
1804
|
+
|
|
1805
|
+
/***/ 6119:
|
|
1806
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
1807
|
+
|
|
1808
|
+
|
|
1809
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1810
|
+
exports.TwitterAccessScopeEnum = void 0;
|
|
1811
|
+
var TwitterAccessScopeEnum;
|
|
1812
|
+
(function (TwitterAccessScopeEnum) {
|
|
1813
|
+
TwitterAccessScopeEnum["USERS_READ"] = "users.read";
|
|
1814
|
+
TwitterAccessScopeEnum["FOLLOWS_READ"] = "follows.read";
|
|
1815
|
+
TwitterAccessScopeEnum["FOLLOWS_WRITE"] = "follows.write";
|
|
1816
|
+
TwitterAccessScopeEnum["TWEET_READ"] = "tweet.read";
|
|
1817
|
+
TwitterAccessScopeEnum["TWEET_WRITE"] = "tweet.write";
|
|
1818
|
+
TwitterAccessScopeEnum["OFFLINE_ACCESS"] = "offline.access";
|
|
1819
|
+
TwitterAccessScopeEnum["LIKE_READ"] = "like.read";
|
|
1820
|
+
TwitterAccessScopeEnum["LIKE_WRITE"] = "like.write";
|
|
1821
|
+
})(TwitterAccessScopeEnum || (exports.TwitterAccessScopeEnum = TwitterAccessScopeEnum = {}));
|
|
1822
|
+
|
|
1823
|
+
|
|
1824
|
+
/***/ }),
|
|
1825
|
+
|
|
1826
|
+
/***/ 6168:
|
|
1827
|
+
/***/ ((module) => {
|
|
1828
|
+
|
|
1829
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__6168__;
|
|
1830
|
+
|
|
1831
|
+
/***/ }),
|
|
1832
|
+
|
|
1833
|
+
/***/ 6615:
|
|
1834
|
+
/***/ ((module) => {
|
|
1835
|
+
|
|
1836
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__6615__;
|
|
1837
|
+
|
|
1838
|
+
/***/ }),
|
|
1839
|
+
|
|
1840
|
+
/***/ 6828:
|
|
1841
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
1842
|
+
|
|
1843
|
+
|
|
1844
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1845
|
+
exports.KYCAuthenticationStatus = exports.LastLookAction = exports.FeeTier = void 0;
|
|
1846
|
+
var FeeTier;
|
|
1847
|
+
(function (FeeTier) {
|
|
1848
|
+
FeeTier[FeeTier["FEE_TIER_1"] = 1] = "FEE_TIER_1";
|
|
1849
|
+
FeeTier[FeeTier["FEE_TIER_2"] = 2] = "FEE_TIER_2";
|
|
1850
|
+
FeeTier[FeeTier["FEE_TIER_3"] = 3] = "FEE_TIER_3";
|
|
1851
|
+
FeeTier[FeeTier["FEE_TIER_4"] = 4] = "FEE_TIER_4";
|
|
1852
|
+
FeeTier[FeeTier["FEE_TIER_5"] = 5] = "FEE_TIER_5";
|
|
1853
|
+
FeeTier[FeeTier["FEE_TIER_6"] = 6] = "FEE_TIER_6";
|
|
1854
|
+
})(FeeTier || (exports.FeeTier = FeeTier = {}));
|
|
1855
|
+
var LastLookAction;
|
|
1856
|
+
(function (LastLookAction) {
|
|
1857
|
+
LastLookAction[LastLookAction["Approve"] = 1] = "Approve";
|
|
1858
|
+
LastLookAction[LastLookAction["Reject"] = 0] = "Reject";
|
|
1859
|
+
})(LastLookAction || (exports.LastLookAction = LastLookAction = {}));
|
|
1860
|
+
var KYCAuthenticationStatus;
|
|
1861
|
+
(function (KYCAuthenticationStatus) {
|
|
1862
|
+
KYCAuthenticationStatus["INITIATED"] = "INITIATED";
|
|
1863
|
+
KYCAuthenticationStatus["CREATED"] = "CREATED";
|
|
1864
|
+
KYCAuthenticationStatus["PROCESSING"] = "PROCESSING";
|
|
1865
|
+
KYCAuthenticationStatus["APPROVED"] = "APPROVED";
|
|
1866
|
+
KYCAuthenticationStatus["REJECTED"] = "REJECTED";
|
|
1867
|
+
})(KYCAuthenticationStatus || (exports.KYCAuthenticationStatus = KYCAuthenticationStatus = {}));
|
|
1868
|
+
|
|
1869
|
+
|
|
1870
|
+
/***/ }),
|
|
1871
|
+
|
|
1872
|
+
/***/ 6978:
|
|
1873
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
1874
|
+
|
|
1875
|
+
|
|
1876
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1877
|
+
exports.MaintenanceMode = void 0;
|
|
1878
|
+
var MaintenanceMode;
|
|
1879
|
+
(function (MaintenanceMode) {
|
|
1880
|
+
MaintenanceMode[MaintenanceMode["Off"] = 0] = "Off";
|
|
1881
|
+
MaintenanceMode[MaintenanceMode["Full"] = 1] = "Full";
|
|
1882
|
+
MaintenanceMode[MaintenanceMode["Partial"] = 2] = "Partial";
|
|
1883
|
+
MaintenanceMode[MaintenanceMode["Scheduled"] = 3] = "Scheduled";
|
|
1884
|
+
})(MaintenanceMode || (exports.MaintenanceMode = MaintenanceMode = {}));
|
|
1885
|
+
|
|
1886
|
+
|
|
1887
|
+
/***/ }),
|
|
1888
|
+
|
|
1889
|
+
/***/ 7413:
|
|
1890
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
1891
|
+
|
|
1892
|
+
|
|
1893
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
1894
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1895
|
+
};
|
|
1896
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1897
|
+
exports.extractAppOrders = extractAppOrders;
|
|
1898
|
+
const decode_1 = __webpack_require__(3450);
|
|
1899
|
+
const logger_1 = __importDefault(__webpack_require__(298));
|
|
1900
|
+
function extractAppOrders(account, appId) {
|
|
1901
|
+
logger_1.default.log('accountInfo', account);
|
|
1902
|
+
if (!account?.hasOwnProperty('apps-local-state')) {
|
|
1903
|
+
logger_1.default.log(`No apps-local-state at account`, account);
|
|
1904
|
+
return [];
|
|
1905
|
+
}
|
|
1906
|
+
let localState = account['apps-local-state'];
|
|
1907
|
+
if (!localState?.length) {
|
|
1908
|
+
logger_1.default.log('apps-local-state', localState);
|
|
1909
|
+
return [];
|
|
1910
|
+
}
|
|
1911
|
+
const ordersInApp = localState.filter((state) => !state.deleted && state.id === appId);
|
|
1912
|
+
logger_1.default.log(`[App Id: ${appId}]`, ordersInApp);
|
|
1913
|
+
return ordersInApp
|
|
1914
|
+
.map(state => {
|
|
1915
|
+
const balancesKey = state['key-value'].find((el) => (el.key === "YWNjb3VudEluZm8="));
|
|
1916
|
+
const ordersKey = state['key-value'].filter((el) => (el.key !== "YWNjb3VudEluZm8="));
|
|
1917
|
+
const decodedBalances = (0, decode_1.getAccounInfoFormLocalStorage)(balancesKey.value.bytes);
|
|
1918
|
+
const decodedOrders = ordersKey.map((el) => (0, decode_1.printUnpackedLocalData)(el.value.bytes));
|
|
1919
|
+
return decodedOrders.flat(Infinity);
|
|
1920
|
+
})
|
|
1921
|
+
.flat().filter((o) => o.orderID !== 0);
|
|
1922
|
+
}
|
|
1923
|
+
|
|
1924
|
+
|
|
1925
|
+
/***/ }),
|
|
1926
|
+
|
|
1927
|
+
/***/ 7542:
|
|
1928
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1929
|
+
|
|
1930
|
+
|
|
1931
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1932
|
+
exports.mapOrderSideFromShort = mapOrderSideFromShort;
|
|
1933
|
+
exports.mapOrderSideToShort = mapOrderSideToShort;
|
|
1934
|
+
exports.mapOrderTypeShort = mapOrderTypeShort;
|
|
1935
|
+
exports.mapOrderSideFromShortToLong = mapOrderSideFromShortToLong;
|
|
1936
|
+
exports.mapOrderTypeShortToLong = mapOrderTypeShortToLong;
|
|
1937
|
+
const _enums_1 = __webpack_require__(9965);
|
|
1938
|
+
function mapOrderSideFromShort(value) {
|
|
1939
|
+
switch (value) {
|
|
1940
|
+
case "B": return _enums_1.OrderSide.Buy;
|
|
1941
|
+
case "S": return _enums_1.OrderSide.Sell;
|
|
1942
|
+
default:
|
|
1943
|
+
throw new Error("Unknown order side short type: " + value);
|
|
1944
|
+
}
|
|
1945
|
+
}
|
|
1946
|
+
function mapOrderSideToShort(value) {
|
|
1947
|
+
switch (value) {
|
|
1948
|
+
case _enums_1.OrderSide.Buy: return "B";
|
|
1949
|
+
case _enums_1.OrderSide.Sell: return "S";
|
|
1950
|
+
default:
|
|
1951
|
+
throw new Error("Unknown order side type: " + value);
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
function mapOrderTypeShort(value) {
|
|
1955
|
+
switch (value) {
|
|
1956
|
+
case "I": return _enums_1.OrderType.IOC;
|
|
1957
|
+
case "P": return _enums_1.OrderType.POST;
|
|
1958
|
+
case "M": return _enums_1.OrderType.Market;
|
|
1959
|
+
case "L":
|
|
1960
|
+
default:
|
|
1961
|
+
return _enums_1.OrderType.Limit;
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1964
|
+
function mapOrderSideFromShortToLong(value) {
|
|
1965
|
+
switch (value) {
|
|
1966
|
+
case "B": return "BUY";
|
|
1967
|
+
case "S": return "SELL";
|
|
1968
|
+
default:
|
|
1969
|
+
throw new Error("Unknown order side short type: " + value);
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
function mapOrderTypeShortToLong(value) {
|
|
1973
|
+
switch (value) {
|
|
1974
|
+
case "I": return "IOC";
|
|
1975
|
+
case "P": return "POST";
|
|
1976
|
+
case "M": return "Market";
|
|
1977
|
+
case "L":
|
|
1978
|
+
default:
|
|
1979
|
+
return "Limit";
|
|
1980
|
+
}
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1983
|
+
|
|
1984
|
+
/***/ }),
|
|
1985
|
+
|
|
1986
|
+
/***/ 7639:
|
|
1987
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
1988
|
+
|
|
1989
|
+
|
|
1990
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1991
|
+
exports.dropIndexIfExists = dropIndexIfExists;
|
|
1992
|
+
exports.createIndexIfNotExists = createIndexIfNotExists;
|
|
1993
|
+
exports.checkIfExists = checkIfExists;
|
|
1994
|
+
async function dropIndexIfExists(queryRunner, tableName, indexName) {
|
|
1995
|
+
if (await checkIfExists(queryRunner, tableName, indexName)) {
|
|
1996
|
+
await queryRunner.query(`ALTER TABLE \`${tableName}\` DROP index \`${indexName}\``);
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
async function createIndexIfNotExists(queryRunner, tableName, indexName, cols) {
|
|
2000
|
+
if (!(await checkIfExists(queryRunner, tableName, indexName))) {
|
|
2001
|
+
await queryRunner.query(`CREATE INDEX \`${indexName}\` ON \`${tableName}\` (${cols});`);
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
2004
|
+
async function checkIfExists(queryRunner, tableName, indexName) {
|
|
2005
|
+
let result = await queryRunner.query(`SELECT EXISTS(SELECT * FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = '${tableName}'
|
|
2006
|
+
AND INDEX_NAME = '${indexName}' AND INDEX_SCHEMA='order_service') as existed`);
|
|
2007
|
+
console.log(result);
|
|
2008
|
+
return result.length > 0 && result[0].existed == 1;
|
|
2009
|
+
}
|
|
2010
|
+
|
|
2011
|
+
|
|
2012
|
+
/***/ }),
|
|
2013
|
+
|
|
2014
|
+
/***/ 7818:
|
|
2015
|
+
/***/ ((module) => {
|
|
2016
|
+
|
|
2017
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__7818__;
|
|
2018
|
+
|
|
2019
|
+
/***/ }),
|
|
2020
|
+
|
|
2021
|
+
/***/ 8398:
|
|
2022
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
2023
|
+
|
|
2024
|
+
|
|
2025
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2026
|
+
exports.equalIgnoreCase = exports.listDateFormat = void 0;
|
|
2027
|
+
exports.getRandomInt = getRandomInt;
|
|
2028
|
+
exports.getDomains = getDomains;
|
|
2029
|
+
exports.cutEvent = cutEvent;
|
|
2030
|
+
exports.maskingString = maskingString;
|
|
2031
|
+
exports.removeField = removeField;
|
|
2032
|
+
const listDateFormat = (date) => {
|
|
2033
|
+
let newDAte = new Date(date);
|
|
2034
|
+
let parsedDate = newDAte.toLocaleDateString('default', {
|
|
2035
|
+
year: 'numeric',
|
|
2036
|
+
month: 'numeric',
|
|
2037
|
+
day: 'numeric',
|
|
2038
|
+
});
|
|
2039
|
+
let time = newDAte.toLocaleTimeString('en-US', {
|
|
2040
|
+
hour12: true,
|
|
2041
|
+
hour: '2-digit',
|
|
2042
|
+
minute: '2-digit',
|
|
2043
|
+
});
|
|
2044
|
+
return parsedDate + ' ' + time;
|
|
2045
|
+
};
|
|
2046
|
+
exports.listDateFormat = listDateFormat;
|
|
2047
|
+
const equalIgnoreCase = (value1, value2) => {
|
|
2048
|
+
return String(value1).toLowerCase() === String(value2).toLowerCase();
|
|
2049
|
+
};
|
|
2050
|
+
exports.equalIgnoreCase = equalIgnoreCase;
|
|
2051
|
+
function getRandomInt(min, max) {
|
|
2052
|
+
min = Math.ceil(min);
|
|
2053
|
+
max = Math.floor(max);
|
|
2054
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
2055
|
+
}
|
|
2056
|
+
function getDomains(domain) {
|
|
2057
|
+
const domains = [];
|
|
2058
|
+
const parts = domain.split('.');
|
|
2059
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
2060
|
+
domains.push(parts.slice(i).join('.'));
|
|
2061
|
+
}
|
|
2062
|
+
return domains;
|
|
2063
|
+
}
|
|
2064
|
+
;
|
|
2065
|
+
function cutEvent(event) {
|
|
2066
|
+
const headers = event.headers && removeUndefined({
|
|
2067
|
+
'Authorization': event.headers['Authorization']?.substring(0, 200),
|
|
2068
|
+
'CloudFront-Viewer-Country': event.headers['CloudFront-Viewer-Country'],
|
|
2069
|
+
'Host': event.headers['Host'],
|
|
2070
|
+
'origin': event.headers['origin'],
|
|
2071
|
+
'Referer': event.headers['Referer'],
|
|
2072
|
+
'User-Agent': event.headers['User-Agent'],
|
|
2073
|
+
'wl-domain': event.headers['wl-domain'],
|
|
2074
|
+
'X-API-Key': maskingString(event.headers['X-API-Key']),
|
|
2075
|
+
'X-Forwarded-For': event.headers['X-Forwarded-For'],
|
|
2076
|
+
'X-Forwarded-Port': event.headers['X-Forwarded-Port'],
|
|
2077
|
+
'X-Forwarded-Proto': event.headers['X-Forwarded-Proto'],
|
|
2078
|
+
'X-Trading-Key': event.headers['X-Trading-Key'],
|
|
2079
|
+
'X-Wallet-Address': event.headers['X-Wallet-Address'],
|
|
2080
|
+
'X-Wallet-Token': event.headers['X-Wallet-Token'],
|
|
2081
|
+
'accessToken': maskingString(event.headers['accessToken']),
|
|
2082
|
+
'companyId': event.headers['companyId'],
|
|
2083
|
+
'seasonId': event.headers['seasonId'],
|
|
2084
|
+
});
|
|
2085
|
+
const requestContext = event.requestContext && removeUndefined({
|
|
2086
|
+
identity: event.requestContext.identity && removeUndefined({
|
|
2087
|
+
'userAgent': event.requestContext.identity['userAgent'],
|
|
2088
|
+
'sourceIp': event.requestContext.identity['sourceIp'],
|
|
2089
|
+
}),
|
|
2090
|
+
domainName: event.requestContext.domainName,
|
|
2091
|
+
});
|
|
2092
|
+
return removeUndefined({
|
|
2093
|
+
manage: event.manage,
|
|
2094
|
+
path: event.path,
|
|
2095
|
+
httpMethod: event.httpMethod,
|
|
2096
|
+
headers,
|
|
2097
|
+
requestContext,
|
|
2098
|
+
});
|
|
2099
|
+
}
|
|
2100
|
+
function maskingString(str) {
|
|
2101
|
+
if (!str?.length)
|
|
2102
|
+
return str;
|
|
2103
|
+
const maskLen = Math.round(str.length / 3);
|
|
2104
|
+
const start = maskLen;
|
|
2105
|
+
const end = str.length - maskLen;
|
|
2106
|
+
const maskedStr = str.substring(0, start) + "*".repeat(maskLen) + str.substring(end);
|
|
2107
|
+
return maskedStr;
|
|
2108
|
+
}
|
|
2109
|
+
function removeField(obj, fieldToRemove) {
|
|
2110
|
+
if (Array.isArray(obj)) {
|
|
2111
|
+
return obj.map(item => removeField(item, fieldToRemove));
|
|
2112
|
+
}
|
|
2113
|
+
else if (typeof obj === 'object' && obj !== null) {
|
|
2114
|
+
return Object.fromEntries(Object.entries(obj)
|
|
2115
|
+
.filter(([key]) => key !== fieldToRemove)
|
|
2116
|
+
.map(([key, value]) => [key, removeField(value, fieldToRemove)]));
|
|
2117
|
+
}
|
|
2118
|
+
return obj; // Return primitives as-is
|
|
2119
|
+
}
|
|
2120
|
+
function removeUndefined(obj) {
|
|
2121
|
+
return Object.fromEntries(Object.entries(obj).filter(([, value]) => value !== undefined));
|
|
2122
|
+
}
|
|
2123
|
+
|
|
2124
|
+
|
|
2125
|
+
/***/ }),
|
|
2126
|
+
|
|
2127
|
+
/***/ 8593:
|
|
2128
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2129
|
+
|
|
2130
|
+
|
|
2131
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
2132
|
+
if (k2 === undefined) k2 = k;
|
|
2133
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
2134
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
2135
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
2136
|
+
}
|
|
2137
|
+
Object.defineProperty(o, k2, desc);
|
|
2138
|
+
}) : (function(o, m, k, k2) {
|
|
2139
|
+
if (k2 === undefined) k2 = k;
|
|
2140
|
+
o[k2] = m[k];
|
|
2141
|
+
}));
|
|
2142
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
2143
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
2144
|
+
}) : function(o, v) {
|
|
2145
|
+
o["default"] = v;
|
|
2146
|
+
});
|
|
2147
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
2148
|
+
var ownKeys = function(o) {
|
|
2149
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
2150
|
+
var ar = [];
|
|
2151
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
2152
|
+
return ar;
|
|
2153
|
+
};
|
|
2154
|
+
return ownKeys(o);
|
|
2155
|
+
};
|
|
2156
|
+
return function (mod) {
|
|
2157
|
+
if (mod && mod.__esModule) return mod;
|
|
2158
|
+
var result = {};
|
|
2159
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
2160
|
+
__setModuleDefault(result, mod);
|
|
2161
|
+
return result;
|
|
2162
|
+
};
|
|
2163
|
+
})();
|
|
2164
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2165
|
+
exports.decodeAddress = exports.encodeAddress = void 0;
|
|
2166
|
+
exports.concatArrays = concatArrays;
|
|
2167
|
+
exports.packData = packData;
|
|
2168
|
+
exports.unpackData = unpackData;
|
|
2169
|
+
exports.encodeArgArray = encodeArgArray;
|
|
2170
|
+
exports.encodeString = encodeString;
|
|
2171
|
+
exports.decodeString = decodeString;
|
|
2172
|
+
exports.encode32Bytes = encode32Bytes;
|
|
2173
|
+
exports.encodeUint64 = encodeUint64;
|
|
2174
|
+
exports.decodeUint64 = decodeUint64;
|
|
2175
|
+
exports.encodeBase64 = encodeBase64;
|
|
2176
|
+
exports.decodeBase64 = decodeBase64;
|
|
2177
|
+
exports.compareArrays = compareArrays;
|
|
2178
|
+
exports.getDeltaUint = getDeltaUint;
|
|
2179
|
+
exports.getDeltaBytes = getDeltaBytes;
|
|
2180
|
+
exports.toUnix = toUnix;
|
|
2181
|
+
exports.fromUnix = fromUnix;
|
|
2182
|
+
const algosdk_1 = __importStar(__webpack_require__(9709));
|
|
2183
|
+
// import sha512 from "js-sha512"
|
|
2184
|
+
const buffer_1 = __webpack_require__(18);
|
|
2185
|
+
function concatArrays(arrays) {
|
|
2186
|
+
return arrays.reduce((a, b) => Uint8Array.from([...a, ...b]));
|
|
2187
|
+
}
|
|
2188
|
+
function packData(value, format) {
|
|
2189
|
+
const chunks = [];
|
|
2190
|
+
for (const [name, type] of Object.entries(format)) {
|
|
2191
|
+
const v = value[name];
|
|
2192
|
+
if (v === undefined) {
|
|
2193
|
+
throw new Error(`Key ${name} missing from value`);
|
|
2194
|
+
}
|
|
2195
|
+
switch (type.type) {
|
|
2196
|
+
case 'address':
|
|
2197
|
+
if (v instanceof Uint8Array && v.length == 32) {
|
|
2198
|
+
chunks.push(v);
|
|
2199
|
+
break;
|
|
2200
|
+
}
|
|
2201
|
+
else if (typeof v === 'string') {
|
|
2202
|
+
chunks.push((0, algosdk_1.decodeAddress)(v).publicKey);
|
|
2203
|
+
}
|
|
2204
|
+
else {
|
|
2205
|
+
throw new Error(`${name}: Expected address, got ${v}`);
|
|
2206
|
+
}
|
|
2207
|
+
break;
|
|
2208
|
+
case 'bytes':
|
|
2209
|
+
if (v instanceof Uint8Array) {
|
|
2210
|
+
if (v.length == type.size) {
|
|
2211
|
+
chunks.push(v);
|
|
2212
|
+
break;
|
|
2213
|
+
}
|
|
2214
|
+
else {
|
|
2215
|
+
throw new Error(`${name}: Bytes length is wrong, expected ${type.size}, got ${v.length}`);
|
|
2216
|
+
}
|
|
2217
|
+
}
|
|
2218
|
+
else {
|
|
2219
|
+
throw new Error(`${name}: Expected bytes[${type.size}], got ${v}`);
|
|
2220
|
+
}
|
|
2221
|
+
case 'double':
|
|
2222
|
+
if (typeof v === 'number') {
|
|
2223
|
+
const bytes = new ArrayBuffer(8);
|
|
2224
|
+
buffer_1.Buffer.from(bytes).writeDoubleLE(v, 0);
|
|
2225
|
+
chunks.push(new Uint8Array(bytes));
|
|
2226
|
+
break;
|
|
2227
|
+
}
|
|
2228
|
+
else {
|
|
2229
|
+
throw new Error(`${name}: Expected double, got ${v}`);
|
|
2230
|
+
}
|
|
2231
|
+
case 'number':
|
|
2232
|
+
case 'uint':
|
|
2233
|
+
if (typeof v === 'bigint' || typeof v === 'number') {
|
|
2234
|
+
chunks.push(encodeUint64(v));
|
|
2235
|
+
break;
|
|
2236
|
+
}
|
|
2237
|
+
else {
|
|
2238
|
+
throw new Error(`${name}: Expected uint or number, got ${v}`);
|
|
2239
|
+
}
|
|
2240
|
+
case 'string':
|
|
2241
|
+
if (typeof v === 'string') {
|
|
2242
|
+
const str = encodeString(v);
|
|
2243
|
+
if (str.length == type.size) {
|
|
2244
|
+
chunks.push(str);
|
|
2245
|
+
break;
|
|
2246
|
+
}
|
|
2247
|
+
else {
|
|
2248
|
+
throw new Error(`${name}: Expected string length ${type.size}, got string length ${str.length}`);
|
|
2249
|
+
}
|
|
2250
|
+
}
|
|
2251
|
+
else {
|
|
2252
|
+
throw new Error(`${name}: Expected string length ${type.size}, got ${v}`);
|
|
2253
|
+
}
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2256
|
+
return concatArrays(chunks);
|
|
2257
|
+
}
|
|
2258
|
+
function unpackData(data, format) {
|
|
2259
|
+
const result = new Map();
|
|
2260
|
+
let index = 0;
|
|
2261
|
+
for (const [name, type] of Object.entries(format)) {
|
|
2262
|
+
if (index >= data.length) {
|
|
2263
|
+
throw new Error('Array index out of bounds');
|
|
2264
|
+
}
|
|
2265
|
+
let value;
|
|
2266
|
+
switch (type.type) {
|
|
2267
|
+
case 'address':
|
|
2268
|
+
value = (0, algosdk_1.encodeAddress)(data.slice(index, index + 32));
|
|
2269
|
+
index += 32;
|
|
2270
|
+
break;
|
|
2271
|
+
case 'bytes':
|
|
2272
|
+
value = data.slice(index, index + type.size);
|
|
2273
|
+
index += type.size;
|
|
2274
|
+
break;
|
|
2275
|
+
case 'double':
|
|
2276
|
+
value = buffer_1.Buffer.from(data.slice(index, index + 8)).readDoubleLE(0);
|
|
2277
|
+
index += 8;
|
|
2278
|
+
break;
|
|
2279
|
+
case 'number':
|
|
2280
|
+
value = Number(decodeUint64(data.slice(index, index + 8)));
|
|
2281
|
+
index += 8;
|
|
2282
|
+
break;
|
|
2283
|
+
case 'uint':
|
|
2284
|
+
value = decodeUint64(data.slice(index, index + 8));
|
|
2285
|
+
index += 8;
|
|
2286
|
+
break;
|
|
2287
|
+
case 'string':
|
|
2288
|
+
value = decodeString(data.slice(index, index + type.size));
|
|
2289
|
+
index += type.size;
|
|
2290
|
+
break;
|
|
2291
|
+
}
|
|
2292
|
+
result.set(name, value);
|
|
2293
|
+
}
|
|
2294
|
+
return Object.fromEntries(result);
|
|
2295
|
+
}
|
|
2296
|
+
function encodeArgArray(params) {
|
|
2297
|
+
return params.map(param => {
|
|
2298
|
+
if (param instanceof Uint8Array)
|
|
2299
|
+
return new Uint8Array(param);
|
|
2300
|
+
if (typeof param === "string")
|
|
2301
|
+
return encodeString(param);
|
|
2302
|
+
if (typeof param === "boolean")
|
|
2303
|
+
param = BigInt(param ? 1 : 0);
|
|
2304
|
+
if (typeof param === "number")
|
|
2305
|
+
param = BigInt(param);
|
|
2306
|
+
return encodeUint64(param);
|
|
2307
|
+
});
|
|
2308
|
+
}
|
|
2309
|
+
function encodeString(value) {
|
|
2310
|
+
return new Uint8Array(buffer_1.Buffer.from(value));
|
|
2311
|
+
}
|
|
2312
|
+
function decodeString(value) {
|
|
2313
|
+
return buffer_1.Buffer.from(value).toString('utf-8');
|
|
2314
|
+
}
|
|
2315
|
+
function encode32Bytes(value) {
|
|
2316
|
+
const valueButes = algosdk_1.default.encodeUint64(value);
|
|
2317
|
+
return concatArrays([new Uint8Array(32 - valueButes.length), valueButes]);
|
|
2318
|
+
}
|
|
2319
|
+
function encodeUint64(value) {
|
|
2320
|
+
const bytes = buffer_1.Buffer.alloc(8);
|
|
2321
|
+
for (let index = 0; index < 8; index++)
|
|
2322
|
+
bytes[7 - index] = Number((BigInt(value) >> BigInt(index * 8)) & BigInt(0xFF));
|
|
2323
|
+
return new Uint8Array(bytes);
|
|
2324
|
+
}
|
|
2325
|
+
function decodeUint64(value) {
|
|
2326
|
+
let num = BigInt(0);
|
|
2327
|
+
for (let index = 0; index < 8 && value?.length; index++)
|
|
2328
|
+
num = (num << BigInt(8)) | BigInt(value[index]);
|
|
2329
|
+
return num;
|
|
2330
|
+
}
|
|
2331
|
+
function encodeBase64(value) {
|
|
2332
|
+
return buffer_1.Buffer.from(value).toString('base64');
|
|
2333
|
+
}
|
|
2334
|
+
function decodeBase64(value) {
|
|
2335
|
+
return buffer_1.Buffer.from(value, 'base64');
|
|
2336
|
+
}
|
|
2337
|
+
// export const sha256HashLength = 32
|
|
2338
|
+
// export function sha256Hash(arr: sha512.Message): Uint8Array {
|
|
2339
|
+
// return new Uint8Array(sha512.sha512_256.arrayBuffer(arr))
|
|
2340
|
+
// }
|
|
2341
|
+
// export function encodeApplicationAddress(id: number): Address {
|
|
2342
|
+
// const APP_ID_PREFIX = Buffer.from('appID');
|
|
2343
|
+
// const toBeSigned = concatArrays([APP_ID_PREFIX, encodeUint64(BigInt(id))]);
|
|
2344
|
+
// return encodeAddress(sha256Hash(toBeSigned));
|
|
2345
|
+
// }
|
|
2346
|
+
function compareArrays(a, b) {
|
|
2347
|
+
return a.length === b.length && a.reduce((equal, item, index) => equal && item === b[index], true);
|
|
2348
|
+
}
|
|
2349
|
+
function getDelta(response, key) {
|
|
2350
|
+
const delta = response['global-state-delta'].find((v) => v.key === key);
|
|
2351
|
+
if (delta === undefined)
|
|
2352
|
+
return undefined;
|
|
2353
|
+
return delta['value'];
|
|
2354
|
+
}
|
|
2355
|
+
function getDeltaUint(response, key) {
|
|
2356
|
+
const delta = getDelta(response, key);
|
|
2357
|
+
if (delta === undefined)
|
|
2358
|
+
return undefined;
|
|
2359
|
+
return BigInt(delta['uint']);
|
|
2360
|
+
}
|
|
2361
|
+
function getDeltaBytes(response, key) {
|
|
2362
|
+
const delta = getDelta(response, key);
|
|
2363
|
+
if (delta === undefined)
|
|
2364
|
+
return undefined;
|
|
2365
|
+
return decodeBase64(delta['bytes']);
|
|
2366
|
+
}
|
|
2367
|
+
function toUnix(date) {
|
|
2368
|
+
return Math.floor(date.getTime() / 1000);
|
|
2369
|
+
}
|
|
2370
|
+
function fromUnix(timestamp) {
|
|
2371
|
+
return new Date(timestamp * 1000);
|
|
2372
|
+
}
|
|
2373
|
+
var algosdk_2 = __webpack_require__(9709);
|
|
2374
|
+
Object.defineProperty(exports, "encodeAddress", ({ enumerable: true, get: function () { return algosdk_2.encodeAddress; } }));
|
|
2375
|
+
Object.defineProperty(exports, "decodeAddress", ({ enumerable: true, get: function () { return algosdk_2.decodeAddress; } }));
|
|
2376
|
+
|
|
2377
|
+
|
|
2378
|
+
/***/ }),
|
|
2379
|
+
|
|
2380
|
+
/***/ 8980:
|
|
2381
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2382
|
+
|
|
2383
|
+
|
|
2384
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2385
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2386
|
+
};
|
|
2387
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2388
|
+
exports.decrypt = exports.encrypt = void 0;
|
|
2389
|
+
const client_kms_1 = __webpack_require__(7818);
|
|
2390
|
+
const logger_1 = __importDefault(__webpack_require__(298));
|
|
2391
|
+
const encrypt = async (string) => {
|
|
2392
|
+
if (process.env.ENVIRONMENT === 'LOCAL') {
|
|
2393
|
+
logger_1.default.logWarning('WARNING: AWS KMS encryption is bypassed in local environment.');
|
|
2394
|
+
return string;
|
|
2395
|
+
}
|
|
2396
|
+
const input = {
|
|
2397
|
+
KeyId: process.env.SOCIAL_SECRET_KEY_ID,
|
|
2398
|
+
Plaintext: Buffer.from(string),
|
|
2399
|
+
};
|
|
2400
|
+
const command = new client_kms_1.EncryptCommand(input);
|
|
2401
|
+
const result = await sendKmsCommand(command);
|
|
2402
|
+
return Buffer.from(result.CiphertextBlob).toString('base64');
|
|
2403
|
+
};
|
|
2404
|
+
exports.encrypt = encrypt;
|
|
2405
|
+
const decrypt = async (encryptedString) => {
|
|
2406
|
+
if (process.env.ENVIRONMENT === 'LOCAL') {
|
|
2407
|
+
logger_1.default.logWarning('WARNING: AWS KMS decryption is bypassed in local environment.');
|
|
2408
|
+
return encryptedString;
|
|
2409
|
+
}
|
|
2410
|
+
const input = {
|
|
2411
|
+
KeyId: process.env.SOCIAL_SECRET_KEY_ID,
|
|
2412
|
+
CiphertextBlob: Buffer.from(encryptedString, 'base64'),
|
|
2413
|
+
};
|
|
2414
|
+
const command = new client_kms_1.DecryptCommand(input);
|
|
2415
|
+
const result = await sendKmsCommand(command);
|
|
2416
|
+
return new TextDecoder().decode(result.Plaintext);
|
|
2417
|
+
};
|
|
2418
|
+
exports.decrypt = decrypt;
|
|
2419
|
+
const sendKmsCommand = async (command) => {
|
|
2420
|
+
return new Promise((resolve, reject) => {
|
|
2421
|
+
try {
|
|
2422
|
+
const client = new client_kms_1.KMSClient({ region: 'us-east-1' });
|
|
2423
|
+
client.send(command, (err, data) => {
|
|
2424
|
+
if (err) {
|
|
2425
|
+
console.log('-----error in KMS operation---------', err);
|
|
2426
|
+
reject(err);
|
|
2427
|
+
}
|
|
2428
|
+
else {
|
|
2429
|
+
console.log('KMS command was successfully sent');
|
|
2430
|
+
resolve(data);
|
|
2431
|
+
}
|
|
2432
|
+
});
|
|
2433
|
+
}
|
|
2434
|
+
catch (error) {
|
|
2435
|
+
console.log('KMSClient error', error);
|
|
2436
|
+
reject(error);
|
|
2437
|
+
}
|
|
2438
|
+
});
|
|
2439
|
+
};
|
|
2440
|
+
|
|
2441
|
+
|
|
2442
|
+
/***/ }),
|
|
2443
|
+
|
|
2444
|
+
/***/ 9321:
|
|
2445
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2446
|
+
|
|
2447
|
+
|
|
2448
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
2449
|
+
if (k2 === undefined) k2 = k;
|
|
2450
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
2451
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
2452
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
2453
|
+
}
|
|
2454
|
+
Object.defineProperty(o, k2, desc);
|
|
2455
|
+
}) : (function(o, m, k, k2) {
|
|
2456
|
+
if (k2 === undefined) k2 = k;
|
|
2457
|
+
o[k2] = m[k];
|
|
2458
|
+
}));
|
|
2459
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
2460
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
2461
|
+
};
|
|
2462
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2463
|
+
__exportStar(__webpack_require__(221), exports);
|
|
2464
|
+
__exportStar(__webpack_require__(2137), exports);
|
|
2465
|
+
__exportStar(__webpack_require__(5320), exports);
|
|
2466
|
+
|
|
2467
|
+
|
|
2468
|
+
/***/ }),
|
|
2469
|
+
|
|
2470
|
+
/***/ 9709:
|
|
2471
|
+
/***/ ((module) => {
|
|
2472
|
+
|
|
2473
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__9709__;
|
|
2474
|
+
|
|
2475
|
+
/***/ }),
|
|
2476
|
+
|
|
2477
|
+
/***/ 9965:
|
|
2478
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2479
|
+
|
|
2480
|
+
|
|
2481
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
2482
|
+
if (k2 === undefined) k2 = k;
|
|
2483
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
2484
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
2485
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
2486
|
+
}
|
|
2487
|
+
Object.defineProperty(o, k2, desc);
|
|
2488
|
+
}) : (function(o, m, k, k2) {
|
|
2489
|
+
if (k2 === undefined) k2 = k;
|
|
2490
|
+
o[k2] = m[k];
|
|
2491
|
+
}));
|
|
2492
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
2493
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
2494
|
+
};
|
|
2495
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2496
|
+
__exportStar(__webpack_require__(2228), exports);
|
|
2497
|
+
__exportStar(__webpack_require__(6978), exports);
|
|
2498
|
+
__exportStar(__webpack_require__(2739), exports);
|
|
2499
|
+
__exportStar(__webpack_require__(6119), exports);
|
|
2500
|
+
__exportStar(__webpack_require__(3004), exports);
|
|
2501
|
+
|
|
2502
|
+
|
|
2503
|
+
/***/ })
|
|
2504
|
+
|
|
2505
|
+
/******/ });
|
|
2506
|
+
/************************************************************************/
|
|
2507
|
+
/******/ // The module cache
|
|
2508
|
+
/******/ var __webpack_module_cache__ = {};
|
|
2509
|
+
/******/
|
|
2510
|
+
/******/ // The require function
|
|
2511
|
+
/******/ function __webpack_require__(moduleId) {
|
|
2512
|
+
/******/ // Check if module is in cache
|
|
2513
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
2514
|
+
/******/ if (cachedModule !== undefined) {
|
|
2515
|
+
/******/ return cachedModule.exports;
|
|
2516
|
+
/******/ }
|
|
2517
|
+
/******/ // Create a new module (and put it into the cache)
|
|
2518
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
2519
|
+
/******/ // no module.id needed
|
|
2520
|
+
/******/ // no module.loaded needed
|
|
2521
|
+
/******/ exports: {}
|
|
2522
|
+
/******/ };
|
|
2523
|
+
/******/
|
|
2524
|
+
/******/ // Execute the module function
|
|
2525
|
+
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
2526
|
+
/******/
|
|
2527
|
+
/******/ // Return the exports of the module
|
|
2528
|
+
/******/ return module.exports;
|
|
2529
|
+
/******/ }
|
|
2530
|
+
/******/
|
|
2531
|
+
/************************************************************************/
|
|
2532
|
+
/******/
|
|
2533
|
+
/******/ // startup
|
|
2534
|
+
/******/ // Load entry module and return exports
|
|
2535
|
+
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
2536
|
+
/******/ var __webpack_exports__ = __webpack_require__(3528);
|
|
2537
|
+
/******/
|
|
2538
|
+
/******/ return __webpack_exports__;
|
|
2539
|
+
/******/ })()
|
|
2540
|
+
;
|
|
2541
|
+
});
|