Skip to content

Commit e81f4c4

Browse files
authored
Merge pull request #3489 from hollaex/beta
Beta
2 parents 08b0b84 + 4fa5425 commit e81f4c4

File tree

13 files changed

+2570
-315
lines changed

13 files changed

+2570
-315
lines changed

server/api/swagger/swagger.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const definition = {
44
swagger: '2.0',
55
info: {
66
title: 'HollaEx Kit',
7-
version: '2.15.7'
7+
version: '2.15.8'
88
},
99
host: 'api.hollaex.com',
1010
basePath: '/v2',

server/db/migrations/20220106210332-add-token-permissions.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const PERMISSION_COLUMNS = [
55
'can_read',
66
'can_trade',
77
'can_withdraw'
8-
]
8+
];
99

1010
module.exports = {
1111
async up(queryInterface, Sequelize) {
@@ -30,7 +30,7 @@ module.exports = {
3030
});
3131
},
3232
async down(queryInterface, Sequelize) {
33-
await Promise.all(COLUMNS.map(async (COLUMN) => {
33+
await Promise.all(PERMISSION_COLUMNS.map(async (COLUMN) => {
3434
await queryInterface.removeColumn(TABLE, COLUMN);
3535
}));
3636

server/db/migrations/20220401073018-update-broker.js

Lines changed: 63 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -3,68 +3,69 @@
33
const TABLE = 'Brokers';
44

55
module.exports = {
6-
async up(queryInterface, Sequelize) {
7-
return Promise.all([
8-
queryInterface
9-
.addColumn(TABLE, 'type', {
10-
type: Sequelize.ENUM('manual', 'dynamic'),
11-
defaultValue: 'manual',
12-
allowNull: false
13-
}),
14-
queryInterface
15-
.addColumn(TABLE, 'quote_expiry_time', {
16-
type: Sequelize.INTEGER,
17-
defaultValue: 30,
18-
allowNull: true
19-
}),
20-
queryInterface
21-
.addColumn(TABLE, 'rebalancing_symbol', {
22-
type: Sequelize.STRING,
23-
allowNull: true,
24-
}),
25-
queryInterface
26-
.addColumn(TABLE, 'account', {
27-
type: Sequelize.JSONB,
28-
allowNull: true,
29-
}),
30-
queryInterface
31-
.addColumn(TABLE, 'formula', {
32-
type: Sequelize.TEXT,
33-
allowNull: true
34-
}),
35-
queryInterface
36-
.changeColumn(TABLE, 'buy_price', {
37-
type: Sequelize.DOUBLE,
38-
allowNull: false,
39-
defaultValue: 0,
40-
}),
41-
queryInterface
42-
.changeColumn(TABLE, 'sell_price', {
43-
type: Sequelize.DOUBLE,
44-
allowNull: false,
45-
defaultValue: 0,
46-
})
47-
]);
6+
async up(queryInterface, Sequelize) {
7+
return Promise.all([
8+
queryInterface
9+
.addColumn(TABLE, 'quote_expiry_time', {
10+
type: Sequelize.INTEGER,
11+
defaultValue: 30,
12+
allowNull: true
13+
}),
14+
queryInterface
15+
.addColumn(TABLE, 'type', {
16+
type: Sequelize.ENUM('manual', 'dynamic'),
17+
defaultValue: 'manual',
18+
allowNull: false
19+
}),
20+
queryInterface
21+
.addColumn(TABLE, 'rebalancing_symbol', {
22+
type: Sequelize.STRING,
23+
allowNull: true,
24+
}),
25+
queryInterface
26+
.addColumn(TABLE, 'account', {
27+
type: Sequelize.JSONB,
28+
allowNull: true,
29+
}),
30+
queryInterface
31+
.addColumn(TABLE, 'formula', {
32+
type: Sequelize.TEXT,
33+
allowNull: true
34+
}),
35+
queryInterface
36+
.changeColumn(TABLE, 'buy_price', {
37+
type: Sequelize.DOUBLE,
38+
allowNull: false,
39+
defaultValue: 0,
40+
}),
41+
queryInterface
42+
.changeColumn(TABLE, 'sell_price', {
43+
type: Sequelize.DOUBLE,
44+
allowNull: false,
45+
defaultValue: 0,
46+
})
47+
]);
4848

49-
},
49+
},
5050

51-
async down(queryInterface, Sequelize) {
52-
return Promise.all([
53-
queryInterface.removeColumn(TABLE, 'type'),
54-
queryInterface.removeColumn(TABLE, 'quote_expiry_time'),
55-
queryInterface.removeColumn(TABLE, 'rebalancing_symbol'),
56-
queryInterface.removeColumn(TABLE, 'account'),
57-
queryInterface.removeColumn(TABLE, 'formula'),
58-
queryInterface
59-
.changeColumn(TABLE, 'buy_price', {
60-
type: Sequelize.DOUBLE,
61-
allowNull: false,
62-
}),
63-
queryInterface
64-
.changeColumn(TABLE, 'sell_price', {
65-
type: Sequelize.DOUBLE,
66-
allowNull: false,
67-
})
68-
]);
69-
}
51+
async down(queryInterface, Sequelize) {
52+
return Promise.all([
53+
queryInterface.removeColumn(TABLE, 'type'),
54+
queryInterface.sequelize.query('DROP TYPE "enum_Brokers_type";'),
55+
queryInterface.removeColumn(TABLE, 'quote_expiry_time'),
56+
queryInterface.removeColumn(TABLE, 'rebalancing_symbol'),
57+
queryInterface.removeColumn(TABLE, 'account'),
58+
queryInterface.removeColumn(TABLE, 'formula'),
59+
queryInterface
60+
.changeColumn(TABLE, 'buy_price', {
61+
type: Sequelize.DOUBLE,
62+
allowNull: false,
63+
}),
64+
queryInterface
65+
.changeColumn(TABLE, 'sell_price', {
66+
type: Sequelize.DOUBLE,
67+
allowNull: false,
68+
})
69+
]);
70+
}
7071
};

server/db/migrations/20250605123275-add-markup-fees.js

Lines changed: 43 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -12,56 +12,60 @@ const models = require('../models');
1212
module.exports = {
1313
async up(queryInterface) {
1414

15-
const checkActivation = (name, url, activation_code, constants = {}) => {
16-
const body = {
17-
name,
18-
url,
19-
activation_code,
20-
constants
21-
};
15+
try {
16+
const checkActivation = (name, url, activation_code, constants = {}) => {
17+
const body = {
18+
name,
19+
url,
20+
activation_code,
21+
constants
22+
};
2223

23-
const options = {
24-
method: 'POST',
25-
body,
26-
uri: `${HOLLAEX_NETWORK_ENDPOINT}${HOLLAEX_NETWORK_BASE_URL}${HOLLAEX_NETWORK_PATH_ACTIVATE}`,
27-
json: true
24+
const options = {
25+
method: 'POST',
26+
body,
27+
uri: `${HOLLAEX_NETWORK_ENDPOINT}${HOLLAEX_NETWORK_BASE_URL}${HOLLAEX_NETWORK_PATH_ACTIVATE}`,
28+
json: true
29+
};
30+
return rp(options);
2831
};
29-
return rp(options);
30-
};
3132

3233

33-
const statusModel = models[TABLE];
34-
const status = await statusModel.findOne({});
34+
const statusModel = models[TABLE];
35+
const status = await statusModel.findOne({});
3536

36-
if (status?.activation_code) {
37-
const exchange = await checkActivation(status.name,
38-
status.url,
39-
status.activation_code,
40-
status.constants);
37+
if (status?.activation_code) {
38+
const exchange = await checkActivation(status.name,
39+
status.url,
40+
status.activation_code,
41+
status.constants);
4142

4243

43-
for (const [symbol, customization] of Object.entries(status?.kit?.coin_customizations || [])) {
44-
// Skip if already has fee_markups or no fee_markup defined
45-
if (customization.fee_markups || customization.fee_markup == null) continue;
44+
for (const [symbol, customization] of Object.entries(status?.kit?.coin_customizations || [])) {
45+
// Skip if already has fee_markups or no fee_markup defined
46+
if (customization.fee_markups || customization.fee_markup == null) continue;
4647

47-
// Find the matching coin by symbol
48-
const coin = exchange.coins.find((c) => c.symbol === symbol);
49-
if (!coin || !coin.network) continue;
48+
// Find the matching coin by symbol
49+
const coin = exchange.coins.find((c) => c.symbol === symbol);
50+
if (!coin || !coin.network) continue;
5051

51-
const networks = coin.network.split(',').map((n) => n.trim().toLowerCase());
52-
customization.fee_markups = {};
52+
const networks = coin.network.split(',').map((n) => n.trim().toLowerCase());
53+
customization.fee_markups = {};
5354

54-
networks.forEach((network) => {
55-
customization.fee_markups[network] = {
56-
deposit_fee_markup: 0,
57-
withdrawal_fee_markup: customization.fee_markup
58-
};
59-
});
55+
networks.forEach((network) => {
56+
customization.fee_markups[network] = {
57+
deposit_fee_markup: 0,
58+
withdrawal_fee_markup: customization.fee_markup
59+
};
60+
});
61+
}
62+
await statusModel.update(
63+
{ kit: status.kit },
64+
{ where: { id: status.id } }
65+
);
6066
}
61-
await statusModel.update(
62-
{ kit: status.kit },
63-
{ where: { id: status.id } }
64-
);
67+
} catch (error) {
68+
return error;
6569
}
6670

6771
},

server/db/migrations/20250615123279-modify-markup-fees.js

Lines changed: 49 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -11,63 +11,66 @@ const models = require('../models');
1111

1212
module.exports = {
1313
async up(queryInterface) {
14+
try {
15+
const checkActivation = (name, url, activation_code, constants = {}) => {
16+
const body = {
17+
name,
18+
url,
19+
activation_code,
20+
constants
21+
};
1422

15-
const checkActivation = (name, url, activation_code, constants = {}) => {
16-
const body = {
17-
name,
18-
url,
19-
activation_code,
20-
constants
23+
const options = {
24+
method: 'POST',
25+
body,
26+
uri: `${HOLLAEX_NETWORK_ENDPOINT}${HOLLAEX_NETWORK_BASE_URL}${HOLLAEX_NETWORK_PATH_ACTIVATE}`,
27+
json: true
28+
};
29+
return rp(options);
2130
};
2231

23-
const options = {
24-
method: 'POST',
25-
body,
26-
uri: `${HOLLAEX_NETWORK_ENDPOINT}${HOLLAEX_NETWORK_BASE_URL}${HOLLAEX_NETWORK_PATH_ACTIVATE}`,
27-
json: true
28-
};
29-
return rp(options);
30-
};
3132

33+
const statusModel = models[TABLE];
34+
const status = await statusModel.findOne({});
35+
if (status?.activation_code) {
36+
const exchange = await checkActivation(status.name,
37+
status.url,
38+
status.activation_code,
39+
status.constants);
3240

33-
const statusModel = models[TABLE];
34-
const status = await statusModel.findOne({});
35-
if (status?.activation_code) {
36-
const exchange = await checkActivation(status.name,
37-
status.url,
38-
status.activation_code,
39-
status.constants);
4041

42+
for (const [symbol, customization] of Object.entries(status?.kit?.coin_customizations || [])) {
43+
// Skip if already has fee_markups or no fee_markup defined
44+
if (customization?.fee_markup == null) continue;
4145

42-
for (const [symbol, customization] of Object.entries(status?.kit?.coin_customizations || [])) {
43-
// Skip if already has fee_markups or no fee_markup defined
44-
if (customization?.fee_markup == null) continue;
46+
// Find the matching coin by symbol
47+
const coin = exchange?.coins?.find((c) => c.symbol === symbol);
48+
if (!coin || !coin?.network) continue;
4549

46-
// Find the matching coin by symbol
47-
const coin = exchange?.coins?.find((c) => c.symbol === symbol);
48-
if (!coin || !coin?.network) continue;
50+
const networks = coin?.network?.split(',')?.map((n) => n?.trim()?.toLowerCase()) || [];
51+
customization.fee_markups = {};
4952

50-
const networks = coin?.network?.split(',')?.map((n) => n?.trim()?.toLowerCase()) || [];
51-
customization.fee_markups = {};
53+
networks.forEach((network) => {
54+
customization.fee_markups[network] = {
55+
deposit: {
56+
value: customization?.fee_markups?.[network]?.deposit_fee_markup || 0,
57+
symbol: symbol
58+
},
59+
withdrawal: {
60+
value: customization?.fee_markups?.[network]?.withdrawal_fee_markup || customization?.fee_markup || 0,
61+
symbol: coin?.withdrawal_fees?.[network]?.symbol
62+
}
63+
};
64+
});
65+
}
66+
await statusModel.update(
67+
{ kit: status.kit },
68+
{ where: { id: status.id } }
69+
);
5270

53-
networks.forEach((network) => {
54-
customization.fee_markups[network] = {
55-
deposit: {
56-
value: customization?.fee_markups?.[network]?.deposit_fee_markup || 0,
57-
symbol: symbol
58-
},
59-
withdrawal: {
60-
value: customization?.fee_markups?.[network]?.withdrawal_fee_markup || customization?.fee_markup || 0,
61-
symbol: coin?.withdrawal_fees?.[network]?.symbol
62-
}
63-
};
64-
});
6571
}
66-
await statusModel.update(
67-
{ kit: status.kit },
68-
{ where: { id: status.id } }
69-
);
70-
72+
} catch (error) {
73+
return error;
7174
}
7275

7376
},

server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "2.15.7",
2+
"version": "2.15.8",
33
"private": false,
44
"description": "HollaEx Kit",
55
"keywords": [

server/utils/hollaex-tools-lib/tools/security.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1299,7 +1299,7 @@ const checkPermission = (req, user) => {
12991299
if (!apiPath) {
13001300
throw new Error(NOT_AUTHORIZED);
13011301
}
1302-
1302+
apiPath = apiPath.replace(/\?.*$/, '');
13031303
apiPath = apiPath.replace(/^\/v[0-9]+\//, '/');
13041304

13051305
if (!apiPath.includes('admin')) return;

version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.15.7
1+
2.15.8

web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hollaex-kit",
3-
"version": "2.15.7",
3+
"version": "2.15.8",
44
"private": true,
55
"dependencies": {
66
"@ant-design/compatible": "1.0.5",

0 commit comments

Comments
 (0)