1
0

bitbox02: display amounts in sats if Electrum's base unit is sat

The BitBox02 has the ability to display all amounts in sats instead of
BTC. This was introduced in v9.13.0. If Electrum is configured to show
sats, we propagate this config to the BitBox02.

This is backwards compatible: users with older firmware will see the
values in BTC regardless of the config.
This commit is contained in:
Marko Bencun
2023-05-30 23:56:27 +02:00
parent 7164f9fd6e
commit dfed0ef54a

View File

@@ -510,6 +510,12 @@ class BitBox02Client(HardwareClientBase):
)
keypath_account = full_path[:-2]
format_unit = bitbox02.btc.BTCSignInitRequest.FormatUnit.DEFAULT
# Base unit is configured to be "sat":
if self.config.get_decimal_point() == 0:
format_unit = bitbox02.btc.BTCSignInitRequest.FormatUnit.SAT
sigs = self.bitbox02_device.btc_sign(
coin,
[bitbox02.btc.BTCScriptConfigWithKeypath(
@@ -520,6 +526,7 @@ class BitBox02Client(HardwareClientBase):
outputs=outputs,
locktime=tx.locktime,
version=tx.version,
format_unit=format_unit,
)
# Fill signatures