@@ -121,14 +121,18 @@ func (handlers *Handlers) formatAmountAsJSON(amount coin.Amount, isFee bool) For
121
121
122
122
func (handlers * Handlers ) formatAmountAtTimeAsJSON (amount coin.Amount , timeStamp * time.Time ) FormattedAmount {
123
123
accountCoin := handlers .account .Coin ()
124
- conversions , estimated := coin .ConversionsAtTime (
125
- amount ,
126
- handlers .account .Coin (),
127
- false ,
128
- handlers .account .Config ().RateUpdater ,
129
- util .FormatBtcAsSat (handlers .account .Config ().BtcCurrencyUnit ),
130
- timeStamp ,
131
- )
124
+ conversions := map [string ]string {}
125
+ estimated := false
126
+ if timeStamp != nil {
127
+ conversions , estimated = coin .ConversionsAtTime (
128
+ amount ,
129
+ handlers .account .Coin (),
130
+ false ,
131
+ handlers .account .Config ().RateUpdater ,
132
+ util .FormatBtcAsSat (handlers .account .Config ().BtcCurrencyUnit ),
133
+ timeStamp ,
134
+ )
135
+ }
132
136
return FormattedAmount {
133
137
Amount : accountCoin .FormatAmount (amount , false ),
134
138
Unit : accountCoin .GetFormatUnit (false ),
@@ -195,12 +199,12 @@ func (handlers *Handlers) getTxInfoJSON(txInfo *accounts.TransactionData, detail
195
199
timestamp = txInfo .CreatedTimestamp
196
200
}
197
201
198
- var deductedAmountAtTime FormattedAmount
202
+ deductedAmountAtTime := handlers .formatAmountAtTimeAsJSON (txInfo .DeductedAmount , timestamp )
203
+
199
204
if timestamp != nil {
200
205
t := timestamp .Format (time .RFC3339 )
201
206
formattedTime = & t
202
207
amountAtTime = handlers .formatAmountAtTimeAsJSON (txInfo .Amount , timestamp )
203
- deductedAmountAtTime = handlers .formatAmountAtTimeAsJSON (txInfo .DeductedAmount , timestamp )
204
208
}
205
209
206
210
addresses := []string {}
0 commit comments