diff --git a/dist/rpcQuery.d.ts.map b/dist/rpcQuery.d.ts.map index 9f1cf32..f4a5e3e 100644 --- a/dist/rpcQuery.d.ts.map +++ b/dist/rpcQuery.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"rpcQuery.d.ts","sourceRoot":"","sources":["../src/rpcQuery.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAe,MAAM,SAAS,CAAC;AAIlD,MAAM,CAAC,OAAO,OAAO,QAAQ;IAC3B,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,QAAQ,CAAC,CAAe;IAChC,OAAO,CAAC,aAAa,CAAC,CAAM;IAC5B,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,UAAU,CAAwC;IAC1D,OAAO,CAAC,eAAe,CAAC,CAAsB;gBAElC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU;IAMlD,IAAI,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,CAEzB;IAED,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,OAAO;YAQD,IAAI;YA2BJ,UAAU;IAgCxB,OAAO,CAAC,cAAc;IA8CtB,OAAO,CAAC,KAAK;CASd"} \ No newline at end of file +{"version":3,"file":"rpcQuery.d.ts","sourceRoot":"","sources":["../src/rpcQuery.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAe,MAAM,SAAS,CAAC;AAMlD,MAAM,CAAC,OAAO,OAAO,QAAQ;IAC3B,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,QAAQ,CAAC,CAAe;IAChC,OAAO,CAAC,aAAa,CAAC,CAAM;IAC5B,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,UAAU,CAAwC;IAC1D,OAAO,CAAC,eAAe,CAAC,CAAsB;gBAElC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU;IAMlD,IAAI,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,CAEzB;IAED,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,OAAO;YAQD,IAAI;YA2BJ,UAAU;IAgCxB,OAAO,CAAC,cAAc;IA8CtB,OAAO,CAAC,KAAK;CASd"} \ No newline at end of file diff --git a/dist/rpcQuery.js b/dist/rpcQuery.js index 4d1b221..aa73fd5 100644 --- a/dist/rpcQuery.js +++ b/dist/rpcQuery.js @@ -2,6 +2,7 @@ import { clearTimeout, setTimeout } from "timers"; import { pack, unpack } from "msgpackr"; import { Buffer } from "buffer"; import { blake2b } from "libskynet"; +import jsonStringify from "json-stable-stringify"; export default class RpcQuery { _network; _query; @@ -82,12 +83,12 @@ export default class RpcQuery { const responseStore = this._responses; const responseStoreData = Object.values(responseStore); const responseObjects = responseStoreData.reduce((output, item) => { - const hash = Buffer.from(blake2b(Buffer.from(JSON.stringify(item?.data)))).toString("hex"); + const hash = Buffer.from(blake2b(Buffer.from(jsonStringify(item?.data)))).toString("hex"); output[hash] = item?.data; return output; }, {}); const responses = responseStoreData.reduce((output, item) => { - const hash = Buffer.from(blake2b(Buffer.from(JSON.stringify(item?.data)))).toString("hex"); + const hash = Buffer.from(blake2b(Buffer.from(jsonStringify(item?.data)))).toString("hex"); output[hash] = output[hash] ?? 0; output[hash]++; return output;