@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,5 +1,5 @@
|
|
|
1
1
|
import { FeeTier, LastLookAction, KYCAuthenticationStatus, StateType, UpgradeStatus, OrderSide, TradeStatus, TradeSubStatus, TradingKeyType, ComponentType, ComponentStatusType, PairComponentStatusType } from '@enums';
|
|
2
|
-
import { IBaseModel, ICompany
|
|
2
|
+
import { IBaseModel, ICompany } from '@interfaces';
|
|
3
3
|
export interface IAccount {
|
|
4
4
|
address: string;
|
|
5
5
|
chainId: number;
|
|
@@ -86,10 +86,38 @@ export interface ICodexBalance {
|
|
|
86
86
|
lockedAmount: string;
|
|
87
87
|
token?: ICodexAsset;
|
|
88
88
|
}
|
|
89
|
+
export interface IPairEntity extends IBaseModel {
|
|
90
|
+
id: number;
|
|
91
|
+
pairKey: string;
|
|
92
|
+
marketPair: string;
|
|
93
|
+
baseCurrency: string;
|
|
94
|
+
priceCurrency: string;
|
|
95
|
+
baseCurrencyId: string;
|
|
96
|
+
baseChainId: number;
|
|
97
|
+
priceCurrencyId: string;
|
|
98
|
+
priceChainId: number;
|
|
99
|
+
priceDecimal: number;
|
|
100
|
+
baseDecimal: number;
|
|
101
|
+
isActive: any;
|
|
102
|
+
pairName: string;
|
|
103
|
+
minPriceIncrement: string;
|
|
104
|
+
minOrderSize: string;
|
|
105
|
+
minSizeIncrement: string;
|
|
106
|
+
isPairPublic: boolean;
|
|
107
|
+
created_at: Date;
|
|
108
|
+
updated_at: Date;
|
|
109
|
+
deleted_on: Date;
|
|
110
|
+
baseAsset?: ICodexAsset;
|
|
111
|
+
priceAsset?: ICodexAsset;
|
|
112
|
+
companies: ICompany[];
|
|
113
|
+
company: ICompany;
|
|
114
|
+
countries: ICountry[];
|
|
115
|
+
settings: IPairSetting[];
|
|
116
|
+
}
|
|
89
117
|
export interface ICountry {
|
|
90
118
|
id: string;
|
|
91
119
|
name: string;
|
|
92
|
-
pairs:
|
|
120
|
+
pairs: IPairEntity[];
|
|
93
121
|
}
|
|
94
122
|
export interface IPairDelisting {
|
|
95
123
|
pairId: number;
|
|
@@ -106,7 +134,7 @@ export interface IPairSetting extends IBaseModel {
|
|
|
106
134
|
companyId?: number;
|
|
107
135
|
value: string;
|
|
108
136
|
enabled: boolean;
|
|
109
|
-
pair:
|
|
137
|
+
pair: IPairEntity;
|
|
110
138
|
setting: IAvailablePairSetting;
|
|
111
139
|
}
|
|
112
140
|
export interface IAvailablePairSetting {
|
|
@@ -115,7 +143,7 @@ export interface IAvailablePairSetting {
|
|
|
115
143
|
export interface IOrder {
|
|
116
144
|
id: number;
|
|
117
145
|
pairId: number;
|
|
118
|
-
pair:
|
|
146
|
+
pair: IPairEntity;
|
|
119
147
|
side: number;
|
|
120
148
|
type: number;
|
|
121
149
|
price: string;
|
|
@@ -145,7 +173,7 @@ export interface IOrder {
|
|
|
145
173
|
export interface ITrade {
|
|
146
174
|
tradeId: number;
|
|
147
175
|
pairId: number;
|
|
148
|
-
pair:
|
|
176
|
+
pair: IPairEntity;
|
|
149
177
|
txnId?: string;
|
|
150
178
|
buyOrderId: number | null;
|
|
151
179
|
buyOrder?: IOrder;
|
|
@@ -285,7 +313,7 @@ export interface IComponentInstance {
|
|
|
285
313
|
}
|
|
286
314
|
export interface IPairComponent {
|
|
287
315
|
pair_id: number;
|
|
288
|
-
pair:
|
|
316
|
+
pair: IPairEntity;
|
|
289
317
|
instance_id?: number;
|
|
290
318
|
instance?: IComponentInstance;
|
|
291
319
|
status: PairComponentStatusType;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SettingTypeColumn, MarketMakerRebateTier } from '@enums';
|
|
2
|
-
import { ICollectionWallet, IBaseModel, ISoftDeleteModel, IAccount,
|
|
2
|
+
import { ICollectionWallet, IBaseModel, ISoftDeleteModel, IAccount, IPairEntity, IAvailablePairSetting, IInvitedByAffiliateAccount } from '@interfaces';
|
|
3
3
|
export interface ICompanyBDPartner {
|
|
4
4
|
companyId: number;
|
|
5
5
|
name: string;
|
|
@@ -133,7 +133,7 @@ export interface IPairSettingHistoryItem extends IBaseModel {
|
|
|
133
133
|
prev_value?: string;
|
|
134
134
|
new_value: string;
|
|
135
135
|
pairId: number;
|
|
136
|
-
pair:
|
|
136
|
+
pair: IPairEntity;
|
|
137
137
|
setting: IAvailablePairSetting;
|
|
138
138
|
}
|
|
139
139
|
export interface ICompanySettingHistoryItem extends IBaseModel {
|
|
@@ -147,7 +147,7 @@ export interface ICompanySettingHistoryItem extends IBaseModel {
|
|
|
147
147
|
export interface ITag {
|
|
148
148
|
id: number;
|
|
149
149
|
value: string;
|
|
150
|
-
pairs:
|
|
150
|
+
pairs: IPairEntity[];
|
|
151
151
|
}
|
|
152
152
|
export interface IPriceCoin {
|
|
153
153
|
address: string;
|
package/dist/interfaces/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
|
|
|
@@ -1207,6 +1197,14 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
1207
1197
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1208
1198
|
exports.ISetting = void 0;
|
|
1209
1199
|
class ISetting {
|
|
1200
|
+
id;
|
|
1201
|
+
description;
|
|
1202
|
+
hint;
|
|
1203
|
+
help_url;
|
|
1204
|
+
type;
|
|
1205
|
+
allowed_values;
|
|
1206
|
+
settings;
|
|
1207
|
+
public;
|
|
1210
1208
|
}
|
|
1211
1209
|
exports.ISetting = ISetting;
|
|
1212
1210
|
|
|
@@ -1312,8 +1310,7 @@ Object.defineProperty(exports, "WithdrawalWalletType", ({ enumerable: true, get:
|
|
|
1312
1310
|
/******/ // Load entry module and return exports
|
|
1313
1311
|
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
1314
1312
|
/******/ var __webpack_exports__ = __webpack_require__(7525);
|
|
1313
|
+
/******/ module.exports = __webpack_exports__;
|
|
1315
1314
|
/******/
|
|
1316
|
-
/******/ return __webpack_exports__;
|
|
1317
1315
|
/******/ })()
|
|
1318
|
-
;
|
|
1319
|
-
});
|
|
1316
|
+
;
|
package/dist/types/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
|
|
|
@@ -224,23 +214,19 @@ var SmallTimeframeEnum;
|
|
|
224
214
|
SmallTimeframeEnum["last_year"] = "last_year";
|
|
225
215
|
})(SmallTimeframeEnum || (exports.SmallTimeframeEnum = SmallTimeframeEnum = {}));
|
|
226
216
|
class PairsQueryDto {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
this.page = 1;
|
|
233
|
-
}
|
|
217
|
+
timeRange = SmallTimeframeEnum.last_30_days;
|
|
218
|
+
sortBy = 'volume_usd';
|
|
219
|
+
order = 'desc';
|
|
220
|
+
limit = 20;
|
|
221
|
+
page = 1;
|
|
234
222
|
}
|
|
235
223
|
exports.PairsQueryDto = PairsQueryDto;
|
|
236
224
|
class UsersQueryDto {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
this.page = 1;
|
|
243
|
-
}
|
|
225
|
+
timeRange = SmallTimeframeEnum.last_30_days;
|
|
226
|
+
sortBy = 'volume_usd';
|
|
227
|
+
order = 'desc';
|
|
228
|
+
limit = 20;
|
|
229
|
+
page = 1;
|
|
244
230
|
}
|
|
245
231
|
exports.UsersQueryDto = UsersQueryDto;
|
|
246
232
|
var StatisticTypeQuery;
|
|
@@ -251,10 +237,8 @@ var StatisticTypeQuery;
|
|
|
251
237
|
StatisticTypeQuery["dau"] = "dau";
|
|
252
238
|
})(StatisticTypeQuery || (exports.StatisticTypeQuery = StatisticTypeQuery = {}));
|
|
253
239
|
class ChartQueryDto {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
this.timeRange = SmallTimeframeEnum.last_7_days;
|
|
257
|
-
}
|
|
240
|
+
type = StatisticTypeQuery.volume;
|
|
241
|
+
timeRange = SmallTimeframeEnum.last_7_days;
|
|
258
242
|
}
|
|
259
243
|
exports.ChartQueryDto = ChartQueryDto;
|
|
260
244
|
|
|
@@ -265,7 +249,6 @@ exports.ChartQueryDto = ChartQueryDto;
|
|
|
265
249
|
/***/ ((__unused_webpack_module, exports) => {
|
|
266
250
|
|
|
267
251
|
|
|
268
|
-
//--import { Asset } from "@ultrade/shared/db/entities/market/asset.entity";
|
|
269
252
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
270
253
|
exports.AmmBucketKeys = exports.VALIDATOR_APP_ID = exports.CONTRACT_VERSION = exports.AmmForeignResources = exports.AmmChars = exports.AmmIds = exports.PoolType = void 0;
|
|
271
254
|
var PoolType;
|
|
@@ -355,8 +338,7 @@ var AmmBucketKeys;
|
|
|
355
338
|
/******/ // Load entry module and return exports
|
|
356
339
|
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
357
340
|
/******/ var __webpack_exports__ = __webpack_require__(3574);
|
|
341
|
+
/******/ module.exports = __webpack_exports__;
|
|
358
342
|
/******/
|
|
359
|
-
/******/ return __webpack_exports__;
|
|
360
343
|
/******/ })()
|
|
361
|
-
;
|
|
362
|
-
});
|
|
344
|
+
;
|
package/package.json
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultrade/shared",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "This package contains shared code for the projects.",
|
|
5
5
|
"exports": {
|
|
6
|
+
"./common": {
|
|
7
|
+
"import": "./dist/common/index.js",
|
|
8
|
+
"types": "./dist/common/index.d.ts",
|
|
9
|
+
"require": "./dist/common/index.js"
|
|
10
|
+
},
|
|
6
11
|
"./common/*": {
|
|
7
12
|
"import": "./dist/common/*.js",
|
|
8
13
|
"types": "./dist/common/*.d.ts",
|
|
@@ -10,12 +15,19 @@
|
|
|
10
15
|
},
|
|
11
16
|
"./constants": {
|
|
12
17
|
"import": "./dist/constants/index.js",
|
|
18
|
+
"types": "./dist/constants/index.d.ts",
|
|
13
19
|
"require": "./dist/constants/index.js"
|
|
14
20
|
},
|
|
15
21
|
"./enums": {
|
|
16
22
|
"import": "./dist/enums/index.js",
|
|
23
|
+
"types": "./dist/enums/index.d.ts",
|
|
17
24
|
"require": "./dist/enums/index.js"
|
|
18
25
|
},
|
|
26
|
+
"./helpers": {
|
|
27
|
+
"import": "./dist/helpers/index.js",
|
|
28
|
+
"types": "./dist/helpers/index.d.ts",
|
|
29
|
+
"require": "./dist/helpers/index.js"
|
|
30
|
+
},
|
|
19
31
|
"./helpers/*": {
|
|
20
32
|
"import": "./dist/helpers/*.js",
|
|
21
33
|
"types": "./dist/helpers/*.d.ts",
|
|
@@ -23,19 +35,15 @@
|
|
|
23
35
|
},
|
|
24
36
|
"./interfaces": {
|
|
25
37
|
"import": "./dist/interfaces/index.js",
|
|
38
|
+
"types": "./dist/interfaces/index.d.ts",
|
|
26
39
|
"require": "./dist/interfaces/index.js"
|
|
27
40
|
},
|
|
28
41
|
"./types": {
|
|
29
42
|
"import": "./dist/types/index.js",
|
|
43
|
+
"types": "./dist/types/index.d.ts",
|
|
30
44
|
"require": "./dist/types/index.js"
|
|
31
45
|
}
|
|
32
46
|
},
|
|
33
|
-
"types": [
|
|
34
|
-
"./dist/constants/index.d.ts",
|
|
35
|
-
"./dist/enums/index.d.ts",
|
|
36
|
-
"./dist/interfaces/index.d.ts",
|
|
37
|
-
"./dist/types/index.d.ts"
|
|
38
|
-
],
|
|
39
47
|
"scripts": {
|
|
40
48
|
"build:prod": "webpack --config webpack.config.js --env production=true",
|
|
41
49
|
"build:dev": "webpack --config webpack.config.js --env production=false",
|
|
@@ -64,7 +72,7 @@
|
|
|
64
72
|
"@solana/web3.js": "^1.87.6",
|
|
65
73
|
"algosdk": "^2.0.0",
|
|
66
74
|
"amqplib": "^0.10.0",
|
|
67
|
-
"axios": "^0.27.2",
|
|
75
|
+
"axios": "^0.27.2 || ^1.0.0",
|
|
68
76
|
"bignumber.js": "^9.1.2",
|
|
69
77
|
"bs58": "^5.0.0",
|
|
70
78
|
"buffer": "^6.0.3",
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { DataSource } from 'typeorm';
|
|
2
|
-
declare class BaseModel {
|
|
3
|
-
protected dataSource: DataSource;
|
|
4
|
-
tableName: string;
|
|
5
|
-
insertion: string;
|
|
6
|
-
selectCols: string;
|
|
7
|
-
selectWhere: string;
|
|
8
|
-
offsets: number;
|
|
9
|
-
limits: number;
|
|
10
|
-
orderBy: string;
|
|
11
|
-
orderIs: string;
|
|
12
|
-
fromDate: any;
|
|
13
|
-
toDate: any;
|
|
14
|
-
updation: string;
|
|
15
|
-
updateWhere: string;
|
|
16
|
-
insertPrimaryKey: string;
|
|
17
|
-
deleteWhere: string;
|
|
18
|
-
userId: string;
|
|
19
|
-
constructor(value: string, dataSource: DataSource);
|
|
20
|
-
SelectAssetData(): Promise<any>;
|
|
21
|
-
callQuery(query: string, args?: any[]): Promise<any>;
|
|
22
|
-
deleteFavRecord(): Promise<any>;
|
|
23
|
-
deleteAssetRecord(pairId: number, address: string): Promise<any>;
|
|
24
|
-
private resetSelectSettings;
|
|
25
|
-
}
|
|
26
|
-
export default BaseModel;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import BaseModel from "../baseModel";
|
|
2
|
-
import { DataSource } from 'typeorm';
|
|
3
|
-
export declare class TradingApiHelper extends BaseModel {
|
|
4
|
-
constructor(dataSource: DataSource);
|
|
5
|
-
getPairInfo(pair_key: string, application_id?: string): Promise<any>;
|
|
6
|
-
getSlotsGraphDataNew(from: string, to: string, slot: number, pair_id: number): Promise<any>;
|
|
7
|
-
getSlotsGraphDataWithCountBack(countBack: string, to: string, slot: number, pair_id: number): Promise<any>;
|
|
8
|
-
deleteFavourite(oid: any): Promise<unknown>;
|
|
9
|
-
insertFavourite(pairId: string, userId: string): Promise<any>;
|
|
10
|
-
tokenList(userId?: string): Promise<unknown>;
|
|
11
|
-
despensIpCount(ip: any): Promise<any>;
|
|
12
|
-
googleCaptchaVerify(url: any): Promise<unknown>;
|
|
13
|
-
checkDispenserAssetAccess(pairId: number, userId: string, ip: any): Promise<boolean>;
|
|
14
|
-
groupTransaction(to: string, assets: any): Promise<any[]>;
|
|
15
|
-
insertUserAsset(pairId: number, userId: string, ip: any, amount: number): Promise<any>;
|
|
16
|
-
}
|