@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,4 @@
1
+ import { QueryRunner } from "typeorm";
2
+ export declare function dropIndexIfExists(queryRunner: QueryRunner, tableName: string, indexName: string): Promise<void>;
3
+ export declare function createIndexIfNotExists(queryRunner: QueryRunner, tableName: string, indexName: string, cols: string): Promise<void>;
4
+ export declare function checkIfExists(queryRunner: QueryRunner, tableName: string, indexName: string): Promise<boolean>;
@@ -0,0 +1,44 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
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
12
+ /******/ "use strict";
13
+ var __webpack_exports__ = {};
14
+ // This entry needs to be wrapped in an IIFE because it uses a non-standard name for the exports (exports).
15
+ (() => {
16
+ var exports = __webpack_exports__;
17
+
18
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
19
+ exports.dropIndexIfExists = dropIndexIfExists;
20
+ exports.createIndexIfNotExists = createIndexIfNotExists;
21
+ exports.checkIfExists = checkIfExists;
22
+ async function dropIndexIfExists(queryRunner, tableName, indexName) {
23
+ if (await checkIfExists(queryRunner, tableName, indexName)) {
24
+ await queryRunner.query(`ALTER TABLE \`${tableName}\` DROP index \`${indexName}\``);
25
+ }
26
+ }
27
+ async function createIndexIfNotExists(queryRunner, tableName, indexName, cols) {
28
+ if (!(await checkIfExists(queryRunner, tableName, indexName))) {
29
+ await queryRunner.query(`CREATE INDEX \`${indexName}\` ON \`${tableName}\` (${cols});`);
30
+ }
31
+ }
32
+ async function checkIfExists(queryRunner, tableName, indexName) {
33
+ let result = await queryRunner.query(`SELECT EXISTS(SELECT * FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = '${tableName}'
34
+ AND INDEX_NAME = '${indexName}' AND INDEX_SCHEMA='order_service') as existed`);
35
+ console.log(result);
36
+ return result.length > 0 && result[0].existed == 1;
37
+ }
38
+
39
+ })();
40
+
41
+ /******/ return __webpack_exports__;
42
+ /******/ })()
43
+ ;
44
+ });
@@ -0,0 +1,27 @@
1
+ import Redis from 'ioredis';
2
+ declare class RedisHelper {
3
+ private host;
4
+ private port;
5
+ client: Redis;
6
+ private operationQueue;
7
+ private runningOperations;
8
+ constructor();
9
+ private performPendingOperations;
10
+ setString(key: string, value: string, expires?: number, database?: string): Promise<void>;
11
+ incrementKey(key: string, expires?: number, database?: string): Promise<void>;
12
+ scanKeys(pattern: string, database?: string): Promise<string[]>;
13
+ getString(key: string, database?: string): Promise<string | null>;
14
+ deleteString(key: string, database?: string): Promise<void>;
15
+ deleteByKeyPattern(pattern: string, database?: string): Promise<void>;
16
+ destroyDb(dbKey: string): Promise<boolean>;
17
+ private performOperation;
18
+ close(): Promise<void>;
19
+ createStream(key: string): Promise<void>;
20
+ writeToStream(key: string, message: object): Promise<void>;
21
+ readStream<T>(key: string, timeout: number): Promise<T>;
22
+ deleteStream(key: string): Promise<void>;
23
+ setTTL(key: string, ttlSeconds: number): Promise<void>;
24
+ streamExists(key: string): Promise<boolean>;
25
+ }
26
+ declare const _default: RedisHelper;
27
+ export default _default;
@@ -0,0 +1,269 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory(require("ioredis"));
4
+ else if(typeof define === 'function' && define.amd)
5
+ define(["ioredis"], factory);
6
+ else {
7
+ var a = typeof exports === 'object' ? factory(require("ioredis")) : factory(root["ioredis"]);
8
+ for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
9
+ }
10
+ })(global, (__WEBPACK_EXTERNAL_MODULE__6615__) => {
11
+ return /******/ (() => { // webpackBootstrap
12
+ /******/ "use strict";
13
+ /******/ var __webpack_modules__ = ({
14
+
15
+ /***/ 5281:
16
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
17
+
18
+
19
+ var __importDefault = (this && this.__importDefault) || function (mod) {
20
+ return (mod && mod.__esModule) ? mod : { "default": mod };
21
+ };
22
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
23
+ const ioredis_1 = __importDefault(__webpack_require__(6615));
24
+ class RedisHelper {
25
+ constructor() {
26
+ this.host = process.env.REDIS_HOSTNAME;
27
+ this.port = process.env.REDIS_PORT;
28
+ this.client = new ioredis_1.default({
29
+ host: this.host,
30
+ port: Number(this.port),
31
+ lazyConnect: true,
32
+ });
33
+ this.operationQueue = [];
34
+ this.runningOperations = false;
35
+ this.client.on('connect', () => {
36
+ // console.log('Redis Connected');
37
+ });
38
+ this.client.on('ready', () => {
39
+ // console.log('Redis Ready');
40
+ this.performPendingOperations();
41
+ });
42
+ this.client.on('error', (err) => {
43
+ console.error('Redis error:', err.message);
44
+ });
45
+ this.client.on('close', () => {
46
+ console.log('Redis connection closed');
47
+ });
48
+ }
49
+ async performPendingOperations() {
50
+ this.runningOperations = true;
51
+ while (this.operationQueue.length > 0) {
52
+ const operation = this.operationQueue.shift();
53
+ if (operation) {
54
+ try {
55
+ await operation();
56
+ }
57
+ catch (err) {
58
+ console.error('Error performing Redis operation:', err);
59
+ }
60
+ }
61
+ }
62
+ this.runningOperations = false;
63
+ }
64
+ async setString(key, value, expires = 0, database = '') {
65
+ const operation = async () => {
66
+ if (database !== '') {
67
+ this.client.select(Number(database));
68
+ }
69
+ await this.client.set(key, value);
70
+ if (expires !== 0) {
71
+ await this.client.expire(key, expires * 60);
72
+ }
73
+ };
74
+ await this.performOperation(operation);
75
+ }
76
+ async incrementKey(key, expires = 0, database = '') {
77
+ const operation = async () => {
78
+ if (database !== '') {
79
+ this.client.select(Number(database));
80
+ }
81
+ await this.client.incr(key);
82
+ if (expires !== 0) {
83
+ const ttl = await this.client.ttl(key);
84
+ if (ttl === -1) {
85
+ await this.client.expire(key, expires * 60);
86
+ }
87
+ }
88
+ };
89
+ await this.performOperation(operation);
90
+ }
91
+ async scanKeys(pattern, database = '') {
92
+ const matchedKeys = [];
93
+ const operation = async () => {
94
+ if (database !== '') {
95
+ this.client.select(Number(database));
96
+ }
97
+ let cursor = '0';
98
+ do {
99
+ const [nextCursor, keys] = await this.client.scan(cursor, 'MATCH', pattern, 'COUNT', 100);
100
+ cursor = nextCursor;
101
+ matchedKeys.push(...keys);
102
+ } while (cursor !== '0');
103
+ };
104
+ await this.performOperation(operation);
105
+ return matchedKeys;
106
+ }
107
+ getString(key, database = '') {
108
+ return new Promise(async (resolve, reject) => {
109
+ const operation = async () => {
110
+ try {
111
+ if (database !== '') {
112
+ await this.client.select(Number(database));
113
+ }
114
+ const value = await this.client.get(key);
115
+ resolve(value);
116
+ }
117
+ catch (err) {
118
+ reject(err);
119
+ }
120
+ };
121
+ this.performOperation(operation);
122
+ });
123
+ }
124
+ async deleteString(key, database = '') {
125
+ const operation = async () => {
126
+ if (database !== '') {
127
+ this.client.select(Number(database));
128
+ }
129
+ await this.client.del(key);
130
+ };
131
+ await this.performOperation(operation);
132
+ }
133
+ async deleteByKeyPattern(pattern, database = '') {
134
+ const operation = async () => {
135
+ if (database !== '') {
136
+ this.client.select(Number(database));
137
+ }
138
+ const keys = await this.client.keys(pattern);
139
+ if (keys.length > 0) {
140
+ await this.client.unlink(keys);
141
+ console.log(`Deleted ${keys.length} keys`);
142
+ }
143
+ else {
144
+ console.log('No keys for delete');
145
+ }
146
+ };
147
+ await this.performOperation(operation);
148
+ }
149
+ async destroyDb(dbKey) {
150
+ const response = await this.client.del(dbKey);
151
+ return response === 1;
152
+ }
153
+ async performOperation(operation) {
154
+ this.operationQueue.push(operation);
155
+ if (!this.runningOperations) {
156
+ try {
157
+ await this.performPendingOperations();
158
+ }
159
+ catch (error) {
160
+ console.error('Error during performing Redis operation', error);
161
+ }
162
+ }
163
+ }
164
+ async close() {
165
+ console.log('Closing Redis client for graceful shutdown...');
166
+ try {
167
+ while (this.operationQueue.length > 0 || this.runningOperations) {
168
+ await new Promise((resolve) => setTimeout(resolve, 100));
169
+ }
170
+ await this.client.quit();
171
+ console.log('Redis client closed successfully');
172
+ }
173
+ catch (error) {
174
+ console.error('Error during Redis client shutdown:', error);
175
+ }
176
+ }
177
+ async createStream(key) {
178
+ // console.log(`[Stream '${key}'] Creating...`);
179
+ await this.client.xgroup('CREATE', key, 'group', '$', 'MKSTREAM');
180
+ }
181
+ async writeToStream(key, message) {
182
+ try {
183
+ // console.log(`[Stream '${key}']`, `Try write to stream`);
184
+ if (await this.streamExists(key)) {
185
+ // console.log(`[Stream '${key}']`, `Writing the message`, JSON.stringify(message));
186
+ await this.client.xadd(key, '*', 'message', JSON.stringify(message));
187
+ }
188
+ }
189
+ catch (error) {
190
+ console.log(`[Stream '${key}']`, 'Error while writing to stream', error);
191
+ }
192
+ }
193
+ async readStream(key, timeout) {
194
+ // console.log(`[Stream '${key}'] Reading with timeout ${timeout}s...`);
195
+ const results = await this.client.xreadgroup('GROUP', 'group', 'consumer', 'COUNT', 1, 'BLOCK', timeout * 1000, 'STREAMS', key, '>');
196
+ if (results && results.length > 0) {
197
+ const [, entries] = results[0];
198
+ if (entries && entries.length > 0) {
199
+ const [, [, message]] = entries[0];
200
+ return JSON.parse(message);
201
+ }
202
+ }
203
+ return null;
204
+ }
205
+ async deleteStream(key) {
206
+ // console.log(`[Stream '${key}']`, `Try delete stream`);
207
+ if (await this.streamExists(key)) {
208
+ // console.log(`[Stream '${key}']`, `Deleting...`);
209
+ await this.client.del(key);
210
+ }
211
+ }
212
+ async setTTL(key, ttlSeconds) {
213
+ await this.client.expire(key, ttlSeconds);
214
+ }
215
+ async streamExists(key) {
216
+ const exists = await this.client.exists(key);
217
+ // console.log(`Key '${key}' in redis exists: ${exists}`);
218
+ return exists === 1;
219
+ }
220
+ }
221
+ exports["default"] = new RedisHelper();
222
+
223
+
224
+ /***/ }),
225
+
226
+ /***/ 6615:
227
+ /***/ ((module) => {
228
+
229
+ module.exports = __WEBPACK_EXTERNAL_MODULE__6615__;
230
+
231
+ /***/ })
232
+
233
+ /******/ });
234
+ /************************************************************************/
235
+ /******/ // The module cache
236
+ /******/ var __webpack_module_cache__ = {};
237
+ /******/
238
+ /******/ // The require function
239
+ /******/ function __webpack_require__(moduleId) {
240
+ /******/ // Check if module is in cache
241
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
242
+ /******/ if (cachedModule !== undefined) {
243
+ /******/ return cachedModule.exports;
244
+ /******/ }
245
+ /******/ // Create a new module (and put it into the cache)
246
+ /******/ var module = __webpack_module_cache__[moduleId] = {
247
+ /******/ // no module.id needed
248
+ /******/ // no module.loaded needed
249
+ /******/ exports: {}
250
+ /******/ };
251
+ /******/
252
+ /******/ // Execute the module function
253
+ /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
254
+ /******/
255
+ /******/ // Return the exports of the module
256
+ /******/ return module.exports;
257
+ /******/ }
258
+ /******/
259
+ /************************************************************************/
260
+ /******/
261
+ /******/ // startup
262
+ /******/ // Load entry module and return exports
263
+ /******/ // This entry module is referenced by other modules so it can't be inlined
264
+ /******/ var __webpack_exports__ = __webpack_require__(5281);
265
+ /******/
266
+ /******/ return __webpack_exports__;
267
+ /******/ })()
268
+ ;
269
+ });
@@ -0,0 +1,28 @@
1
+ interface RelayerSecrets {
2
+ algorand: string;
3
+ polygon: string;
4
+ solana: string;
5
+ }
6
+ export interface OndatoSecrets {
7
+ clientId: string;
8
+ clientSecret: string;
9
+ hmacSecret: string;
10
+ setupId: string;
11
+ }
12
+ declare class SecretHelper {
13
+ private creatorMnemonicSecretName;
14
+ private dispenserMnemonicSecretName;
15
+ private transactionMnemonicSecretName;
16
+ private relayerMnemonicSecretName;
17
+ private ondatoCredentialsSecretName;
18
+ getCreatorMnemonic(): Promise<string>;
19
+ getDispenserMnemonic(): Promise<string>;
20
+ getTransactionMnemonic(): Promise<string>;
21
+ getRelayerMnemonics(): Promise<RelayerSecrets>;
22
+ getOndatoSecrets(): Promise<OndatoSecrets>;
23
+ private getClient;
24
+ private getSecrets;
25
+ saveSecret(secretName: string, secretValue: string): Promise<void>;
26
+ }
27
+ declare const _default: SecretHelper;
28
+ export default _default;
@@ -0,0 +1,144 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory(require("@aws-sdk/client-secrets-manager"));
4
+ else if(typeof define === 'function' && define.amd)
5
+ define(["@aws-sdk/client-secrets-manager"], factory);
6
+ else {
7
+ var a = typeof exports === 'object' ? factory(require("@aws-sdk/client-secrets-manager")) : factory(root["@aws-sdk/client-secrets-manager"]);
8
+ for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
9
+ }
10
+ })(global, (__WEBPACK_EXTERNAL_MODULE__2216__) => {
11
+ return /******/ (() => { // webpackBootstrap
12
+ /******/ "use strict";
13
+ /******/ var __webpack_modules__ = ({
14
+
15
+ /***/ 2216:
16
+ /***/ ((module) => {
17
+
18
+ module.exports = __WEBPACK_EXTERNAL_MODULE__2216__;
19
+
20
+ /***/ })
21
+
22
+ /******/ });
23
+ /************************************************************************/
24
+ /******/ // The module cache
25
+ /******/ var __webpack_module_cache__ = {};
26
+ /******/
27
+ /******/ // The require function
28
+ /******/ function __webpack_require__(moduleId) {
29
+ /******/ // Check if module is in cache
30
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
31
+ /******/ if (cachedModule !== undefined) {
32
+ /******/ return cachedModule.exports;
33
+ /******/ }
34
+ /******/ // Create a new module (and put it into the cache)
35
+ /******/ var module = __webpack_module_cache__[moduleId] = {
36
+ /******/ // no module.id needed
37
+ /******/ // no module.loaded needed
38
+ /******/ exports: {}
39
+ /******/ };
40
+ /******/
41
+ /******/ // Execute the module function
42
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
43
+ /******/
44
+ /******/ // Return the exports of the module
45
+ /******/ return module.exports;
46
+ /******/ }
47
+ /******/
48
+ /************************************************************************/
49
+ var __webpack_exports__ = {};
50
+ // This entry needs to be wrapped in an IIFE because it uses a non-standard name for the exports (exports).
51
+ (() => {
52
+ var exports = __webpack_exports__;
53
+
54
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
55
+ const client_secrets_manager_1 = __webpack_require__(2216);
56
+ class SecretHelper {
57
+ constructor() {
58
+ this.creatorMnemonicSecretName = process.env.CreatorSecret;
59
+ this.dispenserMnemonicSecretName = process.env.DispenserSecret;
60
+ this.transactionMnemonicSecretName = process.env.TransactionSecret;
61
+ this.relayerMnemonicSecretName = process.env.RelayerSecret;
62
+ this.ondatoCredentialsSecretName = process.env.OndatoSecret;
63
+ }
64
+ async getCreatorMnemonic() {
65
+ const creatorMnemonic = await this.getSecrets(this.creatorMnemonicSecretName);
66
+ return JSON.parse(creatorMnemonic).creator;
67
+ }
68
+ async getDispenserMnemonic() {
69
+ const dispenserMnemonic = await this.getSecrets(this.dispenserMnemonicSecretName);
70
+ return JSON.parse(dispenserMnemonic).dispenser;
71
+ }
72
+ async getTransactionMnemonic() {
73
+ const transactionMnemonic = await this.getSecrets(this.transactionMnemonicSecretName);
74
+ return JSON.parse(transactionMnemonic).txs;
75
+ }
76
+ async getRelayerMnemonics() {
77
+ const relayerMnemonic = await this.getSecrets(this.relayerMnemonicSecretName);
78
+ return JSON.parse(relayerMnemonic);
79
+ }
80
+ async getOndatoSecrets() {
81
+ const ondatoSecrets = await this.getSecrets(this.ondatoCredentialsSecretName);
82
+ return JSON.parse(ondatoSecrets);
83
+ }
84
+ getClient() {
85
+ return new client_secrets_manager_1.SecretsManager({ region: 'us-east-1' });
86
+ }
87
+ getSecrets(secretName) {
88
+ // console.log(`Getting secrets by name: ${secretName}`);
89
+ return new Promise((resolve, reject) => {
90
+ try {
91
+ const command = new client_secrets_manager_1.GetSecretValueCommand({ SecretId: secretName });
92
+ const client = this.getClient();
93
+ client.send(command, (err, data) => {
94
+ if (err) {
95
+ console.log('-----error in secrets---------', err);
96
+ reject(err);
97
+ }
98
+ else {
99
+ // console.log('secrets successfully received');
100
+ resolve(data.SecretString);
101
+ }
102
+ });
103
+ }
104
+ catch (error) {
105
+ console.log('error curl', error);
106
+ reject(error);
107
+ }
108
+ });
109
+ }
110
+ saveSecret(secretName, secretValue) {
111
+ console.log(`Saving secret with name: ${secretName}`);
112
+ return new Promise((resolve, reject) => {
113
+ try {
114
+ const command = new client_secrets_manager_1.PutSecretValueCommand({
115
+ SecretId: secretName,
116
+ SecretString: secretValue,
117
+ });
118
+ const client = this.getClient();
119
+ client.send(command, (err, data) => {
120
+ if (err) {
121
+ console.log('-----error in saving secret---------', err);
122
+ reject(err);
123
+ }
124
+ else {
125
+ console.log('secret successfully saved');
126
+ resolve();
127
+ }
128
+ });
129
+ }
130
+ catch (error) {
131
+ console.log('error curl', error);
132
+ reject(error);
133
+ }
134
+ });
135
+ }
136
+ }
137
+ exports["default"] = new SecretHelper();
138
+
139
+ })();
140
+
141
+ /******/ return __webpack_exports__;
142
+ /******/ })()
143
+ ;
144
+ });
@@ -0,0 +1 @@
1
+ export declare function timestamp(accuracy?: "micro" | "nano"): string;
@@ -0,0 +1,41 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
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
12
+ /******/ "use strict";
13
+ var __webpack_exports__ = {};
14
+ // This entry needs to be wrapped in an IIFE because it uses a non-standard name for the exports (exports).
15
+ (() => {
16
+ var exports = __webpack_exports__;
17
+
18
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
19
+ exports.timestamp = timestamp;
20
+ const startTime = BigInt(Date.now());
21
+ const startHrTime = process.hrtime.bigint();
22
+ function timestamp(accuracy = 'micro') {
23
+ const elapsedNano = process.hrtime.bigint() - startHrTime;
24
+ const baseTimestampNano = startTime * 10n ** 6n + elapsedNano;
25
+ const baseString = baseTimestampNano.toString();
26
+ let result;
27
+ if (accuracy === "micro") {
28
+ result = `${baseString.slice(0, -6)}.${baseString.slice(-6, -3)}`;
29
+ }
30
+ else {
31
+ result = `${baseString.slice(0, -6)}.${baseString.slice(-6)}`;
32
+ }
33
+ return result;
34
+ }
35
+
36
+ })();
37
+
38
+ /******/ return __webpack_exports__;
39
+ /******/ })()
40
+ ;
41
+ });
@@ -0,0 +1 @@
1
+ export declare const assert: (condition: boolean, message: string) => void;
@@ -0,0 +1,32 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
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
12
+ /******/ "use strict";
13
+ var __webpack_exports__ = {};
14
+ // This entry needs to be wrapped in an IIFE because it uses a non-standard name for the exports (exports).
15
+ (() => {
16
+ var exports = __webpack_exports__;
17
+
18
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
19
+ exports.assert = void 0;
20
+ const assert = (condition, message) => {
21
+ if (!condition) {
22
+ throw new Error(`Assertion error: ${message}`);
23
+ }
24
+ };
25
+ exports.assert = assert;
26
+
27
+ })();
28
+
29
+ /******/ return __webpack_exports__;
30
+ /******/ })()
31
+ ;
32
+ });
@@ -0,0 +1,5 @@
1
+ import { AlgoOrder } from "../../types/algo-order.type";
2
+ export declare const getAccounInfoFormLocalStorage: (localState: any) => any;
3
+ export declare function unpackData(data: any, format: any): any;
4
+ export declare function decodeString(value: Uint8Array): string;
5
+ export declare const printUnpackedLocalData: (localState: any) => Array<AlgoOrder>;