From 193498dbebb9e131d4c22f51e9171e399e4115e7 Mon Sep 17 00:00:00 2001 From: Bohdan Serdinov Date: Fri, 17 Apr 2026 15:01:19 +0200 Subject: [PATCH 1/2] chore(history): change history filtration params --- client/swaps.go | 6 ++++++ types/intents.go | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/client/swaps.go b/client/swaps.go index c651f82..a55fd6c 100644 --- a/client/swaps.go +++ b/client/swaps.go @@ -40,6 +40,8 @@ type ListSwapHistoryParams struct { Token string // Wallets specify addresses filter. Wallets []string + // Statuses specify statusses filter. + Statuses []types.CombinedStatus // RetailID specifies the retail ID filter. RetailID string } @@ -83,6 +85,10 @@ func (params *ListSwapHistoryParams) toQueryParams() string { q.Set("retail_id", params.RetailID) } + for _, status := range params.Statuses { + q.Add("status", status.String()) + } + return q.Encode() } diff --git a/types/intents.go b/types/intents.go index fcdccc3..4775f08 100644 --- a/types/intents.go +++ b/types/intents.go @@ -25,3 +25,7 @@ const ( // CombinedStatusRefunded defines the `Refunded` status. CombinedStatusRefunded CombinedStatus = "Refunded" ) + +func (s CombinedStatus) String() string { + return string(s) +} From 315f789566c4be7aed5b8a867fafe51be44a5795 Mon Sep 17 00:00:00 2001 From: Bohdan Serdinov Date: Fri, 17 Apr 2026 15:20:40 +0200 Subject: [PATCH 2/2] remove old status --- client/swaps.go | 6 ------ examples/get-history/main.go | 2 +- types/swaps.go | 20 -------------------- 3 files changed, 1 insertion(+), 27 deletions(-) diff --git a/client/swaps.go b/client/swaps.go index a55fd6c..504c700 100644 --- a/client/swaps.go +++ b/client/swaps.go @@ -28,8 +28,6 @@ type ListSwapHistoryParams struct { Limit int64 // Offset defines the number of swaps to skip. Offset int64 - // Status defines the swap status filter (optional). - Status types.UiStatus // Network defines the swap network filter (optional). Network int64 // From defines the swap `from` timestamp filter (optional). @@ -57,10 +55,6 @@ func (params *ListSwapHistoryParams) toQueryParams() string { q.Set("offset", strconv.FormatInt(params.Offset, 10)) } - if params.Status != "" { - q.Set("status", string(params.Status)) - } - if params.Network != 0 { q.Set("network", strconv.FormatInt(params.Network, 10)) } diff --git a/examples/get-history/main.go b/examples/get-history/main.go index 628a2e3..772fd49 100644 --- a/examples/get-history/main.go +++ b/examples/get-history/main.go @@ -34,7 +34,7 @@ func main() { RetailID: cfg.RetailID, Limit: cfg.Limit, Offset: cfg.Offset, - Status: types.UiStatusSubmitted, + Statuses: []types.CombinedStatus{types.CombinedStatusAccepted}, Network: cfg.NetworkID, From: time.Now().UnixMilli() - OneDayInMs, To: time.Now().UnixMilli() + OneDayInMs, diff --git a/types/swaps.go b/types/swaps.go index 9775909..dde771f 100644 --- a/types/swaps.go +++ b/types/swaps.go @@ -41,23 +41,3 @@ type SwapAdditionalInfo struct { MinDestAmountLots *Int `json:"min_dest_amount_lots"` MaxDestAmountLots *Int `json:"max_dest_amount_lots"` } - -// UiStatus represents a human-readable status of a swap. -type UiStatus string - -const ( - // UiStatusSubmitted defines the `Submitted` status. - UiStatusSubmitted UiStatus = "Submitted" - // UiStatusFailed defines the `Failed` status. - UiStatusFailed UiStatus = "Failed" - // UiStatusExecuting defines the `Executing` status. - UiStatusExecuting UiStatus = "Executing" - // UiStatusCompleted defines the `Completed` status. - UiStatusCompleted UiStatus = "Completed" - // UiStatusRefunding defines the `Refunding` status. - UiStatusRefunding UiStatus = "Refunding" - // UiStatusRefunded defines the `Refunded` status. - UiStatusRefunded UiStatus = "Refunded" - // UiStatusExpired defines the `Expired` status. - UiStatusExpired UiStatus = "Expired" -)