Skip to content

Commit

Permalink
Convert string response
Browse files Browse the repository at this point in the history
  • Loading branch information
af-afk committed Jun 18, 2024
1 parent 2fe61fa commit 713288c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cmd/faucet.superposition/graph/stakers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package graph

import (
"encoding/json"
"fmt"
"net/http"
"strconv"
"strings"
"fmt"
)

// UrlModeratorsGraph to ask whether a user is currently staking and their
Expand Down Expand Up @@ -32,9 +33,10 @@ func IsUserStaker(wallet string) (bool, error) {
}
var isStaker bool
staker := stakerInfo[0]["points"]
v, ok := staker.(int)
if !ok {
return false, fmt.Errorf("bad type conversion: %T", staker)
s, _ := staker.(string)
v, err := strconv.Atoi(s)
if err != nil {
return false, fmt.Errorf("bad type conversion to int: %#v: %v", staker, err)
}
isStaker = v > StakerCutoff
return isStaker, nil
Expand Down

0 comments on commit 713288c

Please sign in to comment.