From cba056aba6ad3b1cc3dc8fe9ece807eea520f8e7 Mon Sep 17 00:00:00 2001 From: mitallast Date: Tue, 5 Mar 2024 13:13:47 +0300 Subject: [PATCH] fix wasm bigint progress handler --- templates/widget/index.ts | 4 ++-- templates/widget/prove.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/widget/index.ts b/templates/widget/index.ts index d40306e1..08defd8f 100644 --- a/templates/widget/index.ts +++ b/templates/widget/index.ts @@ -3,7 +3,7 @@ // // SPDX-License-Identifier: MIT OR Apache-2.0 -import { Work, ServiceWorkerMessage } from "./types"; +import {Work, ServiceWorkerMessage} from "./types"; import fetchPoWConfig from "./fetchPoWConfig"; import sendWork from "./sendWork"; import sendToParent from "./sendToParent"; @@ -94,7 +94,7 @@ export const solveCaptchaRunner = async (e: Event): Promise => { } if (resp.type === "progress") { if (width < 80) { - width = Number(resp.nonce / max_recorded_nonce) * 100; + width = resp.nonce / max_recorded_nonce * 100; setWidth(width); } console.log(`received nonce ${resp.nonce}`); diff --git a/templates/widget/prove.ts b/templates/widget/prove.ts index c0576bc4..d4f1ee9f 100644 --- a/templates/widget/prove.ts +++ b/templates/widget/prove.ts @@ -30,7 +30,7 @@ const prove = async ( config.string, config.difficulty_factor, STEPS, - progress + (nonce: BigInt | number) => progress(Number(nonce)) ); const t1 = performance.now(); time = t1 - t0;