From 25b0b5ded5eceb32414ded77e26d8ddd6da9de70 Mon Sep 17 00:00:00 2001 From: c9s Date: Wed, 7 Aug 2024 17:12:55 +0800 Subject: [PATCH] max: fix withdraw state convert by calling convertWithdrawStatusV2 v3 api does not return status field --- pkg/exchange/max/convert.go | 2 +- pkg/exchange/max/exchange.go | 3 +-- pkg/exchange/max/maxapi/account.go | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/exchange/max/convert.go b/pkg/exchange/max/convert.go index c1fe3dfb8..20b80e397 100644 --- a/pkg/exchange/max/convert.go +++ b/pkg/exchange/max/convert.go @@ -361,7 +361,7 @@ func convertWithdrawStatusV3(status max.WithdrawStatus) types.WithdrawStatus { return types.WithdrawStatus(status) } -func convertWithdrawStatus(state max.WithdrawState) types.WithdrawStatus { +func convertWithdrawStatusV2(state max.WithdrawState) types.WithdrawStatus { switch state { case max.WithdrawStateSent, max.WithdrawStateSubmitting, max.WithdrawStatePending, "accepted", "approved": diff --git a/pkg/exchange/max/exchange.go b/pkg/exchange/max/exchange.go index 3852aadf5..873eed3ef 100644 --- a/pkg/exchange/max/exchange.go +++ b/pkg/exchange/max/exchange.go @@ -865,8 +865,7 @@ func (e *Exchange) QueryWithdrawHistory( continue } - // we can convert this later - status := convertWithdrawStatusV3(d.Status) + status := convertWithdrawStatusV2(d.State) txIDs[d.TxID] = struct{}{} withdraw := types.Withdraw{ diff --git a/pkg/exchange/max/maxapi/account.go b/pkg/exchange/max/maxapi/account.go index cc0ae7925..be176f923 100644 --- a/pkg/exchange/max/maxapi/account.go +++ b/pkg/exchange/max/maxapi/account.go @@ -194,7 +194,7 @@ type Withdraw struct { // "sygna_verifying" State WithdrawState `json:"state"` - Status WithdrawStatus `json:"status,omitempty"` + // Status WithdrawStatus `json:"status,omitempty"` CreatedAt types.MillisecondTimestamp `json:"created_at"` UpdatedAt types.MillisecondTimestamp `json:"updated_at"`