@ultrade/shared 1.0.5 → 1.0.7

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