@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.
Files changed (189) hide show
  1. package/dist/baseModel/base.model.d.ts +26 -0
  2. package/dist/baseModel/index.d.ts +2 -0
  3. package/dist/common/auth.helper.d.ts +4 -0
  4. package/dist/common/auth.helper.js +367 -0
  5. package/dist/common/awsKms.d.ts +2 -0
  6. package/dist/common/awsKms.js +265 -0
  7. package/dist/common/big-number.helper.d.ts +38 -0
  8. package/dist/common/big-number.helper.js +263 -0
  9. package/dist/common/index.d.ts +11 -0
  10. package/dist/common/index.js +2541 -0
  11. package/dist/common/indexer.helper.d.ts +2 -0
  12. package/dist/common/indexer.helper.js +387 -0
  13. package/dist/common/logger.d.ts +32 -0
  14. package/dist/common/logger.js +188 -0
  15. package/dist/common/mappers/codexAsset.mapper.d.ts +2 -0
  16. package/dist/common/mappers/codexAsset.mapper.js +40 -0
  17. package/dist/common/mappers/codexBalance.mapper.d.ts +2 -0
  18. package/dist/common/mappers/codexBalance.mapper.js +38 -0
  19. package/dist/common/mappers/index.d.ts +3 -0
  20. package/dist/common/mappers/index.js +1421 -0
  21. package/dist/common/mappers/trade.mapper.d.ts +6 -0
  22. package/dist/common/mappers/trade.mapper.js +1343 -0
  23. package/dist/common/migration.helpers.d.ts +4 -0
  24. package/dist/common/migration.helpers.js +44 -0
  25. package/dist/common/redis.helper.d.ts +27 -0
  26. package/dist/common/redis.helper.js +269 -0
  27. package/dist/common/secret.helper.d.ts +28 -0
  28. package/dist/common/secret.helper.js +144 -0
  29. package/dist/common/timestamp.helper.d.ts +1 -0
  30. package/dist/common/timestamp.helper.js +41 -0
  31. package/dist/common/utils/assert.d.ts +1 -0
  32. package/dist/common/utils/assert.js +32 -0
  33. package/dist/common/utils/decode.d.ts +5 -0
  34. package/dist/common/utils/decode.js +206 -0
  35. package/dist/common/utils/index.d.ts +9 -0
  36. package/dist/common/utils/index.js +122 -0
  37. package/dist/common/utils/social.d.ts +1 -0
  38. package/dist/common/utils/social.js +30 -0
  39. package/dist/common/utils/stat.d.ts +1 -0
  40. package/dist/common/utils/stat.js +274 -0
  41. package/dist/constants/allowedUrls.d.ts +1 -0
  42. package/dist/constants/auth.d.ts +2 -0
  43. package/dist/constants/cctp.d.ts +3 -0
  44. package/dist/constants/codex.d.ts +11 -0
  45. package/dist/constants/env.d.ts +6 -0
  46. package/dist/constants/index.d.ts +7 -0
  47. package/dist/constants/index.js +455 -0
  48. package/dist/constants/queue.d.ts +39 -0
  49. package/dist/constants/response.d.ts +82 -0
  50. package/dist/constants/settings.d.ts +2 -0
  51. package/dist/constants/social.d.ts +3 -0
  52. package/dist/constants/withdrawalWalletsMessage.d.ts +1 -0
  53. package/dist/enums/chains.enum.d.ts +50 -0
  54. package/dist/enums/db/account/index.d.ts +19 -0
  55. package/dist/enums/db/affiliate.enum.d.ts +7 -0
  56. package/dist/enums/db/available-pair-settings.enum.d.ts +12 -0
  57. package/dist/enums/db/chains.d.ts +30 -0
  58. package/dist/enums/db/common.enum.d.ts +4 -0
  59. package/dist/enums/db/component/index.d.ts +22 -0
  60. package/dist/enums/db/index.d.ts +21 -0
  61. package/dist/enums/db/market-maker.enum.d.ts +15 -0
  62. package/dist/enums/db/notification-center/userNotification.enum.d.ts +36 -0
  63. package/dist/enums/db/order-side.enum.d.ts +5 -0
  64. package/dist/enums/db/order-status.enum.d.ts +8 -0
  65. package/dist/enums/db/order-type.enum.d.ts +7 -0
  66. package/dist/enums/db/pending-actions.enum.d.ts +6 -0
  67. package/dist/enums/db/relayer.enum.d.ts +23 -0
  68. package/dist/enums/db/setting-type.enum.d.ts +8 -0
  69. package/dist/enums/db/social-action.enum.d.ts +24 -0
  70. package/dist/enums/db/social-prompt.enum.d.ts +8 -0
  71. package/dist/enums/db/social.enum.d.ts +10 -0
  72. package/dist/enums/db/state-type.enum.d.ts +9 -0
  73. package/dist/enums/db/trade.enums.d.ts +10 -0
  74. package/dist/enums/db/tradingKeyType.enum.d.ts +4 -0
  75. package/dist/enums/db/upgrade.enum.d.ts +5 -0
  76. package/dist/enums/db/withdrawal-wallet.enum.d.ts +5 -0
  77. package/dist/enums/index.d.ts +5 -0
  78. package/dist/enums/index.js +893 -0
  79. package/dist/enums/maintenanceMode.enum.d.ts +10 -0
  80. package/dist/enums/notification.enum.d.ts +7 -0
  81. package/dist/enums/social.enum.d.ts +10 -0
  82. package/dist/helpers/Encoding.d.ts +33 -0
  83. package/dist/helpers/Encoding.js +318 -0
  84. package/dist/helpers/algo.helper.d.ts +14 -0
  85. package/dist/helpers/algo.helper.js +1211 -0
  86. package/dist/helpers/api.helper.d.ts +16 -0
  87. package/dist/helpers/api.helper.js +1652 -0
  88. package/dist/helpers/assert.helper.d.ts +10 -0
  89. package/dist/helpers/assert.helper.js +1677 -0
  90. package/dist/helpers/atomic.helper.d.ts +21 -0
  91. package/dist/helpers/atomic.helper.js +712 -0
  92. package/dist/helpers/balance.helper.d.ts +13 -0
  93. package/dist/helpers/balance.helper.js +4330 -0
  94. package/dist/helpers/codex/common.helper.d.ts +24 -0
  95. package/dist/helpers/codex/common.helper.js +4246 -0
  96. package/dist/helpers/codex/index.d.ts +6 -0
  97. package/dist/helpers/codex/index.js +4246 -0
  98. package/dist/helpers/codex/mbr.helper.d.ts +6 -0
  99. package/dist/helpers/codex/mbr.helper.js +4246 -0
  100. package/dist/helpers/codex/mna.helper.d.ts +2 -0
  101. package/dist/helpers/codex/mna.helper.js +4246 -0
  102. package/dist/helpers/codex/order.helper.d.ts +6 -0
  103. package/dist/helpers/codex/order.helper.js +4246 -0
  104. package/dist/helpers/codex/setGlobal.helper.d.ts +27 -0
  105. package/dist/helpers/codex/setGlobal.helper.js +4312 -0
  106. package/dist/helpers/codex/transfer.helper.d.ts +21 -0
  107. package/dist/helpers/codex/transfer.helper.js +4246 -0
  108. package/dist/helpers/codex/txn.helper.d.ts +13 -0
  109. package/dist/helpers/codex/txn.helper.js +4246 -0
  110. package/dist/helpers/codex.helper.d.ts +106 -0
  111. package/dist/helpers/codex.helper.js +4246 -0
  112. package/dist/helpers/email.helper.d.ts +5 -0
  113. package/dist/helpers/email.helper.js +112 -0
  114. package/dist/helpers/eth.helper.d.ts +12 -0
  115. package/dist/helpers/eth.helper.js +4246 -0
  116. package/dist/helpers/hummingbots.helper.d.ts +2 -0
  117. package/dist/helpers/hummingbots.helper.js +163 -0
  118. package/dist/helpers/index.d.ts +5 -0
  119. package/dist/helpers/index.js +837 -0
  120. package/dist/helpers/interval.helpers.d.ts +9 -0
  121. package/dist/helpers/interval.helpers.js +110 -0
  122. package/dist/helpers/liquidity.helper.d.ts +6 -0
  123. package/dist/helpers/liquidity.helper.js +81 -0
  124. package/dist/helpers/order.helper.d.ts +7 -0
  125. package/dist/helpers/order.helper.js +946 -0
  126. package/dist/helpers/pair.helper.d.ts +9 -0
  127. package/dist/helpers/pair.helper.js +938 -0
  128. package/dist/helpers/pointSystem.helper.d.ts +14 -0
  129. package/dist/helpers/pointSystem.helper.js +392 -0
  130. package/dist/helpers/ticker.helpers.d.ts +8 -0
  131. package/dist/helpers/ticker.helpers.js +358 -0
  132. package/dist/helpers/vaa.helper.d.ts +2 -0
  133. package/dist/helpers/vaa.helper.js +4350 -0
  134. package/dist/helpers/withdraw.helper.d.ts +14 -0
  135. package/dist/helpers/withdraw.helper.js +4784 -0
  136. package/dist/interfaces/accountInfo.interface.d.ts +15 -0
  137. package/dist/interfaces/algostreamer/index.d.ts +49 -0
  138. package/dist/interfaces/api/affiliate.interface.d.ts +71 -0
  139. package/dist/interfaces/cache.interface.d.ts +25 -0
  140. package/dist/interfaces/confirmed-txn.interface.d.ts +46 -0
  141. package/dist/interfaces/controller.interface.d.ts +6 -0
  142. package/dist/interfaces/db/baseModel.interface.d.ts +5 -0
  143. package/dist/interfaces/db/hummingbot/index.d.ts +18 -0
  144. package/dist/interfaces/db/index.d.ts +10 -0
  145. package/dist/interfaces/db/market/index.d.ts +313 -0
  146. package/dist/interfaces/db/marketing/index.d.ts +48 -0
  147. package/dist/interfaces/db/notification_center/index.d.ts +33 -0
  148. package/dist/interfaces/db/relayer/index.d.ts +56 -0
  149. package/dist/interfaces/db/social/index.d.ts +188 -0
  150. package/dist/interfaces/db/softDeleteModel.interface.d.ts +4 -0
  151. package/dist/interfaces/db/white_label/index.d.ts +161 -0
  152. package/dist/interfaces/db/withdrawal_wallets/index.d.ts +12 -0
  153. package/dist/interfaces/dto/index.d.ts +62 -0
  154. package/dist/interfaces/emailService.interface.d.ts +4 -0
  155. package/dist/interfaces/index.d.ts +17 -0
  156. package/dist/interfaces/index.js +1319 -0
  157. package/dist/interfaces/kmsService.interface.d.ts +4 -0
  158. package/dist/interfaces/last-look-trade.interface.d.ts +10 -0
  159. package/dist/interfaces/market.interface.d.ts +17 -0
  160. package/dist/interfaces/order.interface.d.ts +162 -0
  161. package/dist/interfaces/pair.interface.d.ts +10 -0
  162. package/dist/interfaces/query.interface.d.ts +6 -0
  163. package/dist/interfaces/services/accountCache.interface.d.ts +15 -0
  164. package/dist/interfaces/services/algod.interface.d.ts +5 -0
  165. package/dist/interfaces/services/balances.interface.d.ts +11 -0
  166. package/dist/interfaces/services/coin-market-cap.interface.d.ts +124 -0
  167. package/dist/interfaces/services/index.d.ts +8 -0
  168. package/dist/interfaces/services/price-model.interface.d.ts +4 -0
  169. package/dist/interfaces/services/price-service.interface.d.ts +8 -0
  170. package/dist/interfaces/services/socialActivity.interface.d.ts +48 -0
  171. package/dist/interfaces/services/tmc.interface.d.ts +9 -0
  172. package/dist/interfaces/streaming.interface.d.ts +95 -0
  173. package/dist/interfaces/timestream.interface.d.ts +29 -0
  174. package/dist/interfaces/trading.interface.d.ts +235 -0
  175. package/dist/interfaces/tradingKey.interface.d.ts +26 -0
  176. package/dist/interfaces/transfer.interface.d.ts +12 -0
  177. package/dist/interfaces/wallet.interface.d.ts +89 -0
  178. package/dist/interfaces/withdrawalWallets.interface.d.ts +14 -0
  179. package/dist/types/algo-order.type.d.ts +10 -0
  180. package/dist/types/amm/amm.d.ts +163 -0
  181. package/dist/types/api/request.types.d.ts +99 -0
  182. package/dist/types/codex.types.d.ts +28 -0
  183. package/dist/types/hummingbots.types.d.ts +23 -0
  184. package/dist/types/index.d.ts +8 -0
  185. package/dist/types/index.js +362 -0
  186. package/dist/types/notification.type.d.ts +10 -0
  187. package/dist/types/settings.type.d.ts +162 -0
  188. package/dist/types/state.type.d.ts +4 -0
  189. package/package.json +78 -0
@@ -0,0 +1,1343 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory(require("bignumber.js"));
4
+ else if(typeof define === 'function' && define.amd)
5
+ define(["bignumber.js"], factory);
6
+ else {
7
+ var a = typeof exports === 'object' ? factory(require("bignumber.js")) : factory(root["bignumber.js"]);
8
+ for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
9
+ }
10
+ })(global, (__WEBPACK_EXTERNAL_MODULE__6168__) => {
11
+ return /******/ (() => { // webpackBootstrap
12
+ /******/ "use strict";
13
+ /******/ var __webpack_modules__ = ({
14
+
15
+ /***/ 835:
16
+ /***/ ((__unused_webpack_module, exports) => {
17
+
18
+
19
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
20
+ var OrderSide;
21
+ (function (OrderSide) {
22
+ OrderSide[OrderSide["Buy"] = 0] = "Buy";
23
+ OrderSide[OrderSide["Sell"] = 1] = "Sell";
24
+ })(OrderSide || (OrderSide = {}));
25
+ exports["default"] = OrderSide;
26
+
27
+
28
+ /***/ }),
29
+
30
+ /***/ 892:
31
+ /***/ ((__unused_webpack_module, exports) => {
32
+
33
+
34
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
35
+ exports.PairComponentStatusType = exports.ComponentType = exports.ComponentStatusType = void 0;
36
+ var ComponentStatusType;
37
+ (function (ComponentStatusType) {
38
+ ComponentStatusType["ACTIVE"] = "ACTIVE";
39
+ ComponentStatusType["FAILED"] = "FAILED";
40
+ ComponentStatusType["STARTING"] = "STARTING";
41
+ ComponentStatusType["DRAINING"] = "DRAINING";
42
+ ComponentStatusType["TERMINATING"] = "TERMINATING";
43
+ ComponentStatusType["TERMINATED"] = "TERMINATED";
44
+ })(ComponentStatusType || (exports.ComponentStatusType = ComponentStatusType = {}));
45
+ var ComponentType;
46
+ (function (ComponentType) {
47
+ ComponentType["MATCHING_ENGINE"] = "me";
48
+ ComponentType["ORDER_SERVICE"] = "ors";
49
+ ComponentType["API"] = "api";
50
+ ComponentType["SOCKET_SERVICE"] = "ws";
51
+ ComponentType["TRANSACTION_SERVICE"] = "tns";
52
+ })(ComponentType || (exports.ComponentType = ComponentType = {}));
53
+ var PairComponentStatusType;
54
+ (function (PairComponentStatusType) {
55
+ PairComponentStatusType["ACTIVE"] = "ACTIVE";
56
+ PairComponentStatusType["FAILED"] = "FAILED";
57
+ PairComponentStatusType["UNASSIGNED"] = "UNASSIGNED";
58
+ PairComponentStatusType["ASSIGNED"] = "ASSIGNED";
59
+ PairComponentStatusType["STARTING"] = "STARTING";
60
+ })(PairComponentStatusType || (exports.PairComponentStatusType = PairComponentStatusType = {}));
61
+
62
+
63
+ /***/ }),
64
+
65
+ /***/ 893:
66
+ /***/ ((__unused_webpack_module, exports) => {
67
+
68
+
69
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
70
+ exports.NON_REPEATABLE_ACTIONS = exports.ActionEnum = exports.ActionSource = void 0;
71
+ var ActionSource;
72
+ (function (ActionSource) {
73
+ ActionSource["COMPANY"] = "COMPANY";
74
+ ActionSource["TWITTER"] = "TWITTER";
75
+ ActionSource["DISCORD"] = "DISCORD";
76
+ ActionSource["TELEGRAM"] = "TELEGRAM";
77
+ })(ActionSource || (exports.ActionSource = ActionSource = {}));
78
+ var ActionEnum;
79
+ (function (ActionEnum) {
80
+ ActionEnum[ActionEnum["TWITTER_FOLLOW"] = 1] = "TWITTER_FOLLOW";
81
+ ActionEnum[ActionEnum["TWITTER_REPLY"] = 2] = "TWITTER_REPLY";
82
+ ActionEnum[ActionEnum["TWITTER_RETWEET"] = 3] = "TWITTER_RETWEET";
83
+ ActionEnum[ActionEnum["TWITTER_LIKE"] = 4] = "TWITTER_LIKE";
84
+ ActionEnum[ActionEnum["COMPANY_FIRST_LOGIN"] = 5] = "COMPANY_FIRST_LOGIN";
85
+ ActionEnum[ActionEnum["COMPANY_CONFIRM_EMAIL"] = 6] = "COMPANY_CONFIRM_EMAIL";
86
+ ActionEnum[ActionEnum["COMPANY_DEPOSIT"] = 7] = "COMPANY_DEPOSIT";
87
+ ActionEnum[ActionEnum["COMPANY_TRADE"] = 8] = "COMPANY_TRADE";
88
+ ActionEnum[ActionEnum["TELEGRAM_JOIN_GROUP"] = 9] = "TELEGRAM_JOIN_GROUP";
89
+ ActionEnum[ActionEnum["DISCORD_JOIN_SERVER"] = 10] = "DISCORD_JOIN_SERVER";
90
+ ActionEnum[ActionEnum["AFFILIATE_POINTS_REWARD"] = 11] = "AFFILIATE_POINTS_REWARD";
91
+ })(ActionEnum || (exports.ActionEnum = ActionEnum = {}));
92
+ exports.NON_REPEATABLE_ACTIONS = [
93
+ ActionEnum.TWITTER_FOLLOW,
94
+ ActionEnum.TELEGRAM_JOIN_GROUP,
95
+ ActionEnum.DISCORD_JOIN_SERVER,
96
+ ActionEnum.COMPANY_CONFIRM_EMAIL,
97
+ ActionEnum.COMPANY_FIRST_LOGIN,
98
+ ];
99
+
100
+
101
+ /***/ }),
102
+
103
+ /***/ 1048:
104
+ /***/ ((__unused_webpack_module, exports) => {
105
+
106
+
107
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
108
+ exports.WithdrawalWalletType = void 0;
109
+ var WithdrawalWalletType;
110
+ (function (WithdrawalWalletType) {
111
+ WithdrawalWalletType["SOLANA"] = "SOLANA";
112
+ WithdrawalWalletType["ALGORAND"] = "ALGORAND";
113
+ WithdrawalWalletType["EVM"] = "EVM";
114
+ })(WithdrawalWalletType || (exports.WithdrawalWalletType = WithdrawalWalletType = {}));
115
+
116
+
117
+ /***/ }),
118
+
119
+ /***/ 1134:
120
+ /***/ ((__unused_webpack_module, exports) => {
121
+
122
+
123
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
124
+ var OrderType;
125
+ (function (OrderType) {
126
+ OrderType[OrderType["Limit"] = 0] = "Limit";
127
+ OrderType[OrderType["IOC"] = 1] = "IOC";
128
+ OrderType[OrderType["POST"] = 2] = "POST";
129
+ OrderType[OrderType["Market"] = 3] = "Market";
130
+ })(OrderType || (OrderType = {}));
131
+ exports["default"] = OrderType;
132
+
133
+
134
+ /***/ }),
135
+
136
+ /***/ 1174:
137
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
138
+
139
+
140
+ var __importDefault = (this && this.__importDefault) || function (mod) {
141
+ return (mod && mod.__esModule) ? mod : { "default": mod };
142
+ };
143
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
144
+ exports.Operations = void 0;
145
+ exports.absolute = absolute;
146
+ exports.ceil = ceil;
147
+ exports.toFixed = toFixed;
148
+ exports.floor = floor;
149
+ exports.round = round;
150
+ exports.plus = plus;
151
+ exports.minus = minus;
152
+ exports.multiply = multiply;
153
+ exports.toUsd = toUsd;
154
+ exports.divide = divide;
155
+ exports.greaterThanOrEqual = greaterThanOrEqual;
156
+ exports.greaterThan = greaterThan;
157
+ exports.lessThanOrEqual = lessThanOrEqual;
158
+ exports.lessThan = lessThan;
159
+ exports.equal = equal;
160
+ exports.mod = mod;
161
+ exports.modZero = modZero;
162
+ exports.bn_operation = bn_operation;
163
+ exports.roundNumber = roundNumber;
164
+ exports.convertFromBaseUnits = convertFromBaseUnits;
165
+ exports.convertToBaseUnits = convertToBaseUnits;
166
+ const bignumber_js_1 = __importDefault(__webpack_require__(6168));
167
+ bignumber_js_1.default.config({ DECIMAL_PLACES: 40, EXPONENTIAL_AT: 45 });
168
+ var Operations;
169
+ (function (Operations) {
170
+ Operations["MINUS"] = "-";
171
+ Operations["PLUS"] = "+";
172
+ Operations["MULTIPLY"] = "*";
173
+ Operations["DIVIDE"] = "/";
174
+ Operations["GREATER_THAN_OR_EQUAL"] = ">=";
175
+ Operations["GREATER_THAN"] = ">";
176
+ Operations["LESS_THAN_OR_EQUAL"] = "<=";
177
+ Operations["LESS_THAN"] = "<";
178
+ Operations["EQUAL"] = "==";
179
+ Operations["MOD"] = "mod";
180
+ })(Operations || (exports.Operations = Operations = {}));
181
+ function absolute(value) {
182
+ let x = new bignumber_js_1.default(value);
183
+ const res = x.abs().toString();
184
+ // console.log('Absolute value', { value, res })
185
+ return res;
186
+ }
187
+ function ceil(value) {
188
+ let x = new bignumber_js_1.default(String(value));
189
+ const res = x.integerValue(bignumber_js_1.default.ROUND_CEIL).toString();
190
+ if (!equal(value, res)) {
191
+ console.log('Ceil value', { value, res });
192
+ }
193
+ return res;
194
+ }
195
+ function toFixed(value, decimalPlaces, roundUpToFirstSignificant = false) {
196
+ const x = new bignumber_js_1.default(String(value));
197
+ let res;
198
+ if (roundUpToFirstSignificant) {
199
+ const valueStr = x.toFixed();
200
+ const decimalIndex = valueStr.indexOf('.');
201
+ if (decimalIndex >= 0) {
202
+ const fractionalPart = valueStr.slice(decimalIndex + 1);
203
+ let leadingZeros = 0;
204
+ for (let char of fractionalPart) {
205
+ if (char === '0') {
206
+ leadingZeros++;
207
+ }
208
+ else {
209
+ break;
210
+ }
211
+ }
212
+ const totalDecimalPlaces = leadingZeros + 1;
213
+ res = x.toFixed(totalDecimalPlaces, bignumber_js_1.default.ROUND_UP);
214
+ }
215
+ else {
216
+ res = x.toFixed(0);
217
+ }
218
+ }
219
+ else {
220
+ res = x.toFixed(decimalPlaces);
221
+ }
222
+ console.log('Fixed value', { value, res });
223
+ return res;
224
+ }
225
+ function floor(value) {
226
+ let x = new bignumber_js_1.default(String(value));
227
+ const res = x.integerValue(bignumber_js_1.default.ROUND_FLOOR).toString();
228
+ console.log('Floor value', { value, res });
229
+ return res;
230
+ }
231
+ function round(value) {
232
+ let x = new bignumber_js_1.default(String(value));
233
+ const res = x.integerValue(bignumber_js_1.default.ROUND_HALF_UP).toString();
234
+ console.log('Round value', { value, res });
235
+ return res;
236
+ }
237
+ function plus(value1, value2) {
238
+ return bn_operation(value1, value2, Operations.PLUS);
239
+ }
240
+ function minus(value1, value2) {
241
+ return bn_operation(value1, value2, Operations.MINUS);
242
+ }
243
+ function multiply(value1, value2) {
244
+ return bn_operation(value1, value2, Operations.MULTIPLY);
245
+ }
246
+ function toUsd(amount, price) {
247
+ return multiply(amount, price || 0);
248
+ }
249
+ ;
250
+ function divide(value1, value2) {
251
+ return bn_operation(value1, value2, Operations.DIVIDE);
252
+ }
253
+ function greaterThanOrEqual(value1, value2) {
254
+ return Boolean(bn_operation(value1, value2, Operations.GREATER_THAN_OR_EQUAL));
255
+ }
256
+ function greaterThan(value1, value2) {
257
+ return Boolean(bn_operation(value1, value2, Operations.GREATER_THAN));
258
+ }
259
+ function lessThanOrEqual(value1, value2) {
260
+ return Boolean(bn_operation(value1, value2, Operations.LESS_THAN_OR_EQUAL));
261
+ }
262
+ function lessThan(value1, value2) {
263
+ return Boolean(bn_operation(value1, value2, Operations.LESS_THAN));
264
+ }
265
+ function equal(value1, value2) {
266
+ return Boolean(bn_operation(value1, value2, Operations.EQUAL));
267
+ }
268
+ function mod(value1, value2) {
269
+ return bn_operation(value1, value2, Operations.MOD);
270
+ }
271
+ function modZero(value1, value2) {
272
+ return equal(mod(value1, value2), 0);
273
+ }
274
+ function bn_operation(a, b, operation) {
275
+ a = new bignumber_js_1.default(String(a));
276
+ b = new bignumber_js_1.default(String(b));
277
+ switch (operation.toLowerCase()) {
278
+ case '-':
279
+ return a.minus(b).toString();
280
+ case '+':
281
+ return a.plus(b).toString();
282
+ case '*':
283
+ case 'x':
284
+ return a.multipliedBy(b).toString();
285
+ case '÷':
286
+ case '/':
287
+ return a.dividedBy(b).toString();
288
+ case '>=':
289
+ return a.isGreaterThanOrEqualTo(b);
290
+ case '>':
291
+ return a.isGreaterThan(b);
292
+ case '<=':
293
+ return a.isLessThanOrEqualTo(b);
294
+ case '<':
295
+ return a.isLessThan(b);
296
+ case '==':
297
+ return a.isEqualTo(b);
298
+ case 'mod':
299
+ return a.modulo(b);
300
+ default:
301
+ break;
302
+ }
303
+ }
304
+ function getExponentialNumberComponents(x) {
305
+ if (x.toString().includes('e')) {
306
+ const parts = x.toString().split('e');
307
+ return [parseFloat(parts[0]), parseFloat(parts[1])];
308
+ }
309
+ return [x, 0];
310
+ }
311
+ function generateExponentialNumberFromComponents(decimalPart, exponent) {
312
+ return decimalPart + (exponent < 0 ? `e${exponent}` : `e+${exponent}`);
313
+ }
314
+ function roundNumber({ decimalPlaces = 0 }, x) {
315
+ if (decimalPlaces > 0) {
316
+ const [decimal, decimalExponentialPart] = getExponentialNumberComponents(x);
317
+ const [rounded, roundedExponentialPart] = getExponentialNumberComponents(Math.round(Number(generateExponentialNumberFromComponents(decimal, decimalExponentialPart + decimalPlaces))));
318
+ return Number(generateExponentialNumberFromComponents(rounded, roundedExponentialPart - decimalPlaces));
319
+ }
320
+ return Math.round(x);
321
+ }
322
+ function convertFromBaseUnits(assetDecimals, quantity) {
323
+ const decimals = Number(assetDecimals);
324
+ return roundNumber({ decimalPlaces: decimals },
325
+ // eslint-disable-next-line no-magic-numbers
326
+ Math.pow(10, -decimals) * Number(quantity));
327
+ }
328
+ /**
329
+ * Computs quantity * 10^(assetDecimals) and rounds the result
330
+ */
331
+ function convertToBaseUnits(assetDecimals, quantity) {
332
+ // eslint-disable-next-line no-magic-numbers
333
+ const baseAmount = Math.pow(10, Number(assetDecimals)) * Number(quantity);
334
+ // 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
335
+ return roundNumber({ decimalPlaces: 0 }, baseAmount);
336
+ }
337
+
338
+
339
+ /***/ }),
340
+
341
+ /***/ 1283:
342
+ /***/ ((__unused_webpack_module, exports) => {
343
+
344
+
345
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
346
+ exports.StateType = void 0;
347
+ var StateType;
348
+ (function (StateType) {
349
+ StateType["VERSION"] = "version";
350
+ StateType["LAST_ALGO_BLOCK"] = "last_algo_block";
351
+ StateType["PRICES_PROVIDER_API_KEY"] = "prices_provider_api_key";
352
+ StateType["DEFAULT_API_DOMAIN"] = "default_api_domain";
353
+ StateType["NONCE_ACCOUNTS_SOLANA"] = "nonce_accounts_solana";
354
+ StateType["ARCHIVE_DATA_BATCH_SIZE"] = "archive_data_batch_size";
355
+ StateType["ARCHIVE_TASK_LOCK"] = "archive_task_lock";
356
+ })(StateType || (exports.StateType = StateType = {}));
357
+
358
+
359
+ /***/ }),
360
+
361
+ /***/ 1492:
362
+ /***/ ((__unused_webpack_module, exports) => {
363
+
364
+
365
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
366
+ var OrderStatus;
367
+ (function (OrderStatus) {
368
+ OrderStatus[OrderStatus["Open"] = 1] = "Open";
369
+ OrderStatus[OrderStatus["Canceled"] = 2] = "Canceled";
370
+ OrderStatus[OrderStatus["Matched"] = 3] = "Matched";
371
+ OrderStatus[OrderStatus["SelfMatched"] = 4] = "SelfMatched";
372
+ OrderStatus[OrderStatus["Expired"] = 5] = "Expired";
373
+ })(OrderStatus || (OrderStatus = {}));
374
+ exports["default"] = OrderStatus;
375
+
376
+
377
+ /***/ }),
378
+
379
+ /***/ 1682:
380
+ /***/ ((__unused_webpack_module, exports) => {
381
+
382
+
383
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
384
+ exports.SettingTypeColumn = void 0;
385
+ var SettingTypeColumn;
386
+ (function (SettingTypeColumn) {
387
+ SettingTypeColumn["STRING"] = "string";
388
+ SettingTypeColumn["BOOLEAN"] = "boolean";
389
+ SettingTypeColumn["INT"] = "int";
390
+ SettingTypeColumn["FLOAT"] = "float";
391
+ SettingTypeColumn["SINGLE_CHOICE"] = "single-choice";
392
+ SettingTypeColumn["MULTI_CHOICE"] = "multi-choice";
393
+ })(SettingTypeColumn || (exports.SettingTypeColumn = SettingTypeColumn = {}));
394
+
395
+
396
+ /***/ }),
397
+
398
+ /***/ 2224:
399
+ /***/ ((__unused_webpack_module, exports) => {
400
+
401
+
402
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
403
+ exports.AffiliateSortByEnum = void 0;
404
+ var AffiliateSortByEnum;
405
+ (function (AffiliateSortByEnum) {
406
+ AffiliateSortByEnum["INVITED_ACCOUNTS_COUNT"] = "invitedAccountsCount";
407
+ AffiliateSortByEnum["CREATED_AT"] = "createdAt";
408
+ AffiliateSortByEnum["FEE_SHARE"] = "feeShare";
409
+ AffiliateSortByEnum["ADDRESS"] = "address";
410
+ AffiliateSortByEnum["REFERRAL_TRADING_VOLUME"] = "referralTradingVolume";
411
+ })(AffiliateSortByEnum || (exports.AffiliateSortByEnum = AffiliateSortByEnum = {}));
412
+
413
+
414
+ /***/ }),
415
+
416
+ /***/ 2228:
417
+ /***/ ((__unused_webpack_module, exports) => {
418
+
419
+
420
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
421
+ exports.HTTPSRPC_MAINNET = exports.HTTPSRPC_TESTNET = exports.ChainNames = exports.Chains = void 0;
422
+ var Chains;
423
+ (function (Chains) {
424
+ Chains[Chains["Solana"] = 1] = "Solana";
425
+ Chains[Chains["Algorand"] = 8] = "Algorand";
426
+ Chains[Chains["Polygon"] = 5] = "Polygon";
427
+ Chains[Chains["Bsc"] = 4] = "Bsc";
428
+ Chains[Chains["Avalanche"] = 6] = "Avalanche";
429
+ Chains[Chains["Arbitrum"] = 23] = "Arbitrum";
430
+ Chains[Chains["Optimism"] = 24] = "Optimism";
431
+ Chains[Chains["Base"] = 30] = "Base";
432
+ Chains[Chains["Ethereum"] = 2] = "Ethereum";
433
+ Chains[Chains["Sepolia"] = 10002] = "Sepolia";
434
+ Chains[Chains["ArbitrumSepolia"] = 10003] = "ArbitrumSepolia";
435
+ Chains[Chains["BaseSepolia"] = 10004] = "BaseSepolia";
436
+ Chains[Chains["OptimismSepolia"] = 10005] = "OptimismSepolia";
437
+ Chains[Chains["PolygonAmoy"] = 10007] = "PolygonAmoy";
438
+ })(Chains || (exports.Chains = Chains = {}));
439
+ exports.ChainNames = {
440
+ [Chains.Solana]: "Solana",
441
+ [Chains.Ethereum]: "Ethereum",
442
+ [Chains.Polygon]: "Polygon",
443
+ [Chains.Bsc]: "BNB Chain",
444
+ [Chains.Avalanche]: "Avalanche",
445
+ [Chains.Algorand]: "Algorand",
446
+ [Chains.Arbitrum]: "Arbitrum",
447
+ [Chains.Optimism]: "Optimism",
448
+ [Chains.Base]: "Base",
449
+ [Chains.Sepolia]: "Ethereum Sepolia",
450
+ [Chains.ArbitrumSepolia]: "Arbitrum Sepolia",
451
+ [Chains.BaseSepolia]: "Base Sepolia",
452
+ [Chains.OptimismSepolia]: "Optimism Sepolia",
453
+ [Chains.PolygonAmoy]: "Polygon Amoy",
454
+ };
455
+ exports.HTTPSRPC_TESTNET = {
456
+ [Chains.Bsc]: [
457
+ '',
458
+ 'https://bsc-testnet.public.blastapi.io',
459
+ 'https://bsc-testnet.blockpi.network/v1/rpc/private',
460
+ 'https://bsc-testnet-rpc.publicnode.com',
461
+ 'https://api.zan.top/bsc-testnet',
462
+ 'https://data-seed-prebsc-2-s1.bnbchain.org:8545',
463
+ 'https://data-seed-prebsc-2-s2.bnbchain.org:8545',
464
+ 'https://data-seed-prebsc-2-s3.bnbchain.org:8545',
465
+ 'https://data-seed-prebsc-1-s1.bnbchain.org:8545',
466
+ 'https://data-seed-prebsc-1-s2.bnbchain.org:8545',
467
+ 'https://data-seed-prebsc-1-s3.bnbchain.org:8545',
468
+ 'https://endpoints.omniatech.io/v1/bsc/testnet/public',
469
+ ],
470
+ [Chains.Avalanche]: [
471
+ '',
472
+ 'https://rpc.ankr.com/avalanche_fuji',
473
+ 'https://rpc.ankr.com/avalanche_fuji-c',
474
+ 'https://api.avax-test.network/ext/bc/C/rpc',
475
+ 'https://ava-testnet.public.blastapi.io/ext/bc/C/rpc',
476
+ 'https://endpoints.omniatech.io/v1/avax/fuji/public',
477
+ 'https://avalanche-fuji.blockpi.network/v1/rpc/private',
478
+ 'https://avalanche-fuji-c-chain-rpc.publicnode.com',
479
+ 'https://avalanche-fuji.blockpi.network/v1/rpc/private',
480
+ ],
481
+ [Chains.Sepolia]: [
482
+ 'https://ethereum-sepolia-rpc.publicnode.com',
483
+ 'https://sepolia.gateway.tenderly.co',
484
+ 'https://eth-sepolia.public.blastapi.io',
485
+ 'https://ethereum-sepolia.blockpi.network/v1/rpc/private',
486
+ 'https://sepolia.drpc.org',
487
+ 'https://endpoints.omniatech.io/v1/eth/sepolia/public',
488
+ 'https://1rpc.io/sepolia',
489
+ 'https://gateway.tenderly.co/public/sepolia',
490
+ 'https://sepolia.gateway.tenderly.co',
491
+ 'https://api.zan.top/eth-sepolia',
492
+ 'https://ethereum-sepolia.rpc.subquery.network/public',
493
+ ],
494
+ [Chains.ArbitrumSepolia]: [
495
+ '',
496
+ 'https://arbitrum-sepolia.blockpi.network/v1/rpc/private ',
497
+ 'https://arbitrum-sepolia.gateway.tenderly.co',
498
+ 'https://endpoints.omniatech.io/v1/arbitrum/sepolia/public',
499
+ 'https://api.zan.top/arb-sepolia',
500
+ 'https://sepolia-rollup.arbitrum.io/rpc',
501
+ ],
502
+ [Chains.BaseSepolia]: [
503
+ '',
504
+ 'https://sepolia.base.org',
505
+ 'https://base-sepolia-rpc.publicnode.com',
506
+ 'https://base-sepolia.gateway.tenderly.co',
507
+ 'https://base-sepolia.blockpi.network/v1/rpc/private',
508
+ 'https://node.histori.xyz/base-sepolia/8ry9f6t9dct1se2hlagxnd9n2a',
509
+ ],
510
+ [Chains.OptimismSepolia]: [
511
+ '',
512
+ 'https://optimism-sepolia.blockpi.network/v1/rpc/private',
513
+ 'https://sepolia.optimism.io',
514
+ 'https://api.zan.top/opt-sepolia',
515
+ 'https://optimism-sepolia.gateway.tenderly.co',
516
+ 'https://optimism-sepolia.drpc.org',
517
+ 'https://endpoints.omniatech.io/v1/op/sepolia/public',
518
+ ],
519
+ [Chains.PolygonAmoy]: [
520
+ 'https://rpc-amoy.polygon.technology',
521
+ 'https://polygon-amoy-bor-rpc.publicnode.com',
522
+ 'https://rpc.ankr.com/polygon_amoy',
523
+ 'https://polygon-amoy.drpc.org',
524
+ 'https://api.zan.top/polygon-amoy',
525
+ 'https://polygon-amoy.gateway.tenderly.co',
526
+ ],
527
+ };
528
+ exports.HTTPSRPC_MAINNET = {
529
+ [Chains.Ethereum]: [
530
+ '',
531
+ 'https://eth.llamarpc.com',
532
+ 'https://ethereum.blockpi.network/v1/rpc/public',
533
+ 'https://eth-mainnet.nodereal.io/v1/1659dfb40aa24bbb8153a677b98064d7',
534
+ 'https://uk.rpc.blxrbdn.com',
535
+ 'https://singapore.rpc.blxrbdn.com',
536
+ 'https://virginia.rpc.blxrbdn.com',
537
+ 'https://eth-mainnet.public.blastapi.io',
538
+ 'https://api.securerpc.com/v1',
539
+ 'https://mainnet.gateway.tenderly.co',
540
+ 'https://eth-pokt.nodies.app',
541
+ 'https://eth.blockrazor.xyz',
542
+ 'https://eth.merkle.io',
543
+ 'https://gateway.tenderly.co/public/mainnet',
544
+ 'https://eth.rpc.blxrbdn.com',
545
+ ],
546
+ [Chains.Bsc]: [
547
+ '',
548
+ 'https://bsc.blockrazor.xyz',
549
+ 'https://bscrpc.com',
550
+ 'https://bsc-mainnet.public.blastapi.io',
551
+ 'https://binance.llamarpc.com',
552
+ 'https://go.getblock.io/cc778cdbdf5c4b028ec9456e0e6c0cf3',
553
+ 'https://bsc-pokt.nodies.app',
554
+ 'https://56.rpc.thirdweb.com',
555
+ 'https://bsc.blockpi.network/v1/rpc/private',
556
+ 'https://bsc.rpc.blxrbdn.com',
557
+ 'https://bsc-dataseed.bnbchain.org',
558
+ 'https://endpoints.omniatech.io/v1/bsc/mainnet/public',
559
+ 'https://bsc-dataseed1.ninicoin.io',
560
+ 'https://bsc-dataseed2.defibit.io',
561
+ 'https://bsc-dataseed2.ninicoin.io',
562
+ 'https://0.48.club',
563
+ 'https://bsc-dataseed3.defibit.io',
564
+ ],
565
+ [Chains.Polygon]: [
566
+ '',
567
+ 'https://polygon.llamarpc.com',
568
+ 'https://polygon-rpc.com',
569
+ 'https://rpc-mainnet.matic.quiknode.pro',
570
+ 'https://endpoints.omniatech.io/v1/matic/mainnet/public',
571
+ 'https://polygon-pokt.nodies.app',
572
+ 'https://polygon-bor-rpc.publicnode.com',
573
+ 'https://polygon.rpc.subquery.network/public',
574
+ 'https://polygon-bor-rpc.publicnode.com',
575
+ 'https://polygon.blockpi.network/v1/rpc/private',
576
+ 'https://polygon.api.onfinality.io/public',
577
+ 'https://polygon.lava.build',
578
+ 'https://api.zan.top/polygon-mainnet',
579
+ 'https://polygon.meowrpc.com',
580
+ ],
581
+ [Chains.Avalanche]: [
582
+ '',
583
+ 'https://avalanche-c-chain-rpc.publicnode.com',
584
+ 'https://ava-mainnet.public.blastapi.io/ext/bc/C/rpc',
585
+ 'https://endpoints.omniatech.io/v1/avax/mainnet/public',
586
+ 'https://avalanche-c-chain-rpc.publicnode.com',
587
+ 'https://avalanche.blockpi.network/v1/rpc/private',
588
+ 'https://avalanche.public-rpc.com',
589
+ 'https://avalanche.drpc.org',
590
+ 'https://avax.meowrpc.com',
591
+ 'https://endpoints.omniatech.io/v1/avax/mainnet/public',
592
+ 'https://api.avax.network/ext/bc/C/rpc',
593
+ 'https://1rpc.io/avax/c',
594
+ 'https://avax-pokt.nodies.app/ext/bc/C/rpc',
595
+ 'https://endpoints.omniatech.io/v1/avax/mainnet/public',
596
+ 'https://api.zan.top/avax-mainnet/ext/bc/C/rpc',
597
+ ],
598
+ [Chains.Arbitrum]: [
599
+ '',
600
+ 'https://arbitrum.llamarpc.com',
601
+ 'https://arbitrum.rpc.subquery.network/public',
602
+ 'https://endpoints.omniatech.io/v1/arbitrum/one/public',
603
+ 'https://arbitrum.meowrpc.com',
604
+ 'https://arbitrum.gateway.tenderly.co',
605
+ 'https://arbitrum-one.public.blastapi.io',
606
+ 'https://arb1.lava.build',
607
+ 'https://arbitrum-one.publicnode.com',
608
+ 'https://arbitrum.blockpi.network/v1/rpc/public',
609
+ 'https://arb-pokt.nodies.app',
610
+ 'https://api.zan.top/arb-one',
611
+ 'https://arb1.arbitrum.io/rpc',
612
+ 'https://arbitrum.drpc.org',
613
+ 'https://1rpc.io/arb',
614
+ ],
615
+ [Chains.Optimism]: [
616
+ '',
617
+ 'https://optimism.llamarpc.com',
618
+ 'https://op-pokt.nodies.app',
619
+ 'https://optimism-mainnet.public.blastapi.io',
620
+ 'https://optimism.blockpi.network/v1/rpc/public',
621
+ 'https://endpoints.omniatech.io/v1/op/mainnet/public',
622
+ 'https://optimism-rpc.publicnode.com',
623
+ 'https://optimism.drpc.org',
624
+ 'https://1rpc.io/op',
625
+ 'https://optimism.gateway.tenderly.co',
626
+ 'https://optimism.lava.build',
627
+ 'https://optimism.rpc.subquery.network/public',
628
+ 'https://mainnet.optimism.io',
629
+ 'https://optimism-rpc.publicnode.com',
630
+ 'https://gateway.tenderly.co/public/optimism',
631
+ ],
632
+ [Chains.Base]: [
633
+ '',
634
+ 'https://base.llamarpc.com',
635
+ 'https://base-mainnet.public.blastapi.io',
636
+ 'https://base-rpc.publicnode.com',
637
+ 'https://base.blockpi.network/v1/rpc/public',
638
+ 'https://base.drpc.org',
639
+ 'https://mainnet.base.org',
640
+ 'https://base.api.onfinality.io/public',
641
+ 'https://base-pokt.nodies.app',
642
+ 'https://1rpc.io/base',
643
+ 'https://developer-access-mainnet.base.org',
644
+ 'https://endpoints.omniatech.io/v1/base/mainnet/public',
645
+ 'https://base.rpc.subquery.network/public',
646
+ 'https://base.api.onfinality.io/public',
647
+ 'https://base.meowrpc.com',
648
+ 'https://base.gateway.tenderly.co',
649
+ ],
650
+ };
651
+
652
+
653
+ /***/ }),
654
+
655
+ /***/ 2623:
656
+ /***/ ((__unused_webpack_module, exports) => {
657
+
658
+
659
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
660
+ exports.TransactionType = exports.CCTPStatus = exports.ActionTypeEnum = exports.OperationStatusEnum = void 0;
661
+ var OperationStatusEnum;
662
+ (function (OperationStatusEnum) {
663
+ OperationStatusEnum["Pending"] = "pending";
664
+ OperationStatusEnum["Completed"] = "completed";
665
+ OperationStatusEnum["Failed"] = "failed";
666
+ OperationStatusEnum["Received"] = "received";
667
+ })(OperationStatusEnum || (exports.OperationStatusEnum = OperationStatusEnum = {}));
668
+ var ActionTypeEnum;
669
+ (function (ActionTypeEnum) {
670
+ ActionTypeEnum["Deposit"] = "deposit";
671
+ ActionTypeEnum["Withdraw"] = "withdraw";
672
+ ActionTypeEnum["Rebalance"] = "rebalance";
673
+ })(ActionTypeEnum || (exports.ActionTypeEnum = ActionTypeEnum = {}));
674
+ var CCTPStatus;
675
+ (function (CCTPStatus) {
676
+ CCTPStatus["PENDING"] = "pending";
677
+ CCTPStatus["COMPLETED"] = "completed";
678
+ CCTPStatus["FAILED"] = "failed";
679
+ })(CCTPStatus || (exports.CCTPStatus = CCTPStatus = {}));
680
+ var TransactionType;
681
+ (function (TransactionType) {
682
+ TransactionType["USER_TO_TMC"] = "user_to_tmc";
683
+ TransactionType["TMC_TO_USER"] = "tmc_to_user";
684
+ TransactionType["RELAYER_TO_TMC"] = "relayer_to_tmc";
685
+ TransactionType["RELAYER_TO_CODEX"] = "relayer_to_codex";
686
+ TransactionType["RELAYER_TO_CIRCLE"] = "relayer_to_circle";
687
+ })(TransactionType || (exports.TransactionType = TransactionType = {}));
688
+
689
+
690
+ /***/ }),
691
+
692
+ /***/ 2739:
693
+ /***/ ((__unused_webpack_module, exports) => {
694
+
695
+
696
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
697
+ exports.Notification = void 0;
698
+ var Notification;
699
+ (function (Notification) {
700
+ Notification[Notification["SELF_TRADE"] = 1] = "SELF_TRADE";
701
+ Notification[Notification["FULL_FILLED"] = 2] = "FULL_FILLED";
702
+ Notification[Notification["FULL_CANCELLED"] = 3] = "FULL_CANCELLED";
703
+ Notification[Notification["PARTIALLY_CANCELLED"] = 4] = "PARTIALLY_CANCELLED";
704
+ Notification[Notification["CREATED"] = 5] = "CREATED";
705
+ })(Notification || (exports.Notification = Notification = {}));
706
+
707
+
708
+ /***/ }),
709
+
710
+ /***/ 2797:
711
+ /***/ ((__unused_webpack_module, exports) => {
712
+
713
+
714
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
715
+ var AvailablePairSettings;
716
+ (function (AvailablePairSettings) {
717
+ AvailablePairSettings["MFT_AUDIO_LINK"] = "mft.audioLink";
718
+ AvailablePairSettings["MFT_TITLE"] = "mft.title";
719
+ AvailablePairSettings["MODE_PRE_SALE"] = "mode.preSale";
720
+ AvailablePairSettings["MAKER_FEE"] = "makerFee";
721
+ AvailablePairSettings["TAKER_FEE"] = "takerFee";
722
+ AvailablePairSettings["VIEW_BASE_COIN_ICON_LINK"] = "view.baseCoinIconLink";
723
+ AvailablePairSettings["VIEW_BASE_COIN_MARKET_LINK"] = "view.baseCoinMarketLink";
724
+ AvailablePairSettings["VIEW_PRICE_COIN_ICON_LINK"] = "view.priceCoinIconLink";
725
+ AvailablePairSettings["VIEW_PRICE_COIN_MARKET_LINK"] = "view.priceCoinMarketLink";
726
+ })(AvailablePairSettings || (AvailablePairSettings = {}));
727
+ exports["default"] = AvailablePairSettings;
728
+
729
+
730
+ /***/ }),
731
+
732
+ /***/ 3004:
733
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
734
+
735
+
736
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
737
+ if (k2 === undefined) k2 = k;
738
+ var desc = Object.getOwnPropertyDescriptor(m, k);
739
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
740
+ desc = { enumerable: true, get: function() { return m[k]; } };
741
+ }
742
+ Object.defineProperty(o, k2, desc);
743
+ }) : (function(o, m, k, k2) {
744
+ if (k2 === undefined) k2 = k;
745
+ o[k2] = m[k];
746
+ }));
747
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
748
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
749
+ };
750
+ var __importDefault = (this && this.__importDefault) || function (mod) {
751
+ return (mod && mod.__esModule) ? mod : { "default": mod };
752
+ };
753
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
754
+ exports.TradingKeyType = exports.OrderType = exports.OrderStatus = exports.OrderSide = exports.AvailablePairSettings = void 0;
755
+ const available_pair_settings_enum_1 = __importDefault(__webpack_require__(2797));
756
+ exports.AvailablePairSettings = available_pair_settings_enum_1.default;
757
+ const order_side_enum_1 = __importDefault(__webpack_require__(835));
758
+ exports.OrderSide = order_side_enum_1.default;
759
+ const order_status_enum_1 = __importDefault(__webpack_require__(1492));
760
+ exports.OrderStatus = order_status_enum_1.default;
761
+ const order_type_enum_1 = __importDefault(__webpack_require__(1134));
762
+ exports.OrderType = order_type_enum_1.default;
763
+ const tradingKeyType_enum_1 = __webpack_require__(3487);
764
+ Object.defineProperty(exports, "TradingKeyType", ({ enumerable: true, get: function () { return tradingKeyType_enum_1.TradingKeyType; } }));
765
+ __exportStar(__webpack_require__(893), exports);
766
+ __exportStar(__webpack_require__(3338), exports);
767
+ __exportStar(__webpack_require__(3245), exports);
768
+ __exportStar(__webpack_require__(6828), exports);
769
+ __exportStar(__webpack_require__(2224), exports);
770
+ __exportStar(__webpack_require__(892), exports);
771
+ __exportStar(__webpack_require__(2623), exports);
772
+ __exportStar(__webpack_require__(3854), exports);
773
+ __exportStar(__webpack_require__(4132), exports);
774
+ __exportStar(__webpack_require__(3516), exports);
775
+ __exportStar(__webpack_require__(4199), exports);
776
+ __exportStar(__webpack_require__(1682), exports);
777
+ __exportStar(__webpack_require__(1283), exports);
778
+ __exportStar(__webpack_require__(5237), exports);
779
+ __exportStar(__webpack_require__(1048), exports);
780
+
781
+
782
+ /***/ }),
783
+
784
+ /***/ 3245:
785
+ /***/ ((__unused_webpack_module, exports) => {
786
+
787
+
788
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
789
+ exports.PromptTypeEnum = void 0;
790
+ var PromptTypeEnum;
791
+ (function (PromptTypeEnum) {
792
+ PromptTypeEnum["INSTRUCTIONS"] = "INSTRUCTIONS";
793
+ PromptTypeEnum["TEXT_STYLE"] = "TEXT_STYLE";
794
+ PromptTypeEnum["TEXT_TONE"] = "TEXT_TONE";
795
+ PromptTypeEnum["REACTION_TYPE"] = "REACTION_TYPE";
796
+ PromptTypeEnum["COMMENT_LENGTH"] = "COMMENT_LENGTH";
797
+ PromptTypeEnum["CONTEXT"] = "CONTEXT";
798
+ })(PromptTypeEnum || (exports.PromptTypeEnum = PromptTypeEnum = {}));
799
+
800
+
801
+ /***/ }),
802
+
803
+ /***/ 3338:
804
+ /***/ ((__unused_webpack_module, exports) => {
805
+
806
+
807
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
808
+ exports.TweetType = exports.SeasonStatusEnum = void 0;
809
+ var SeasonStatusEnum;
810
+ (function (SeasonStatusEnum) {
811
+ SeasonStatusEnum["CREATED"] = "created";
812
+ SeasonStatusEnum["STARTED"] = "started";
813
+ SeasonStatusEnum["PAUSED"] = "paused";
814
+ SeasonStatusEnum["CLOSED"] = "closed";
815
+ })(SeasonStatusEnum || (exports.SeasonStatusEnum = SeasonStatusEnum = {}));
816
+ var TweetType;
817
+ (function (TweetType) {
818
+ TweetType["Post"] = "POST";
819
+ TweetType["Comment"] = "COMMENT";
820
+ })(TweetType || (exports.TweetType = TweetType = {}));
821
+
822
+
823
+ /***/ }),
824
+
825
+ /***/ 3487:
826
+ /***/ ((__unused_webpack_module, exports) => {
827
+
828
+
829
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
830
+ exports.TradingKeyType = void 0;
831
+ var TradingKeyType;
832
+ (function (TradingKeyType) {
833
+ TradingKeyType["User"] = "User";
834
+ TradingKeyType["Api"] = "API";
835
+ })(TradingKeyType || (exports.TradingKeyType = TradingKeyType = {}));
836
+
837
+
838
+ /***/ }),
839
+
840
+ /***/ 3516:
841
+ /***/ ((__unused_webpack_module, exports) => {
842
+
843
+
844
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
845
+ exports.SortDirectionEnum = void 0;
846
+ var SortDirectionEnum;
847
+ (function (SortDirectionEnum) {
848
+ SortDirectionEnum["ASCENDING"] = "ASC";
849
+ SortDirectionEnum["DESCENDING"] = "DESC";
850
+ })(SortDirectionEnum || (exports.SortDirectionEnum = SortDirectionEnum = {}));
851
+
852
+
853
+ /***/ }),
854
+
855
+ /***/ 3854:
856
+ /***/ ((__unused_webpack_module, exports) => {
857
+
858
+
859
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
860
+ exports.TradeSubStatus = exports.TradeStatus = void 0;
861
+ var TradeStatus;
862
+ (function (TradeStatus) {
863
+ TradeStatus["Unconfirmed"] = "UNCONFIRMED";
864
+ TradeStatus["Confirmed"] = "CONFIRMED";
865
+ TradeStatus["Rejected"] = "REJECTED";
866
+ })(TradeStatus || (exports.TradeStatus = TradeStatus = {}));
867
+ var TradeSubStatus;
868
+ (function (TradeSubStatus) {
869
+ TradeSubStatus["RESUBMITTED"] = "RESUBMITTED";
870
+ TradeSubStatus["PROCESSED"] = "PROCESSED";
871
+ TradeSubStatus["REMATCHED"] = "REMATCHED";
872
+ })(TradeSubStatus || (exports.TradeSubStatus = TradeSubStatus = {}));
873
+
874
+
875
+ /***/ }),
876
+
877
+ /***/ 4132:
878
+ /***/ ((__unused_webpack_module, exports) => {
879
+
880
+
881
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
882
+ exports.MarketMakerSortByEnum = exports.MarketMakerRebateTier = void 0;
883
+ var MarketMakerRebateTier;
884
+ (function (MarketMakerRebateTier) {
885
+ MarketMakerRebateTier[MarketMakerRebateTier["FIRST"] = 1] = "FIRST";
886
+ MarketMakerRebateTier[MarketMakerRebateTier["SECOND"] = 2] = "SECOND";
887
+ MarketMakerRebateTier[MarketMakerRebateTier["THIRD"] = 3] = "THIRD";
888
+ MarketMakerRebateTier[MarketMakerRebateTier["FOURTH"] = 4] = "FOURTH";
889
+ })(MarketMakerRebateTier || (exports.MarketMakerRebateTier = MarketMakerRebateTier = {}));
890
+ var MarketMakerSortByEnum;
891
+ (function (MarketMakerSortByEnum) {
892
+ MarketMakerSortByEnum["REBATE_TIER"] = "rebateTier";
893
+ MarketMakerSortByEnum["CREATED_AT"] = "createdAt";
894
+ MarketMakerSortByEnum["NAME"] = "name";
895
+ MarketMakerSortByEnum["TAKER_FEE"] = "takerFee";
896
+ MarketMakerSortByEnum["ENABLED"] = "enabled";
897
+ MarketMakerSortByEnum["ADDRESS"] = "address";
898
+ MarketMakerSortByEnum["CHAIN"] = "chainId";
899
+ })(MarketMakerSortByEnum || (exports.MarketMakerSortByEnum = MarketMakerSortByEnum = {}));
900
+
901
+
902
+ /***/ }),
903
+
904
+ /***/ 4199:
905
+ /***/ ((__unused_webpack_module, exports) => {
906
+
907
+
908
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
909
+ exports.ScheduledNotificationStatusEnum = exports.NotificationStatusEnum = exports.NotificationPriorityEnum = exports.CombinedNotificationEnum = exports.AccountNotificationEnum = exports.GlobalNotificationEnum = void 0;
910
+ var GlobalNotificationEnum;
911
+ (function (GlobalNotificationEnum) {
912
+ GlobalNotificationEnum["GLOBAL_PAIR_DELISTING"] = "GLOBAL_PAIR_DELISTING";
913
+ GlobalNotificationEnum["GLOBAL_NEW_PAIR_LISTING"] = "GLOBAL_NEW_PAIR_LISTING";
914
+ GlobalNotificationEnum["GLOBAL_SYSTEM_MAINTENANCE"] = "GLOBAL_SYSTEM_MAINTENANCE";
915
+ GlobalNotificationEnum["GLOBAL_SMART_CONTRACT_UPDATE"] = "GLOBAL_SMART_CONTRACT_UPDATE";
916
+ })(GlobalNotificationEnum || (exports.GlobalNotificationEnum = GlobalNotificationEnum = {}));
917
+ var AccountNotificationEnum;
918
+ (function (AccountNotificationEnum) {
919
+ AccountNotificationEnum["ACCOUNT_POINTS_UNLOCK_ACHIEVEMENT"] = "ACCOUNT_POINTS_UNLOCK_ACHIEVEMENT";
920
+ AccountNotificationEnum["ACCOUNT_KYC_STATUS_CHANGED"] = "ACCOUNT_KYC_STATUS_CHANGED";
921
+ AccountNotificationEnum["ACCOUNT_AFFILIATE_DASHBOARD_UNLOCKED"] = "ACCOUNT_AFFILIATE_DASHBOARD_UNLOCKED";
922
+ })(AccountNotificationEnum || (exports.AccountNotificationEnum = AccountNotificationEnum = {}));
923
+ exports.CombinedNotificationEnum = {
924
+ ...GlobalNotificationEnum,
925
+ ...AccountNotificationEnum,
926
+ };
927
+ var NotificationPriorityEnum;
928
+ (function (NotificationPriorityEnum) {
929
+ NotificationPriorityEnum["CRITICAL"] = "CRITICAL";
930
+ NotificationPriorityEnum["IMPORTANT"] = "IMPORTANT";
931
+ NotificationPriorityEnum["INFO"] = "INFO";
932
+ })(NotificationPriorityEnum || (exports.NotificationPriorityEnum = NotificationPriorityEnum = {}));
933
+ var NotificationStatusEnum;
934
+ (function (NotificationStatusEnum) {
935
+ NotificationStatusEnum["UNREAD"] = "UNREAD";
936
+ NotificationStatusEnum["READ"] = "READ";
937
+ })(NotificationStatusEnum || (exports.NotificationStatusEnum = NotificationStatusEnum = {}));
938
+ var ScheduledNotificationStatusEnum;
939
+ (function (ScheduledNotificationStatusEnum) {
940
+ ScheduledNotificationStatusEnum["PENDING"] = "PENDING";
941
+ ScheduledNotificationStatusEnum["PROCESSED"] = "PROCESSED";
942
+ ScheduledNotificationStatusEnum["FAILED"] = "FAILED";
943
+ })(ScheduledNotificationStatusEnum || (exports.ScheduledNotificationStatusEnum = ScheduledNotificationStatusEnum = {}));
944
+
945
+
946
+ /***/ }),
947
+
948
+ /***/ 5237:
949
+ /***/ ((__unused_webpack_module, exports) => {
950
+
951
+
952
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
953
+ exports.UpgradeStatus = void 0;
954
+ var UpgradeStatus;
955
+ (function (UpgradeStatus) {
956
+ UpgradeStatus["SUCCESS"] = "success";
957
+ UpgradeStatus["FAILED"] = "failed";
958
+ UpgradeStatus["PENDING"] = "pending";
959
+ })(UpgradeStatus || (exports.UpgradeStatus = UpgradeStatus = {}));
960
+
961
+
962
+ /***/ }),
963
+
964
+ /***/ 6119:
965
+ /***/ ((__unused_webpack_module, exports) => {
966
+
967
+
968
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
969
+ exports.TwitterAccessScopeEnum = void 0;
970
+ var TwitterAccessScopeEnum;
971
+ (function (TwitterAccessScopeEnum) {
972
+ TwitterAccessScopeEnum["USERS_READ"] = "users.read";
973
+ TwitterAccessScopeEnum["FOLLOWS_READ"] = "follows.read";
974
+ TwitterAccessScopeEnum["FOLLOWS_WRITE"] = "follows.write";
975
+ TwitterAccessScopeEnum["TWEET_READ"] = "tweet.read";
976
+ TwitterAccessScopeEnum["TWEET_WRITE"] = "tweet.write";
977
+ TwitterAccessScopeEnum["OFFLINE_ACCESS"] = "offline.access";
978
+ TwitterAccessScopeEnum["LIKE_READ"] = "like.read";
979
+ TwitterAccessScopeEnum["LIKE_WRITE"] = "like.write";
980
+ })(TwitterAccessScopeEnum || (exports.TwitterAccessScopeEnum = TwitterAccessScopeEnum = {}));
981
+
982
+
983
+ /***/ }),
984
+
985
+ /***/ 6168:
986
+ /***/ ((module) => {
987
+
988
+ module.exports = __WEBPACK_EXTERNAL_MODULE__6168__;
989
+
990
+ /***/ }),
991
+
992
+ /***/ 6828:
993
+ /***/ ((__unused_webpack_module, exports) => {
994
+
995
+
996
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
997
+ exports.KYCAuthenticationStatus = exports.LastLookAction = exports.FeeTier = void 0;
998
+ var FeeTier;
999
+ (function (FeeTier) {
1000
+ FeeTier[FeeTier["FEE_TIER_1"] = 1] = "FEE_TIER_1";
1001
+ FeeTier[FeeTier["FEE_TIER_2"] = 2] = "FEE_TIER_2";
1002
+ FeeTier[FeeTier["FEE_TIER_3"] = 3] = "FEE_TIER_3";
1003
+ FeeTier[FeeTier["FEE_TIER_4"] = 4] = "FEE_TIER_4";
1004
+ FeeTier[FeeTier["FEE_TIER_5"] = 5] = "FEE_TIER_5";
1005
+ FeeTier[FeeTier["FEE_TIER_6"] = 6] = "FEE_TIER_6";
1006
+ })(FeeTier || (exports.FeeTier = FeeTier = {}));
1007
+ var LastLookAction;
1008
+ (function (LastLookAction) {
1009
+ LastLookAction[LastLookAction["Approve"] = 1] = "Approve";
1010
+ LastLookAction[LastLookAction["Reject"] = 0] = "Reject";
1011
+ })(LastLookAction || (exports.LastLookAction = LastLookAction = {}));
1012
+ var KYCAuthenticationStatus;
1013
+ (function (KYCAuthenticationStatus) {
1014
+ KYCAuthenticationStatus["INITIATED"] = "INITIATED";
1015
+ KYCAuthenticationStatus["CREATED"] = "CREATED";
1016
+ KYCAuthenticationStatus["PROCESSING"] = "PROCESSING";
1017
+ KYCAuthenticationStatus["APPROVED"] = "APPROVED";
1018
+ KYCAuthenticationStatus["REJECTED"] = "REJECTED";
1019
+ })(KYCAuthenticationStatus || (exports.KYCAuthenticationStatus = KYCAuthenticationStatus = {}));
1020
+
1021
+
1022
+ /***/ }),
1023
+
1024
+ /***/ 6978:
1025
+ /***/ ((__unused_webpack_module, exports) => {
1026
+
1027
+
1028
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1029
+ exports.MaintenanceMode = void 0;
1030
+ var MaintenanceMode;
1031
+ (function (MaintenanceMode) {
1032
+ MaintenanceMode[MaintenanceMode["Off"] = 0] = "Off";
1033
+ MaintenanceMode[MaintenanceMode["Full"] = 1] = "Full";
1034
+ MaintenanceMode[MaintenanceMode["Partial"] = 2] = "Partial";
1035
+ MaintenanceMode[MaintenanceMode["Scheduled"] = 3] = "Scheduled";
1036
+ })(MaintenanceMode || (exports.MaintenanceMode = MaintenanceMode = {}));
1037
+
1038
+
1039
+ /***/ }),
1040
+
1041
+ /***/ 7542:
1042
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1043
+
1044
+
1045
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1046
+ exports.mapOrderSideFromShort = mapOrderSideFromShort;
1047
+ exports.mapOrderSideToShort = mapOrderSideToShort;
1048
+ exports.mapOrderTypeShort = mapOrderTypeShort;
1049
+ exports.mapOrderSideFromShortToLong = mapOrderSideFromShortToLong;
1050
+ exports.mapOrderTypeShortToLong = mapOrderTypeShortToLong;
1051
+ const _enums_1 = __webpack_require__(9965);
1052
+ function mapOrderSideFromShort(value) {
1053
+ switch (value) {
1054
+ case "B": return _enums_1.OrderSide.Buy;
1055
+ case "S": return _enums_1.OrderSide.Sell;
1056
+ default:
1057
+ throw new Error("Unknown order side short type: " + value);
1058
+ }
1059
+ }
1060
+ function mapOrderSideToShort(value) {
1061
+ switch (value) {
1062
+ case _enums_1.OrderSide.Buy: return "B";
1063
+ case _enums_1.OrderSide.Sell: return "S";
1064
+ default:
1065
+ throw new Error("Unknown order side type: " + value);
1066
+ }
1067
+ }
1068
+ function mapOrderTypeShort(value) {
1069
+ switch (value) {
1070
+ case "I": return _enums_1.OrderType.IOC;
1071
+ case "P": return _enums_1.OrderType.POST;
1072
+ case "M": return _enums_1.OrderType.Market;
1073
+ case "L":
1074
+ default:
1075
+ return _enums_1.OrderType.Limit;
1076
+ }
1077
+ }
1078
+ function mapOrderSideFromShortToLong(value) {
1079
+ switch (value) {
1080
+ case "B": return "BUY";
1081
+ case "S": return "SELL";
1082
+ default:
1083
+ throw new Error("Unknown order side short type: " + value);
1084
+ }
1085
+ }
1086
+ function mapOrderTypeShortToLong(value) {
1087
+ switch (value) {
1088
+ case "I": return "IOC";
1089
+ case "P": return "POST";
1090
+ case "M": return "Market";
1091
+ case "L":
1092
+ default:
1093
+ return "Limit";
1094
+ }
1095
+ }
1096
+
1097
+
1098
+ /***/ }),
1099
+
1100
+ /***/ 8398:
1101
+ /***/ ((__unused_webpack_module, exports) => {
1102
+
1103
+
1104
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1105
+ exports.equalIgnoreCase = exports.listDateFormat = void 0;
1106
+ exports.getRandomInt = getRandomInt;
1107
+ exports.getDomains = getDomains;
1108
+ exports.cutEvent = cutEvent;
1109
+ exports.maskingString = maskingString;
1110
+ exports.removeField = removeField;
1111
+ const listDateFormat = (date) => {
1112
+ let newDAte = new Date(date);
1113
+ let parsedDate = newDAte.toLocaleDateString('default', {
1114
+ year: 'numeric',
1115
+ month: 'numeric',
1116
+ day: 'numeric',
1117
+ });
1118
+ let time = newDAte.toLocaleTimeString('en-US', {
1119
+ hour12: true,
1120
+ hour: '2-digit',
1121
+ minute: '2-digit',
1122
+ });
1123
+ return parsedDate + ' ' + time;
1124
+ };
1125
+ exports.listDateFormat = listDateFormat;
1126
+ const equalIgnoreCase = (value1, value2) => {
1127
+ return String(value1).toLowerCase() === String(value2).toLowerCase();
1128
+ };
1129
+ exports.equalIgnoreCase = equalIgnoreCase;
1130
+ function getRandomInt(min, max) {
1131
+ min = Math.ceil(min);
1132
+ max = Math.floor(max);
1133
+ return Math.floor(Math.random() * (max - min + 1)) + min;
1134
+ }
1135
+ function getDomains(domain) {
1136
+ const domains = [];
1137
+ const parts = domain.split('.');
1138
+ for (let i = 0; i < parts.length - 1; i++) {
1139
+ domains.push(parts.slice(i).join('.'));
1140
+ }
1141
+ return domains;
1142
+ }
1143
+ ;
1144
+ function cutEvent(event) {
1145
+ const headers = event.headers && removeUndefined({
1146
+ 'Authorization': event.headers['Authorization']?.substring(0, 200),
1147
+ 'CloudFront-Viewer-Country': event.headers['CloudFront-Viewer-Country'],
1148
+ 'Host': event.headers['Host'],
1149
+ 'origin': event.headers['origin'],
1150
+ 'Referer': event.headers['Referer'],
1151
+ 'User-Agent': event.headers['User-Agent'],
1152
+ 'wl-domain': event.headers['wl-domain'],
1153
+ 'X-API-Key': maskingString(event.headers['X-API-Key']),
1154
+ 'X-Forwarded-For': event.headers['X-Forwarded-For'],
1155
+ 'X-Forwarded-Port': event.headers['X-Forwarded-Port'],
1156
+ 'X-Forwarded-Proto': event.headers['X-Forwarded-Proto'],
1157
+ 'X-Trading-Key': event.headers['X-Trading-Key'],
1158
+ 'X-Wallet-Address': event.headers['X-Wallet-Address'],
1159
+ 'X-Wallet-Token': event.headers['X-Wallet-Token'],
1160
+ 'accessToken': maskingString(event.headers['accessToken']),
1161
+ 'companyId': event.headers['companyId'],
1162
+ 'seasonId': event.headers['seasonId'],
1163
+ });
1164
+ const requestContext = event.requestContext && removeUndefined({
1165
+ identity: event.requestContext.identity && removeUndefined({
1166
+ 'userAgent': event.requestContext.identity['userAgent'],
1167
+ 'sourceIp': event.requestContext.identity['sourceIp'],
1168
+ }),
1169
+ domainName: event.requestContext.domainName,
1170
+ });
1171
+ return removeUndefined({
1172
+ manage: event.manage,
1173
+ path: event.path,
1174
+ httpMethod: event.httpMethod,
1175
+ headers,
1176
+ requestContext,
1177
+ });
1178
+ }
1179
+ function maskingString(str) {
1180
+ if (!str?.length)
1181
+ return str;
1182
+ const maskLen = Math.round(str.length / 3);
1183
+ const start = maskLen;
1184
+ const end = str.length - maskLen;
1185
+ const maskedStr = str.substring(0, start) + "*".repeat(maskLen) + str.substring(end);
1186
+ return maskedStr;
1187
+ }
1188
+ function removeField(obj, fieldToRemove) {
1189
+ if (Array.isArray(obj)) {
1190
+ return obj.map(item => removeField(item, fieldToRemove));
1191
+ }
1192
+ else if (typeof obj === 'object' && obj !== null) {
1193
+ return Object.fromEntries(Object.entries(obj)
1194
+ .filter(([key]) => key !== fieldToRemove)
1195
+ .map(([key, value]) => [key, removeField(value, fieldToRemove)]));
1196
+ }
1197
+ return obj; // Return primitives as-is
1198
+ }
1199
+ function removeUndefined(obj) {
1200
+ return Object.fromEntries(Object.entries(obj).filter(([, value]) => value !== undefined));
1201
+ }
1202
+
1203
+
1204
+ /***/ }),
1205
+
1206
+ /***/ 9965:
1207
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1208
+
1209
+
1210
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
1211
+ if (k2 === undefined) k2 = k;
1212
+ var desc = Object.getOwnPropertyDescriptor(m, k);
1213
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1214
+ desc = { enumerable: true, get: function() { return m[k]; } };
1215
+ }
1216
+ Object.defineProperty(o, k2, desc);
1217
+ }) : (function(o, m, k, k2) {
1218
+ if (k2 === undefined) k2 = k;
1219
+ o[k2] = m[k];
1220
+ }));
1221
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
1222
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1223
+ };
1224
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1225
+ __exportStar(__webpack_require__(2228), exports);
1226
+ __exportStar(__webpack_require__(6978), exports);
1227
+ __exportStar(__webpack_require__(2739), exports);
1228
+ __exportStar(__webpack_require__(6119), exports);
1229
+ __exportStar(__webpack_require__(3004), exports);
1230
+
1231
+
1232
+ /***/ })
1233
+
1234
+ /******/ });
1235
+ /************************************************************************/
1236
+ /******/ // The module cache
1237
+ /******/ var __webpack_module_cache__ = {};
1238
+ /******/
1239
+ /******/ // The require function
1240
+ /******/ function __webpack_require__(moduleId) {
1241
+ /******/ // Check if module is in cache
1242
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
1243
+ /******/ if (cachedModule !== undefined) {
1244
+ /******/ return cachedModule.exports;
1245
+ /******/ }
1246
+ /******/ // Create a new module (and put it into the cache)
1247
+ /******/ var module = __webpack_module_cache__[moduleId] = {
1248
+ /******/ // no module.id needed
1249
+ /******/ // no module.loaded needed
1250
+ /******/ exports: {}
1251
+ /******/ };
1252
+ /******/
1253
+ /******/ // Execute the module function
1254
+ /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
1255
+ /******/
1256
+ /******/ // Return the exports of the module
1257
+ /******/ return module.exports;
1258
+ /******/ }
1259
+ /******/
1260
+ /************************************************************************/
1261
+ var __webpack_exports__ = {};
1262
+ // This entry needs to be wrapped in an IIFE because it uses a non-standard name for the exports (exports).
1263
+ (() => {
1264
+ var exports = __webpack_exports__;
1265
+
1266
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1267
+ exports.mapToUserTradeDto = mapToUserTradeDto;
1268
+ exports.mapToOrderTradeDto = mapToOrderTradeDto;
1269
+ exports.isMaker = isMaker;
1270
+ const order_helper_1 = __webpack_require__(7542);
1271
+ const utils_1 = __webpack_require__(8398);
1272
+ const big_number_helper_1 = __webpack_require__(1174);
1273
+ const _enums_1 = __webpack_require__(9965);
1274
+ function mapToUserTradeDto(t, baseAsset, priceAsset) {
1275
+ const o = t.buyOrder && t.sellOrder
1276
+ ? (t.buyOrderId > t.sellOrderId ? t.buyOrder : t.sellOrder) // which order is self order
1277
+ : (t.buyOrder || t.sellOrder); // user order
1278
+ return {
1279
+ pairId: t.pairId,
1280
+ orderId: o?.id,
1281
+ orderSide: (o && (0, order_helper_1.mapOrderSideToShort)(o.side)),
1282
+ ...mapAssets(baseAsset, priceAsset),
1283
+ ...mapTrade(t, o),
1284
+ };
1285
+ }
1286
+ function mapToOrderTradeDto(order, trades, pairKey, baseAsset, priceAsset) {
1287
+ return {
1288
+ id: order.id,
1289
+ pairId: order.pairId,
1290
+ // @ts-ignore
1291
+ pair: pairKey || order.pair?.pairKey,
1292
+ ...mapAssets(baseAsset, priceAsset),
1293
+ amount: order.amount,
1294
+ price: order.price,
1295
+ total: order.total,
1296
+ filledAmount: order.filledAmount,
1297
+ filledTotal: order.filledTotal,
1298
+ avgPrice: order.excutedPrice,
1299
+ status: order.status,
1300
+ side: order.side,
1301
+ type: order.type,
1302
+ userId: order.userId,
1303
+ createdAt: order.createdAt?.getTime(),
1304
+ completedAt: order.completedAt?.getTime() || null,
1305
+ updatedAt: order.updatedAt?.getTime(),
1306
+ trades: trades && trades.map((t) => mapTrade(t, order)),
1307
+ };
1308
+ }
1309
+ function mapAssets(baseAsset, priceAsset) {
1310
+ return {
1311
+ baseTokenId: baseAsset?.id,
1312
+ baseTokenDecimal: baseAsset?.decimals,
1313
+ quoteTokenId: priceAsset?.id,
1314
+ quoteTokenDecimal: priceAsset?.decimals,
1315
+ };
1316
+ }
1317
+ function mapTrade(t, o) {
1318
+ return {
1319
+ tradeId: t.tradeId,
1320
+ status: t.txStatus,
1321
+ amount: t.amount,
1322
+ total: t.total,
1323
+ price: t.price,
1324
+ fee: o && t.tradeFees
1325
+ .filter(f => (0, utils_1.equalIgnoreCase)(f.address, o.userId))
1326
+ .reduce((acc, cur) => (0, big_number_helper_1.plus)(acc, cur.fee), '0'),
1327
+ createdAt: t.createdAt?.getTime(),
1328
+ updatedAt: t.updatedAt?.getTime(),
1329
+ isBuyer: o && o.side === _enums_1.OrderSide.Buy,
1330
+ isMaker: o && isMaker(o.side, t.tradeSide),
1331
+ };
1332
+ }
1333
+ function isMaker(oSide, tSide) {
1334
+ return oSide === _enums_1.OrderSide.Buy && tSide === _enums_1.OrderSide.Sell
1335
+ || oSide === _enums_1.OrderSide.Sell && tSide === _enums_1.OrderSide.Buy;
1336
+ }
1337
+
1338
+ })();
1339
+
1340
+ /******/ return __webpack_exports__;
1341
+ /******/ })()
1342
+ ;
1343
+ });