@ultrade/shared 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/auth.helper.js +16 -37
- package/dist/common/awsKms.js +9 -19
- package/dist/common/big-number.helper.d.ts +0 -3
- package/dist/common/big-number.helper.js +7 -26
- package/dist/common/index.js +65 -107
- package/dist/common/indexer.helper.js +9 -19
- package/dist/common/logger.js +6 -16
- package/dist/common/mappers/codexAsset.mapper.js +3 -14
- package/dist/common/mappers/codexBalance.mapper.js +3 -14
- package/dist/common/mappers/index.js +15 -35
- package/dist/common/mappers/trade.mapper.js +15 -35
- package/dist/common/migration.helpers.js +3 -14
- package/dist/common/redis.helper.js +20 -40
- package/dist/common/secret.helper.js +11 -26
- package/dist/common/timestamp.helper.js +3 -14
- package/dist/common/utils/assert.js +3 -14
- package/dist/common/utils/decode.js +6 -17
- package/dist/common/utils/index.js +4 -15
- package/dist/common/utils/social.js +3 -14
- package/dist/common/utils/stat.js +7 -26
- package/dist/constants/index.js +3 -14
- package/dist/enums/index.js +3 -14
- package/dist/helpers/Encoding.js +10 -31
- package/dist/helpers/algo.helper.js +44 -82
- package/dist/helpers/assert.helper.js +13 -34
- package/dist/helpers/atomic.helper.d.ts +0 -17
- package/dist/helpers/atomic.helper.js +7 -43
- package/dist/helpers/balance.helper.js +71 -166
- package/dist/helpers/codex/common.helper.js +71 -149
- package/dist/helpers/codex/index.js +71 -149
- package/dist/helpers/codex/mbr.helper.js +71 -149
- package/dist/helpers/codex/mna.helper.js +71 -149
- package/dist/helpers/codex/order.helper.js +71 -149
- package/dist/helpers/codex/setGlobal.helper.js +73 -151
- package/dist/helpers/codex/transfer.helper.js +71 -149
- package/dist/helpers/codex/txn.helper.js +71 -149
- package/dist/helpers/codex.helper.js +71 -149
- package/dist/helpers/email.helper.js +6 -17
- package/dist/helpers/eth.helper.js +71 -149
- package/dist/helpers/hummingbots.helper.js +11 -22
- package/dist/helpers/index.js +31 -58
- package/dist/helpers/interval.helpers.js +10 -21
- package/dist/helpers/liquidity.helper.js +6 -17
- package/dist/helpers/order.helper.js +3 -14
- package/dist/helpers/pair.helper.js +3 -14
- package/dist/helpers/pointSystem.helper.js +15 -33
- package/dist/helpers/ticker.helpers.js +7 -27
- package/dist/helpers/vaa.helper.js +97 -175
- package/dist/helpers/withdraw.helper.js +97 -167
- package/dist/interfaces/db/market/index.d.ts +34 -6
- package/dist/interfaces/db/white_label/index.d.ts +3 -3
- package/dist/interfaces/index.js +11 -14
- package/dist/types/index.js +15 -33
- package/package.json +16 -8
- package/dist/baseModel/base.model.d.ts +0 -26
- package/dist/baseModel/index.d.ts +0 -2
- package/dist/helpers/api.helper.d.ts +0 -16
- package/dist/helpers/api.helper.js +0 -1652
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
-
module.exports = factory(require("algosdk"));
|
|
4
|
-
else if(typeof define === 'function' && define.amd)
|
|
5
|
-
define(["algosdk"], factory);
|
|
6
|
-
else {
|
|
7
|
-
var a = typeof exports === 'object' ? factory(require("algosdk")) : factory(root["algosdk"]);
|
|
8
|
-
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
9
|
-
}
|
|
10
|
-
})(global, (__WEBPACK_EXTERNAL_MODULE__9709__) => {
|
|
11
|
-
return /******/ (() => { // webpackBootstrap
|
|
1
|
+
/******/ (() => { // webpackBootstrap
|
|
12
2
|
/******/ "use strict";
|
|
13
3
|
/******/ var __webpack_modules__ = ({
|
|
14
4
|
|
|
@@ -53,7 +43,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
53
43
|
exports.printUnpackedLocalData = exports.getAccounInfoFormLocalStorage = void 0;
|
|
54
44
|
exports.unpackData = unpackData;
|
|
55
45
|
exports.decodeString = decodeString;
|
|
56
|
-
const algosdk_1 = __importStar(__webpack_require__(
|
|
46
|
+
const algosdk_1 = __importStar(__webpack_require__(8115));
|
|
57
47
|
const orderByteSize = 28;
|
|
58
48
|
const getAccounInfoFormLocalStorage = (localState) => {
|
|
59
49
|
const uintArray = Buffer.from(localState, 'base64');
|
|
@@ -160,10 +150,10 @@ exports.printUnpackedLocalData = printUnpackedLocalData;
|
|
|
160
150
|
|
|
161
151
|
/***/ }),
|
|
162
152
|
|
|
163
|
-
/***/
|
|
153
|
+
/***/ 8115:
|
|
164
154
|
/***/ ((module) => {
|
|
165
155
|
|
|
166
|
-
module.exports =
|
|
156
|
+
module.exports = require("algosdk");
|
|
167
157
|
|
|
168
158
|
/***/ })
|
|
169
159
|
|
|
@@ -199,8 +189,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__9709__;
|
|
|
199
189
|
/******/ // Load entry module and return exports
|
|
200
190
|
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
201
191
|
/******/ var __webpack_exports__ = __webpack_require__(3450);
|
|
192
|
+
/******/ module.exports = __webpack_exports__;
|
|
202
193
|
/******/
|
|
203
|
-
/******/ return __webpack_exports__;
|
|
204
194
|
/******/ })()
|
|
205
|
-
;
|
|
206
|
-
});
|
|
195
|
+
;
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
-
module.exports = factory();
|
|
4
|
-
else if(typeof define === 'function' && define.amd)
|
|
5
|
-
define([], factory);
|
|
6
|
-
else {
|
|
7
|
-
var a = factory();
|
|
8
|
-
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
9
|
-
}
|
|
10
|
-
})(global, () => {
|
|
11
|
-
return /******/ (() => { // webpackBootstrap
|
|
1
|
+
/******/ (() => { // webpackBootstrap
|
|
12
2
|
/******/ "use strict";
|
|
13
3
|
var __webpack_exports__ = {};
|
|
14
4
|
// This entry needs to be wrapped in an IIFE because it uses a non-standard name for the exports (exports).
|
|
@@ -108,7 +98,7 @@ function removeField(obj, fieldToRemove) {
|
|
|
108
98
|
.filter(([key]) => key !== fieldToRemove)
|
|
109
99
|
.map(([key, value]) => [key, removeField(value, fieldToRemove)]));
|
|
110
100
|
}
|
|
111
|
-
return obj;
|
|
101
|
+
return obj;
|
|
112
102
|
}
|
|
113
103
|
function removeUndefined(obj) {
|
|
114
104
|
return Object.fromEntries(Object.entries(obj).filter(([, value]) => value !== undefined));
|
|
@@ -116,7 +106,6 @@ function removeUndefined(obj) {
|
|
|
116
106
|
|
|
117
107
|
})();
|
|
118
108
|
|
|
119
|
-
|
|
109
|
+
module.exports = __webpack_exports__;
|
|
120
110
|
/******/ })()
|
|
121
|
-
;
|
|
122
|
-
});
|
|
111
|
+
;
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
-
module.exports = factory();
|
|
4
|
-
else if(typeof define === 'function' && define.amd)
|
|
5
|
-
define([], factory);
|
|
6
|
-
else {
|
|
7
|
-
var a = factory();
|
|
8
|
-
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
9
|
-
}
|
|
10
|
-
})(global, () => {
|
|
11
|
-
return /******/ (() => { // webpackBootstrap
|
|
1
|
+
/******/ (() => { // webpackBootstrap
|
|
12
2
|
/******/ "use strict";
|
|
13
3
|
var __webpack_exports__ = {};
|
|
14
4
|
// This entry needs to be wrapped in an IIFE because it uses a non-standard name for the exports (exports).
|
|
@@ -24,7 +14,6 @@ exports.getGlobalPointSystemId = getGlobalPointSystemId;
|
|
|
24
14
|
|
|
25
15
|
})();
|
|
26
16
|
|
|
27
|
-
|
|
17
|
+
module.exports = __webpack_exports__;
|
|
28
18
|
/******/ })()
|
|
29
|
-
;
|
|
30
|
-
});
|
|
19
|
+
;
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
-
module.exports = factory(require("bignumber.js"));
|
|
4
|
-
else if(typeof define === 'function' && define.amd)
|
|
5
|
-
define(["bignumber.js"], factory);
|
|
6
|
-
else {
|
|
7
|
-
var a = typeof exports === 'object' ? factory(require("bignumber.js")) : factory(root["bignumber.js"]);
|
|
8
|
-
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
9
|
-
}
|
|
10
|
-
})(global, (__WEBPACK_EXTERNAL_MODULE__6168__) => {
|
|
11
|
-
return /******/ (() => { // webpackBootstrap
|
|
1
|
+
/******/ (() => { // webpackBootstrap
|
|
12
2
|
/******/ "use strict";
|
|
13
3
|
/******/ var __webpack_modules__ = ({
|
|
14
4
|
|
|
@@ -42,7 +32,7 @@ exports.bn_operation = bn_operation;
|
|
|
42
32
|
exports.roundNumber = roundNumber;
|
|
43
33
|
exports.convertFromBaseUnits = convertFromBaseUnits;
|
|
44
34
|
exports.convertToBaseUnits = convertToBaseUnits;
|
|
45
|
-
const bignumber_js_1 = __importDefault(__webpack_require__(
|
|
35
|
+
const bignumber_js_1 = __importDefault(__webpack_require__(4978));
|
|
46
36
|
bignumber_js_1.default.config({ DECIMAL_PLACES: 40, EXPONENTIAL_AT: 45 });
|
|
47
37
|
var Operations;
|
|
48
38
|
(function (Operations) {
|
|
@@ -60,7 +50,6 @@ var Operations;
|
|
|
60
50
|
function absolute(value) {
|
|
61
51
|
let x = new bignumber_js_1.default(value);
|
|
62
52
|
const res = x.abs().toString();
|
|
63
|
-
// console.log('Absolute value', { value, res })
|
|
64
53
|
return res;
|
|
65
54
|
}
|
|
66
55
|
function ceil(value) {
|
|
@@ -200,27 +189,20 @@ function roundNumber({ decimalPlaces = 0 }, x) {
|
|
|
200
189
|
}
|
|
201
190
|
function convertFromBaseUnits(assetDecimals, quantity) {
|
|
202
191
|
const decimals = Number(assetDecimals);
|
|
203
|
-
return roundNumber({ decimalPlaces: decimals },
|
|
204
|
-
// eslint-disable-next-line no-magic-numbers
|
|
205
|
-
Math.pow(10, -decimals) * Number(quantity));
|
|
192
|
+
return roundNumber({ decimalPlaces: decimals }, Math.pow(10, -decimals) * Number(quantity));
|
|
206
193
|
}
|
|
207
|
-
/**
|
|
208
|
-
* Computs quantity * 10^(assetDecimals) and rounds the result
|
|
209
|
-
*/
|
|
210
194
|
function convertToBaseUnits(assetDecimals, quantity) {
|
|
211
|
-
// eslint-disable-next-line no-magic-numbers
|
|
212
195
|
const baseAmount = Math.pow(10, Number(assetDecimals)) * Number(quantity);
|
|
213
|
-
// make sure the final value is an integer. This prevents this kind of computation errors: 0.0012 * 100000 = 119.99999999999999 and rounds this result into 120
|
|
214
196
|
return roundNumber({ decimalPlaces: 0 }, baseAmount);
|
|
215
197
|
}
|
|
216
198
|
|
|
217
199
|
|
|
218
200
|
/***/ }),
|
|
219
201
|
|
|
220
|
-
/***/
|
|
202
|
+
/***/ 4978:
|
|
221
203
|
/***/ ((module) => {
|
|
222
204
|
|
|
223
|
-
module.exports =
|
|
205
|
+
module.exports = require("bignumber.js");
|
|
224
206
|
|
|
225
207
|
/***/ })
|
|
226
208
|
|
|
@@ -268,7 +250,6 @@ exports.changes24H = changes24H;
|
|
|
268
250
|
|
|
269
251
|
})();
|
|
270
252
|
|
|
271
|
-
|
|
253
|
+
module.exports = __webpack_exports__;
|
|
272
254
|
/******/ })()
|
|
273
|
-
;
|
|
274
|
-
});
|
|
255
|
+
;
|
package/dist/constants/index.js
CHANGED
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
-
module.exports = factory();
|
|
4
|
-
else if(typeof define === 'function' && define.amd)
|
|
5
|
-
define([], factory);
|
|
6
|
-
else {
|
|
7
|
-
var a = factory();
|
|
8
|
-
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
9
|
-
}
|
|
10
|
-
})(global, () => {
|
|
11
|
-
return /******/ (() => { // webpackBootstrap
|
|
1
|
+
/******/ (() => { // webpackBootstrap
|
|
12
2
|
/******/ "use strict";
|
|
13
3
|
/******/ var __webpack_modules__ = ({
|
|
14
4
|
|
|
@@ -448,8 +438,7 @@ exports.CCTP_UNIFIED_ASSETS = {
|
|
|
448
438
|
/******/ // Load entry module and return exports
|
|
449
439
|
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
450
440
|
/******/ var __webpack_exports__ = __webpack_require__(6450);
|
|
441
|
+
/******/ module.exports = __webpack_exports__;
|
|
451
442
|
/******/
|
|
452
|
-
/******/ return __webpack_exports__;
|
|
453
443
|
/******/ })()
|
|
454
|
-
;
|
|
455
|
-
});
|
|
444
|
+
;
|
package/dist/enums/index.js
CHANGED
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
-
module.exports = factory();
|
|
4
|
-
else if(typeof define === 'function' && define.amd)
|
|
5
|
-
define([], factory);
|
|
6
|
-
else {
|
|
7
|
-
var a = factory();
|
|
8
|
-
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
9
|
-
}
|
|
10
|
-
})(global, () => {
|
|
11
|
-
return /******/ (() => { // webpackBootstrap
|
|
1
|
+
/******/ (() => { // webpackBootstrap
|
|
12
2
|
/******/ "use strict";
|
|
13
3
|
/******/ var __webpack_modules__ = ({
|
|
14
4
|
|
|
@@ -886,8 +876,7 @@ __exportStar(__webpack_require__(3004), exports);
|
|
|
886
876
|
/******/ // Load entry module and return exports
|
|
887
877
|
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
888
878
|
/******/ var __webpack_exports__ = __webpack_require__(9965);
|
|
879
|
+
/******/ module.exports = __webpack_exports__;
|
|
889
880
|
/******/
|
|
890
|
-
/******/ return __webpack_exports__;
|
|
891
881
|
/******/ })()
|
|
892
|
-
;
|
|
893
|
-
});
|
|
882
|
+
;
|
package/dist/helpers/Encoding.js
CHANGED
|
@@ -1,21 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
-
module.exports = factory(require("buffer"), require("algosdk"));
|
|
4
|
-
else if(typeof define === 'function' && define.amd)
|
|
5
|
-
define(["buffer", "algosdk"], factory);
|
|
6
|
-
else {
|
|
7
|
-
var a = typeof exports === 'object' ? factory(require("buffer"), require("algosdk")) : factory(root["buffer"], root["algosdk"]);
|
|
8
|
-
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
9
|
-
}
|
|
10
|
-
})(global, (__WEBPACK_EXTERNAL_MODULE__18__, __WEBPACK_EXTERNAL_MODULE__9709__) => {
|
|
11
|
-
return /******/ (() => { // webpackBootstrap
|
|
1
|
+
/******/ (() => { // webpackBootstrap
|
|
12
2
|
/******/ "use strict";
|
|
13
3
|
/******/ var __webpack_modules__ = ({
|
|
14
4
|
|
|
15
|
-
/***/
|
|
5
|
+
/***/ 8115:
|
|
16
6
|
/***/ ((module) => {
|
|
17
7
|
|
|
18
|
-
module.exports =
|
|
8
|
+
module.exports = require("algosdk");
|
|
19
9
|
|
|
20
10
|
/***/ }),
|
|
21
11
|
|
|
@@ -74,9 +64,8 @@ exports.getDeltaUint = getDeltaUint;
|
|
|
74
64
|
exports.getDeltaBytes = getDeltaBytes;
|
|
75
65
|
exports.toUnix = toUnix;
|
|
76
66
|
exports.fromUnix = fromUnix;
|
|
77
|
-
const algosdk_1 = __importStar(__webpack_require__(
|
|
78
|
-
|
|
79
|
-
const buffer_1 = __webpack_require__(18);
|
|
67
|
+
const algosdk_1 = __importStar(__webpack_require__(8115));
|
|
68
|
+
const buffer_1 = __webpack_require__(9428);
|
|
80
69
|
function concatArrays(arrays) {
|
|
81
70
|
return arrays.reduce((a, b) => Uint8Array.from([...a, ...b]));
|
|
82
71
|
}
|
|
@@ -229,15 +218,6 @@ function encodeBase64(value) {
|
|
|
229
218
|
function decodeBase64(value) {
|
|
230
219
|
return buffer_1.Buffer.from(value, 'base64');
|
|
231
220
|
}
|
|
232
|
-
// export const sha256HashLength = 32
|
|
233
|
-
// export function sha256Hash(arr: sha512.Message): Uint8Array {
|
|
234
|
-
// return new Uint8Array(sha512.sha512_256.arrayBuffer(arr))
|
|
235
|
-
// }
|
|
236
|
-
// export function encodeApplicationAddress(id: number): Address {
|
|
237
|
-
// const APP_ID_PREFIX = Buffer.from('appID');
|
|
238
|
-
// const toBeSigned = concatArrays([APP_ID_PREFIX, encodeUint64(BigInt(id))]);
|
|
239
|
-
// return encodeAddress(sha256Hash(toBeSigned));
|
|
240
|
-
// }
|
|
241
221
|
function compareArrays(a, b) {
|
|
242
222
|
return a.length === b.length && a.reduce((equal, item, index) => equal && item === b[index], true);
|
|
243
223
|
}
|
|
@@ -265,17 +245,17 @@ function toUnix(date) {
|
|
|
265
245
|
function fromUnix(timestamp) {
|
|
266
246
|
return new Date(timestamp * 1000);
|
|
267
247
|
}
|
|
268
|
-
var algosdk_2 = __webpack_require__(
|
|
248
|
+
var algosdk_2 = __webpack_require__(8115);
|
|
269
249
|
Object.defineProperty(exports, "encodeAddress", ({ enumerable: true, get: function () { return algosdk_2.encodeAddress; } }));
|
|
270
250
|
Object.defineProperty(exports, "decodeAddress", ({ enumerable: true, get: function () { return algosdk_2.decodeAddress; } }));
|
|
271
251
|
|
|
272
252
|
|
|
273
253
|
/***/ }),
|
|
274
254
|
|
|
275
|
-
/***/
|
|
255
|
+
/***/ 9428:
|
|
276
256
|
/***/ ((module) => {
|
|
277
257
|
|
|
278
|
-
module.exports =
|
|
258
|
+
module.exports = require("buffer");
|
|
279
259
|
|
|
280
260
|
/***/ })
|
|
281
261
|
|
|
@@ -311,8 +291,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__9709__;
|
|
|
311
291
|
/******/ // Load entry module and return exports
|
|
312
292
|
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
313
293
|
/******/ var __webpack_exports__ = __webpack_require__(8593);
|
|
294
|
+
/******/ module.exports = __webpack_exports__;
|
|
314
295
|
/******/
|
|
315
|
-
/******/ return __webpack_exports__;
|
|
316
296
|
/******/ })()
|
|
317
|
-
;
|
|
318
|
-
});
|
|
297
|
+
;
|
|
@@ -1,24 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
-
module.exports = factory(require("buffer"), require("bignumber.js"), require("algosdk"));
|
|
4
|
-
else if(typeof define === 'function' && define.amd)
|
|
5
|
-
define(["buffer", "bignumber.js", "algosdk"], factory);
|
|
6
|
-
else {
|
|
7
|
-
var a = typeof exports === 'object' ? factory(require("buffer"), require("bignumber.js"), require("algosdk")) : factory(root["buffer"], root["bignumber.js"], root["algosdk"]);
|
|
8
|
-
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
9
|
-
}
|
|
10
|
-
})(global, (__WEBPACK_EXTERNAL_MODULE__18__, __WEBPACK_EXTERNAL_MODULE__6168__, __WEBPACK_EXTERNAL_MODULE__9709__) => {
|
|
11
|
-
return /******/ (() => { // webpackBootstrap
|
|
1
|
+
/******/ (() => { // webpackBootstrap
|
|
12
2
|
/******/ "use strict";
|
|
13
3
|
/******/ var __webpack_modules__ = ({
|
|
14
4
|
|
|
15
|
-
/***/ 18:
|
|
16
|
-
/***/ ((module) => {
|
|
17
|
-
|
|
18
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__18__;
|
|
19
|
-
|
|
20
|
-
/***/ }),
|
|
21
|
-
|
|
22
5
|
/***/ 573:
|
|
23
6
|
/***/ ((__unused_webpack_module, exports) => {
|
|
24
7
|
|
|
@@ -81,7 +64,6 @@ function groupTickersByInterval(tickers, newIntervalInSec, endTimeInSec) {
|
|
|
81
64
|
const newGroupedTickers = [];
|
|
82
65
|
let timestamp = endTimeInSec - newIntervalInSec;
|
|
83
66
|
let slot = null;
|
|
84
|
-
// desc direction by timestamp
|
|
85
67
|
const sortedTickers = tickers.sort((a, b) => b.t - a.t);
|
|
86
68
|
for (let i = 0; i < sortedTickers.length; i++) {
|
|
87
69
|
const element = sortedTickers[i];
|
|
@@ -195,7 +177,7 @@ exports.bn_operation = bn_operation;
|
|
|
195
177
|
exports.roundNumber = roundNumber;
|
|
196
178
|
exports.convertFromBaseUnits = convertFromBaseUnits;
|
|
197
179
|
exports.convertToBaseUnits = convertToBaseUnits;
|
|
198
|
-
const bignumber_js_1 = __importDefault(__webpack_require__(
|
|
180
|
+
const bignumber_js_1 = __importDefault(__webpack_require__(4978));
|
|
199
181
|
bignumber_js_1.default.config({ DECIMAL_PLACES: 40, EXPONENTIAL_AT: 45 });
|
|
200
182
|
var Operations;
|
|
201
183
|
(function (Operations) {
|
|
@@ -213,7 +195,6 @@ var Operations;
|
|
|
213
195
|
function absolute(value) {
|
|
214
196
|
let x = new bignumber_js_1.default(value);
|
|
215
197
|
const res = x.abs().toString();
|
|
216
|
-
// console.log('Absolute value', { value, res })
|
|
217
198
|
return res;
|
|
218
199
|
}
|
|
219
200
|
function ceil(value) {
|
|
@@ -353,17 +334,10 @@ function roundNumber({ decimalPlaces = 0 }, x) {
|
|
|
353
334
|
}
|
|
354
335
|
function convertFromBaseUnits(assetDecimals, quantity) {
|
|
355
336
|
const decimals = Number(assetDecimals);
|
|
356
|
-
return roundNumber({ decimalPlaces: decimals },
|
|
357
|
-
// eslint-disable-next-line no-magic-numbers
|
|
358
|
-
Math.pow(10, -decimals) * Number(quantity));
|
|
337
|
+
return roundNumber({ decimalPlaces: decimals }, Math.pow(10, -decimals) * Number(quantity));
|
|
359
338
|
}
|
|
360
|
-
/**
|
|
361
|
-
* Computs quantity * 10^(assetDecimals) and rounds the result
|
|
362
|
-
*/
|
|
363
339
|
function convertToBaseUnits(assetDecimals, quantity) {
|
|
364
|
-
// eslint-disable-next-line no-magic-numbers
|
|
365
340
|
const baseAmount = Math.pow(10, Number(assetDecimals)) * Number(quantity);
|
|
366
|
-
// make sure the final value is an integer. This prevents this kind of computation errors: 0.0012 * 100000 = 119.99999999999999 and rounds this result into 120
|
|
367
341
|
return roundNumber({ decimalPlaces: 0 }, baseAmount);
|
|
368
342
|
}
|
|
369
343
|
|
|
@@ -416,6 +390,13 @@ var HummingbotInstanceStatus;
|
|
|
416
390
|
})(HummingbotInstanceStatus || (exports.HummingbotInstanceStatus = HummingbotInstanceStatus = {}));
|
|
417
391
|
|
|
418
392
|
|
|
393
|
+
/***/ }),
|
|
394
|
+
|
|
395
|
+
/***/ 4978:
|
|
396
|
+
/***/ ((module) => {
|
|
397
|
+
|
|
398
|
+
module.exports = require("bignumber.js");
|
|
399
|
+
|
|
419
400
|
/***/ }),
|
|
420
401
|
|
|
421
402
|
/***/ 5386:
|
|
@@ -452,25 +433,25 @@ function getDatepartValue(value) {
|
|
|
452
433
|
if (!units) {
|
|
453
434
|
return mapWithTimeframe(datepart, 1);
|
|
454
435
|
}
|
|
455
|
-
if (datepart === 'minute' && units % (7 * 24 * 60) === 0) {
|
|
436
|
+
if (datepart === 'minute' && units % (7 * 24 * 60) === 0) {
|
|
456
437
|
return mapWithTimeframe('week', units / (7 * 24 * 60));
|
|
457
438
|
}
|
|
458
|
-
if (datepart === 'minute' && units % (24 * 60) === 0) {
|
|
439
|
+
if (datepart === 'minute' && units % (24 * 60) === 0) {
|
|
459
440
|
return mapWithTimeframe('day', units / (24 * 60));
|
|
460
441
|
}
|
|
461
|
-
if (datepart === 'minute' && units % 60 === 0) {
|
|
442
|
+
if (datepart === 'minute' && units % 60 === 0) {
|
|
462
443
|
return mapWithTimeframe('hour', units / 60);
|
|
463
444
|
}
|
|
464
|
-
if (datepart === 'hour' && units % (7 * 24) === 0) {
|
|
445
|
+
if (datepart === 'hour' && units % (7 * 24) === 0) {
|
|
465
446
|
return mapWithTimeframe('week', units / (7 * 24));
|
|
466
447
|
}
|
|
467
|
-
if (datepart === 'hour' && units % 24 === 0) {
|
|
448
|
+
if (datepart === 'hour' && units % 24 === 0) {
|
|
468
449
|
return mapWithTimeframe(units === 24 ? 'hour' : 'day', units === 24 ? 24 : units / 24);
|
|
469
450
|
}
|
|
470
|
-
if (datepart === 'day' && units % 7 === 0) {
|
|
451
|
+
if (datepart === 'day' && units % 7 === 0) {
|
|
471
452
|
return mapWithTimeframe('week', units / 7);
|
|
472
453
|
}
|
|
473
|
-
if (datepart === 'month' && units % 12 === 0) {
|
|
454
|
+
if (datepart === 'month' && units % 12 === 0) {
|
|
474
455
|
return mapWithTimeframe('year', units / 12);
|
|
475
456
|
}
|
|
476
457
|
return mapWithTimeframe(datepart, units);
|
|
@@ -519,13 +500,6 @@ function mapDatepartToTimeframe(datepart, value) {
|
|
|
519
500
|
}
|
|
520
501
|
|
|
521
502
|
|
|
522
|
-
/***/ }),
|
|
523
|
-
|
|
524
|
-
/***/ 6168:
|
|
525
|
-
/***/ ((module) => {
|
|
526
|
-
|
|
527
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__6168__;
|
|
528
|
-
|
|
529
503
|
/***/ }),
|
|
530
504
|
|
|
531
505
|
/***/ 6897:
|
|
@@ -538,7 +512,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
538
512
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
539
513
|
exports.verifySignature = exports.decodeAndNormalizeAddress = exports.isAssetOptedIn = exports.getTxnParams = exports.getBoxByName = exports.getAppBoxes = exports.getAppGlobalState = exports.getAccountAssetBalances = exports.createBoxes = void 0;
|
|
540
514
|
exports.decodeStateArray = decodeStateArray;
|
|
541
|
-
const algosdk_1 = __importDefault(__webpack_require__(
|
|
515
|
+
const algosdk_1 = __importDefault(__webpack_require__(8115));
|
|
542
516
|
const Encoding_1 = __webpack_require__(8593);
|
|
543
517
|
const helpers_1 = __webpack_require__(9730);
|
|
544
518
|
const createBoxes = (appIndex, foreignApps) => {
|
|
@@ -598,7 +572,6 @@ const getAppBoxes = async (algodClient, appId) => {
|
|
|
598
572
|
exports.getAppBoxes = getAppBoxes;
|
|
599
573
|
const getBoxByName = async (algoClient, appId, boxName) => {
|
|
600
574
|
try {
|
|
601
|
-
// console.log('Get box by name', boxName);
|
|
602
575
|
const { value } = await algoClient.getApplicationBoxByName(appId, boxName).do();
|
|
603
576
|
const box = value;
|
|
604
577
|
return box;
|
|
@@ -781,23 +754,19 @@ var SmallTimeframeEnum;
|
|
|
781
754
|
SmallTimeframeEnum["last_year"] = "last_year";
|
|
782
755
|
})(SmallTimeframeEnum || (exports.SmallTimeframeEnum = SmallTimeframeEnum = {}));
|
|
783
756
|
class PairsQueryDto {
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
this.page = 1;
|
|
790
|
-
}
|
|
757
|
+
timeRange = SmallTimeframeEnum.last_30_days;
|
|
758
|
+
sortBy = 'volume_usd';
|
|
759
|
+
order = 'desc';
|
|
760
|
+
limit = 20;
|
|
761
|
+
page = 1;
|
|
791
762
|
}
|
|
792
763
|
exports.PairsQueryDto = PairsQueryDto;
|
|
793
764
|
class UsersQueryDto {
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
this.page = 1;
|
|
800
|
-
}
|
|
765
|
+
timeRange = SmallTimeframeEnum.last_30_days;
|
|
766
|
+
sortBy = 'volume_usd';
|
|
767
|
+
order = 'desc';
|
|
768
|
+
limit = 20;
|
|
769
|
+
page = 1;
|
|
801
770
|
}
|
|
802
771
|
exports.UsersQueryDto = UsersQueryDto;
|
|
803
772
|
var StatisticTypeQuery;
|
|
@@ -808,14 +777,19 @@ var StatisticTypeQuery;
|
|
|
808
777
|
StatisticTypeQuery["dau"] = "dau";
|
|
809
778
|
})(StatisticTypeQuery || (exports.StatisticTypeQuery = StatisticTypeQuery = {}));
|
|
810
779
|
class ChartQueryDto {
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
this.timeRange = SmallTimeframeEnum.last_7_days;
|
|
814
|
-
}
|
|
780
|
+
type = StatisticTypeQuery.volume;
|
|
781
|
+
timeRange = SmallTimeframeEnum.last_7_days;
|
|
815
782
|
}
|
|
816
783
|
exports.ChartQueryDto = ChartQueryDto;
|
|
817
784
|
|
|
818
785
|
|
|
786
|
+
/***/ }),
|
|
787
|
+
|
|
788
|
+
/***/ 8115:
|
|
789
|
+
/***/ ((module) => {
|
|
790
|
+
|
|
791
|
+
module.exports = require("algosdk");
|
|
792
|
+
|
|
819
793
|
/***/ }),
|
|
820
794
|
|
|
821
795
|
/***/ 8593:
|
|
@@ -873,9 +847,8 @@ exports.getDeltaUint = getDeltaUint;
|
|
|
873
847
|
exports.getDeltaBytes = getDeltaBytes;
|
|
874
848
|
exports.toUnix = toUnix;
|
|
875
849
|
exports.fromUnix = fromUnix;
|
|
876
|
-
const algosdk_1 = __importStar(__webpack_require__(
|
|
877
|
-
|
|
878
|
-
const buffer_1 = __webpack_require__(18);
|
|
850
|
+
const algosdk_1 = __importStar(__webpack_require__(8115));
|
|
851
|
+
const buffer_1 = __webpack_require__(9428);
|
|
879
852
|
function concatArrays(arrays) {
|
|
880
853
|
return arrays.reduce((a, b) => Uint8Array.from([...a, ...b]));
|
|
881
854
|
}
|
|
@@ -1028,15 +1001,6 @@ function encodeBase64(value) {
|
|
|
1028
1001
|
function decodeBase64(value) {
|
|
1029
1002
|
return buffer_1.Buffer.from(value, 'base64');
|
|
1030
1003
|
}
|
|
1031
|
-
// export const sha256HashLength = 32
|
|
1032
|
-
// export function sha256Hash(arr: sha512.Message): Uint8Array {
|
|
1033
|
-
// return new Uint8Array(sha512.sha512_256.arrayBuffer(arr))
|
|
1034
|
-
// }
|
|
1035
|
-
// export function encodeApplicationAddress(id: number): Address {
|
|
1036
|
-
// const APP_ID_PREFIX = Buffer.from('appID');
|
|
1037
|
-
// const toBeSigned = concatArrays([APP_ID_PREFIX, encodeUint64(BigInt(id))]);
|
|
1038
|
-
// return encodeAddress(sha256Hash(toBeSigned));
|
|
1039
|
-
// }
|
|
1040
1004
|
function compareArrays(a, b) {
|
|
1041
1005
|
return a.length === b.length && a.reduce((equal, item, index) => equal && item === b[index], true);
|
|
1042
1006
|
}
|
|
@@ -1064,7 +1028,7 @@ function toUnix(date) {
|
|
|
1064
1028
|
function fromUnix(timestamp) {
|
|
1065
1029
|
return new Date(timestamp * 1000);
|
|
1066
1030
|
}
|
|
1067
|
-
var algosdk_2 = __webpack_require__(
|
|
1031
|
+
var algosdk_2 = __webpack_require__(8115);
|
|
1068
1032
|
Object.defineProperty(exports, "encodeAddress", ({ enumerable: true, get: function () { return algosdk_2.encodeAddress; } }));
|
|
1069
1033
|
Object.defineProperty(exports, "decodeAddress", ({ enumerable: true, get: function () { return algosdk_2.decodeAddress; } }));
|
|
1070
1034
|
|
|
@@ -1075,7 +1039,6 @@ Object.defineProperty(exports, "decodeAddress", ({ enumerable: true, get: functi
|
|
|
1075
1039
|
/***/ ((__unused_webpack_module, exports) => {
|
|
1076
1040
|
|
|
1077
1041
|
|
|
1078
|
-
//--import { Asset } from "@ultrade/shared/db/entities/market/asset.entity";
|
|
1079
1042
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1080
1043
|
exports.AmmBucketKeys = exports.VALIDATOR_APP_ID = exports.CONTRACT_VERSION = exports.AmmForeignResources = exports.AmmChars = exports.AmmIds = exports.PoolType = void 0;
|
|
1081
1044
|
var PoolType;
|
|
@@ -1133,10 +1096,10 @@ var AmmBucketKeys;
|
|
|
1133
1096
|
|
|
1134
1097
|
/***/ }),
|
|
1135
1098
|
|
|
1136
|
-
/***/
|
|
1099
|
+
/***/ 9428:
|
|
1137
1100
|
/***/ ((module) => {
|
|
1138
1101
|
|
|
1139
|
-
module.exports =
|
|
1102
|
+
module.exports = require("buffer");
|
|
1140
1103
|
|
|
1141
1104
|
/***/ }),
|
|
1142
1105
|
|
|
@@ -1204,8 +1167,7 @@ function round2(val) { return Math.round(val * 100) / 100; }
|
|
|
1204
1167
|
/******/ // Load entry module and return exports
|
|
1205
1168
|
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
1206
1169
|
/******/ var __webpack_exports__ = __webpack_require__(6897);
|
|
1170
|
+
/******/ module.exports = __webpack_exports__;
|
|
1207
1171
|
/******/
|
|
1208
|
-
/******/ return __webpack_exports__;
|
|
1209
1172
|
/******/ })()
|
|
1210
|
-
;
|
|
1211
|
-
});
|
|
1173
|
+
;
|