@ultrade/shared 1.0.6 → 1.0.8

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