diff --git a/bin/wasm-node/CHANGELOG.md b/bin/wasm-node/CHANGELOG.md index f89054661a..aa11a344d1 100644 --- a/bin/wasm-node/CHANGELOG.md +++ b/bin/wasm-node/CHANGELOG.md @@ -4,6 +4,7 @@ ### Fixed +- On NodeJS, the usage of `hrtime` has been replaced with `performance.now()`. While this doesn't change anything for NodeJS users, Deno users that were importing smoldot through the website will no longer get an error due to Deno's compatibility layer not supporting `hrtime`. As a reminder, smoldot is also published on the Deno/x registry and using is unnecessary. ([#2964](https://github.com/paritytech/smoldot/pull/2964)) - Fix the `ext_crypto_ecdsa_verify_version_1` and `ext_crypto_ecdsa_verify_prehashed_version_1` host functions mixing their parameters and thus always failing. ([#2955](https://github.com/paritytech/smoldot/pull/2955)) ## 0.7.5 - 2022-10-31 diff --git a/bin/wasm-node/javascript/src/index-nodejs.ts b/bin/wasm-node/javascript/src/index-nodejs.ts index ea61df0981..3fea783694 100644 --- a/bin/wasm-node/javascript/src/index-nodejs.ts +++ b/bin/wasm-node/javascript/src/index-nodejs.ts @@ -25,7 +25,7 @@ import { Connection, ConnectionError, ConnectionConfig } from './instance/instan import { WebSocket } from 'ws'; import { inflate } from 'pako'; -import { hrtime } from 'node:process'; +import { performance } from 'node:perf_hooks'; import { createConnection as nodeCreateConnection } from 'node:net'; import type { Socket as TcpSocket } from 'node:net'; import { randomFillSync } from 'node:crypto'; @@ -59,8 +59,7 @@ export function start(options?: ClientOptions): Client { return Promise.resolve(inflate(Buffer.from(input, 'base64'))) }, performanceNow: () => { - const time = hrtime(); - return ((time[0] * 1e3) + (time[1] / 1e6)); + return performance.now() }, getRandomValues: (buffer) => { if (buffer.length >= 65536)