Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions services/wallet/common/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"math/big"
"reflect"
"slices"
"time"

ethereum "github.com/ethereum/go-ethereum"
Expand Down Expand Up @@ -33,12 +34,7 @@ func NetworksToChainIDs(networks []*params.Network) []uint64 {
}

func ArrayContainsElement[T comparable](el T, arr []T) bool {
for _, e := range arr {
if e == el {
return true
}
}
return false
return slices.Contains(arr, el)
}

func IsSingleChainOperation(fromChain *params.Network, toChain *params.Network) bool {
Expand Down
7 changes: 1 addition & 6 deletions services/wallet/testutils/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@ const SntSymbol = "SNT"
const DaiSymbol = "DAI"

func SliceContains[T comparable](slice []T, value T) bool {
for _, v := range slice {
if v == value {
return true
}
}
return false
return slices.Contains(slice, value)
}
func StructExistsInSlice[T any](target T, slice []T) bool {
for _, item := range slice {
Expand Down
9 changes: 2 additions & 7 deletions services/wallet/thirdparty/http_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"net/http"
"net/http/httptest"
"net/url"
"slices"
"testing"

"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -252,13 +253,7 @@ func TestFetchDataCompression(t *testing.T) {
// Create test server
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// Check if client requested gzip
acceptsGzip := false
for _, encoding := range r.Header["Accept-Encoding"] {
if encoding == "gzip" {
acceptsGzip = true
break
}
}
acceptsGzip := slices.Contains(r.Header["Accept-Encoding"], "gzip")

// Verify auth
username, password, ok := r.BasicAuth()
Expand Down