Skip to content

Commit

Permalink
Correct fee api call to return via API
Browse files Browse the repository at this point in the history
  • Loading branch information
steveocrypto authored and gertjaap committed Feb 26, 2021
1 parent b21bc8c commit d346991
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions pools/hashalot.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,25 @@ func (p *Hashalot) GetName() string {

func (p *Hashalot) GetFee() float64 {
jsonPayload := map[string]interface{}{}
err := util.GetJson(fmt.Sprintf("http://api.hashalot.net/pools/"), &jsonPayload)
err := util.GetJson("http://api.hashalot.net/pools", &jsonPayload)
if err != nil {
return 2.0
}
fee, ok := jsonPayload[0]["poolFeePercent"].(float64)

pools, ok := jsonPayload["pools"].([]interface{})
if !ok {
return 2.0
}
return uint64(fee)

pool, ok := pools[0].(map[string]interface{})
if !ok {
return 2.0
}

fee, ok := pool["poolFeePercent"].(float64)
if !ok {
return 2.0
}

return fee
}

0 comments on commit d346991

Please sign in to comment.