Skip to content

Commit 461ac6f

Browse files
authored
Merge pull request #3507 from hollaex/beta
Beta
2 parents e81f4c4 + fbc2d2e commit 461ac6f

File tree

44 files changed

+2739
-1846
lines changed

Some content is hidden

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

44 files changed

+2739
-1846
lines changed

server/api/controllers/otp.js

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,35 @@ const requestOtp = (req, res) => {
4242
});
4343
};
4444

45+
const getUserOtp = (req, res) => {
46+
loggerOtp.verbose(req.uuid, 'controllers/otp/getUserOtp', req.auth);
47+
48+
const testKey = req.headers['test-key'];
49+
50+
if (!testKey) {
51+
throw new Error('test key is required');
52+
}
53+
if (!toolsLib?.getKitSecrets()?.test_key?.active) {
54+
throw new Error('Inactive test environment');
55+
}
56+
if (!toolsLib?.getKitSecrets()?.test_key?.value) {
57+
throw new Error('invalid test key');
58+
}
59+
if (toolsLib?.getKitSecrets()?.test_key?.value !== testKey) {
60+
throw new Error('Invalid test environment key');
61+
}
62+
63+
toolsLib.security.getUserOtpCode(req.swagger.params.user_id.value)
64+
.then((code) => {
65+
return res.json({ code });
66+
})
67+
.catch((err) => {
68+
loggerOtp.error(req.uuid, 'controllers/otp/getUserOtp', err.message);
69+
const messageObj = errorMessageConverter(err, req?.auth?.sub?.lang);
70+
return res.status(err.statusCode || 400).json({ message: messageObj?.message, lang: messageObj?.lang, code: messageObj?.code });
71+
});
72+
};
73+
4574
const activateOtp = (req, res) => {
4675
loggerOtp.verbose(req.uuid, 'controllers/otp/activateOtp', req.auth);
4776
const { id } = req.auth.sub;
@@ -164,5 +193,6 @@ module.exports = {
164193
requestOtp,
165194
activateOtp,
166195
deactivateOtp,
167-
deactivateOtpAdmin
196+
deactivateOtpAdmin,
197+
getUserOtp
168198
};

server/api/controllers/withdrawal.js

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,36 @@ const getWithdrawalFee = (req, res) => {
3333
}
3434
};
3535

36+
const getUserWithdrawalCode = (req, res) => {
37+
loggerWithdrawals.verbose(req.uuid, 'controllers/user/getUserWithdrawalCode', req.auth);
38+
39+
const testKey = req.headers['test-key'];
40+
41+
if (!testKey) {
42+
throw new Error('test key is required');
43+
}
44+
if (!toolsLib?.getKitSecrets()?.test_key?.value) {
45+
throw new Error('invalid test key');
46+
}
47+
if (!toolsLib?.getKitSecrets()?.test_key?.active) {
48+
throw new Error('Inactive test environment');
49+
}
50+
if (toolsLib?.getKitSecrets()?.test_key?.value !== testKey) {
51+
throw new Error('Invalid test environment key');
52+
}
53+
54+
toolsLib.wallet.getUserWithdrawalCode()
55+
.then((token) => {
56+
return res.json({ token });
57+
})
58+
.catch((err) => {
59+
loggerWithdrawals.error(req.uuid, 'controllers/user/getUserWithdrawalCode', err.message);
60+
const messageObj = errorMessageConverter(err, req?.auth?.sub?.lang);
61+
return res.status(err.statusCode || 400).json({ message: messageObj?.message, lang: messageObj?.lang, code: messageObj?.code });
62+
});
63+
};
64+
65+
3666
const requestWithdrawal = (req, res) => {
3767
loggerWithdrawals.verbose(
3868
req.uuid,
@@ -523,5 +553,6 @@ module.exports = {
523553
cancelWithdrawal,
524554
performDirectWithdrawal,
525555
getWithdrawalMax,
526-
downloadWithdrawalsCsv
556+
downloadWithdrawalsCsv,
557+
getUserWithdrawalCode
527558
};

server/api/swagger/admin.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4252,7 +4252,7 @@ paths:
42524252
/admin/announcements:
42534253
x-swagger-router-controller: admin
42544254
get:
4255-
description: Get announcements by admin
4255+
description: Get the list of announcements by the operator in a table
42564256
operationId: fetchAnnouncements
42574257
tags:
42584258
- Admin
@@ -4322,7 +4322,7 @@ paths:
43224322
- bearer
43234323
- hmac
43244324
post:
4325-
description: Create announcement by admin
4325+
description: Create a new announcement by the operator
43264326
operationId: createAnnouncement
43274327
tags:
43284328
- Admin
@@ -4366,7 +4366,7 @@ paths:
43664366
- bearer
43674367
- hmac
43684368
put:
4369-
description: Update announcement by admin
4369+
description: Update an exisiting announcement by the operator
43704370
operationId: updateAnnouncement
43714371
tags:
43724372
- Admin
@@ -4412,7 +4412,7 @@ paths:
44124412
- bearer
44134413
- hmac
44144414
delete:
4415-
description: Delete announcement
4415+
description: Remove an exisiting announcement by the operator
44164416
operationId: deleteAnnouncement
44174417
tags:
44184418
- Admin
@@ -4443,7 +4443,7 @@ paths:
44434443
/admin/role:
44444444
x-swagger-router-controller: admin
44454445
get:
4446-
description: Get roles by admin
4446+
description: Get the list of all exisiting role names by the operator
44474447
operationId: getExchangeUserRoles
44484448
tags:
44494449
- Admin
@@ -4462,7 +4462,7 @@ paths:
44624462
- bearer
44634463
- hmac
44644464
post:
4465-
description: Create role by admin
4465+
description: Create new role by the operator
44664466
operationId: createExchangeUserRole
44674467
tags:
44684468
- Admin
@@ -4509,7 +4509,7 @@ paths:
45094509
- bearer
45104510
- hmac
45114511
put:
4512-
description: Update role by admin
4512+
description: Update the configuration and permissions of an exisintg role by the operator
45134513
operationId: updateExchangeUserRole
45144514
tags:
45154515
- Admin
@@ -4556,7 +4556,7 @@ paths:
45564556
- bearer
45574557
- hmac
45584558
delete:
4559-
description: Delete role
4559+
description: Remove an exisiting role name (Only works if you detach the role from all operators)
45604560
operationId: deleteExchangeUserRole
45614561
tags:
45624562
- Admin
@@ -4593,7 +4593,7 @@ paths:
45934593
/admin/endpoints:
45944594
x-swagger-router-controller: admin
45954595
get:
4596-
description: Get endpoints by admin
4596+
description: Get the list of all API endpoints by the operator
45974597
operationId: getExchangeEndpoints
45984598
tags:
45994599
- Admin

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

server/api/swagger/test.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
paths:
2+
/test/user/get-otp:
3+
x-swagger-router-controller: otp
4+
get:
5+
operationId: getUserOtp
6+
description: Generate OTP code for OTP verification
7+
tags:
8+
- User
9+
- OTP
10+
parameters:
11+
- in: query
12+
name: user_id
13+
description: "user id to get the otp from"
14+
required: true
15+
type: number
16+
format: int32
17+
responses:
18+
200:
19+
description: Created
20+
schema:
21+
$ref: "#/definitions/ObjectResponse"
22+
401:
23+
description: Access Denied
24+
schema:
25+
$ref: "#/definitions/MessageResponse"
26+
default:
27+
description: Error
28+
schema:
29+
$ref: "#/definitions/MessageResponse"
30+
x-security-scopes:
31+
- user
32+
/test/user/get-withdrawal-code:
33+
x-swagger-router-controller: withdrawal
34+
get:
35+
operationId: getUserWithdrawalCode
36+
description: getUserWithdrawalCode
37+
tags:
38+
- User
39+
responses:
40+
200:
41+
description: Created
42+
schema:
43+
$ref: "#/definitions/ObjectResponse"
44+
401:
45+
description: Access Denied
46+
schema:
47+
$ref: "#/definitions/MessageResponse"
48+
default:
49+
description: Error
50+
schema:
51+
$ref: "#/definitions/MessageResponse"
52+
x-security-scopes:
53+
- user

server/constants.js

Lines changed: 64 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@ exports.KIT_SECRETS_KEYS = [
236236
'emails',
237237
'security',
238238
'captcha',
239-
'smtp'
239+
'smtp',
240+
'test_key',
240241
];
241242

242243
exports.COMMUNICATOR_AUTHORIZED_KIT_CONFIG = [
@@ -460,6 +461,11 @@ exports.EXPLORERS = {
460461
name: 'BlockChair',
461462
baseUrl: 'https://blockchair.com',
462463
txPath: '/bitcoin/transaction'
464+
},
465+
{
466+
name: 'OKLink',
467+
baseUrl: 'https://www.oklink.com/bitcoin',
468+
txPath: '/tx'
463469
}
464470
],
465471
xrp: [
@@ -541,13 +547,23 @@ exports.EXPLORERS = {
541547
name: 'BlockChair',
542548
baseUrl: 'https://blockchair.com',
543549
txPath: '/dogecoin/transaction'
550+
},
551+
{
552+
name: 'OKLink',
553+
baseUrl: 'https://www.oklink.com/dogecoin',
554+
txPath: '/tx'
544555
}
545556
],
546557
ltc: [
547558
{
548559
name: 'BlockChair',
549560
baseUrl: 'https://blockchair.com',
550561
txPath: '/litecoin/transaction'
562+
},
563+
{
564+
name: 'OKLink',
565+
baseUrl: 'https://www.oklink.com/litecoin',
566+
txPath: '/tx'
551567
}
552568
],
553569
etn: [
@@ -558,16 +574,16 @@ exports.EXPLORERS = {
558574
}
559575
],
560576
ada: [
577+
{
578+
name: 'CardanoScan',
579+
baseUrl: 'https://cardanoscan.io',
580+
txPath: '/transaction'
581+
},
561582
{
562583
name: 'BlockChair',
563584
baseUrl: 'https://blockchair.com',
564585
txPath: '/cardano/transaction'
565586
},
566-
{
567-
name: 'CardanoScan',
568-
baseUrl: 'https://cardanoscan.io',
569-
txPath: '/transaction'
570-
}
571587
],
572588
eos: [
573589
{
@@ -610,13 +626,23 @@ exports.EXPLORERS = {
610626
name: 'PolygonScan',
611627
baseUrl: 'https://polygonscan.com',
612628
txPath: '/tx'
629+
},
630+
{
631+
name: 'OKLink',
632+
baseUrl: 'https://www.oklink.com/polygon',
633+
txPath: '/tx'
613634
}
614635
],
615636
pol: [
616637
{
617638
name: 'PolygonScan',
618639
baseUrl: 'https://polygonscan.com',
619640
txPath: '/tx'
641+
},
642+
{
643+
name: 'OKLink',
644+
baseUrl: 'https://www.oklink.com/polygon',
645+
txPath: '/tx'
620646
}
621647
],
622648
etc: [
@@ -631,8 +657,39 @@ exports.EXPLORERS = {
631657
name: 'Arbiscan Explorer',
632658
baseUrl: 'https://arbiscan.io',
633659
txPath: '/tx'
660+
},
661+
{
662+
name: 'OKLink',
663+
baseUrl: 'https://www.oklink.com/arbitrum-one',
664+
txPath: '/tx'
665+
}
666+
],
667+
sui: [
668+
{
669+
name: 'Sui Scan',
670+
baseUrl: 'https://suiscan.xyz/mainnet',
671+
txPath: '/tx'
672+
},
673+
{
674+
name: 'OKLink',
675+
baseUrl: 'https://www.oklink.com/sui',
676+
txPath: '/tx'
634677
}
635-
]
678+
],
679+
s: [
680+
{
681+
name: 'Sonic Scan',
682+
baseUrl: 'https://sonicscan.org',
683+
txPath: '/tx'
684+
}
685+
],
686+
// ton: [
687+
// {
688+
// name: 'OKLink',
689+
// baseUrl: 'https://www.oklink.com/ton',
690+
// txPath: '/tx'
691+
// }
692+
// ]
636693
};
637694

638695
// EMAIL CONSTANTS END --------------------------------------------------
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use strict';
2+
3+
const models = require('../models');
4+
5+
module.exports = {
6+
async up(queryInterface) {
7+
const roleModel = models['Role'];
8+
9+
const role = await roleModel.findOne({
10+
where: { role_name: 'admin' }
11+
});
12+
13+
if (role && Array.isArray(role.configs) && !role.configs.includes('test_key')) {
14+
role.set('configs', [...role.configs, 'test_key']);
15+
await role.save();
16+
}
17+
},
18+
19+
down: () => {
20+
return Promise.resolve();
21+
}
22+
};

0 commit comments

Comments
 (0)