Skip to content

fix(wasm-utxo): use BigInt-specific conversion for unspent values#211

Merged
OttoAllmendinger merged 2 commits intomasterfrom
BTC-3159.fix-hydration
Mar 16, 2026
Merged

fix(wasm-utxo): use BigInt-specific conversion for unspent values#211
OttoAllmendinger merged 2 commits intomasterfrom
BTC-3159.fix-hydration

Conversation

@OttoAllmendinger
Copy link
Contributor

Replace BigInt::from(v).as_f64() with u64::try_from(BigInt::unchecked_from_js(v)).
unchecked_from_js treats the JsValue as a BigInt without re-wrapping it, then
try_from converts directly to u64 — no lossy f64 round-trip and no false error
when the caller correctly passes a JS bigint.

BigInt::from(value_js).as_f64() wraps a JsValue as a BigInt but then calls
JsValue::as_f64(), which only returns Some(_) for JS Number — not BigInt.
Any caller passing value: bigint (as typed) always gets "'value' must be a bigint".

Issue: BTC-3159

…nt values

BigInt::from(value_js).as_f64() wraps a JsValue as a BigInt but then calls
JsValue::as_f64(), which only returns Some(_) for JS Number — not BigInt.
Any caller passing value: bigint (as typed) always gets "'value' must be a bigint".

Issue: BTC-3159
Replace BigInt::from(v).as_f64() with u64::try_from(BigInt::unchecked_from_js(v)).
unchecked_from_js treats the JsValue as a BigInt without re-wrapping it, then
try_from converts directly to u64 — no lossy f64 round-trip and no false error
when the caller correctly passes a JS bigint.

Issue: BTC-3159
@OttoAllmendinger OttoAllmendinger marked this pull request as ready for review March 16, 2026 17:58
@OttoAllmendinger OttoAllmendinger requested a review from a team as a code owner March 16, 2026 17:58
@OttoAllmendinger OttoAllmendinger merged commit 5600a48 into master Mar 16, 2026
13 checks passed
@OttoAllmendinger OttoAllmendinger deleted the BTC-3159.fix-hydration branch March 16, 2026 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants