removed crypto-js dependency

This commit is contained in:
KS
2024-04-04 17:32:37 +03:00
parent ddc8acde7c
commit 9afda4260b

View File

@@ -19,8 +19,9 @@ import httpToWS from '../../utils/httpToWS.js';
import { ethers } from 'ethers'; import { ethers } from 'ethers';
import orderSchema from './schemas/orderSchema.js'; import orderSchema from './schemas/orderSchema.js';
import { fetchWithValidation } from 'simple-typed-fetch'; import { fetchWithValidation } from 'simple-typed-fetch';
import hmacSHA256 from "crypto-js/hmac-sha256"; // import hmacSHA256 from "crypto-js/hmac-sha256";
import Hex from "crypto-js/enc-hex"; // import Hex from "crypto-js/enc-hex";
const crypto = require('crypto')
import {pmmOrderSchema} from "../../Unit/Pmm/schemas/order"; import {pmmOrderSchema} from "../../Unit/Pmm/schemas/order";
class Aggregator { class Aggregator {
@@ -379,10 +380,9 @@ class Aggregator {
} }
private sign(message : string, key: string) { private sign(message : string, key: string) {
return hmacSHA256( return crypto.createHmac('sha256', this.encode_utf8(key))
this.encode_utf8(message), .update(this.encode_utf8(message))
this.encode_utf8(key) .digest('hex');
).toString(Hex);
} }
private generateHeaders(body : any, method : string, path : string, timestamp : number, apiKey : string, secretKey : string) { private generateHeaders(body : any, method : string, path : string, timestamp : number, apiKey : string, secretKey : string) {