@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,1211 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory(require("buffer"), require("bignumber.js"), require("algosdk"));
4
+ else if(typeof define === 'function' && define.amd)
5
+ define(["buffer", "bignumber.js", "algosdk"], factory);
6
+ else {
7
+ var a = typeof exports === 'object' ? factory(require("buffer"), require("bignumber.js"), require("algosdk")) : factory(root["buffer"], root["bignumber.js"], 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__6168__, __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
+ /***/ 573:
23
+ /***/ ((__unused_webpack_module, exports) => {
24
+
25
+
26
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
27
+
28
+
29
+ /***/ }),
30
+
31
+ /***/ 839:
32
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
33
+
34
+
35
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
36
+ exports.transformPointSystemSettings = void 0;
37
+ const _types_1 = __webpack_require__(3574);
38
+ const transformPointSystemSettings = (pointSystemSettings) => {
39
+ const settingsObj = {};
40
+ pointSystemSettings.forEach(({ settingId, value, setting }) => {
41
+ if (setting.type === 'boolean') {
42
+ settingsObj[settingId] = value === 'true';
43
+ }
44
+ else {
45
+ settingsObj[settingId] = value;
46
+ }
47
+ });
48
+ return {
49
+ discordEnabled: settingsObj[_types_1.SettingIds.POINT_SYSTEM_DISCORD_ENABLED],
50
+ telegramBotName: settingsObj[_types_1.SettingIds.POINT_SYSTEM_TELEGRAM_BOT_NAME],
51
+ telegramBotId: settingsObj[_types_1.SettingIds.POINT_SYSTEM_TELEGRAM_BOT_ID],
52
+ telegramEnabled: settingsObj[_types_1.SettingIds.POINT_SYSTEM_TELEGRAM_ENABLED],
53
+ telegramGroupId: settingsObj[_types_1.SettingIds.POINT_SYSTEM_TELEGRAM_GROUP_ID],
54
+ telegramGroupName: settingsObj[_types_1.SettingIds.POINT_SYSTEM_TELEGRAM_GROUP_NAME],
55
+ twitterAccountId: settingsObj[_types_1.SettingIds.POINT_SYSTEM_TWITTER_ACCOUNT_ID],
56
+ twitterAccountName: settingsObj[_types_1.SettingIds.POINT_SYSTEM_TWITTER_ACCOUNT_NAME],
57
+ twitterEnabled: settingsObj[_types_1.SettingIds.POINT_SYSTEM_TWITTER_ENABLED],
58
+ twitterJobEnabled: settingsObj[_types_1.SettingIds.POINT_SYSTEM_TWITTER_JOB_ENABLED],
59
+ guideLink: settingsObj[_types_1.SettingIds.POINT_SYSTEM_GUIDE_LINK],
60
+ };
61
+ };
62
+ exports.transformPointSystemSettings = transformPointSystemSettings;
63
+
64
+
65
+ /***/ }),
66
+
67
+ /***/ 865:
68
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
69
+
70
+
71
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
72
+ exports.groupTickersByInterval = groupTickersByInterval;
73
+ exports.groupTickersByMonthInterval = groupTickersByMonthInterval;
74
+ exports.groupTickersByYearInterval = groupTickersByYearInterval;
75
+ exports.mapCandleToTicker = mapCandleToTicker;
76
+ exports.roundUpSecondsInTimestamp = roundUpSecondsInTimestamp;
77
+ exports.roundUpMinutesInTimestamp = roundUpMinutesInTimestamp;
78
+ exports.roundUpHoursInTimestamp = roundUpHoursInTimestamp;
79
+ const big_number_helper_1 = __webpack_require__(1174);
80
+ function groupTickersByInterval(tickers, newIntervalInSec, endTimeInSec) {
81
+ const newGroupedTickers = [];
82
+ let timestamp = endTimeInSec - newIntervalInSec;
83
+ let slot = null;
84
+ // desc direction by timestamp
85
+ const sortedTickers = tickers.sort((a, b) => b.t - a.t);
86
+ for (let i = 0; i < sortedTickers.length; i++) {
87
+ const element = sortedTickers[i];
88
+ if (element.t < timestamp) {
89
+ if (slot) {
90
+ newGroupedTickers.push({ ...slot });
91
+ slot = null;
92
+ }
93
+ timestamp = timestamp - newIntervalInSec * Math.ceil((timestamp - element.t) / newIntervalInSec);
94
+ }
95
+ if (!slot) {
96
+ slot = { ...element, t: timestamp };
97
+ }
98
+ else {
99
+ if ((0, big_number_helper_1.lessThan)(slot.h, element.h))
100
+ slot.h = element.h;
101
+ if ((0, big_number_helper_1.greaterThan)(slot.l, element.l))
102
+ slot.l = element.l;
103
+ slot.o = element.o;
104
+ slot.v = Number((0, big_number_helper_1.plus)(slot.v, element.v));
105
+ }
106
+ if (i + 1 === sortedTickers.length) {
107
+ newGroupedTickers.push({ ...slot });
108
+ }
109
+ }
110
+ return newGroupedTickers;
111
+ }
112
+ function groupTickersByMonthInterval(tickers, months, endTimeInSec) {
113
+ const sortedTickers = tickers.sort((a, b) => b.t - a.t);
114
+ const yearlyTickers = [];
115
+ const tickersByYear = new Map();
116
+ for (const ticker of sortedTickers) {
117
+ const date = new Date(ticker.t * 1000);
118
+ const year = date.getFullYear();
119
+ if (!tickersByYear.has(year)) {
120
+ tickersByYear.set(year, []);
121
+ }
122
+ tickersByYear.get(year).push(ticker);
123
+ }
124
+ for (const [year, yearTickers] of tickersByYear) {
125
+ if (yearTickers.length === 0)
126
+ continue;
127
+ const sortedYearTickers = yearTickers.sort((a, b) => a.t - b.t);
128
+ const yearlyTicker = {
129
+ t: new Date(year, 0, 1).getTime() / 1000,
130
+ o: sortedYearTickers[0].o,
131
+ h: Math.max(...sortedYearTickers.map(t => t.h)),
132
+ l: Math.min(...sortedYearTickers.map(t => t.l)),
133
+ c: sortedYearTickers[sortedYearTickers.length - 1].c,
134
+ v: sortedYearTickers.reduce((sum, t) => sum + t.v, 0),
135
+ q: sortedYearTickers.reduce((sum, t) => sum + t.q, 0),
136
+ };
137
+ yearlyTickers.push(yearlyTicker);
138
+ }
139
+ return yearlyTickers.sort((a, b) => b.t - a.t);
140
+ }
141
+ function groupTickersByYearInterval(tickers, years, endTimeInSec) {
142
+ throw new Error("groupTickersByYearInterval has not implemented yet");
143
+ }
144
+ function mapCandleToTicker(candle) {
145
+ return {
146
+ t: +(0, big_number_helper_1.divide)(candle.timestamp, 1000),
147
+ o: candle.open,
148
+ h: candle.high,
149
+ l: candle.low,
150
+ c: candle.close,
151
+ v: candle.volume,
152
+ q: candle.quote
153
+ };
154
+ }
155
+ function roundUpSecondsInTimestamp(timeInSec) {
156
+ return (new Date(timeInSec * 1000).setSeconds(60, 0)) / 1000;
157
+ }
158
+ function roundUpMinutesInTimestamp(timeInSec) {
159
+ return (new Date(timeInSec * 1000).setMinutes(60, 0, 0)) / 1000;
160
+ }
161
+ function roundUpHoursInTimestamp(timeInSec) {
162
+ return (new Date(timeInSec * 1000).setHours(24, 0, 0, 0)) / 1000;
163
+ }
164
+
165
+
166
+ /***/ }),
167
+
168
+ /***/ 1174:
169
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
170
+
171
+
172
+ var __importDefault = (this && this.__importDefault) || function (mod) {
173
+ return (mod && mod.__esModule) ? mod : { "default": mod };
174
+ };
175
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
176
+ exports.Operations = void 0;
177
+ exports.absolute = absolute;
178
+ exports.ceil = ceil;
179
+ exports.toFixed = toFixed;
180
+ exports.floor = floor;
181
+ exports.round = round;
182
+ exports.plus = plus;
183
+ exports.minus = minus;
184
+ exports.multiply = multiply;
185
+ exports.toUsd = toUsd;
186
+ exports.divide = divide;
187
+ exports.greaterThanOrEqual = greaterThanOrEqual;
188
+ exports.greaterThan = greaterThan;
189
+ exports.lessThanOrEqual = lessThanOrEqual;
190
+ exports.lessThan = lessThan;
191
+ exports.equal = equal;
192
+ exports.mod = mod;
193
+ exports.modZero = modZero;
194
+ exports.bn_operation = bn_operation;
195
+ exports.roundNumber = roundNumber;
196
+ exports.convertFromBaseUnits = convertFromBaseUnits;
197
+ exports.convertToBaseUnits = convertToBaseUnits;
198
+ const bignumber_js_1 = __importDefault(__webpack_require__(6168));
199
+ bignumber_js_1.default.config({ DECIMAL_PLACES: 40, EXPONENTIAL_AT: 45 });
200
+ var Operations;
201
+ (function (Operations) {
202
+ Operations["MINUS"] = "-";
203
+ Operations["PLUS"] = "+";
204
+ Operations["MULTIPLY"] = "*";
205
+ Operations["DIVIDE"] = "/";
206
+ Operations["GREATER_THAN_OR_EQUAL"] = ">=";
207
+ Operations["GREATER_THAN"] = ">";
208
+ Operations["LESS_THAN_OR_EQUAL"] = "<=";
209
+ Operations["LESS_THAN"] = "<";
210
+ Operations["EQUAL"] = "==";
211
+ Operations["MOD"] = "mod";
212
+ })(Operations || (exports.Operations = Operations = {}));
213
+ function absolute(value) {
214
+ let x = new bignumber_js_1.default(value);
215
+ const res = x.abs().toString();
216
+ // console.log('Absolute value', { value, res })
217
+ return res;
218
+ }
219
+ function ceil(value) {
220
+ let x = new bignumber_js_1.default(String(value));
221
+ const res = x.integerValue(bignumber_js_1.default.ROUND_CEIL).toString();
222
+ if (!equal(value, res)) {
223
+ console.log('Ceil value', { value, res });
224
+ }
225
+ return res;
226
+ }
227
+ function toFixed(value, decimalPlaces, roundUpToFirstSignificant = false) {
228
+ const x = new bignumber_js_1.default(String(value));
229
+ let res;
230
+ if (roundUpToFirstSignificant) {
231
+ const valueStr = x.toFixed();
232
+ const decimalIndex = valueStr.indexOf('.');
233
+ if (decimalIndex >= 0) {
234
+ const fractionalPart = valueStr.slice(decimalIndex + 1);
235
+ let leadingZeros = 0;
236
+ for (let char of fractionalPart) {
237
+ if (char === '0') {
238
+ leadingZeros++;
239
+ }
240
+ else {
241
+ break;
242
+ }
243
+ }
244
+ const totalDecimalPlaces = leadingZeros + 1;
245
+ res = x.toFixed(totalDecimalPlaces, bignumber_js_1.default.ROUND_UP);
246
+ }
247
+ else {
248
+ res = x.toFixed(0);
249
+ }
250
+ }
251
+ else {
252
+ res = x.toFixed(decimalPlaces);
253
+ }
254
+ console.log('Fixed value', { value, res });
255
+ return res;
256
+ }
257
+ function floor(value) {
258
+ let x = new bignumber_js_1.default(String(value));
259
+ const res = x.integerValue(bignumber_js_1.default.ROUND_FLOOR).toString();
260
+ console.log('Floor value', { value, res });
261
+ return res;
262
+ }
263
+ function round(value) {
264
+ let x = new bignumber_js_1.default(String(value));
265
+ const res = x.integerValue(bignumber_js_1.default.ROUND_HALF_UP).toString();
266
+ console.log('Round value', { value, res });
267
+ return res;
268
+ }
269
+ function plus(value1, value2) {
270
+ return bn_operation(value1, value2, Operations.PLUS);
271
+ }
272
+ function minus(value1, value2) {
273
+ return bn_operation(value1, value2, Operations.MINUS);
274
+ }
275
+ function multiply(value1, value2) {
276
+ return bn_operation(value1, value2, Operations.MULTIPLY);
277
+ }
278
+ function toUsd(amount, price) {
279
+ return multiply(amount, price || 0);
280
+ }
281
+ ;
282
+ function divide(value1, value2) {
283
+ return bn_operation(value1, value2, Operations.DIVIDE);
284
+ }
285
+ function greaterThanOrEqual(value1, value2) {
286
+ return Boolean(bn_operation(value1, value2, Operations.GREATER_THAN_OR_EQUAL));
287
+ }
288
+ function greaterThan(value1, value2) {
289
+ return Boolean(bn_operation(value1, value2, Operations.GREATER_THAN));
290
+ }
291
+ function lessThanOrEqual(value1, value2) {
292
+ return Boolean(bn_operation(value1, value2, Operations.LESS_THAN_OR_EQUAL));
293
+ }
294
+ function lessThan(value1, value2) {
295
+ return Boolean(bn_operation(value1, value2, Operations.LESS_THAN));
296
+ }
297
+ function equal(value1, value2) {
298
+ return Boolean(bn_operation(value1, value2, Operations.EQUAL));
299
+ }
300
+ function mod(value1, value2) {
301
+ return bn_operation(value1, value2, Operations.MOD);
302
+ }
303
+ function modZero(value1, value2) {
304
+ return equal(mod(value1, value2), 0);
305
+ }
306
+ function bn_operation(a, b, operation) {
307
+ a = new bignumber_js_1.default(String(a));
308
+ b = new bignumber_js_1.default(String(b));
309
+ switch (operation.toLowerCase()) {
310
+ case '-':
311
+ return a.minus(b).toString();
312
+ case '+':
313
+ return a.plus(b).toString();
314
+ case '*':
315
+ case 'x':
316
+ return a.multipliedBy(b).toString();
317
+ case '÷':
318
+ case '/':
319
+ return a.dividedBy(b).toString();
320
+ case '>=':
321
+ return a.isGreaterThanOrEqualTo(b);
322
+ case '>':
323
+ return a.isGreaterThan(b);
324
+ case '<=':
325
+ return a.isLessThanOrEqualTo(b);
326
+ case '<':
327
+ return a.isLessThan(b);
328
+ case '==':
329
+ return a.isEqualTo(b);
330
+ case 'mod':
331
+ return a.modulo(b);
332
+ default:
333
+ break;
334
+ }
335
+ }
336
+ function getExponentialNumberComponents(x) {
337
+ if (x.toString().includes('e')) {
338
+ const parts = x.toString().split('e');
339
+ return [parseFloat(parts[0]), parseFloat(parts[1])];
340
+ }
341
+ return [x, 0];
342
+ }
343
+ function generateExponentialNumberFromComponents(decimalPart, exponent) {
344
+ return decimalPart + (exponent < 0 ? `e${exponent}` : `e+${exponent}`);
345
+ }
346
+ function roundNumber({ decimalPlaces = 0 }, x) {
347
+ if (decimalPlaces > 0) {
348
+ const [decimal, decimalExponentialPart] = getExponentialNumberComponents(x);
349
+ const [rounded, roundedExponentialPart] = getExponentialNumberComponents(Math.round(Number(generateExponentialNumberFromComponents(decimal, decimalExponentialPart + decimalPlaces))));
350
+ return Number(generateExponentialNumberFromComponents(rounded, roundedExponentialPart - decimalPlaces));
351
+ }
352
+ return Math.round(x);
353
+ }
354
+ function convertFromBaseUnits(assetDecimals, quantity) {
355
+ const decimals = Number(assetDecimals);
356
+ return roundNumber({ decimalPlaces: decimals },
357
+ // eslint-disable-next-line no-magic-numbers
358
+ Math.pow(10, -decimals) * Number(quantity));
359
+ }
360
+ /**
361
+ * Computs quantity * 10^(assetDecimals) and rounds the result
362
+ */
363
+ function convertToBaseUnits(assetDecimals, quantity) {
364
+ // eslint-disable-next-line no-magic-numbers
365
+ const baseAmount = Math.pow(10, Number(assetDecimals)) * Number(quantity);
366
+ // 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
367
+ return roundNumber({ decimalPlaces: 0 }, baseAmount);
368
+ }
369
+
370
+
371
+ /***/ }),
372
+
373
+ /***/ 3574:
374
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
375
+
376
+
377
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
378
+ if (k2 === undefined) k2 = k;
379
+ var desc = Object.getOwnPropertyDescriptor(m, k);
380
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
381
+ desc = { enumerable: true, get: function() { return m[k]; } };
382
+ }
383
+ Object.defineProperty(o, k2, desc);
384
+ }) : (function(o, m, k, k2) {
385
+ if (k2 === undefined) k2 = k;
386
+ o[k2] = m[k];
387
+ }));
388
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
389
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
390
+ };
391
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
392
+ __exportStar(__webpack_require__(7114), exports);
393
+ __exportStar(__webpack_require__(5386), exports);
394
+ __exportStar(__webpack_require__(7159), exports);
395
+ __exportStar(__webpack_require__(9181), exports);
396
+ __exportStar(__webpack_require__(7359), exports);
397
+ __exportStar(__webpack_require__(3620), exports);
398
+ __exportStar(__webpack_require__(573), exports);
399
+
400
+
401
+ /***/ }),
402
+
403
+ /***/ 3620:
404
+ /***/ ((__unused_webpack_module, exports) => {
405
+
406
+
407
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
408
+ exports.HummingbotInstanceStatus = void 0;
409
+ var HummingbotInstanceStatus;
410
+ (function (HummingbotInstanceStatus) {
411
+ HummingbotInstanceStatus["PREPARING"] = "provisioning";
412
+ HummingbotInstanceStatus["STOPPING"] = "stopping";
413
+ HummingbotInstanceStatus["RUNNING"] = "running";
414
+ HummingbotInstanceStatus["STOPPED"] = "stopped";
415
+ HummingbotInstanceStatus["FAILED"] = "failed";
416
+ })(HummingbotInstanceStatus || (exports.HummingbotInstanceStatus = HummingbotInstanceStatus = {}));
417
+
418
+
419
+ /***/ }),
420
+
421
+ /***/ 5386:
422
+ /***/ ((__unused_webpack_module, exports) => {
423
+
424
+
425
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
426
+
427
+
428
+ /***/ }),
429
+
430
+ /***/ 5910:
431
+ /***/ ((__unused_webpack_module, exports) => {
432
+
433
+
434
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
435
+ exports.getDatepartValue = getDatepartValue;
436
+ exports.identityDatepart = identityDatepart;
437
+ exports.inMinCandles = inMinCandles;
438
+ exports.inHourCandles = inHourCandles;
439
+ const intervalRegex = {
440
+ hour: /(\d+)[H]/i,
441
+ day: /(\d+)[D]/i,
442
+ week: /(\d+)[W]/i,
443
+ month: /(\d+)[M]/i,
444
+ year: /(\d+)[Y]/i,
445
+ };
446
+ function getDatepartValue(value) {
447
+ const datepart = identityDatepart(value);
448
+ if (datepart === null) {
449
+ throw new Error(`Cannot fetch datepart from interval: ${value}`);
450
+ }
451
+ const units = datepart === 'minute' ? Number(value) : Number(value.slice(0, -1));
452
+ if (!units) {
453
+ return mapWithTimeframe(datepart, 1);
454
+ }
455
+ if (datepart === 'minute' && units % (7 * 24 * 60) === 0) { // week
456
+ return mapWithTimeframe('week', units / (7 * 24 * 60));
457
+ }
458
+ if (datepart === 'minute' && units % (24 * 60) === 0) { // day
459
+ return mapWithTimeframe('day', units / (24 * 60));
460
+ }
461
+ if (datepart === 'minute' && units % 60 === 0) { // hour
462
+ return mapWithTimeframe('hour', units / 60);
463
+ }
464
+ if (datepart === 'hour' && units % (7 * 24) === 0) { // week
465
+ return mapWithTimeframe('week', units / (7 * 24));
466
+ }
467
+ if (datepart === 'hour' && units % 24 === 0) { // day
468
+ return mapWithTimeframe(units === 24 ? 'hour' : 'day', units === 24 ? 24 : units / 24);
469
+ }
470
+ if (datepart === 'day' && units % 7 === 0) { // week
471
+ return mapWithTimeframe('week', units / 7);
472
+ }
473
+ if (datepart === 'month' && units % 12 === 0) { // year
474
+ return mapWithTimeframe('year', units / 12);
475
+ }
476
+ return mapWithTimeframe(datepart, units);
477
+ }
478
+ function identityDatepart(interval) {
479
+ if (!isNaN(Number(interval))) {
480
+ return 'minute';
481
+ }
482
+ const lastLetter = interval.slice(-1);
483
+ const value = `1${lastLetter}`;
484
+ switch (true) {
485
+ case intervalRegex.hour.test(value): return 'hour';
486
+ case intervalRegex.day.test(value): return 'day';
487
+ case intervalRegex.week.test(value): return 'week';
488
+ case intervalRegex.month.test(value): return 'month';
489
+ case intervalRegex.year.test(value): return 'year';
490
+ default: return null;
491
+ }
492
+ }
493
+ function mapWithTimeframe(datepart, value) {
494
+ return { datepart, value, timeframe: mapDatepartToTimeframe(datepart, value) };
495
+ }
496
+ function inMinCandles(value) {
497
+ return [1, 3, 5, 15, 30].includes(value);
498
+ }
499
+ function inHourCandles(value) {
500
+ return [1, 2, 3, 4, 12].includes(value);
501
+ }
502
+ function mapDatepartToTimeframe(datepart, value) {
503
+ switch (datepart) {
504
+ case 'minute':
505
+ return inMinCandles(value) ? `${value}m` : '1m';
506
+ case 'hour':
507
+ return inHourCandles(value) ? `${value}h` : '1h';
508
+ case 'day':
509
+ return `1d`;
510
+ case 'week':
511
+ return `1w`;
512
+ case 'month':
513
+ return `1M`;
514
+ case 'year':
515
+ return `1Y`;
516
+ default:
517
+ throw new Error(`Unsupported datepart: ${datepart}`);
518
+ }
519
+ }
520
+
521
+
522
+ /***/ }),
523
+
524
+ /***/ 6168:
525
+ /***/ ((module) => {
526
+
527
+ module.exports = __WEBPACK_EXTERNAL_MODULE__6168__;
528
+
529
+ /***/ }),
530
+
531
+ /***/ 6897:
532
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
533
+
534
+
535
+ var __importDefault = (this && this.__importDefault) || function (mod) {
536
+ return (mod && mod.__esModule) ? mod : { "default": mod };
537
+ };
538
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
539
+ exports.verifySignature = exports.decodeAndNormalizeAddress = exports.isAssetOptedIn = exports.getTxnParams = exports.getBoxByName = exports.getAppBoxes = exports.getAppGlobalState = exports.getAccountAssetBalances = exports.createBoxes = void 0;
540
+ exports.decodeStateArray = decodeStateArray;
541
+ const algosdk_1 = __importDefault(__webpack_require__(9709));
542
+ const Encoding_1 = __webpack_require__(8593);
543
+ const helpers_1 = __webpack_require__(9730);
544
+ const createBoxes = (appIndex, foreignApps) => {
545
+ const boxes = foreignApps.map((wlpIndex) => ({
546
+ appIndex,
547
+ name: (0, Encoding_1.concatArrays)((0, Encoding_1.encodeArgArray)(["WLP_", wlpIndex]))
548
+ }));
549
+ return boxes;
550
+ };
551
+ exports.createBoxes = createBoxes;
552
+ function decodeStateArray(stateArray) {
553
+ const state = {};
554
+ stateArray.forEach((row) => {
555
+ const key = (0, Encoding_1.decodeBase64)(row['key']).toString();
556
+ let value = row['value'];
557
+ const valueType = value['type'];
558
+ if (valueType == 2)
559
+ value = value['uint'];
560
+ if (valueType == 1)
561
+ value = (0, Encoding_1.decodeBase64)(value['bytes']);
562
+ if (key == 'gov') {
563
+ state['gov'] = (0, Encoding_1.encodeAddress)(value);
564
+ }
565
+ else {
566
+ state[key] = value;
567
+ }
568
+ });
569
+ return (0, helpers_1.sortKeysInObject)(state);
570
+ }
571
+ const getAccountAssetBalances = (accountInfo) => {
572
+ const balances = {
573
+ '0': accountInfo['amount']
574
+ };
575
+ const assets = accountInfo['assets'];
576
+ for (let i = 0; i < assets.length; i++) {
577
+ const assetId = assets[i]['asset-id'];
578
+ const assetAmt = assets[i]['amount'];
579
+ balances[assetId] = assetAmt;
580
+ }
581
+ console.log(`Account ${accountInfo.address} balances`, JSON.stringify(balances));
582
+ return balances;
583
+ };
584
+ exports.getAccountAssetBalances = getAccountAssetBalances;
585
+ const getAppGlobalState = async (algodClient, appId) => {
586
+ const app = await algodClient.getApplicationByID(appId).do();
587
+ const globalState = decodeStateArray(app['params']['global-state']);
588
+ return globalState;
589
+ };
590
+ exports.getAppGlobalState = getAppGlobalState;
591
+ const getAppBoxes = async (algodClient, appId) => {
592
+ const { boxes } = await algodClient.getApplicationBoxes(appId).do();
593
+ console.log('boxes', appId, boxes
594
+ .map(o => o.name)
595
+ .filter(o => o.length === 32)
596
+ .map(o => Buffer.from(o).toString('base64')));
597
+ };
598
+ exports.getAppBoxes = getAppBoxes;
599
+ const getBoxByName = async (algoClient, appId, boxName) => {
600
+ try {
601
+ // console.log('Get box by name', boxName);
602
+ const { value } = await algoClient.getApplicationBoxByName(appId, boxName).do();
603
+ const box = value;
604
+ return box;
605
+ }
606
+ catch (error) {
607
+ if (error.message.includes('box not found')) {
608
+ console.log(`Box not found '${Buffer.from(boxName).toString('hex')}'`);
609
+ return null;
610
+ }
611
+ throw error;
612
+ }
613
+ };
614
+ exports.getBoxByName = getBoxByName;
615
+ const getTxnParams = async (algoClient, txnsCount = 1) => {
616
+ const params = await algoClient.getTransactionParams().do();
617
+ if (txnsCount > 1) {
618
+ params.fee = algosdk_1.default.ALGORAND_MIN_TX_FEE * txnsCount;
619
+ params.flatFee = true;
620
+ }
621
+ return { ...params };
622
+ };
623
+ exports.getTxnParams = getTxnParams;
624
+ const isAssetOptedIn = (balances, assetId) => {
625
+ return Object.keys(balances).includes(assetId.toString());
626
+ };
627
+ exports.isAssetOptedIn = isAssetOptedIn;
628
+ const decodeAndNormalizeAddress = (address) => algosdk_1.default.decodeAddress(address.toUpperCase()).publicKey;
629
+ exports.decodeAndNormalizeAddress = decodeAndNormalizeAddress;
630
+ const verifySignature = (signature, address, message, encoding) => {
631
+ return algosdk_1.default.verifyBytes(new Uint8Array(Buffer.from(message, encoding)), (0, Encoding_1.decodeBase64)(signature), address);
632
+ };
633
+ exports.verifySignature = verifySignature;
634
+
635
+
636
+ /***/ }),
637
+
638
+ /***/ 7114:
639
+ /***/ ((__unused_webpack_module, exports) => {
640
+
641
+
642
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
643
+
644
+
645
+ /***/ }),
646
+
647
+ /***/ 7159:
648
+ /***/ ((__unused_webpack_module, exports) => {
649
+
650
+
651
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
652
+ exports.defaultThemesValue = exports.defaultThemeSettingValue = exports.defaultLogoSettingValue = exports.requiredColors = exports.settingIdToSecretType = exports.CredentialNameEnum = exports.AffDashboardVisibilitySettingEnum = exports.SettingIds = void 0;
653
+ var SettingIds;
654
+ (function (SettingIds) {
655
+ SettingIds["ENABLED"] = "company.enabled";
656
+ SettingIds["APP_TITLE"] = "company.appTitle";
657
+ SettingIds["DOMAIN"] = "company.domain";
658
+ SettingIds["LOGO"] = "appearance.logo";
659
+ SettingIds["AMM"] = "product.amm";
660
+ SettingIds["OBDEX"] = "product.obdex";
661
+ SettingIds["THEMES"] = "appearance.themes";
662
+ SettingIds["DIRECT_SETTLE"] = "company.directSettlement";
663
+ SettingIds["AMM_FEE"] = "company.ammFee";
664
+ SettingIds["FEE_SHARE"] = "company.feeShare";
665
+ SettingIds["MIN_FEE"] = "company.minFee";
666
+ SettingIds["MAKER_FEE"] = "company.makerFee";
667
+ SettingIds["TAKER_FEE"] = "company.takerFee";
668
+ SettingIds["GEOBLOCK"] = "company.geoblock";
669
+ SettingIds["EMBEDDED_APP_URL"] = "company.embeddedAppUrl";
670
+ SettingIds["PRODUCT_OBDEX"] = "product.obdex";
671
+ SettingIds["PRODUCT_AMM"] = "product.amm";
672
+ SettingIds["NEW_TAB"] = "appearance.newTab";
673
+ SettingIds["APPEARANCE_TARGET"] = "appearance.target";
674
+ SettingIds["CUSTOM_MENU_ITEMS"] = "appearance.customMenuItems";
675
+ SettingIds["REPORT_BUTTONS"] = "appearance.reportButtons";
676
+ SettingIds["APPEARANCE_CHART_TYPE"] = "appearance.chartType";
677
+ SettingIds["APPEARANCE_CHART_INT"] = "appearance.chartInt";
678
+ SettingIds["PINNED_PAIRS"] = "markets.pinnedPairs";
679
+ SettingIds["KYC_TRADE_REQUIREMENT_ENABLED"] = "markets.kycTradeRequirementEnabled";
680
+ SettingIds["AFFILIATE_DASHBOARD_VISIBILITY"] = "product.affiliateDashboardVisibility";
681
+ SettingIds["AFFILIATE_DASHBOARD_THRESHOLD"] = "product.affiliateDashboardThreshold";
682
+ SettingIds["AFFILIATE_DEFAULT_FEE_SHARE"] = "product.affiliateDefaultFeeShare";
683
+ SettingIds["AFFILIATE_POINTS_REWARD"] = "product.affiliatePointsReward";
684
+ SettingIds["POINT_SYSTEM_MODE"] = "product.pointSystem";
685
+ SettingIds["POINT_SYSTEM_TELEGRAM_API_TOKEN"] = "point-system.telegramApiToken";
686
+ SettingIds["POINT_SYSTEM_TELEGRAM_ENABLED"] = "point-system.telegramEnabled";
687
+ SettingIds["POINT_SYSTEM_TELEGRAM_GROUP_ID"] = "point-system.telegramGroupId";
688
+ SettingIds["POINT_SYSTEM_TELEGRAM_BOT_NAME"] = "point-system.telegramBotName";
689
+ SettingIds["POINT_SYSTEM_TELEGRAM_BOT_ID"] = "point-system.telegramBotId";
690
+ SettingIds["POINT_SYSTEM_TELEGRAM_GROUP_NAME"] = "point-system.telegramGroupName";
691
+ SettingIds["POINT_SYSTEM_TELEGRAM_WEBHOOK_TOKEN"] = "point-system.telegramWebhookToken";
692
+ SettingIds["POINT_SYSTEM_DISCORD_CLIENT_ID"] = "point-system.discordClientId";
693
+ SettingIds["POINT_SYSTEM_DISCORD_CLIENT_SECRET"] = "point-system.discordClientSecret";
694
+ SettingIds["POINT_SYSTEM_DISCORD_SERVER_ID"] = "point-system.discordServerId";
695
+ SettingIds["POINT_SYSTEM_DISCORD_ENABLED"] = "point-system.discordEnabled";
696
+ SettingIds["POINT_SYSTEM_TWITTER_CLIENT_ID"] = "point-system.twitterClientId";
697
+ SettingIds["POINT_SYSTEM_TWITTER_CLIENT_SECRET"] = "point-system.twitterClientSecret";
698
+ SettingIds["POINT_SYSTEM_TWITTER_BEARER_TOKEN"] = "point-system.twitterBearerToken";
699
+ SettingIds["POINT_SYSTEM_TWITTER_REFRESH_TOKEN"] = "point-system.twitterRefreshToken";
700
+ SettingIds["POINT_SYSTEM_TWITTER_ENABLED"] = "point-system.twitterEnabled";
701
+ SettingIds["POINT_SYSTEM_TWITTER_JOB_ENABLED"] = "point-system.twitterJobEnabled";
702
+ SettingIds["POINT_SYSTEM_TWITTER_HASHTAGS"] = "point-system.twitterHashtags";
703
+ SettingIds["POINT_SYSTEM_TWITTER_TWEET_EXP_TIME"] = "point-system.twitterPostDefaultExpirationTime";
704
+ SettingIds["POINT_SYSTEM_TWITTER_ACCOUNT_NAME"] = "point-system.twitterAccountName";
705
+ SettingIds["POINT_SYSTEM_TWITTER_ACCOUNT_ID"] = "point-system.twitterAccountId";
706
+ SettingIds["POINT_SYSTEM_TWITTER_WEBHOOK_TOKEN"] = "point-system.twitterWebhookToken";
707
+ SettingIds["POINT_SYSTEM_GUIDE_LINK"] = "point-system.guideLink";
708
+ })(SettingIds || (exports.SettingIds = SettingIds = {}));
709
+ var AffDashboardVisibilitySettingEnum;
710
+ (function (AffDashboardVisibilitySettingEnum) {
711
+ AffDashboardVisibilitySettingEnum["DISABLED"] = "disabled";
712
+ AffDashboardVisibilitySettingEnum["ENABLED_FOR_ALL"] = "enabled for all";
713
+ AffDashboardVisibilitySettingEnum["ENABLED_FOR_AFFILIATES"] = "enabled for affiliates";
714
+ })(AffDashboardVisibilitySettingEnum || (exports.AffDashboardVisibilitySettingEnum = AffDashboardVisibilitySettingEnum = {}));
715
+ var CredentialNameEnum;
716
+ (function (CredentialNameEnum) {
717
+ CredentialNameEnum["API_TOKEN"] = "apiToken";
718
+ CredentialNameEnum["CLIENT_ID"] = "clientId";
719
+ CredentialNameEnum["CLIENT_SECRET"] = "clientSecret";
720
+ CredentialNameEnum["BEARER_TOKEN"] = "bearerToken";
721
+ CredentialNameEnum["REFRESH_TOKEN"] = "refreshToken";
722
+ CredentialNameEnum["ACCESS_TOKEN"] = "accessToken";
723
+ })(CredentialNameEnum || (exports.CredentialNameEnum = CredentialNameEnum = {}));
724
+ exports.settingIdToSecretType = {
725
+ 'point-system.telegramApiToken': CredentialNameEnum.API_TOKEN,
726
+ 'point-system.discordClientId': CredentialNameEnum.CLIENT_ID,
727
+ 'point-system.discordClientSecret': CredentialNameEnum.CLIENT_SECRET,
728
+ 'point-system.twitterClientSecret': CredentialNameEnum.CLIENT_SECRET,
729
+ 'point-system.twitterClientId': CredentialNameEnum.CLIENT_ID,
730
+ 'point-system.twitterBearerToken': CredentialNameEnum.BEARER_TOKEN,
731
+ 'point-system.twitterRefreshToken': CredentialNameEnum.REFRESH_TOKEN,
732
+ };
733
+ exports.requiredColors = [
734
+ 'primary-1',
735
+ 'primary-2',
736
+ 'main-background',
737
+ 'primary-text',
738
+ 'module-background',
739
+ 'buy-text',
740
+ 'buy-background',
741
+ 'sell-text',
742
+ 'sell-background',
743
+ 'secondary-text',
744
+ 'input-background-default',
745
+ 'input-background-hover',
746
+ 'input-background-disabled',
747
+ 'input-border-default',
748
+ 'module-border',
749
+ 'button-disabled',
750
+ 'button-border',
751
+ 'input-border-active',
752
+ 'active-element-default',
753
+ 'hover-element-default',
754
+ 'dropdown-shadow',
755
+ 'button-text',
756
+ 'pair-active-row',
757
+ ];
758
+ exports.defaultLogoSettingValue = `{"theme1":{"value":"${process.env.FRONTEND_URL}/Theme%3DDark.svg","active":true},"theme2":{"value":"${process.env.FRONTEND_URL}/Theme%3DLight.svg","active":true},"theme3":{"value":"${process.env.FRONTEND_URL}/Theme%3DLight.svg","active":true}}`;
759
+ exports.defaultThemeSettingValue = '{"theme1":{"name":"dark","active":true,"value":{"primary-1":"rgba(118, 63, 229, 1)","primary-2":"rgba(249, 132, 146, 1)","main-background":"rgba(1, 1, 1, 1)","primary-text":"rgba(255, 255, 255, 1)","module-background":"rgba(19, 23, 34, 1)","buy-text":"rgba(82, 164, 154, 1)","buy-background":"rgba(2, 199, 122, 0.25)","sell-text":"rgba(221, 94, 86, 1)","sell-background":"rgba(255, 59, 105, 0.25)","secondary-text":"rgba(127, 127, 127, 1)","input-background-default":"rgba(13, 15, 21, 1)","input-background-hover":"rgba(28, 33, 45, 1)","input-background-disabled":"rgba(25, 29, 41, 1)","input-border-default":"rgba(28, 33, 45, 1)","module-border":"rgba(28, 33, 45, 1)","button-disabled":"rgba(111, 113, 118, 1)","button-border":"rgba(255, 255, 255, 1)","input-border-active":"rgba(185, 163, 238, 1)","active-element-default":"rgba(230, 136, 150, 1)","hover-element-default":"rgba(185, 163, 238, 1)","dropdown-shadow":"rgba(154, 92, 253, 0.45)","button-text":"rgba(255, 255, 255, 1)","pair-active-row":"rgba(28, 33, 45, 1)"}},"theme2":{"name":"light","active":true,"value":{"primary-1":"rgba(118, 63, 229, 1)","primary-2":"rgba(249, 132, 146, 1)","main-background":"rgba(249, 248, 248, 1)","primary-text":"rgba(0, 0, 0, 1)","module-background":"rgba(255, 255, 255, 1)","buy-text":"rgba(0, 112, 98, 1)","buy-background":"rgba(0, 112, 98, 0.25)","sell-text":"rgba(195, 12, 1, 1)","sell-background":"rgba(255, 59, 105, 0.25)","secondary-text":"rgba(127, 127, 127, 1)","button-disabled":"rgba(203, 199, 199, 1)","input-background-default":"rgba(255, 255, 255, 1)","input-background-hover":"rgba(249, 248, 248, 1)","input-background-disabled":"rgba(249, 248, 248, 1)","input-border-default":"rgba(228, 225, 225, 1)","module-border":"rgba(228, 225, 225, 1)","button-border":"rgba(170, 167, 167, 1)","input-border-active":"rgba(0, 0, 0, 1)","active-element-default":"rgba(230, 136, 150, 1)","hover-element-default":"rgba(185, 163, 238, 1)","dropdown-shadow":"rgba(154, 92, 253, 0.45)","button-text":"rgba(255, 255, 255, 1)","pair-active-row":"rgb(249, 248, 248)"}},"theme3":{"name":"purple","active":true,"value":{"primary-1":"rgba(118, 63, 229, 1)","primary-2":"rgba(249, 132, 146, 1)","main-background":"rgba(255, 255, 255, 1)","primary-text":"rgba(0, 0, 0, 1)","secondary-text":"rgba(127, 127, 127, 1)","buy-text":"rgba(0, 112, 98, 1)","sell-text":"rgba(195, 12, 1, 1)","buy-background":"rgba(0, 112, 98, 0.25)","sell-background":"rgba(255, 59, 105, 0.25)","module-background":"rgba(254, 250, 255, 1)","module-border":"rgba(228, 225, 225, 1)","input-background-default":"rgba(255, 255, 255, 1)","input-background-hover":"rgba(249, 248, 248, 1)","input-background-disabled":"rgba(254, 250, 255, 1)","input-border-default":"rgba(228, 225, 225, 1)","input-border-active":"rgba(0, 0, 0, 1)","button-border":"rgba(170, 167, 167, 1)","button-disabled":"rgba(203, 199, 199, 1)","active-element-default":"rgba(230, 136, 150, 1)","hover-element-default":"rgba(185, 163, 238, 1)","dropdown-shadow":"rgba(154, 92, 253, 0.45)","button-text":"rgba(255, 255, 255, 1)","pair-active-row":"rgb(249, 248, 248)"}}}';
760
+ var defaultThemesValue;
761
+ (function (defaultThemesValue) {
762
+ defaultThemesValue["theme1"] = "{\"name\":\"dark\",\"id\":\"theme1\",\"active\":true, \"chartColors\":{\"bullish_candle_color\": \"rgba(2, 199, 122, 0.25)\",\"bearish_candle_color\": \"rgba(221, 94, 86, 1)\",\"bullish_wick_color\": \"rgba(2, 199, 122, 0.25)\",\"bearish_wick_color\": \"rgba(221, 94, 86, 1)\",\"bullish_outline_color\": \"rgba(2, 199, 122, 0.25)\",\"bearish_outline_color\": \"rgba(221, 94, 86, 1)\",\"line_color\": \"rgba(41, 98, 255, 1)\",\"chart_background\": \"rgba(19, 23, 34, 1)\",\"chart_text\": \"rgba(127, 127, 127, 1)\"}, \"colors\":{\"primary-1\":\"rgba(118, 63, 229, 1)\",\"primary-2\":\"rgba(249, 132, 146, 1)\",\"main-background\":\"rgba(1, 1, 1, 1)\",\"primary-text\":\"rgba(255, 255, 255, 1)\",\"module-background\":\"rgba(19, 23, 34, 1)\",\"buy-text\":\"rgba(82, 164, 154, 1)\",\"buy-background\":\"rgba(2, 199, 122, 0.25)\",\"sell-text\":\"rgba(221, 94, 86, 1)\",\"sell-background\":\"rgba(255, 59, 105, 0.25)\",\"secondary-text\":\"rgba(127, 127, 127, 1)\",\"input-background-default\":\"rgba(13, 15, 21, 1)\",\"input-background-hover\":\"rgba(28, 33, 45, 1)\",\"input-background-disabled\":\"rgba(25, 29, 41, 1)\",\"input-border-default\":\"rgba(28, 33, 45, 1)\",\"module-border\":\"rgba(28, 33, 45, 1)\",\"button-disabled\":\"rgba(111, 113, 118, 1)\",\"button-border\":\"rgba(255, 255, 255, 1)\",\"input-border-active\":\"rgba(185, 163, 238, 1)\",\"active-element-default\":\"rgba(230, 136, 150, 1)\",\"hover-element-default\":\"rgba(185, 163, 238, 1)\",\"dropdown-shadow\":\"rgba(154, 92, 253, 0.45)\",\"button-text\":\"rgba(255, 255, 255, 1)\",\"pair-active-row\":\"rgba(28, 33, 45, 1)\"}}";
763
+ defaultThemesValue["theme2"] = "{\"name\":\"light\",\"id\":\"theme2\",\"active\":true, \"chartColors\":{\"bullish_candle_color\": \"rgba(0, 112, 98, 1)\",\"bearish_candle_color\": \"rgba(195, 12, 1, 1)\",\"bullish_wick_color\": \"rgba(0, 112, 98, 1)\",\"bearish_wick_color\": \"rgba(195, 12, 1, 1)\",\"bullish_outline_color\": \"rgba(0, 112, 98, 1)\",\"bearish_outline_color\": \"rgba(195, 12, 1, 1)\",\"line_color\": \"rgba(41, 98, 255, 1)\",\"chart_background\": \"rgba(255, 255, 255, 1)\",\"chart_text\": \"rgba(127, 127, 127, 1)\"}, \"colors\":{\"primary-1\":\"rgba(118, 63, 229, 1)\",\"primary-2\":\"rgba(249, 132, 146, 1)\",\"main-background\":\"rgba(249, 248, 248, 1)\",\"primary-text\":\"rgba(0, 0, 0, 1)\",\"module-background\":\"rgba(255, 255, 255, 1)\",\"buy-text\":\"rgba(0, 112, 98, 1)\",\"buy-background\":\"rgba(0, 112, 98, 0.25)\",\"sell-text\":\"rgba(195, 12, 1, 1)\",\"sell-background\":\"rgba(255, 59, 105, 0.25)\",\"secondary-text\":\"rgba(127, 127, 127, 1)\",\"button-disabled\":\"rgba(203, 199, 199, 1)\",\"input-background-default\":\"rgba(255, 255, 255, 1)\",\"input-background-hover\":\"rgba(249, 248, 248, 1)\",\"input-background-disabled\":\"rgba(249, 248, 248, 1)\",\"input-border-default\":\"rgba(228, 225, 225, 1)\",\"module-border\":\"rgba(228, 225, 225, 1)\",\"button-border\":\"rgba(170, 167, 167, 1)\",\"input-border-active\":\"rgba(0, 0, 0, 1)\",\"active-element-default\":\"rgba(230, 136, 150, 1)\",\"hover-element-default\":\"rgba(185, 163, 238, 1)\",\"dropdown-shadow\":\"rgba(154, 92, 253, 0.45)\",\"button-text\":\"rgba(255, 255, 255, 1)\",\"pair-active-row\":\"rgb(249, 248, 248)\"}}";
764
+ defaultThemesValue["theme3"] = "{\"name\":\"purple\",\"id\":\"theme3\",\"active\":true, \"chartColors\":{\"bullish_candle_color\": \"rgba(0, 112, 98, 1)\",\"bearish_candle_color\": \"rgba(195, 12, 1, 1)\",\"bullish_wick_color\": \"rgba(0, 112, 98, 1)\",\"bearish_wick_color\": \"rgba(195, 12, 1, 1)\",\"bullish_outline_color\": \"rgba(0, 112, 98, 1)\",\"bearish_outline_color\": \"rgba(195, 12, 1, 1)\",\"line_color\": \"rgba(41, 98, 255, 1)\",\"chart_background\": \"rgba(254, 250, 255, 1)\",\"chart_text\": \"rgba(127, 127, 127, 1)\"}, \"colors\":{\"primary-1\":\"rgba(118, 63, 229, 1)\",\"primary-2\":\"rgba(249, 132, 146, 1)\",\"main-background\":\"rgba(255, 255, 255, 1)\",\"primary-text\":\"rgba(0, 0, 0, 1)\",\"secondary-text\":\"rgba(127, 127, 127, 1)\",\"buy-text\":\"rgba(0, 112, 98, 1)\",\"sell-text\":\"rgba(195, 12, 1, 1)\",\"buy-background\":\"rgba(0, 112, 98, 0.25)\",\"sell-background\":\"rgba(255, 59, 105, 0.25)\",\"module-background\":\"rgba(254, 250, 255, 1)\",\"module-border\":\"rgba(228, 225, 225, 1)\",\"input-background-default\":\"rgba(255, 255, 255, 1)\",\"input-background-hover\":\"rgba(249, 248, 248, 1)\",\"input-background-disabled\":\"rgba(254, 250, 255, 1)\",\"input-border-default\":\"rgba(228, 225, 225, 1)\",\"input-border-active\":\"rgba(0, 0, 0, 1)\",\"button-border\":\"rgba(170, 167, 167, 1)\",\"button-disabled\":\"rgba(203, 199, 199, 1)\",\"active-element-default\":\"rgba(230, 136, 150, 1)\",\"hover-element-default\":\"rgba(185, 163, 238, 1)\",\"dropdown-shadow\":\"rgba(154, 92, 253, 0.45)\",\"button-text\":\"rgba(255, 255, 255, 1)\",\"pair-active-row\":\"rgb(249, 248, 248)\"}}";
765
+ })(defaultThemesValue || (exports.defaultThemesValue = defaultThemesValue = {}));
766
+
767
+
768
+ /***/ }),
769
+
770
+ /***/ 7359:
771
+ /***/ ((__unused_webpack_module, exports) => {
772
+
773
+
774
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
775
+ exports.ChartQueryDto = exports.StatisticTypeQuery = exports.UsersQueryDto = exports.PairsQueryDto = exports.SmallTimeframeEnum = void 0;
776
+ var SmallTimeframeEnum;
777
+ (function (SmallTimeframeEnum) {
778
+ SmallTimeframeEnum["last_7_days"] = "last_7_days";
779
+ SmallTimeframeEnum["last_30_days"] = "last_30_days";
780
+ SmallTimeframeEnum["last_90_days"] = "last_90_days";
781
+ SmallTimeframeEnum["last_year"] = "last_year";
782
+ })(SmallTimeframeEnum || (exports.SmallTimeframeEnum = SmallTimeframeEnum = {}));
783
+ class PairsQueryDto {
784
+ constructor() {
785
+ this.timeRange = SmallTimeframeEnum.last_30_days;
786
+ this.sortBy = 'volume_usd';
787
+ this.order = 'desc';
788
+ this.limit = 20;
789
+ this.page = 1;
790
+ }
791
+ }
792
+ exports.PairsQueryDto = PairsQueryDto;
793
+ class UsersQueryDto {
794
+ constructor() {
795
+ this.timeRange = SmallTimeframeEnum.last_30_days;
796
+ this.sortBy = 'volume_usd';
797
+ this.order = 'desc';
798
+ this.limit = 20;
799
+ this.page = 1;
800
+ }
801
+ }
802
+ exports.UsersQueryDto = UsersQueryDto;
803
+ var StatisticTypeQuery;
804
+ (function (StatisticTypeQuery) {
805
+ StatisticTypeQuery["volume"] = "volume";
806
+ StatisticTypeQuery["fees"] = "fees";
807
+ StatisticTypeQuery["orders"] = "orders";
808
+ StatisticTypeQuery["dau"] = "dau";
809
+ })(StatisticTypeQuery || (exports.StatisticTypeQuery = StatisticTypeQuery = {}));
810
+ class ChartQueryDto {
811
+ constructor() {
812
+ this.type = StatisticTypeQuery.volume;
813
+ this.timeRange = SmallTimeframeEnum.last_7_days;
814
+ }
815
+ }
816
+ exports.ChartQueryDto = ChartQueryDto;
817
+
818
+
819
+ /***/ }),
820
+
821
+ /***/ 8593:
822
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
823
+
824
+
825
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
826
+ if (k2 === undefined) k2 = k;
827
+ var desc = Object.getOwnPropertyDescriptor(m, k);
828
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
829
+ desc = { enumerable: true, get: function() { return m[k]; } };
830
+ }
831
+ Object.defineProperty(o, k2, desc);
832
+ }) : (function(o, m, k, k2) {
833
+ if (k2 === undefined) k2 = k;
834
+ o[k2] = m[k];
835
+ }));
836
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
837
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
838
+ }) : function(o, v) {
839
+ o["default"] = v;
840
+ });
841
+ var __importStar = (this && this.__importStar) || (function () {
842
+ var ownKeys = function(o) {
843
+ ownKeys = Object.getOwnPropertyNames || function (o) {
844
+ var ar = [];
845
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
846
+ return ar;
847
+ };
848
+ return ownKeys(o);
849
+ };
850
+ return function (mod) {
851
+ if (mod && mod.__esModule) return mod;
852
+ var result = {};
853
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
854
+ __setModuleDefault(result, mod);
855
+ return result;
856
+ };
857
+ })();
858
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
859
+ exports.decodeAddress = exports.encodeAddress = void 0;
860
+ exports.concatArrays = concatArrays;
861
+ exports.packData = packData;
862
+ exports.unpackData = unpackData;
863
+ exports.encodeArgArray = encodeArgArray;
864
+ exports.encodeString = encodeString;
865
+ exports.decodeString = decodeString;
866
+ exports.encode32Bytes = encode32Bytes;
867
+ exports.encodeUint64 = encodeUint64;
868
+ exports.decodeUint64 = decodeUint64;
869
+ exports.encodeBase64 = encodeBase64;
870
+ exports.decodeBase64 = decodeBase64;
871
+ exports.compareArrays = compareArrays;
872
+ exports.getDeltaUint = getDeltaUint;
873
+ exports.getDeltaBytes = getDeltaBytes;
874
+ exports.toUnix = toUnix;
875
+ exports.fromUnix = fromUnix;
876
+ const algosdk_1 = __importStar(__webpack_require__(9709));
877
+ // import sha512 from "js-sha512"
878
+ const buffer_1 = __webpack_require__(18);
879
+ function concatArrays(arrays) {
880
+ return arrays.reduce((a, b) => Uint8Array.from([...a, ...b]));
881
+ }
882
+ function packData(value, format) {
883
+ const chunks = [];
884
+ for (const [name, type] of Object.entries(format)) {
885
+ const v = value[name];
886
+ if (v === undefined) {
887
+ throw new Error(`Key ${name} missing from value`);
888
+ }
889
+ switch (type.type) {
890
+ case 'address':
891
+ if (v instanceof Uint8Array && v.length == 32) {
892
+ chunks.push(v);
893
+ break;
894
+ }
895
+ else if (typeof v === 'string') {
896
+ chunks.push((0, algosdk_1.decodeAddress)(v).publicKey);
897
+ }
898
+ else {
899
+ throw new Error(`${name}: Expected address, got ${v}`);
900
+ }
901
+ break;
902
+ case 'bytes':
903
+ if (v instanceof Uint8Array) {
904
+ if (v.length == type.size) {
905
+ chunks.push(v);
906
+ break;
907
+ }
908
+ else {
909
+ throw new Error(`${name}: Bytes length is wrong, expected ${type.size}, got ${v.length}`);
910
+ }
911
+ }
912
+ else {
913
+ throw new Error(`${name}: Expected bytes[${type.size}], got ${v}`);
914
+ }
915
+ case 'double':
916
+ if (typeof v === 'number') {
917
+ const bytes = new ArrayBuffer(8);
918
+ buffer_1.Buffer.from(bytes).writeDoubleLE(v, 0);
919
+ chunks.push(new Uint8Array(bytes));
920
+ break;
921
+ }
922
+ else {
923
+ throw new Error(`${name}: Expected double, got ${v}`);
924
+ }
925
+ case 'number':
926
+ case 'uint':
927
+ if (typeof v === 'bigint' || typeof v === 'number') {
928
+ chunks.push(encodeUint64(v));
929
+ break;
930
+ }
931
+ else {
932
+ throw new Error(`${name}: Expected uint or number, got ${v}`);
933
+ }
934
+ case 'string':
935
+ if (typeof v === 'string') {
936
+ const str = encodeString(v);
937
+ if (str.length == type.size) {
938
+ chunks.push(str);
939
+ break;
940
+ }
941
+ else {
942
+ throw new Error(`${name}: Expected string length ${type.size}, got string length ${str.length}`);
943
+ }
944
+ }
945
+ else {
946
+ throw new Error(`${name}: Expected string length ${type.size}, got ${v}`);
947
+ }
948
+ }
949
+ }
950
+ return concatArrays(chunks);
951
+ }
952
+ function unpackData(data, format) {
953
+ const result = new Map();
954
+ let index = 0;
955
+ for (const [name, type] of Object.entries(format)) {
956
+ if (index >= data.length) {
957
+ throw new Error('Array index out of bounds');
958
+ }
959
+ let value;
960
+ switch (type.type) {
961
+ case 'address':
962
+ value = (0, algosdk_1.encodeAddress)(data.slice(index, index + 32));
963
+ index += 32;
964
+ break;
965
+ case 'bytes':
966
+ value = data.slice(index, index + type.size);
967
+ index += type.size;
968
+ break;
969
+ case 'double':
970
+ value = buffer_1.Buffer.from(data.slice(index, index + 8)).readDoubleLE(0);
971
+ index += 8;
972
+ break;
973
+ case 'number':
974
+ value = Number(decodeUint64(data.slice(index, index + 8)));
975
+ index += 8;
976
+ break;
977
+ case 'uint':
978
+ value = decodeUint64(data.slice(index, index + 8));
979
+ index += 8;
980
+ break;
981
+ case 'string':
982
+ value = decodeString(data.slice(index, index + type.size));
983
+ index += type.size;
984
+ break;
985
+ }
986
+ result.set(name, value);
987
+ }
988
+ return Object.fromEntries(result);
989
+ }
990
+ function encodeArgArray(params) {
991
+ return params.map(param => {
992
+ if (param instanceof Uint8Array)
993
+ return new Uint8Array(param);
994
+ if (typeof param === "string")
995
+ return encodeString(param);
996
+ if (typeof param === "boolean")
997
+ param = BigInt(param ? 1 : 0);
998
+ if (typeof param === "number")
999
+ param = BigInt(param);
1000
+ return encodeUint64(param);
1001
+ });
1002
+ }
1003
+ function encodeString(value) {
1004
+ return new Uint8Array(buffer_1.Buffer.from(value));
1005
+ }
1006
+ function decodeString(value) {
1007
+ return buffer_1.Buffer.from(value).toString('utf-8');
1008
+ }
1009
+ function encode32Bytes(value) {
1010
+ const valueButes = algosdk_1.default.encodeUint64(value);
1011
+ return concatArrays([new Uint8Array(32 - valueButes.length), valueButes]);
1012
+ }
1013
+ function encodeUint64(value) {
1014
+ const bytes = buffer_1.Buffer.alloc(8);
1015
+ for (let index = 0; index < 8; index++)
1016
+ bytes[7 - index] = Number((BigInt(value) >> BigInt(index * 8)) & BigInt(0xFF));
1017
+ return new Uint8Array(bytes);
1018
+ }
1019
+ function decodeUint64(value) {
1020
+ let num = BigInt(0);
1021
+ for (let index = 0; index < 8 && value?.length; index++)
1022
+ num = (num << BigInt(8)) | BigInt(value[index]);
1023
+ return num;
1024
+ }
1025
+ function encodeBase64(value) {
1026
+ return buffer_1.Buffer.from(value).toString('base64');
1027
+ }
1028
+ function decodeBase64(value) {
1029
+ return buffer_1.Buffer.from(value, 'base64');
1030
+ }
1031
+ // export const sha256HashLength = 32
1032
+ // export function sha256Hash(arr: sha512.Message): Uint8Array {
1033
+ // return new Uint8Array(sha512.sha512_256.arrayBuffer(arr))
1034
+ // }
1035
+ // export function encodeApplicationAddress(id: number): Address {
1036
+ // const APP_ID_PREFIX = Buffer.from('appID');
1037
+ // const toBeSigned = concatArrays([APP_ID_PREFIX, encodeUint64(BigInt(id))]);
1038
+ // return encodeAddress(sha256Hash(toBeSigned));
1039
+ // }
1040
+ function compareArrays(a, b) {
1041
+ return a.length === b.length && a.reduce((equal, item, index) => equal && item === b[index], true);
1042
+ }
1043
+ function getDelta(response, key) {
1044
+ const delta = response['global-state-delta'].find((v) => v.key === key);
1045
+ if (delta === undefined)
1046
+ return undefined;
1047
+ return delta['value'];
1048
+ }
1049
+ function getDeltaUint(response, key) {
1050
+ const delta = getDelta(response, key);
1051
+ if (delta === undefined)
1052
+ return undefined;
1053
+ return BigInt(delta['uint']);
1054
+ }
1055
+ function getDeltaBytes(response, key) {
1056
+ const delta = getDelta(response, key);
1057
+ if (delta === undefined)
1058
+ return undefined;
1059
+ return decodeBase64(delta['bytes']);
1060
+ }
1061
+ function toUnix(date) {
1062
+ return Math.floor(date.getTime() / 1000);
1063
+ }
1064
+ function fromUnix(timestamp) {
1065
+ return new Date(timestamp * 1000);
1066
+ }
1067
+ var algosdk_2 = __webpack_require__(9709);
1068
+ Object.defineProperty(exports, "encodeAddress", ({ enumerable: true, get: function () { return algosdk_2.encodeAddress; } }));
1069
+ Object.defineProperty(exports, "decodeAddress", ({ enumerable: true, get: function () { return algosdk_2.decodeAddress; } }));
1070
+
1071
+
1072
+ /***/ }),
1073
+
1074
+ /***/ 9181:
1075
+ /***/ ((__unused_webpack_module, exports) => {
1076
+
1077
+
1078
+ //--import { Asset } from "@ultrade/shared/db/entities/market/asset.entity";
1079
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1080
+ exports.AmmBucketKeys = exports.VALIDATOR_APP_ID = exports.CONTRACT_VERSION = exports.AmmForeignResources = exports.AmmChars = exports.AmmIds = exports.PoolType = void 0;
1081
+ var PoolType;
1082
+ (function (PoolType) {
1083
+ PoolType["STABLE"] = "stable";
1084
+ PoolType["CPMM"] = "constant_product";
1085
+ PoolType["LEND"] = "lending";
1086
+ PoolType["NANO"] = "nano";
1087
+ PoolType["MVNANO"] = "mvnano";
1088
+ })(PoolType || (exports.PoolType = PoolType = {}));
1089
+ var AmmIds;
1090
+ (function (AmmIds) {
1091
+ AmmIds[AmmIds["ultrade"] = 0] = "ultrade";
1092
+ AmmIds[AmmIds["tinyman"] = 1] = "tinyman";
1093
+ AmmIds[AmmIds["pactfi"] = 2] = "pactfi";
1094
+ AmmIds[AmmIds["humble"] = 3] = "humble";
1095
+ AmmIds[AmmIds["algofi"] = 4] = "algofi";
1096
+ })(AmmIds || (exports.AmmIds = AmmIds = {}));
1097
+ var AmmChars;
1098
+ (function (AmmChars) {
1099
+ AmmChars["ultrade"] = "U";
1100
+ AmmChars["tinyman"] = "T";
1101
+ AmmChars["pactfi"] = "P";
1102
+ AmmChars["humble"] = "H";
1103
+ AmmChars["algofi"] = "A";
1104
+ })(AmmChars || (exports.AmmChars = AmmChars = {}));
1105
+ var AmmForeignResources;
1106
+ (function (AmmForeignResources) {
1107
+ AmmForeignResources[AmmForeignResources["ultrade"] = 1] = "ultrade";
1108
+ AmmForeignResources[AmmForeignResources["tinyman"] = 2] = "tinyman";
1109
+ AmmForeignResources[AmmForeignResources["pactfi"] = 1] = "pactfi";
1110
+ AmmForeignResources[AmmForeignResources["humble"] = 1] = "humble";
1111
+ AmmForeignResources[AmmForeignResources["algofi"] = 2] = "algofi";
1112
+ })(AmmForeignResources || (exports.AmmForeignResources = AmmForeignResources = {}));
1113
+ exports.CONTRACT_VERSION = {
1114
+ V1_1: 'v1_1',
1115
+ V2: 'v2',
1116
+ };
1117
+ exports.VALIDATOR_APP_ID = {
1118
+ [exports.CONTRACT_VERSION.V1_1]: {
1119
+ testnet: 62368684,
1120
+ mainnet: 552635992,
1121
+ },
1122
+ [exports.CONTRACT_VERSION.V2]: {
1123
+ testnet: 148607000,
1124
+ mainnet: 1002541853,
1125
+ },
1126
+ };
1127
+ var AmmBucketKeys;
1128
+ (function (AmmBucketKeys) {
1129
+ AmmBucketKeys["ASSETS"] = "assets.json";
1130
+ AmmBucketKeys["TOP_ASSETS"] = "topAssets.json";
1131
+ })(AmmBucketKeys || (exports.AmmBucketKeys = AmmBucketKeys = {}));
1132
+
1133
+
1134
+ /***/ }),
1135
+
1136
+ /***/ 9709:
1137
+ /***/ ((module) => {
1138
+
1139
+ module.exports = __WEBPACK_EXTERNAL_MODULE__9709__;
1140
+
1141
+ /***/ }),
1142
+
1143
+ /***/ 9730:
1144
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1145
+
1146
+
1147
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
1148
+ if (k2 === undefined) k2 = k;
1149
+ var desc = Object.getOwnPropertyDescriptor(m, k);
1150
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1151
+ desc = { enumerable: true, get: function() { return m[k]; } };
1152
+ }
1153
+ Object.defineProperty(o, k2, desc);
1154
+ }) : (function(o, m, k, k2) {
1155
+ if (k2 === undefined) k2 = k;
1156
+ o[k2] = m[k];
1157
+ }));
1158
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
1159
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1160
+ };
1161
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1162
+ exports.sortKeysInObject = sortKeysInObject;
1163
+ exports.round2 = round2;
1164
+ __exportStar(__webpack_require__(5910), exports);
1165
+ __exportStar(__webpack_require__(865), exports);
1166
+ __exportStar(__webpack_require__(839), exports);
1167
+ function sortKeysInObject(o) {
1168
+ return Object.keys(o).sort().reduce((acc, key) => ({ ...acc, [key]: o[key] }), {});
1169
+ }
1170
+ function round2(val) { return Math.round(val * 100) / 100; }
1171
+
1172
+
1173
+ /***/ })
1174
+
1175
+ /******/ });
1176
+ /************************************************************************/
1177
+ /******/ // The module cache
1178
+ /******/ var __webpack_module_cache__ = {};
1179
+ /******/
1180
+ /******/ // The require function
1181
+ /******/ function __webpack_require__(moduleId) {
1182
+ /******/ // Check if module is in cache
1183
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
1184
+ /******/ if (cachedModule !== undefined) {
1185
+ /******/ return cachedModule.exports;
1186
+ /******/ }
1187
+ /******/ // Create a new module (and put it into the cache)
1188
+ /******/ var module = __webpack_module_cache__[moduleId] = {
1189
+ /******/ // no module.id needed
1190
+ /******/ // no module.loaded needed
1191
+ /******/ exports: {}
1192
+ /******/ };
1193
+ /******/
1194
+ /******/ // Execute the module function
1195
+ /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
1196
+ /******/
1197
+ /******/ // Return the exports of the module
1198
+ /******/ return module.exports;
1199
+ /******/ }
1200
+ /******/
1201
+ /************************************************************************/
1202
+ /******/
1203
+ /******/ // startup
1204
+ /******/ // Load entry module and return exports
1205
+ /******/ // This entry module is referenced by other modules so it can't be inlined
1206
+ /******/ var __webpack_exports__ = __webpack_require__(6897);
1207
+ /******/
1208
+ /******/ return __webpack_exports__;
1209
+ /******/ })()
1210
+ ;
1211
+ });