Skip to content

Commit 08b0b84

Browse files
authored
Merge pull request #3476 from hollaex/beta
Beta
2 parents 3714505 + 4b19a59 commit 08b0b84

File tree

69 files changed

+943
-435
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+943
-435
lines changed

server/api/controllers/admin.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ const getUsersAdmin = (req, res) => {
160160
phone_number,
161161
kyc,
162162
bank,
163+
bank_key,
164+
bank_value,
165+
activated,
163166
id_number
164167

165168
} = req.swagger.params;
@@ -200,6 +203,9 @@ const getUsersAdmin = (req, res) => {
200203
phone_number: phone_number.value,
201204
kyc: kyc.value,
202205
bank: bank.value,
206+
bank_key: bank_key.value,
207+
bank_value: bank_value.value,
208+
activated: activated.value,
203209
id_number: id_number.value,
204210
additionalHeaders: {
205211
'x-forwarded-for': req.headers['x-forwarded-for']
@@ -3391,6 +3397,9 @@ const downloadUsersCsv = (req, res) => {
33913397
phone_number,
33923398
kyc,
33933399
bank,
3400+
bank_key,
3401+
bank_value,
3402+
activated,
33943403
id_number
33953404

33963405
} = req.swagger.params;
@@ -3432,6 +3441,9 @@ const downloadUsersCsv = (req, res) => {
34323441
phone_number: phone_number.value,
34333442
kyc: kyc.value,
34343443
bank: bank.value,
3444+
bank_key: bank_key.value,
3445+
bank_value: bank_value.value,
3446+
activated: activated.value,
34353447
id_number: id_number.value,
34363448
additionalHeaders: {
34373449
'x-forwarded-for': req.headers['x-forwarded-for']

server/api/controllers/notification.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,35 @@ const handleCurrencyDeposit = (req, res) => {
4848
fee_coin
4949
} = req.swagger.params.data.value;
5050

51+
52+
loggerNotification.verbose(
53+
'controller/notification/handleCurrencyDeposit data',
54+
'currency',
55+
currency,
56+
'user_id',
57+
user_id,
58+
'amount',
59+
amount,
60+
'txid',
61+
txid,
62+
'address',
63+
address,
64+
'is_confirmed',
65+
is_confirmed,
66+
'rejected',
67+
rejected,
68+
'created_at',
69+
created_at,
70+
'network',
71+
network,
72+
'fee',
73+
fee,
74+
'description',
75+
description,
76+
'fee_coin',
77+
fee_coin
78+
);
79+
5180
toolsLib.security.verifyNetworkHmacToken(req)
5281
.then(() => {
5382
if (!toolsLib.subscribedToCoin(currency)) {

server/api/controllers/tier.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,18 @@ const updatePairFees = (req, res) => {
6767
req.auth
6868
);
6969

70-
const { pair, fees } = req.swagger.params.data.value;
70+
const { fees } = req.swagger.params.data.value;
7171

7272
loggerTier.info(
7373
req.uuid,
7474
'controllers/tier/updatePairFees pair',
75-
pair
7675
);
7776
const auditInfo = { userEmail: req?.auth?.sub?.email, sessionId: req?.session_id, apiPath: req?.swagger?.apiPath, method: req?.swagger?.operationPath?.[2] };
78-
toolsLib.tier.updatePairFees(pair, fees, auditInfo)
77+
toolsLib.tier.updatePairFees(fees, auditInfo)
7978
.then(() => {
8079
loggerTier.info(
8180
req.uuid,
8281
'controllers/tier/updatePairFees updated fees pair',
83-
pair
8482
);
8583
return res.json({ message: 'Success' });
8684
})

server/api/swagger/admin.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,6 +1089,18 @@ paths:
10891089
name: bank
10901090
required: false
10911091
type: integer
1092+
- in: query
1093+
name: bank_key
1094+
required: false
1095+
type: string
1096+
- in: query
1097+
name: bank_value
1098+
required: false
1099+
type: string
1100+
- in: query
1101+
name: activated
1102+
required: false
1103+
type: boolean
10921104
- in: query
10931105
name: format
10941106
description: Specify data format
@@ -4980,6 +4992,18 @@ paths:
49804992
name: bank
49814993
required: false
49824994
type: integer
4995+
- in: query
4996+
name: bank_key
4997+
required: false
4998+
type: string
4999+
- in: query
5000+
name: bank_value
5001+
required: false
5002+
type: string
5003+
- in: query
5004+
name: activated
5005+
required: false
5006+
type: boolean
49835007
- in: query
49845008
name: format
49855009
description: Specify data format

server/api/swagger/definitions.yaml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,24 +1105,12 @@ definitions:
11051105
PairFeesPut:
11061106
type: object
11071107
required:
1108-
- pair
11091108
- fees
11101109
properties:
11111110
pair:
11121111
description: pair
11131112
fees:
11141113
type: object
1115-
minProperties: 1
1116-
additionalProperties:
1117-
type: object
1118-
minProperties: 1
1119-
properties:
1120-
maker:
1121-
type: number
1122-
format: double
1123-
taker:
1124-
type: number
1125-
format: double
11261114
OraclePriceResponse:
11271115
type: object
11281116
additionalProperties:

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.6'
7+
version: '2.15.7'
88
},
99
host: 'api.hollaex.com',
1010
basePath: '/v2',

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ module.exports = {
3232

3333
const statusModel = models[TABLE];
3434
const status = await statusModel.findOne({});
35-
if (status?.activation_code) {
35+
if (status?.activation_code) {
3636
const exchange = await checkActivation(status.name,
3737
status.url,
3838
status.activation_code,
@@ -41,13 +41,13 @@ module.exports = {
4141

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

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

50-
const networks = coin.network.split(',').map((n) => n.trim().toLowerCase());
50+
const networks = coin?.network?.split(',')?.map((n) => n?.trim()?.toLowerCase()) || [];
5151
customization.fee_markups = {};
5252

5353
networks.forEach((network) => {
@@ -57,8 +57,8 @@ module.exports = {
5757
symbol: symbol
5858
},
5959
withdrawal: {
60-
value: customization?.fee_markups?.[network]?.withdrawal_fee_markup || customization.fee_markup || 0,
61-
symbol: coin.withdrawal_fees[network].symbol
60+
value: customization?.fee_markups?.[network]?.withdrawal_fee_markup || customization?.fee_markup || 0,
61+
symbol: coin?.withdrawal_fees?.[network]?.symbol
6262
}
6363
};
6464
});

server/docker-compose-prod.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: '3'
33
name: "local"
44
services:
55
hollaex-kit-redis:
6-
image: redis:7.2.0-alpine
6+
image: redis:8.0.2-alpine
77
restart: unless-stopped
88
depends_on:
99
- hollaex-kit-db

server/docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
version: '3'
33
services:
44
hollaex-kit-redis:
5-
image: redis:7.2.0-alpine
5+
image: redis:8.0.2-alpine
66
depends_on:
77
- hollaex-kit-db
88
networks:

server/init.js

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ const {
2323
} = require('./constants');
2424
const { isNumber, difference } = require('lodash');
2525
const yaml = require('js-yaml');
26-
const toolsLib = require('hollaex-tools-lib');
2726
const fs = require('fs');
2827

2928
let nodeLib;
@@ -33,17 +32,20 @@ const getNodeLib = () => nodeLib;
3332
subscriber.on('message', async (channel, message) => {
3433
if (channel === INIT_CHANNEL) {
3534
const { type } = JSON.parse(message);
35+
const delay = (ms) => {
36+
return new Promise((resolve) => setTimeout(resolve, ms));
37+
};
3638
switch (type) {
3739
case 'refreshInit':
38-
await toolsLib.sleep((Math.floor(Math.random() * 5) + 1) * 1000);
40+
await delay((Math.floor(Math.random() * 5) + 1) * 1000);
3941
checkStatus();
4042
publisher.publish(
4143
WS_HUB_CHANNEL,
4244
JSON.stringify({ action: 'restart' })
4345
);
4446
break;
4547
case 'refreshApi':
46-
await toolsLib.sleep((Math.floor(Math.random() * 5) + 1) * 1000);
48+
await delay((Math.floor(Math.random() * 5) + 1) * 1000);
4749
checkStatus();
4850
break;
4951
default:
@@ -160,6 +162,35 @@ const checkStatus = () => {
160162
}
161163
}
162164

165+
let hasUpdate = false;
166+
for (const [symbol, customization] of Object.entries(status?.kit?.coin_customizations || [])) {
167+
if (customization?.fee_markup == null) continue;
168+
169+
const coin = exchange?.coins?.find((c) => c.symbol === symbol);
170+
if (!coin || !coin?.network) continue;
171+
172+
const networks = coin?.network?.split(',')?.map((n) => n?.trim()?.toLowerCase()) || [];
173+
174+
for(const network of networks) {
175+
if (!customization?.fee_markups?.[network]?.withdrawal?.symbol) continue;
176+
if (!coin?.withdrawal_fees?.[network]?.symbol) continue;
177+
178+
179+
if (customization?.fee_markups?.[network]?.withdrawal?.symbol != coin?.withdrawal_fees?.[network]?.symbol) {
180+
hasUpdate = true;
181+
customization.fee_markups[network].withdrawal.symbol = coin?.withdrawal_fees?.[network]?.symbol;
182+
customization.fee_markups[network].withdrawal.value = 0;
183+
}
184+
}
185+
}
186+
187+
if (hasUpdate) {
188+
Status.update(
189+
{ kit: status.kit },
190+
{ where: { id: status.id } }
191+
);
192+
}
193+
163194
for (let pair of exchange.pairs) {
164195
exchangePairs.push(pair.name);
165196
configuration.pairs[pair.name] = pair;

0 commit comments

Comments
 (0)