From af3a105e70df5e34272441f6a03eae6a282056b5 Mon Sep 17 00:00:00 2001 From: c9s Date: Fri, 15 Nov 2024 10:57:06 +0800 Subject: [PATCH] max: improve max deposit status string --- pkg/exchange/max/exchange.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/exchange/max/exchange.go b/pkg/exchange/max/exchange.go index fb6ac8811..079f3fe6d 100644 --- a/pkg/exchange/max/exchange.go +++ b/pkg/exchange/max/exchange.go @@ -937,6 +937,14 @@ func (e *Exchange) QueryDepositHistory( return nil, err } + toRawStatusStr := func(d maxapi.Deposit) string { + if len(d.StateReason) > 0 { + return fmt.Sprintf("%s (%s: %s)", d.Status, d.State, d.StateReason) + } + + return fmt.Sprintf("%s (%s)", d.Status, d.State) + } + for i := len(deposits) - 1; i >= 0; i-- { d := deposits[i] if _, ok := txIDs[d.TxID]; ok { @@ -954,7 +962,7 @@ func (e *Exchange) QueryDepositHistory( Status: toGlobalDepositStatus(d.State), Confirmation: strconv.FormatInt(d.Confirmations, 10), Network: d.NetworkProtocol, - RawStatus: fmt.Sprintf("%s (%s: %s)", d.Status, d.State, d.StateReason), + RawStatus: toRawStatusStr(d), }) }