@ultrade/shared 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/dist/baseModel/base.model.d.ts +26 -0
  2. package/dist/baseModel/index.d.ts +2 -0
  3. package/dist/common/auth.helper.d.ts +4 -0
  4. package/dist/common/auth.helper.js +367 -0
  5. package/dist/common/awsKms.d.ts +2 -0
  6. package/dist/common/awsKms.js +265 -0
  7. package/dist/common/big-number.helper.d.ts +38 -0
  8. package/dist/common/big-number.helper.js +263 -0
  9. package/dist/common/index.d.ts +11 -0
  10. package/dist/common/index.js +2541 -0
  11. package/dist/common/indexer.helper.d.ts +2 -0
  12. package/dist/common/indexer.helper.js +387 -0
  13. package/dist/common/logger.d.ts +32 -0
  14. package/dist/common/logger.js +188 -0
  15. package/dist/common/mappers/codexAsset.mapper.d.ts +2 -0
  16. package/dist/common/mappers/codexAsset.mapper.js +40 -0
  17. package/dist/common/mappers/codexBalance.mapper.d.ts +2 -0
  18. package/dist/common/mappers/codexBalance.mapper.js +38 -0
  19. package/dist/common/mappers/index.d.ts +3 -0
  20. package/dist/common/mappers/index.js +1421 -0
  21. package/dist/common/mappers/trade.mapper.d.ts +6 -0
  22. package/dist/common/mappers/trade.mapper.js +1343 -0
  23. package/dist/common/migration.helpers.d.ts +4 -0
  24. package/dist/common/migration.helpers.js +44 -0
  25. package/dist/common/redis.helper.d.ts +27 -0
  26. package/dist/common/redis.helper.js +269 -0
  27. package/dist/common/secret.helper.d.ts +28 -0
  28. package/dist/common/secret.helper.js +144 -0
  29. package/dist/common/timestamp.helper.d.ts +1 -0
  30. package/dist/common/timestamp.helper.js +41 -0
  31. package/dist/common/utils/assert.d.ts +1 -0
  32. package/dist/common/utils/assert.js +32 -0
  33. package/dist/common/utils/decode.d.ts +5 -0
  34. package/dist/common/utils/decode.js +206 -0
  35. package/dist/common/utils/index.d.ts +9 -0
  36. package/dist/common/utils/index.js +122 -0
  37. package/dist/common/utils/social.d.ts +1 -0
  38. package/dist/common/utils/social.js +30 -0
  39. package/dist/common/utils/stat.d.ts +1 -0
  40. package/dist/common/utils/stat.js +274 -0
  41. package/dist/constants/allowedUrls.d.ts +1 -0
  42. package/dist/constants/auth.d.ts +2 -0
  43. package/dist/constants/cctp.d.ts +3 -0
  44. package/dist/constants/codex.d.ts +11 -0
  45. package/dist/constants/env.d.ts +6 -0
  46. package/dist/constants/index.d.ts +7 -0
  47. package/dist/constants/index.js +455 -0
  48. package/dist/constants/queue.d.ts +39 -0
  49. package/dist/constants/response.d.ts +82 -0
  50. package/dist/constants/settings.d.ts +2 -0
  51. package/dist/constants/social.d.ts +3 -0
  52. package/dist/constants/withdrawalWalletsMessage.d.ts +1 -0
  53. package/dist/enums/chains.enum.d.ts +50 -0
  54. package/dist/enums/db/account/index.d.ts +19 -0
  55. package/dist/enums/db/affiliate.enum.d.ts +7 -0
  56. package/dist/enums/db/available-pair-settings.enum.d.ts +12 -0
  57. package/dist/enums/db/chains.d.ts +30 -0
  58. package/dist/enums/db/common.enum.d.ts +4 -0
  59. package/dist/enums/db/component/index.d.ts +22 -0
  60. package/dist/enums/db/index.d.ts +21 -0
  61. package/dist/enums/db/market-maker.enum.d.ts +15 -0
  62. package/dist/enums/db/notification-center/userNotification.enum.d.ts +36 -0
  63. package/dist/enums/db/order-side.enum.d.ts +5 -0
  64. package/dist/enums/db/order-status.enum.d.ts +8 -0
  65. package/dist/enums/db/order-type.enum.d.ts +7 -0
  66. package/dist/enums/db/pending-actions.enum.d.ts +6 -0
  67. package/dist/enums/db/relayer.enum.d.ts +23 -0
  68. package/dist/enums/db/setting-type.enum.d.ts +8 -0
  69. package/dist/enums/db/social-action.enum.d.ts +24 -0
  70. package/dist/enums/db/social-prompt.enum.d.ts +8 -0
  71. package/dist/enums/db/social.enum.d.ts +10 -0
  72. package/dist/enums/db/state-type.enum.d.ts +9 -0
  73. package/dist/enums/db/trade.enums.d.ts +10 -0
  74. package/dist/enums/db/tradingKeyType.enum.d.ts +4 -0
  75. package/dist/enums/db/upgrade.enum.d.ts +5 -0
  76. package/dist/enums/db/withdrawal-wallet.enum.d.ts +5 -0
  77. package/dist/enums/index.d.ts +5 -0
  78. package/dist/enums/index.js +893 -0
  79. package/dist/enums/maintenanceMode.enum.d.ts +10 -0
  80. package/dist/enums/notification.enum.d.ts +7 -0
  81. package/dist/enums/social.enum.d.ts +10 -0
  82. package/dist/helpers/Encoding.d.ts +33 -0
  83. package/dist/helpers/Encoding.js +318 -0
  84. package/dist/helpers/algo.helper.d.ts +14 -0
  85. package/dist/helpers/algo.helper.js +1211 -0
  86. package/dist/helpers/api.helper.d.ts +16 -0
  87. package/dist/helpers/api.helper.js +1652 -0
  88. package/dist/helpers/assert.helper.d.ts +10 -0
  89. package/dist/helpers/assert.helper.js +1677 -0
  90. package/dist/helpers/atomic.helper.d.ts +21 -0
  91. package/dist/helpers/atomic.helper.js +712 -0
  92. package/dist/helpers/balance.helper.d.ts +13 -0
  93. package/dist/helpers/balance.helper.js +4330 -0
  94. package/dist/helpers/codex/common.helper.d.ts +24 -0
  95. package/dist/helpers/codex/common.helper.js +4246 -0
  96. package/dist/helpers/codex/index.d.ts +6 -0
  97. package/dist/helpers/codex/index.js +4246 -0
  98. package/dist/helpers/codex/mbr.helper.d.ts +6 -0
  99. package/dist/helpers/codex/mbr.helper.js +4246 -0
  100. package/dist/helpers/codex/mna.helper.d.ts +2 -0
  101. package/dist/helpers/codex/mna.helper.js +4246 -0
  102. package/dist/helpers/codex/order.helper.d.ts +6 -0
  103. package/dist/helpers/codex/order.helper.js +4246 -0
  104. package/dist/helpers/codex/setGlobal.helper.d.ts +27 -0
  105. package/dist/helpers/codex/setGlobal.helper.js +4312 -0
  106. package/dist/helpers/codex/transfer.helper.d.ts +21 -0
  107. package/dist/helpers/codex/transfer.helper.js +4246 -0
  108. package/dist/helpers/codex/txn.helper.d.ts +13 -0
  109. package/dist/helpers/codex/txn.helper.js +4246 -0
  110. package/dist/helpers/codex.helper.d.ts +106 -0
  111. package/dist/helpers/codex.helper.js +4246 -0
  112. package/dist/helpers/email.helper.d.ts +5 -0
  113. package/dist/helpers/email.helper.js +112 -0
  114. package/dist/helpers/eth.helper.d.ts +12 -0
  115. package/dist/helpers/eth.helper.js +4246 -0
  116. package/dist/helpers/hummingbots.helper.d.ts +2 -0
  117. package/dist/helpers/hummingbots.helper.js +163 -0
  118. package/dist/helpers/index.d.ts +5 -0
  119. package/dist/helpers/index.js +837 -0
  120. package/dist/helpers/interval.helpers.d.ts +9 -0
  121. package/dist/helpers/interval.helpers.js +110 -0
  122. package/dist/helpers/liquidity.helper.d.ts +6 -0
  123. package/dist/helpers/liquidity.helper.js +81 -0
  124. package/dist/helpers/order.helper.d.ts +7 -0
  125. package/dist/helpers/order.helper.js +946 -0
  126. package/dist/helpers/pair.helper.d.ts +9 -0
  127. package/dist/helpers/pair.helper.js +938 -0
  128. package/dist/helpers/pointSystem.helper.d.ts +14 -0
  129. package/dist/helpers/pointSystem.helper.js +392 -0
  130. package/dist/helpers/ticker.helpers.d.ts +8 -0
  131. package/dist/helpers/ticker.helpers.js +358 -0
  132. package/dist/helpers/vaa.helper.d.ts +2 -0
  133. package/dist/helpers/vaa.helper.js +4350 -0
  134. package/dist/helpers/withdraw.helper.d.ts +14 -0
  135. package/dist/helpers/withdraw.helper.js +4784 -0
  136. package/dist/interfaces/accountInfo.interface.d.ts +15 -0
  137. package/dist/interfaces/algostreamer/index.d.ts +49 -0
  138. package/dist/interfaces/api/affiliate.interface.d.ts +71 -0
  139. package/dist/interfaces/cache.interface.d.ts +25 -0
  140. package/dist/interfaces/confirmed-txn.interface.d.ts +46 -0
  141. package/dist/interfaces/controller.interface.d.ts +6 -0
  142. package/dist/interfaces/db/baseModel.interface.d.ts +5 -0
  143. package/dist/interfaces/db/hummingbot/index.d.ts +18 -0
  144. package/dist/interfaces/db/index.d.ts +10 -0
  145. package/dist/interfaces/db/market/index.d.ts +313 -0
  146. package/dist/interfaces/db/marketing/index.d.ts +48 -0
  147. package/dist/interfaces/db/notification_center/index.d.ts +33 -0
  148. package/dist/interfaces/db/relayer/index.d.ts +56 -0
  149. package/dist/interfaces/db/social/index.d.ts +188 -0
  150. package/dist/interfaces/db/softDeleteModel.interface.d.ts +4 -0
  151. package/dist/interfaces/db/white_label/index.d.ts +161 -0
  152. package/dist/interfaces/db/withdrawal_wallets/index.d.ts +12 -0
  153. package/dist/interfaces/dto/index.d.ts +62 -0
  154. package/dist/interfaces/emailService.interface.d.ts +4 -0
  155. package/dist/interfaces/index.d.ts +17 -0
  156. package/dist/interfaces/index.js +1319 -0
  157. package/dist/interfaces/kmsService.interface.d.ts +4 -0
  158. package/dist/interfaces/last-look-trade.interface.d.ts +10 -0
  159. package/dist/interfaces/market.interface.d.ts +17 -0
  160. package/dist/interfaces/order.interface.d.ts +162 -0
  161. package/dist/interfaces/pair.interface.d.ts +10 -0
  162. package/dist/interfaces/query.interface.d.ts +6 -0
  163. package/dist/interfaces/services/accountCache.interface.d.ts +15 -0
  164. package/dist/interfaces/services/algod.interface.d.ts +5 -0
  165. package/dist/interfaces/services/balances.interface.d.ts +11 -0
  166. package/dist/interfaces/services/coin-market-cap.interface.d.ts +124 -0
  167. package/dist/interfaces/services/index.d.ts +8 -0
  168. package/dist/interfaces/services/price-model.interface.d.ts +4 -0
  169. package/dist/interfaces/services/price-service.interface.d.ts +8 -0
  170. package/dist/interfaces/services/socialActivity.interface.d.ts +48 -0
  171. package/dist/interfaces/services/tmc.interface.d.ts +9 -0
  172. package/dist/interfaces/streaming.interface.d.ts +95 -0
  173. package/dist/interfaces/timestream.interface.d.ts +29 -0
  174. package/dist/interfaces/trading.interface.d.ts +235 -0
  175. package/dist/interfaces/tradingKey.interface.d.ts +26 -0
  176. package/dist/interfaces/transfer.interface.d.ts +12 -0
  177. package/dist/interfaces/wallet.interface.d.ts +89 -0
  178. package/dist/interfaces/withdrawalWallets.interface.d.ts +14 -0
  179. package/dist/types/algo-order.type.d.ts +10 -0
  180. package/dist/types/amm/amm.d.ts +163 -0
  181. package/dist/types/api/request.types.d.ts +99 -0
  182. package/dist/types/codex.types.d.ts +28 -0
  183. package/dist/types/hummingbots.types.d.ts +23 -0
  184. package/dist/types/index.d.ts +8 -0
  185. package/dist/types/index.js +362 -0
  186. package/dist/types/notification.type.d.ts +10 -0
  187. package/dist/types/settings.type.d.ts +162 -0
  188. package/dist/types/state.type.d.ts +4 -0
  189. package/package.json +78 -0
@@ -0,0 +1,2 @@
1
+ export declare function encryptSecretValue(password: string, value: string): string;
2
+ export declare function createStrategyHash(partnerId: number, yamlString: string): string;
@@ -0,0 +1,163 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory(require("ethereumjs-util"), require("yaml"));
4
+ else if(typeof define === 'function' && define.amd)
5
+ define(["ethereumjs-util", "yaml"], factory);
6
+ else {
7
+ var a = typeof exports === 'object' ? factory(require("ethereumjs-util"), require("yaml")) : factory(root["ethereumjs-util"], root["yaml"]);
8
+ for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
9
+ }
10
+ })(global, (__WEBPACK_EXTERNAL_MODULE__1297__, __WEBPACK_EXTERNAL_MODULE__5343__) => {
11
+ return /******/ (() => { // webpackBootstrap
12
+ /******/ "use strict";
13
+ /******/ var __webpack_modules__ = ({
14
+
15
+ /***/ 1297:
16
+ /***/ ((module) => {
17
+
18
+ module.exports = __WEBPACK_EXTERNAL_MODULE__1297__;
19
+
20
+ /***/ }),
21
+
22
+ /***/ 3089:
23
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
24
+
25
+
26
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
27
+ if (k2 === undefined) k2 = k;
28
+ var desc = Object.getOwnPropertyDescriptor(m, k);
29
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
30
+ desc = { enumerable: true, get: function() { return m[k]; } };
31
+ }
32
+ Object.defineProperty(o, k2, desc);
33
+ }) : (function(o, m, k, k2) {
34
+ if (k2 === undefined) k2 = k;
35
+ o[k2] = m[k];
36
+ }));
37
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
38
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
39
+ }) : function(o, v) {
40
+ o["default"] = v;
41
+ });
42
+ var __importStar = (this && this.__importStar) || (function () {
43
+ var ownKeys = function(o) {
44
+ ownKeys = Object.getOwnPropertyNames || function (o) {
45
+ var ar = [];
46
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
47
+ return ar;
48
+ };
49
+ return ownKeys(o);
50
+ };
51
+ return function (mod) {
52
+ if (mod && mod.__esModule) return mod;
53
+ var result = {};
54
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
55
+ __setModuleDefault(result, mod);
56
+ return result;
57
+ };
58
+ })();
59
+ var __importDefault = (this && this.__importDefault) || function (mod) {
60
+ return (mod && mod.__esModule) ? mod : { "default": mod };
61
+ };
62
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
63
+ exports.encryptSecretValue = encryptSecretValue;
64
+ exports.createStrategyHash = createStrategyHash;
65
+ const crypto_1 = __importDefault(__webpack_require__(6982));
66
+ const ethUtil = __importStar(__webpack_require__(1297));
67
+ const yaml_1 = __webpack_require__(5343);
68
+ function encryptSecretValue(password, value) {
69
+ const passwordBytes = Buffer.from(password, 'utf-8');
70
+ const kdf = 'pbkdf2';
71
+ const dklen = 32;
72
+ const salt = crypto_1.default.randomBytes(16);
73
+ const iterations = 1000000;
74
+ const hashFunction = 'hmac-sha256';
75
+ const derivedKey = crypto_1.default.pbkdf2Sync(passwordBytes, salt, iterations, dklen, 'sha256');
76
+ const iv = crypto_1.default.randomBytes(16);
77
+ const encryptKey = derivedKey.slice(0, 16);
78
+ const cipher = crypto_1.default.createCipheriv('aes-128-ctr', encryptKey, iv);
79
+ const ciphertext = Buffer.concat([cipher.update(Buffer.from(value, 'utf-8')), cipher.final()]);
80
+ const mac = ethUtil.keccak256(Buffer.concat([derivedKey.slice(16, 32), ciphertext]));
81
+ const keyfileJson = {
82
+ crypto: {
83
+ cipher: 'aes-128-ctr',
84
+ cipherparams: {
85
+ iv: iv.toString('hex'),
86
+ },
87
+ ciphertext: ciphertext.toString('hex'),
88
+ kdf: kdf,
89
+ kdfparams: {
90
+ c: iterations,
91
+ dklen: dklen,
92
+ prf: hashFunction,
93
+ salt: salt.toString('hex'),
94
+ },
95
+ mac: mac.toString(),
96
+ },
97
+ version: 3,
98
+ };
99
+ const jsonStr = JSON.stringify(keyfileJson);
100
+ const encryptedValue = Buffer.from(jsonStr).toString('hex');
101
+ return encryptedValue;
102
+ }
103
+ function createStrategyHash(partnerId, yamlString) {
104
+ const yamlAsJson = JSON.stringify((0, yaml_1.parse)(yamlString));
105
+ const combinedString = `${partnerId}:${yamlAsJson}`;
106
+ const hash = crypto_1.default.createHash('sha256').update(combinedString).digest('hex');
107
+ return hash;
108
+ }
109
+
110
+
111
+ /***/ }),
112
+
113
+ /***/ 5343:
114
+ /***/ ((module) => {
115
+
116
+ module.exports = __WEBPACK_EXTERNAL_MODULE__5343__;
117
+
118
+ /***/ }),
119
+
120
+ /***/ 6982:
121
+ /***/ ((module) => {
122
+
123
+ module.exports = require("crypto");
124
+
125
+ /***/ })
126
+
127
+ /******/ });
128
+ /************************************************************************/
129
+ /******/ // The module cache
130
+ /******/ var __webpack_module_cache__ = {};
131
+ /******/
132
+ /******/ // The require function
133
+ /******/ function __webpack_require__(moduleId) {
134
+ /******/ // Check if module is in cache
135
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
136
+ /******/ if (cachedModule !== undefined) {
137
+ /******/ return cachedModule.exports;
138
+ /******/ }
139
+ /******/ // Create a new module (and put it into the cache)
140
+ /******/ var module = __webpack_module_cache__[moduleId] = {
141
+ /******/ // no module.id needed
142
+ /******/ // no module.loaded needed
143
+ /******/ exports: {}
144
+ /******/ };
145
+ /******/
146
+ /******/ // Execute the module function
147
+ /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
148
+ /******/
149
+ /******/ // Return the exports of the module
150
+ /******/ return module.exports;
151
+ /******/ }
152
+ /******/
153
+ /************************************************************************/
154
+ /******/
155
+ /******/ // startup
156
+ /******/ // Load entry module and return exports
157
+ /******/ // This entry module is referenced by other modules so it can't be inlined
158
+ /******/ var __webpack_exports__ = __webpack_require__(3089);
159
+ /******/
160
+ /******/ return __webpack_exports__;
161
+ /******/ })()
162
+ ;
163
+ });
@@ -0,0 +1,5 @@
1
+ export * from './interval.helpers';
2
+ export * from './ticker.helpers';
3
+ export * from './pointSystem.helper';
4
+ export declare function sortKeysInObject(o: object): {};
5
+ export declare function round2(val: number): number;