From 9afda4260b5d88d33db063039f8ed01e9480e972 Mon Sep 17 00:00:00 2001 From: KS Date: Thu, 4 Apr 2024 17:32:37 +0300 Subject: [PATCH] removed crypto-js dependency --- src/services/Aggregator/index.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/services/Aggregator/index.ts b/src/services/Aggregator/index.ts index 1077a53..09966bf 100644 --- a/src/services/Aggregator/index.ts +++ b/src/services/Aggregator/index.ts @@ -19,8 +19,9 @@ import httpToWS from '../../utils/httpToWS.js'; import { ethers } from 'ethers'; import orderSchema from './schemas/orderSchema.js'; import { fetchWithValidation } from 'simple-typed-fetch'; -import hmacSHA256 from "crypto-js/hmac-sha256"; -import Hex from "crypto-js/enc-hex"; +// import hmacSHA256 from "crypto-js/hmac-sha256"; +// import Hex from "crypto-js/enc-hex"; +const crypto = require('crypto') import {pmmOrderSchema} from "../../Unit/Pmm/schemas/order"; class Aggregator { @@ -379,10 +380,9 @@ class Aggregator { } private sign(message : string, key: string) { - return hmacSHA256( - this.encode_utf8(message), - this.encode_utf8(key) - ).toString(Hex); + return crypto.createHmac('sha256', this.encode_utf8(key)) + .update(this.encode_utf8(message)) + .digest('hex'); } private generateHeaders(body : any, method : string, path : string, timestamp : number, apiKey : string, secretKey : string) {