From b364e2d77cf26830b900f7fecb94a943d386ebf7 Mon Sep 17 00:00:00 2001 From: Harpal Singh <83590561+hsk11@users.noreply.github.com> Date: Sun, 28 Apr 2024 03:45:43 +0530 Subject: [PATCH 1/5] Update package.json Axios & Public IP --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b7ffd84..4fa2092 100644 --- a/package.json +++ b/package.json @@ -15,14 +15,14 @@ "dependencies": { "address": "^1.1.2", "atob": "^2.1.2", - "axios": "^0.20.0", + "axios": "^1.6.8", "binary-parser": "^2.2.1", "chai": "^4.3.10", "mocha": "^10.2.0", "nyc": "^15.1.0", "pako": "^2.1.0", "proxyquire": "^2.1.3", - "public-ip": "^4.0.2", + "public-ip": "^6.0.2", "querystring": "^0.2.0", "sinon": "^17.0.1", "winston": "^3.11.0", From c69fddf49efe85b6f98ed05874a0fd3486d76933 Mon Sep 17 00:00:00 2001 From: Harpal Singh <83590561+hsk11@users.noreply.github.com> Date: Sun, 28 Apr 2024 04:03:57 +0530 Subject: [PATCH 2/5] Update Public IP plugin --- lib/smartapi-connect.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/smartapi-connect.js b/lib/smartapi-connect.js index 265206c..b8d2c68 100644 --- a/lib/smartapi-connect.js +++ b/lib/smartapi-connect.js @@ -3,10 +3,14 @@ let axios = require('axios'); let querystring = require('querystring'); let address = require('address'); -let publicIp = require('public-ip'); const https = require('https'); let { API } = require('../config/api'); const { errorLogger } = require('./winston_log'); +const publicIp = {} +process.nextTick(async () => { + const object = await import('public-ip'); + Object.assign(publicIp, object); + }); /** * @constructor * @name SmartApi @@ -45,7 +49,7 @@ var SmartApi = function (params) { }); (async () => { - self.public_ip = await publicIp.v4(); + self.public_ip = await publicIp.publicIpv4(); })(); var requestInstance = axios.create({ From 0cd0e8d4d89899d4d1948331df319f1b8cd8b3f0 Mon Sep 17 00:00:00 2001 From: Harpal Singh <83590561+hsk11@users.noreply.github.com> Date: Sun, 28 Apr 2024 04:09:11 +0530 Subject: [PATCH 3/5] Update feedType to feedToken Correct Name: Updated feedType to feedToken Correct Name: Also MAKE SURE BACKWARD COMPATIBILITY IS THERE --- lib/websocket2.0.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/websocket2.0.js b/lib/websocket2.0.js index ab7fb1b..0335ae1 100644 --- a/lib/websocket2.0.js +++ b/lib/websocket2.0.js @@ -9,14 +9,14 @@ let triggers = { let WebSocketV2 = function (params) { try { - let { clientcode, jwttoken, apikey, feedtype } = params; + let { clientcode, jwttoken, apikey, feedtype, feedtoken } = params; let self = this; let ws = null; let headers = { 'x-client-code': clientcode, Authorization: jwttoken, 'x-api-key': apikey, - 'x-feed-token': feedtype, + 'x-feed-token': feedtype || feedtoken, // MAKE SURE BACKWARD COMPATIBILITY IS THERE }; const url = CONSTANTS?.websocketURL; let ping_Interval = CONSTANTS?.Interval; From 2f49dcb29aef67a1b5a7fdbdc425c9ccf32cedd2 Mon Sep 17 00:00:00 2001 From: Harpal Singh <83590561+hsk11@users.noreply.github.com> Date: Sun, 28 Apr 2024 04:18:04 +0530 Subject: [PATCH 4/5] Type Bug Fix : token_data.data => response.data Type Bug Fix : token_data.data => response.data --- lib/smartapi-connect.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/smartapi-connect.js b/lib/smartapi-connect.js index b8d2c68..5ac5e91 100644 --- a/lib/smartapi-connect.js +++ b/lib/smartapi-connect.js @@ -230,7 +230,7 @@ var SmartApi = function (params) { token_data.then((response) => { if (response.status) { self.setAccessToken(response.data.jwtToken); - self.setPublicToken(token_data.data.refreshToken); + self.setPublicToken(response.data.refreshToken); } }); From 8bb7b3c4ef06b44f1ff228e116ef6a5df5c474e9 Mon Sep 17 00:00:00 2001 From: Harpal Singh <83590561+hsk11@users.noreply.github.com> Date: Sun, 28 Apr 2024 05:19:45 +0530 Subject: [PATCH 5/5] Reverting back Axios --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4fa2092..f3586be 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "dependencies": { "address": "^1.1.2", "atob": "^2.1.2", - "axios": "^1.6.8", + "axios": "^0.20.0", "binary-parser": "^2.2.1", "chai": "^4.3.10", "mocha": "^10.2.0",