@@ -38,15 +38,6 @@ type internal CurrencyImageSize =
3838
3939module FrontendHelpers =
4040
41- type CryptoSubUnit =
42- | No
43- | Specific of multiplier : int * caption : string
44-
45- let Sats =
46- CryptoSubUnit.Specific( 100_000_000 , " sats" )
47- let Bits =
48- CryptoSubUnit.Specific( 1_000_000 , " bits" )
49-
5041 type IGlobalAppState =
5142 [<CLIEvent>]
5243 abstract member Resumed: IEvent < unit > with get
@@ -118,7 +109,7 @@ module FrontendHelpers =
118109
119110 let UpdateBalance ( balance : MaybeCached < decimal >) currency usdRate
120111 ( maybeFrame : Option < Frame >) ( balanceLabel : Label ) ( fiatBalanceLabel : Label )
121- ( cryptoSubUnit : CryptoSubUnit )
112+ ( cryptoSubUnit : Option < UtxoCoin.SubUnit > )
122113 : MaybeCached < decimal > =
123114 let maybeBalanceAmount =
124115 match balance with
@@ -141,16 +132,16 @@ module FrontendHelpers =
141132 | Some balanceAmount ->
142133 let adjustedBalance =
143134 match cryptoSubUnit with
144- | No -> balanceAmount
145- | Specific ( multiplier , _ caption ) ->
146- balanceAmount * decimal multiplier
135+ | None -> balanceAmount
136+ | Some unit ->
137+ balanceAmount * decimal unit.Multiplier
147138 let cryptoAmount = Formatting.DecimalAmountRounding CurrencyType.Crypto adjustedBalance
148139 let cryptoAmountStr =
149140 match cryptoSubUnit with
150- | No ->
141+ | None ->
151142 SPrintF2 " %A %s " currency cryptoAmount
152- | Specific (_ multiplier , caption ) ->
153- SPrintF2 " %s %A " cryptoAmount caption
143+ | Some unit ->
144+ SPrintF2 " %s %A " cryptoAmount unit.Caption
154145 let fiatAmount , fiatAmountStr = BalanceInUsdString balanceAmount usdRate
155146 cryptoAmountStr, fiatAmount, fiatAmountStr
156147 MainThread.BeginInvokeOnMainThread( fun _ ->
@@ -179,7 +170,7 @@ module FrontendHelpers =
179170 ( Some balanceSet.Widgets.Frame)
180171 balanceSet.Widgets.CryptoLabel
181172 balanceSet.Widgets.FiatLabel
182- CryptoSubUnit.No
173+ None
183174 return {
184175 BalanceSet = balanceSet
185176 FiatAmount = fiatAmount
@@ -208,7 +199,7 @@ module FrontendHelpers =
208199 ( Some balanceSet.Widgets.Frame)
209200 balanceSet.Widgets.CryptoLabel
210201 balanceSet.Widgets.FiatLabel
211- CryptoSubUnit.No
202+ None
212203 return {
213204 BalanceSet = balanceSet
214205 FiatAmount = fiatAmount
0 commit comments