itrm-tools 1.1.22 → 1.1.23
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/api/external/ExternalApiSigner.js +3 -2
- package/dist/api/external/ExternalApiSigner.js.map +1 -1
- package/dist/api/external/cetus/CetusStrategyApiManager.d.ts +14 -0
- package/dist/api/external/cetus/CetusStrategyApiManager.js +30 -0
- package/dist/api/external/cetus/CetusStrategyApiManager.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ExternalApiSigner = void 0;
|
|
4
|
+
const crypto_js_1 = require("crypto-js");
|
|
4
5
|
class ExternalApiSigner {
|
|
5
6
|
constructor(service, keys) {
|
|
6
7
|
this.service = service;
|
|
@@ -9,8 +10,8 @@ class ExternalApiSigner {
|
|
|
9
10
|
sign(method, path, body) {
|
|
10
11
|
let nonce = Date.now();
|
|
11
12
|
let message = nonce + method + path + (body ? JSON.stringify(body) : "{}");
|
|
12
|
-
const hash =
|
|
13
|
-
let signature =
|
|
13
|
+
const hash = (0, crypto_js_1.HmacSHA256)(message, this.keys.secretKey);
|
|
14
|
+
let signature = crypto_js_1.enc.Hex.stringify(hash);
|
|
14
15
|
return {
|
|
15
16
|
headers: {
|
|
16
17
|
Authorization: `${this.service} ${this.keys.publicKey}:${nonce}:${signature}`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExternalApiSigner.js","sourceRoot":"","sources":["../../../src/api/external/ExternalApiSigner.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"ExternalApiSigner.js","sourceRoot":"","sources":["../../../src/api/external/ExternalApiSigner.ts"],"names":[],"mappings":";;;AACA,yCAA4C;AAO5C,MAAa,iBAAiB;IAI1B,YAAY,OAAe,EAAE,IAAgB;QACzC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;IAEM,IAAI,CAAC,MAAqB,EAAE,IAAY,EAAE,IAAU;QACvD,IAAI,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,IAAI,OAAO,GAAG,KAAK,GAAG,MAAM,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC3E,MAAM,IAAI,GAAG,IAAA,sBAAU,EAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtD,IAAI,SAAS,GAAG,eAAG,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACxC,OAAO;YACH,OAAO,EAAE;gBACL,aAAa,EAAE,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,KAAK,IAAI,SAAS,EAAE;aAChF;SACJ,CAAC;IACN,CAAC;CACJ;AApBD,8CAoBC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ApiKeyPair, ExternalApiSigner } from "../ExternalApiSigner";
|
|
2
|
+
export interface CetusRate {
|
|
3
|
+
symbol: string;
|
|
4
|
+
source: string;
|
|
5
|
+
bid?: number;
|
|
6
|
+
ask?: number;
|
|
7
|
+
spot?: number;
|
|
8
|
+
prevDayClose?: number;
|
|
9
|
+
}
|
|
10
|
+
export declare class CetusStrategyApiManager extends ExternalApiSigner {
|
|
11
|
+
private apiUrl;
|
|
12
|
+
constructor(keys: ApiKeyPair, apiUrl: string);
|
|
13
|
+
getRates(): Promise<CetusRate[]>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CetusStrategyApiManager = void 0;
|
|
13
|
+
const ExternalApiSigner_1 = require("../ExternalApiSigner");
|
|
14
|
+
const APIRequest_1 = require("../../APIRequest");
|
|
15
|
+
const RequestAxiosCall_1 = require("../../request/RequestAxiosCall");
|
|
16
|
+
;
|
|
17
|
+
class CetusStrategyApiManager extends ExternalApiSigner_1.ExternalApiSigner {
|
|
18
|
+
constructor(keys, apiUrl) {
|
|
19
|
+
super('cetus', keys);
|
|
20
|
+
this.apiUrl = apiUrl;
|
|
21
|
+
}
|
|
22
|
+
getRates() {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
let signature = this.sign(APIRequest_1.RequestMethod.GET, '/v1/rates');
|
|
25
|
+
return (yield RequestAxiosCall_1.RequestAxiosCall.get(`${this.apiUrl}/v1/rates`, signature)).rates;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.CetusStrategyApiManager = CetusStrategyApiManager;
|
|
30
|
+
//# sourceMappingURL=CetusStrategyApiManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CetusStrategyApiManager.js","sourceRoot":"","sources":["../../../../src/api/external/cetus/CetusStrategyApiManager.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,4DAAqE;AACrE,iDAAiD;AACjD,qEAAkE;AASjE,CAAC;AAEF,MAAa,uBAAwB,SAAQ,qCAAiB;IAG1D,YAAY,IAAgB,EAAE,MAAc;QACxC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAEY,QAAQ;;YACjB,IAAI,SAAS,GAAuB,IAAI,CAAC,IAAI,CAAC,0BAAa,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;YAC9E,OAAQ,CAAC,MAAM,mCAAgB,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,WAAW,EAAE,SAAS,CAAC,CAA6C,CAAC,KAAK,CAAC;QACjI,CAAC;KAAA;CACJ;AAZD,0DAYC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export { ExpressLogableConfig as ExpressLogableConfig } from './api/express/Expr
|
|
|
8
8
|
export { ExpressStandardConfiguration as ExpressStandardConfiguration } from './api/express/ExpressStandardConfiguration';
|
|
9
9
|
export { ExpressFileUploadingConfiguration as ExpressFileUploadingConfiguration } from './api/express/ExpressFileUploadingConfiguration';
|
|
10
10
|
export { ExternalApiSigner as ExternalApiSigner, ApiKeyPair as ApiKeyPair } from './api/external/ExternalApiSigner';
|
|
11
|
+
export { CetusStrategyApiManager as CetusStrategyApiManager } from './api/external/cetus/CetusStrategyApiManager';
|
|
11
12
|
export { APIRequest as APIRequest, RequestMethod as RequestMethod, RequestContext as RequestContext, GroupedParameters as GroupedParameters, APIRequestConfig as APIRequestConfig, RequestParameterType as RequestParameterType } from './api/APIRequest';
|
|
12
13
|
export { APIRequestBuilder as APIRequestBuilder, DocDetails as DocDetails, ISamples as ISamples } from './api/APIRequestBuilder';
|
|
13
14
|
export { APIRouter as APIRouter } from './api/APIRouter';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.round = exports.CoingeckoPriceFinder = exports.Coin = exports.LoggerWebSocket = exports.LoggerManager = exports.Logger = exports.SequelizeModelManager = exports.SequelizeConnection = exports.MongooseModelManager = exports.CrudServiceManager = exports.SimpleCheckableAPIRouter = exports.CorsCheckApiRouter = exports.CheckableAPIRouter = exports.CheckableFileUploadingPostRequest = exports.CheckablePutRequest = exports.CheckablePostRequest = exports.CheckableGetRequest = exports.CheckableDeleteRequest = exports.APIChecker = exports.CheckableAPIRequest = exports.DeleteRequest = exports.PutRequest = exports.PostRequest = exports.GetRequest = exports.RequestAxiosCall = exports.SimpleAPIRouter = exports.APIRouter = exports.APIRequestBuilder = exports.RequestParameterType = exports.RequestContext = exports.RequestMethod = exports.APIRequest = exports.ExternalApiSigner = exports.ExpressFileUploadingConfiguration = exports.ExpressStandardConfiguration = exports.ExpressLogableConfig = exports.HttpsAPIService = exports.ITRMAPIServiceGlobal = exports.APIService = exports.AlegraConnectionManager = void 0;
|
|
3
|
+
exports.round = exports.CoingeckoPriceFinder = exports.Coin = exports.LoggerWebSocket = exports.LoggerManager = exports.Logger = exports.SequelizeModelManager = exports.SequelizeConnection = exports.MongooseModelManager = exports.CrudServiceManager = exports.SimpleCheckableAPIRouter = exports.CorsCheckApiRouter = exports.CheckableAPIRouter = exports.CheckableFileUploadingPostRequest = exports.CheckablePutRequest = exports.CheckablePostRequest = exports.CheckableGetRequest = exports.CheckableDeleteRequest = exports.APIChecker = exports.CheckableAPIRequest = exports.DeleteRequest = exports.PutRequest = exports.PostRequest = exports.GetRequest = exports.RequestAxiosCall = exports.SimpleAPIRouter = exports.APIRouter = exports.APIRequestBuilder = exports.RequestParameterType = exports.RequestContext = exports.RequestMethod = exports.APIRequest = exports.CetusStrategyApiManager = exports.ExternalApiSigner = exports.ExpressFileUploadingConfiguration = exports.ExpressStandardConfiguration = exports.ExpressLogableConfig = exports.HttpsAPIService = exports.ITRMAPIServiceGlobal = exports.APIService = exports.AlegraConnectionManager = void 0;
|
|
4
4
|
var AlegraConnectionManager_1 = require("./api/alegra/AlegraConnectionManager");
|
|
5
5
|
Object.defineProperty(exports, "AlegraConnectionManager", { enumerable: true, get: function () { return AlegraConnectionManager_1.AlegraConnectionManager; } });
|
|
6
6
|
var APIService_1 = require("./api/APIService");
|
|
@@ -16,6 +16,8 @@ var ExpressFileUploadingConfiguration_1 = require("./api/express/ExpressFileUplo
|
|
|
16
16
|
Object.defineProperty(exports, "ExpressFileUploadingConfiguration", { enumerable: true, get: function () { return ExpressFileUploadingConfiguration_1.ExpressFileUploadingConfiguration; } });
|
|
17
17
|
var ExternalApiSigner_1 = require("./api/external/ExternalApiSigner");
|
|
18
18
|
Object.defineProperty(exports, "ExternalApiSigner", { enumerable: true, get: function () { return ExternalApiSigner_1.ExternalApiSigner; } });
|
|
19
|
+
var CetusStrategyApiManager_1 = require("./api/external/cetus/CetusStrategyApiManager");
|
|
20
|
+
Object.defineProperty(exports, "CetusStrategyApiManager", { enumerable: true, get: function () { return CetusStrategyApiManager_1.CetusStrategyApiManager; } });
|
|
19
21
|
var APIRequest_1 = require("./api/APIRequest");
|
|
20
22
|
Object.defineProperty(exports, "APIRequest", { enumerable: true, get: function () { return APIRequest_1.APIRequest; } });
|
|
21
23
|
Object.defineProperty(exports, "RequestMethod", { enumerable: true, get: function () { return APIRequest_1.RequestMethod; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAEA,gFAA0G;AAAjG,kIAAA,uBAAuB,OAA2B;AAG3D,+CAA0L;AAA3I,wGAAA,UAAU,OAAc;AAA4C,kHAAA,oBAAoB,OAAwB;AAC/J,yDAA2E;AAAlE,kHAAA,eAAe,OAAmB;AAE3C,2EAAkG;AAAzF,4HAAA,oBAAoB,OAAwB;AACrD,2FAA0H;AAAjH,4IAAA,4BAA4B,OAAgC;AACrE,qGAAyI;AAAhI,sJAAA,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EAAqG;AAA5F,0HAAA,mBAAmB,OAAuB;AACnD,iFAAwG;AAA/F,4HAAA,oBAAoB,OAAwB;AACrD,+EAAqG;AAA5F,0HAAA,mBAAmB,OAAuB;AACnD,2GAA+I;AAAtI,sJAAA,iCAAiC,OAAqC;AAC/E,qEAA0F;AAAjF,wHAAA,kBAAkB,OAAsB;AACjD,2EAAgG;AAAvF,wHAAA,kBAAkB,OAAsB;AACjD,uFAAkH;AAAzG,oIAAA,wBAAwB,OAA4B;AAG7D,4EAA6J;AAApJ,wHAAA,kBAAkB,OAAsB;AAEjD,iFAAwG;AAA/F,4HAAA,oBAAoB,OAAwB;AACrD,gFAAsG;AAA7F,0HAAA,mBAAmB,OAAuB;AACnD,oFAA4G;AAAnG,8HAAA,qBAAqB,OAAyB;AAEvD,uCAAgD;AAAvC,gGAAA,MAAM,OAAU;AACzB,qDAAqE;AAA5D,8GAAA,aAAa,OAAiB;AACvC,yDAA2E;AAAlE,kHAAA,eAAe,OAAmB;AAE3C,oCAA2C;AAAlC,4FAAA,IAAI,OAAQ;AACrB,8EAAqG;AAA5F,4HAAA,oBAAoB,OAAwB;AAErD,sCAA8C;AAArC,8FAAA,KAAK,OAAS"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "itrm-tools",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.23",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -41,15 +41,15 @@
|
|
|
41
41
|
"@types/uuid": "^10.0.0",
|
|
42
42
|
"axios-mock-adapter": "^2.0.0",
|
|
43
43
|
"jest": "^29.7.0",
|
|
44
|
-
"jest-puppeteer": "^
|
|
44
|
+
"jest-puppeteer": "^11.0.0",
|
|
45
45
|
"mongodb-memory-server": "^10.0.0",
|
|
46
|
-
"puppeteer": "^
|
|
46
|
+
"puppeteer": "^24.6.0",
|
|
47
47
|
"redis": "^4.6.13",
|
|
48
48
|
"rimraf": "^6.0.1",
|
|
49
49
|
"sqlite3": "^5.1.6",
|
|
50
50
|
"ts-jest": "^29.1.2",
|
|
51
51
|
"typescript": "^5.4.4",
|
|
52
|
-
"uuid": "^
|
|
52
|
+
"uuid": "^11.1.0"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@sequelize/core": "^7.0.0-alpha.43",
|
|
@@ -58,10 +58,10 @@
|
|
|
58
58
|
"@types/ws": "^8.5.8",
|
|
59
59
|
"axios": "^1.7.3",
|
|
60
60
|
"axios-retry": "^4.0.0",
|
|
61
|
-
"body-parser": "^
|
|
61
|
+
"body-parser": "^2.2.0",
|
|
62
62
|
"cors": "^2.8.5",
|
|
63
63
|
"crypto-js": "^4.2.0",
|
|
64
|
-
"express": "^
|
|
64
|
+
"express": "^5.1.0",
|
|
65
65
|
"https": "^1.0.0",
|
|
66
66
|
"mogoose": "^0.0.1-security",
|
|
67
67
|
"mongoose": "^8.7.0",
|