-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Description
-
File: packages/adapters/bitcoin/src/utils/UnitsUtil.ts
-
Issue: parseSatoshis divides the incoming integer satoshi by 10**decimals and returns a formatted decimal string. sendBitcoin expects an integer satoshi amount, so using parseSatoshis before sending results in the wrong on‑chain amount.
-
Repro: parseSatoshis("100000000", decimals=8) => "1" — if passed to sendBitcoin this will send 1 satoshi instead of 100,000,000.
-
Suggested fix: separate display vs send logic. Rename to formatSatoshis (display only) and implement using BigInt (avoid parseFloat). Ensure sendBitcoin receives raw satoshi (string/BigInt) or provide a precise converter that returns the exact decimal string required by any RPC.
-
Severity: High — can cause incorrect transfers.
| const value = parseFloat(amount) / 10 ** network.nativeCurrency.decimals |
Metadata
Metadata
Assignees
Labels
No labels