@@ -38,15 +38,6 @@ type internal CurrencyImageSize =
38
38
39
39
module FrontendHelpers =
40
40
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
-
50
41
type IGlobalAppState =
51
42
[<CLIEvent>]
52
43
abstract member Resumed: IEvent < unit > with get
@@ -118,7 +109,7 @@ module FrontendHelpers =
118
109
119
110
let UpdateBalance ( balance : MaybeCached < decimal >) currency usdRate
120
111
( maybeFrame : Option < Frame >) ( balanceLabel : Label ) ( fiatBalanceLabel : Label )
121
- ( cryptoSubUnit : CryptoSubUnit )
112
+ ( cryptoSubUnit : Option < UtxoCoin.SubUnit > )
122
113
: MaybeCached < decimal > =
123
114
let maybeBalanceAmount =
124
115
match balance with
@@ -141,16 +132,16 @@ module FrontendHelpers =
141
132
| Some balanceAmount ->
142
133
let adjustedBalance =
143
134
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
147
138
let cryptoAmount = Formatting.DecimalAmountRounding CurrencyType.Crypto adjustedBalance
148
139
let cryptoAmountStr =
149
140
match cryptoSubUnit with
150
- | No ->
141
+ | None ->
151
142
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
154
145
let fiatAmount , fiatAmountStr = BalanceInUsdString balanceAmount usdRate
155
146
cryptoAmountStr, fiatAmount, fiatAmountStr
156
147
MainThread.BeginInvokeOnMainThread( fun _ ->
@@ -179,7 +170,7 @@ module FrontendHelpers =
179
170
( Some balanceSet.Widgets.Frame)
180
171
balanceSet.Widgets.CryptoLabel
181
172
balanceSet.Widgets.FiatLabel
182
- CryptoSubUnit.No
173
+ None
183
174
return {
184
175
BalanceSet = balanceSet
185
176
FiatAmount = fiatAmount
@@ -208,7 +199,7 @@ module FrontendHelpers =
208
199
( Some balanceSet.Widgets.Frame)
209
200
balanceSet.Widgets.CryptoLabel
210
201
balanceSet.Widgets.FiatLabel
211
- CryptoSubUnit.No
202
+ None
212
203
return {
213
204
BalanceSet = balanceSet
214
205
FiatAmount = fiatAmount
0 commit comments