diff --git a/.gitignore b/.gitignore index 22b9958..324bf95 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ main dist/ +.idea \ No newline at end of file diff --git a/README.md b/README.md index d98f0ea..f0b1662 100644 --- a/README.md +++ b/README.md @@ -132,14 +132,11 @@ You can pass the artuments to the executable file to configure it. Here is the p - `--bech-prefix` - the global prefix for addresses. Defaults to `persistence` - `--denom` - the currency, for example, `uatom` for Cosmos. Defaults to `uxprt` -- `--denom-coefficient` - the number of decimals, `1000000` for cosmos. Defaults to `1`. Can't provide along with `--denom-exponent` -- `--denom-exponent` - the denom exponent, `6` for cosmos. Defaults to `0`. Can't provide along with `--denom-coefficient` - `--listen-address` - the address with port the node would listen to. For example, you can use it to redefine port or to make the exporter accessible from the outside by listening on `127.0.0.1`. Defaults to `:9300` (so it's accessible from the outside on port 9300) - `--node` - the gRPC node URL. Defaults to `localhost:9090` - `--tendermint-rpc` - Tendermint RPC URL to query node stats (specifically `chain-id`). Defaults to `http://localhost:26657` - `--log-devel` - logger level. Defaults to `info`. You can set it to `debug` to make it more verbose. - `--limit` - pagination limit for gRPC requests. Defaults to 1000. -- `--json` - output logs as JSON. Useful if you don't read it on servers but instead use logging aggregation solutions such as ELK stack. You can also specify custom Bech32 prefixes for wallets, validators, consensus nodes, and their pubkeys by using the following params: diff --git a/go.mod b/go.mod index d87b265..985db8d 100644 --- a/go.mod +++ b/go.mod @@ -15,5 +15,6 @@ require ( github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.7.1 github.com/tendermint/tendermint v0.34.9 + golang.org/x/sys v0.2.0 // indirect google.golang.org/grpc v1.35.0 ) diff --git a/go.sum b/go.sum index 6664bf7..ff0017f 100644 --- a/go.sum +++ b/go.sum @@ -717,6 +717,8 @@ golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211 h1:9UQO31fZ+0aKQOFldThf7BKPMJTiBfWycGh/u3UoO88= golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221 h1:/ZHdbVpdR/jk3g30/d4yUL0JU9kksj8+F/bnQUVLGDM= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/validators.go b/validators.go index 753e407..aa23de6 100644 --- a/validators.go +++ b/validators.go @@ -151,9 +151,9 @@ func ValidatorsHandler(w http.ResponseWriter, r *http.Request, grpcConn *grpc.Cl Msg("Finished querying validators") validators = validatorsResponse.Validators - // sorting by delegator shares to display rankings + // sorting by delegator tokens to display rankings sort.Slice(validators, func(i, j int) bool { - return validators[i].DelegatorShares.RoundInt64() > validators[j].DelegatorShares.RoundInt64() + return validators[i].Tokens.GT(validators[j].Tokens) }) }()