From 4fbcb022e9ea420751c883e987800581d02c0815 Mon Sep 17 00:00:00 2001 From: Srinivas Baride Date: Mon, 31 May 2021 00:12:48 +0530 Subject: [PATCH 1/5] Upgraded CLI to Sentinel Hub v0.6.2 --- cli/cmd/server.go | 79 +++-- cli/context/context.go | 31 +- cli/go.mod | 26 +- cli/go.sum | 390 +++++++++++++++------ cli/lite/client.go | 222 +++++------- cli/lite/query.go | 333 ++++++++++-------- cli/lite/tx.go | 50 ++- cli/main.go | 17 +- cli/middlewares/auth.go | 41 --- cli/rest/account/handlers.go | 39 ++- cli/rest/account/requests.go | 1 - cli/rest/auth/handlers.go | 96 ----- cli/rest/auth/requests.go | 24 -- cli/rest/auth/routes.go | 15 - cli/rest/bank/handlers.go | 25 +- cli/rest/bank/requests.go | 22 +- cli/rest/config/handlers.go | 100 +----- cli/rest/deposit/handlers.go | 25 +- cli/rest/deposit/routes.go | 2 +- cli/rest/distribution/handlers.go | 36 +- cli/rest/distribution/requests.go | 17 +- cli/rest/gov/dummy.go | 83 ----- cli/rest/gov/handlers.go | 65 ++-- cli/rest/gov/requests.go | 14 +- cli/rest/keys/handlers.go | 52 +-- cli/rest/keys/requests.go | 25 -- cli/rest/node/handlers.go | 69 ++-- cli/rest/plan/handlers.go | 57 +-- cli/rest/provider/handlers.go | 48 +-- cli/rest/service/handlers.go | 20 +- cli/rest/service/responses.go | 10 +- cli/rest/session/handlers.go | 125 ++++--- cli/rest/staking/handlers.go | 209 +++++------ cli/rest/staking/requests.go | 66 ++-- cli/rest/subscription/handlers.go | 177 +++++----- cli/rest/subscription/requests.go | 36 +- cli/services/wireguard/wireguard_darwin.go | 4 +- cli/types/config.go | 41 +-- cli/types/keys.go | 1 + cli/utils/errors.go | 14 + cli/utils/rest.go | 44 ++- cli/x/auth/account.go | 40 ++- cli/x/bank/msgs.go | 38 -- cli/x/{other => common}/bandwidth.go | 6 +- cli/x/{other => common}/coin.go | 10 +- cli/x/common/deposit.go | 28 ++ cli/x/{other => common}/key.go | 14 +- cli/x/distribution/msgs.go | 32 -- cli/x/gov/msgs.go | 96 ----- cli/x/gov/proposal.go | 67 ++-- cli/x/gov/vote.go | 15 +- cli/x/node/node.go | 29 +- cli/x/other/deposit.go | 29 -- cli/x/plan/plan.go | 31 +- cli/x/provider/provider.go | 11 +- cli/x/session/session.go | 35 +- cli/x/staking/delegation.go | 24 +- cli/x/staking/msgs.go | 105 ------ cli/x/staking/validator.go | 91 +++-- cli/x/subscription/msgs.go | 89 ----- cli/x/subscription/quota.go | 11 +- cli/x/subscription/subscription.go | 43 +-- 62 files changed, 1532 insertions(+), 2063 deletions(-) delete mode 100644 cli/middlewares/auth.go delete mode 100644 cli/rest/account/requests.go delete mode 100644 cli/rest/auth/handlers.go delete mode 100644 cli/rest/auth/requests.go delete mode 100644 cli/rest/auth/routes.go delete mode 100644 cli/rest/gov/dummy.go create mode 100644 cli/utils/errors.go delete mode 100644 cli/x/bank/msgs.go rename cli/x/{other => common}/bandwidth.go (60%) rename cli/x/{other => common}/coin.go (85%) create mode 100644 cli/x/common/deposit.go rename cli/x/{other => common}/key.go (63%) delete mode 100644 cli/x/distribution/msgs.go delete mode 100644 cli/x/gov/msgs.go delete mode 100644 cli/x/other/deposit.go delete mode 100644 cli/x/staking/msgs.go delete mode 100644 cli/x/subscription/msgs.go diff --git a/cli/cmd/server.go b/cli/cmd/server.go index 096fe9e2..c71f6f48 100644 --- a/cli/cmd/server.go +++ b/cli/cmd/server.go @@ -1,6 +1,7 @@ package cmd import ( + "bufio" "fmt" "log" "net/http" @@ -8,18 +9,21 @@ import ( "path/filepath" "strings" - clientutils "github.com/cosmos/cosmos-sdk/x/auth/client/utils" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + "github.com/cosmos/cosmos-sdk/std" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/gorilla/mux" "github.com/rs/cors" "github.com/sentinel-official/hub" + "github.com/sentinel-official/hub/params" "github.com/spf13/cobra" "github.com/spf13/viper" + rpchttp "github.com/tendermint/tendermint/rpc/client/http" "github.com/sentinel-official/desktop-client/cli/context" "github.com/sentinel-official/desktop-client/cli/lite" "github.com/sentinel-official/desktop-client/cli/middlewares" "github.com/sentinel-official/desktop-client/cli/rest/account" - "github.com/sentinel-official/desktop-client/cli/rest/auth" "github.com/sentinel-official/desktop-client/cli/rest/bank" "github.com/sentinel-official/desktop-client/cli/rest/config" "github.com/sentinel-official/desktop-client/cli/rest/deposit" @@ -61,17 +65,37 @@ func ServerCmd(cfg *types.Config) *cobra.Command { } var ( - cdc = hub.MakeCodec() buildFolder = filepath.Join(home, "build") + encoding = params.MakeEncodingConfig() + reader = bufio.NewReader(cmd.InOrStdin()) ) - client, err := lite.NewClientFromConfig(cfg) + std.RegisterInterfaces(encoding.InterfaceRegistry) + hub.ModuleBasics.RegisterInterfaces(encoding.InterfaceRegistry) + + rpcclient, err := rpchttp.New(cfg.Chain.RPCAddress, "/websocket") + if err != nil { + return err + } + + kr, err := keyring.New("sentinel", keyring.BackendOS, home, reader) if err != nil { return err } - client.WithCodec(cdc). - WithTxEncoder(clientutils.GetTxEncoder(cdc)) + client := lite.NewDefaultClient(). + WithAccountRetriever(authtypes.AccountRetriever{}). + WithChainID(cfg.Chain.ID). + WithClient(rpcclient). + WithGas(cfg.Chain.Gas). + WithGasAdjustment(cfg.Chain.GasAdjustment). + WithGasPrices(cfg.Chain.GasPrices). + WithInterfaceRegistry(encoding.InterfaceRegistry). + WithKeyring(kr). + WithLegacyAmino(encoding.Amino). + WithNodeURI(cfg.Chain.RPCAddress). + WithSimulateAndExecute(cfg.Chain.SimulateAndExecute). + WithTxConfig(encoding.TxConfig) ctx := context.NewContext(). WithHome(home). @@ -79,40 +103,35 @@ func ServerCmd(cfg *types.Config) *cobra.Command { WithClient(client) var ( - muxRouter = mux.NewRouter() - protectedRouter = muxRouter.PathPrefix("/api/v1").Subrouter() - unprotectedRouter = muxRouter.PathPrefix("/api/v1").Subrouter() + muxRouter = mux.NewRouter() + prefixRouter = muxRouter.PathPrefix("/api/v1").Subrouter() ) muxRouter.Use(middlewares.Log) muxRouter.PathPrefix("/"). Handler(http.FileServer(http.Dir(buildFolder))) - unprotectedRouter.Use(middlewares.AddHeaders) - auth.RegisterRoutes(unprotectedRouter, ctx) - - protectedRouter.Use(middlewares.AddHeaders) - protectedRouter.Use(middlewares.TokenVerify(ctx)) - account.RegisterRoutes(protectedRouter, ctx) - bank.RegisterRoutes(protectedRouter, ctx) - config.RegisterRoutes(protectedRouter, ctx) - deposit.RegisterRoutes(protectedRouter, ctx) - distribution.RegisterRoutes(protectedRouter, ctx) - gov.RegisterRoutes(protectedRouter, ctx) - keys.RegisterRoutes(protectedRouter, ctx) - node.RegisterRoutes(protectedRouter, ctx) - plan.RegisterRoutes(protectedRouter, ctx) - provider.RegisterRoutes(protectedRouter, ctx) - service.RegisterRoutes(protectedRouter, ctx) - session.RegisterRoutes(protectedRouter, ctx) - staking.RegisterRoutes(protectedRouter, ctx) - subscription.RegisterRoutes(protectedRouter, ctx) + prefixRouter.Use(middlewares.AddHeaders) + account.RegisterRoutes(prefixRouter, ctx) + bank.RegisterRoutes(prefixRouter, ctx) + config.RegisterRoutes(prefixRouter, ctx) + deposit.RegisterRoutes(prefixRouter, ctx) + distribution.RegisterRoutes(prefixRouter, ctx) + gov.RegisterRoutes(prefixRouter, ctx) + keys.RegisterRoutes(prefixRouter, ctx) + node.RegisterRoutes(prefixRouter, ctx) + plan.RegisterRoutes(prefixRouter, ctx) + provider.RegisterRoutes(prefixRouter, ctx) + service.RegisterRoutes(prefixRouter, ctx) + session.RegisterRoutes(prefixRouter, ctx) + staking.RegisterRoutes(prefixRouter, ctx) + subscription.RegisterRoutes(prefixRouter, ctx) router := cors.New( cors.Options{ AllowedOrigins: strings.Split(cfg.CORS.AllowedOrigins, ","), AllowedMethods: []string{http.MethodGet, http.MethodPost, http.MethodPut}, - AllowedHeaders: []string{"Authorization", "Content-Type"}, + AllowedHeaders: []string{"Content-Type"}, }, ).Handler(muxRouter) @@ -121,7 +140,7 @@ func ServerCmd(cfg *types.Config) *cobra.Command { return err } - log.Printf("Listening on URL %s\n", listenURL) + log.Println("Listening on URL", listenURL) switch url.Scheme { case "http": return http.ListenAndServe(url.Host, router) diff --git a/cli/context/context.go b/cli/context/context.go index c03f013a..dd011bc9 100644 --- a/cli/context/context.go +++ b/cli/context/context.go @@ -3,8 +3,6 @@ package context import ( "context" - "github.com/tendermint/tendermint/libs/bytes" - "github.com/sentinel-official/desktop-client/cli/lite" "github.com/sentinel-official/desktop-client/cli/types" ) @@ -15,7 +13,6 @@ type Context struct { service types.Service client *lite.Client config *types.Config - token *types.AuthToken } func NewContext() *Context { @@ -24,23 +21,17 @@ func NewContext() *Context { } } -func (c *Context) WithHome(v string) *Context { c.home = v; return c } -func (c *Context) WithClient(v *lite.Client) *Context { c.client = v; return c } -func (c *Context) WithConfig(v *types.Config) *Context { c.config = v; return c } -func (c *Context) WithAuthToken(v *types.AuthToken) *Context { c.token = v; return c } -func (c *Context) WithContext(v context.Context) *Context { c.ctx = v; return c } -func (c *Context) WithService(v types.Service) *Context { c.service = v; return c } - -func (c *Context) AddressHex() string { - return bytes.HexBytes(c.client.FromAddress().Bytes()).String() -} - -func (c *Context) Home() string { return c.home } -func (c *Context) Client() *lite.Client { return c.client } -func (c *Context) Config() *types.Config { return c.config } -func (c *Context) AuthToken() *types.AuthToken { return c.token } -func (c *Context) Context() context.Context { return c.ctx } -func (c *Context) Service() types.Service { return c.service } +func (c *Context) WithHome(v string) *Context { c.home = v; return c } +func (c *Context) WithClient(v *lite.Client) *Context { c.client = v; return c } +func (c *Context) WithConfig(v *types.Config) *Context { c.config = v; return c } +func (c *Context) WithContext(v context.Context) *Context { c.ctx = v; return c } +func (c *Context) WithService(v types.Service) *Context { c.service = v; return c } + +func (c *Context) Home() string { return c.home } +func (c *Context) Client() *lite.Client { return c.client } +func (c *Context) Config() *types.Config { return c.config } +func (c *Context) Context() context.Context { return c.ctx } +func (c *Context) Service() types.Service { return c.service } func (c *Context) WithValue(key, value interface{}) *Context { c.WithContext(context.WithValue(c.ctx, key, value)) diff --git a/cli/go.mod b/cli/go.mod index f0d3c5d5..a5074691 100644 --- a/cli/go.mod +++ b/cli/go.mod @@ -1,19 +1,25 @@ module github.com/sentinel-official/desktop-client/cli -go 1.15 +go 1.16 require ( - github.com/cosmos/cosmos-sdk v0.39.2 - github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d + github.com/cosmos/cosmos-sdk v0.42.5 + github.com/cosmos/go-bip39 v1.0.0 + github.com/go-kit/kit v0.10.0 github.com/gorilla/mux v1.8.0 - github.com/pelletier/go-toml v1.8.0 + github.com/pelletier/go-toml v1.8.1 github.com/rs/cors v1.7.0 - github.com/sentinel-official/hub v0.5.0 - github.com/spf13/cobra v1.0.0 + github.com/sentinel-official/hub v0.6.2 + github.com/spf13/cobra v1.1.3 github.com/spf13/viper v1.7.1 - github.com/tendermint/tendermint v0.33.9 - golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 - golang.org/x/net v0.0.0-20201010224723-4f7140c49acb + github.com/tendermint/tendermint v0.34.10 + golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad + golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4 + google.golang.org/grpc v1.38.0 ) -replace github.com/keybase/go-keychain => github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 +replace ( + github.com/cosmos/cosmos-sdk => github.com/sentinel-official/cosmos-sdk v0.42.6-sentinel + github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 + google.golang.org/grpc => google.golang.org/grpc v1.33.2 +) diff --git a/cli/go.sum b/cli/go.sum index 6ec5b44d..9445fd1f 100644 --- a/cli/go.sum +++ b/cli/go.sum @@ -1,4 +1,3 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= @@ -11,16 +10,18 @@ cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqCl cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= -github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= github.com/99designs/keyring v1.1.6 h1:kVDC2uCgVwecxCk+9zoCt2uEL6dt+dfVzMvGgnVcIuM= github.com/99designs/keyring v1.1.6/go.mod h1:16e0ds7LGQQcT59QqkTg72Hh5ShM51Byv5PEmW6uoRU= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= +github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= +github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ= +github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= +github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= @@ -34,18 +35,20 @@ github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuy github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-metrics v0.3.8 h1:oOxq3KPj0WhCuy50EhzwiyMyG2ovRQZpZLXQuOh2a/M= +github.com/armon/go-metrics v0.3.8/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= -github.com/bartekn/go-bip39 v0.0.0-20171116152956-a05967ea095d h1:1aAija9gr0Hyv4KfQcRcwlmFIrhkDmIj2dz5bkg/s/8= -github.com/bartekn/go-bip39 v0.0.0-20171116152956-a05967ea095d/go.mod h1:icNx/6QdFblhsEjZehARqbNumymUT/ydwlLojFdv7Sk= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -54,8 +57,9 @@ github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d/go.mod h1:d3C0AkH6BRcvO8T0UEPu53cnw4IbV63x1bEjildYhO0= -github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= +github.com/btcsuite/btcd v0.21.0-beta h1:At9hIZdJW0s9E/fAz28nrz6AmcNlSVucCH796ZteX1M= +github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= @@ -63,7 +67,9 @@ github.com/btcsuite/btcutil v1.0.2 h1:9iZ1Terx9fMIOtq1VrwdqfsATL9MC2l8ZrUY6YZ2ut github.com/btcsuite/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= +github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I= github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= +github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= @@ -73,28 +79,39 @@ github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= +github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= +github.com/confio/ics23/go v0.0.0-20200817220745-f173e6211efb/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/confio/ics23/go v0.6.3/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/confio/ics23/go v0.6.6 h1:pkOy18YxxJ/r0XFDCnrl4Bjv6h4LkBSpLS6F38mrKL8= +github.com/confio/ics23/go v0.6.6/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cosmos/cosmos-sdk v0.39.2 h1:nLfCJMkUuFt7ansi/YvCxwwxLFrgHCA3cYP4sJKYQdk= -github.com/cosmos/cosmos-sdk v0.39.2/go.mod h1:VNUluciWBFj2vkhpMcp8rYZL/kCw0FtNc7SseUjE1KM= -github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= +github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= +github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= +github.com/cosmos/iavl v0.15.0-rc3.0.20201009144442-230e9bdf52cd/go.mod h1:3xOIaNNX19p0QrX0VqWa6voPRoJRGGYtny+DH8NEPvE= +github.com/cosmos/iavl v0.15.0-rc5/go.mod h1:WqoPL9yPTQ85QBMT45OOUzPxG/U/JcJoN7uMjgxke/I= +github.com/cosmos/iavl v0.15.3/go.mod h1:OLjQiAQ4fGD2KDZooyJG9yz+p2ao2IAYSbke8mVvSA4= +github.com/cosmos/iavl v0.16.0 h1:ICIOB8xysirTX27GmVAaoeSpeozzgSu9d49w36xkVJA= +github.com/cosmos/iavl v0.16.0/go.mod h1:2A8O/Jz9YwtjqXMO0CjnnbTYEEaovE8jWcwrakH3PoE= github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4= github.com/cosmos/ledger-cosmos-go v0.11.1/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY= github.com/cosmos/ledger-go v0.9.2 h1:Nnao/dLwaVTk1Q5U9THldpUMMXU94BOTWPddSmVB6pI= github.com/cosmos/ledger-go v0.9.2/go.mod h1:oZJ2hHAZROdlHiwTg4t7kP+GKIIkBT+o6c9QWFanOyI= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= @@ -104,18 +121,29 @@ github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= +github.com/dgraph-io/badger/v2 v2.2007.1/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/badger/v2 v2.2007.2 h1:EjjK0KqwaFMlPin1ajhP943VPENHJdEz1KLIegjaI3k= +github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= +github.com/dgraph-io/ristretto v0.0.3 h1:jh22xisGBjrEVnRZ1DVTpBVQm0Xndu8sMl0CWDzSIBI= +github.com/dgraph-io/ristretto v0.0.3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= +github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b h1:HBah4D48ypg3J7Np4N+HY/ZR76fx3HEUGxDU6Uk39oQ= github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b/go.mod h1:7BvyPhdbLxMXIYTFPLsyJRFMsKmOZnQmzh6Gb+uquuM= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/enigmampc/btcutil v1.0.3-0.20200723161021-e2fb6adb2a25 h1:2vLKys4RBU4pn2T/hjXMbvwTr1Cvy5THHrQkbeY9HRk= +github.com/enigmampc/btcutil v1.0.3-0.20200723161021-e2fb6adb2a25/go.mod h1:hTr8+TLQmkUkgcuh3mcr5fjrT9c64ZzsBCdCEC6UppY= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= @@ -125,14 +153,18 @@ github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqL github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQDg5gKsWoLBOB0n+ZW8s599zru8FJ2/Y= github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ= +github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.10.0 h1:dXFJfIHVvUcpSgDOV+Ne6t7jXri8Tfv2uOLHUZ2XNuo= @@ -146,37 +178,37 @@ github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= -github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= -github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/gateway v1.1.0 h1:u0SuhL9+Il+UbjM9VIE3ntfRujKbvVpFvNB4HbjeVQ0= +github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1-0.20190508161146-9fa652df1129/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.3.1 h1:qGJ6qTW+x6xX/my+8YUVl4WNpX9B7+/l2tRsHGZ7f2s= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1 h1:ZFgWrT+bLgsYPirOnRfKLYJLvssAegOj/hgyMFdJZe0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.2 h1:aeE13tS0IiQgFjYdoL8qN3K1N2bXXtI6Vi51/y7BpMw= -github.com/golang/snappy v0.0.2/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.3-0.20201103224600-674baa8c7fc3 h1:ur2rms48b3Ep1dxh7aUV2FZEQ8jEVO2F6ILKx8ofkAg= +github.com/golang/snappy v0.0.3-0.20201103224600-674baa8c7fc3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -184,25 +216,31 @@ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5a github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= -github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa h1:Q75Upo5UN4JbPFURXZ8nLKYUvF85dyFRop/vQ0Rv+64= +github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= +github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= -github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= +github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= +github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= @@ -211,9 +249,17 @@ github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0U github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.1/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.14.7/go.mod h1:oYZKL012gGh6LMyg/xA7Q2yq6j8bu0wa+9w14EEthWU= +github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= @@ -226,14 +272,18 @@ github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoP github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0 h1:AKDB1HM5PWEA7i4nhcpwOrO2byshxBjXVn/J/3+z5/0= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= @@ -247,33 +297,39 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d h1:Z+RDyXzjKE0i2sTjZ/b1uxiGtPhFy34Ou/Tk0qwN0kM= +github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d/go.mod h1:JJNrCn9otv/2QP4D7SMJBgaleKpOf66PnW6F5WGNRIc= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= +github.com/kkdai/bstream v1.0.0/go.mod h1:FDnDOHt5Yx4p3FaHcioFT0QjDOtgUpvjeZqAs+NVZZA= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= @@ -282,10 +338,10 @@ github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOS github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= -github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls= +github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= @@ -297,8 +353,8 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5 github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 h1:hLDRPB66XQT/8+wG9WsDpiCvZf1yKO7sz7scAjSlBa0= github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= -github.com/minio/highwayhash v1.0.0 h1:iMSDhgUILCr0TNm8LWlSjF8N0ZIj2qbO8WHp6Q/J2BA= -github.com/minio/highwayhash v1.0.0/go.mod h1:xQboMTeM9nY9v/LlAOxFctujiv5+Aq2hR5dxBpaMbdc= +github.com/minio/highwayhash v1.0.1 h1:dZ6IIu8Z14VlC0VpfKofAhCy74wu/Qb5gcn52yWoz/0= +github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= @@ -307,8 +363,9 @@ github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eI github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.3.3 h1:SzB1nHZ2Xi+17FP0zVQBHIZqvwRN9408fJO8h+eeNA8= +github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= @@ -316,6 +373,7 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= @@ -323,15 +381,24 @@ github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzE github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= @@ -341,14 +408,23 @@ github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxS github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= +github.com/otiai10/copy v1.6.0 h1:IinKAryFFuPONZ7cm6T6E2QX/vcJwSnlaA5lfoaXIiQ= +github.com/otiai10/copy v1.6.0/go.mod h1:XWfuS3CrI0R6IE0FbgHsEazaXO8G0LpMp9o8tos0x4E= +github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= +github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= +github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= +github.com/otiai10/mint v1.3.2/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= +github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml v1.6.0/go.mod h1:5N711Q9dKgbdkxHL+MEfF31hpT7l0S0s/t2kKREewys= -github.com/pelletier/go-toml v1.8.0 h1:Keo9qb7iRJs2voHvunFtuuYFsbWeOBh8/P9v/kVMFtw= -github.com/pelletier/go-toml v1.8.0/go.mod h1:D6yutnOGMveHEPV7VQOuvI/gXY61bv+9bAOTRnLElKs= +github.com/pelletier/go-toml v1.8.1 h1:1Nf83orprkJyknT6h7zbuEGUEjcyVlCxSUGTENmNCRM= +github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -356,6 +432,7 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= +github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= @@ -364,8 +441,11 @@ github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= -github.com/prometheus/client_golang v1.5.1 h1:bdHYieyGlH+6OLEk2YQha8THib30KP0/yD0YH9m6xcA= -github.com/prometheus/client_golang v1.5.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= +github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.8.0/go.mod h1:O9VU6huf47PktckDQfMTX0Y8tY0/7TSWwj+ITvv0TnM= +github.com/prometheus/client_golang v1.10.0 h1:/o0BDeWzLWXNZ+4q5gXltUvaMpJqckTa+jTNoB+z4cg= +github.com/prometheus/client_golang v1.10.0/go.mod h1:WJM3cc3yu7XKBKa/I8WeZm+V3eltZnBwfENSU7mdogU= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -378,32 +458,55 @@ github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8 github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= -github.com/prometheus/common v0.9.1 h1:KOMtN28tlbam3/7ZKEYKHhKoJZYYj3gMH4uc62x7X7U= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= +github.com/prometheus/common v0.18.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= +github.com/prometheus/common v0.23.0 h1:GXWvPYuTUenIa+BhOq/x+L/QZzCqASkVRny5KTlPDGM= +github.com/prometheus/common v0.23.0/go.mod h1:H6QK/N6XVT42whUeIdI3dp36w49c+/iMDk7UAI2qm7Q= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.8 h1:+fpWZdT24pJBiqJdAwYBjPSk+5YmQzYNPYzQsdzLkt8= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4= +github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/rakyll/statik v0.1.6/go.mod h1:OEi9wJV/fMUAGx1eNjq75DKDsJVuEv1U0oYdX6GX8Zs= +github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= +github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ= github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/regen-network/cosmos-proto v0.3.1 h1:rV7iM4SSFAagvy8RiyhiACbWEGotmqzywPxOvwMdxcg= +github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM= +github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= +github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= +github.com/rs/zerolog v1.21.0 h1:Q3vdXlfLNT+OftyBHsU0Y445MD+8m8axjKgf2si0QcM= +github.com/rs/zerolog v1.21.0/go.mod h1:ZPhntP/xmq1nnND05hhpAh2QMhSsA4UN3MGZ6O2J3hM= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= +github.com/sasha-s/go-deadlock v0.2.0/go.mod h1:StQn567HiB1fF2yJ44N9au7wOhrPS3iZqiDbRupzT10= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa h1:0U2s5loxrTy6/VgfVoLuVLFJcURKLH49ie0zSch7gh4= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/sentinel-official/hub v0.5.0 h1:r8lTPSUBSb/u7w5A6LAjdn3Vr2vf8r1XjDCIl3IsNJE= -github.com/sentinel-official/hub v0.5.0/go.mod h1:z5S9Bv+vsaz+te8lIi3tXXUlKvNO1Yk8QC0F2ZXhQec= +github.com/sentinel-official/cosmos-sdk v0.42.6-sentinel h1:c0umzLEXlYi5pPoi329i2ULMVUmAQg8Y1mtqH6HyREs= +github.com/sentinel-official/cosmos-sdk v0.42.6-sentinel/go.mod h1:3JyT+Ud7QRTO1/ikncNqVhaF526ZKNqh2HGMqXn+QHE= +github.com/sentinel-official/hub v0.6.2 h1:fquwPh7F6f124iQIletHW32QG67aWAb5C4kgj1RBE3g= +github.com/sentinel-official/hub v0.6.2/go.mod h1:OvUTO+3wTH+EBZY/WeEhezKPpVf13BYxK0yXD404AIg= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= @@ -412,14 +515,20 @@ github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPH github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.2.1 h1:qgMbHoJbPbw579P+1zVY+6n4nIFuIchaIjzZ/I/Yq8M= -github.com/spf13/afero v1.2.1/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= -github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= +github.com/spf13/afero v1.3.4 h1:8q6vk3hthlpb2SouZcnBVKboxWQWMDNF38bwholZrJc= +github.com/spf13/afero v1.3.4/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng= +github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= +github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= +github.com/spf13/cobra v1.1.3 h1:xghbfqPkxzxP3C/f3n5DdpAbdKLj4ZE4BWQI362l53M= +github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= @@ -427,8 +536,9 @@ github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= -github.com/spf13/viper v1.6.3/go.mod h1:jUMtyi0/lB5yZH/FjyGAoH7IMNrIhlBf6pXZmbMDvzw= +github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/spf13/viper v1.7.1 h1:pM5oEahlgWv/WnHXpgbKz7iLIxRf65tye2Ci+XFK5sk= github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= @@ -441,41 +551,47 @@ github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoH github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/syndtr/goleveldb v1.0.1-0.20190923125748-758128399b1d h1:gZZadD8H+fF+n9CmNhYL1Y0dJB+kLOmKd7FbPJLeGHs= -github.com/syndtr/goleveldb v1.0.1-0.20190923125748-758128399b1d/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA= +github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= +github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= github.com/tendermint/btcd v0.1.1 h1:0VcxPfflS2zZ3RiOAHkBiFUcPvbtRj5O7zHmcJWHV7s= github.com/tendermint/btcd v0.1.1/go.mod h1:DC6/m53jtQzr/NFmMNEu0rxf18/ktVoVtMrnDD5pN+U= github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RMWx1aInLzndwxKalgi5rTqgfXxOxbEI= github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= -github.com/tendermint/go-amino v0.14.1/go.mod h1:i/UKE5Uocn+argJJBb12qTZsCDBcAYMbR92AaJVmKso= -github.com/tendermint/go-amino v0.15.1 h1:D2uk35eT4iTsvJd9jWIetzthE5C0/k2QmMFkCN+4JgQ= -github.com/tendermint/go-amino v0.15.1/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= -github.com/tendermint/iavl v0.14.1 h1:jz7YOvGiPwmcqqVMcSMjxCu4WXtQYGhKdKrWTTJ5EKs= -github.com/tendermint/iavl v0.14.1/go.mod h1:QmfViflFiXzxKLQE4tAUuWQHq+RSuQFxablW5oJZ6sE= -github.com/tendermint/tendermint v0.33.5/go.mod h1:0yUs9eIuuDq07nQql9BmI30FtYGcEC60Tu5JzB5IezM= -github.com/tendermint/tendermint v0.33.9 h1:rRKIfu5qAXX5f9bwX1oUXSZz/ALFJjDuivhkbGUQxiU= -github.com/tendermint/tendermint v0.33.9/go.mod h1:0yUs9eIuuDq07nQql9BmI30FtYGcEC60Tu5JzB5IezM= -github.com/tendermint/tm-db v0.5.1 h1:H9HDq8UEA7Eeg13kdYckkgwwkQLBnJGgX4PgLJRhieY= -github.com/tendermint/tm-db v0.5.1/go.mod h1:g92zWjHpCYlEvQXvy9M168Su8V1IBEeawpXVVBaK4f4= +github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= +github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= +github.com/tendermint/tendermint v0.34.0-rc4/go.mod h1:yotsojf2C1QBOw4dZrTcxbyxmPUrT4hNuOQWX9XUwB4= +github.com/tendermint/tendermint v0.34.0-rc6/go.mod h1:ugzyZO5foutZImv0Iyx/gOFCX6mjJTgbLHTwi17VDVg= +github.com/tendermint/tendermint v0.34.0/go.mod h1:Aj3PIipBFSNO21r+Lq3TtzQ+uKESxkbA3yo/INM4QwQ= +github.com/tendermint/tendermint v0.34.10 h1:wBOc/It8sh/pVH9np2V5fBvRmIyFN/bUrGPx+eAHexs= +github.com/tendermint/tendermint v0.34.10/go.mod h1:aeHL7alPh4uTBIJQ8mgFEE8VwJLXI1VD3rVOmH2Mcy0= +github.com/tendermint/tm-db v0.6.2/go.mod h1:GYtQ67SUvATOcoY8/+x6ylk8Qo02BQyLrAs+yAcLvGI= +github.com/tendermint/tm-db v0.6.3/go.mod h1:lfA1dL9/Y/Y8wwyPp2NMLyn5P5Ptr/gvDFNWtrCWSf8= +github.com/tendermint/tm-db v0.6.4 h1:3N2jlnYQkXNQclQwd/eKV/NzlqPlfK21cpRRIx80XXQ= +github.com/tendermint/tm-db v0.6.4/go.mod h1:dptYhIpJ2M5kUuenLr+Yyf3zQOv1SgBZcl8/BmWlMBw= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/zondax/hid v0.9.0 h1:eiT3P6vNxAEVxXMw66eZUAAnU2zD33JBkfG/EnfAKl8= github.com/zondax/hid v0.9.0/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.3 h1:MUGmc65QhB3pIlaQ5bB4LwqSj6GIonVJXpZiaKNyaKk= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= +go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= @@ -493,38 +609,49 @@ go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200406173513-056763e48d71/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200429183012-4b2356b1ed79/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= +golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY= +golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -541,28 +668,38 @@ golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20201010224723-4f7140c49acb h1:mUVeFHoDKis5nxCAzoAi7E8Ghb86EXh/RK6wtvJIqRY= -golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4 h1:b0LrWgu8+q7z4J+0Y3Umo5q1dL7NXBkKBWkaVkAq17E= +golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -572,30 +709,50 @@ golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201013132646-2da7054afaeb h1:HS9IzC4UFbpMBLQUDSQcU+ViVT1vdFCQVjdPVpTlZrs= -golang.org/x/sys v0.0.0-20201013132646-2da7054afaeb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -613,18 +770,24 @@ golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -640,44 +803,45 @@ google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98 google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= +google.golang.org/genproto v0.0.0-20200324203455-a04cca1dde73/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.28.1 h1:C1QC6KzgSiLyBabDi87BbjaGreoRgGUF5nOyvfrAZ1k= -google.golang.org/grpc v1.28.1/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201111145450-ac7456db90a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210524171403-669157292da3 h1:xFyh6GBb+NO1L0xqb978I3sBPQpk6FrKO0jJGRvdj/0= +google.golang.org/genproto v0.0.0-20210524171403-669157292da3/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= +google.golang.org/grpc v1.33.2 h1:EQyQC3sa8M+p6Ulc8yy9SWSS2GVwyRc83gAbG8lrl4o= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= -gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.61.0 h1:LBCdW4FmFYL4s/vDZD1RQYX7oAR6IjujCYgMdbHBR10= +gopkg.in/ini.v1 v1.61.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= @@ -685,13 +849,15 @@ gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRN gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/cli/lite/client.go b/cli/lite/client.go index 4797b168..8f23d1f4 100644 --- a/cli/lite/client.go +++ b/cli/lite/client.go @@ -2,172 +2,142 @@ package lite import ( "io" - "io/ioutil" "os" "sync" - "github.com/cosmos/cosmos-sdk/client/context" - "github.com/cosmos/cosmos-sdk/client/keys" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" "github.com/cosmos/cosmos-sdk/codec" - crypto "github.com/cosmos/cosmos-sdk/crypto/keys" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/crypto/keyring" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/spf13/viper" - "github.com/tendermint/tendermint/libs/bytes" - "github.com/tendermint/tendermint/libs/log" - "github.com/tendermint/tendermint/lite" - "github.com/tendermint/tendermint/lite/proxy" - "github.com/tendermint/tendermint/rpc/client" - "github.com/tendermint/tendermint/rpc/client/http" - - "github.com/sentinel-official/desktop-client/cli/types" + "github.com/cosmos/cosmos-sdk/types/tx/signing" + rpcclient "github.com/tendermint/tendermint/rpc/client" ) type Client struct { - ctx context.CLIContext - txb auth.TxBuilder + ctx client.Context + txf tx.Factory mutex sync.Mutex } func NewClient() *Client { - return new(Client). + return &Client{} +} + +func NewDefaultClient() *Client { + return NewClient(). + WithBroadcastMode("block"). + WithGenerateOnly(false). + WithHeight(0). WithOutput(os.Stdout). WithOutputFormat("text"). - WithHeight(0). WithUseLedger(false). WithSimulate(false). - WithGenerateOnly(false). - WithIndent(false). WithSkipConfirm(true). - WithMemo(""). - WithFrom(""). - WithFromName(""). - WithFromAddress(nil) + WithMemo("") } func (c *Client) Copy() *Client { return &Client{ - ctx: c.ctx, - txb: c.txb, - mutex: sync.Mutex{}, + ctx: c.ctx, + txf: c.txf, } } -func NewClientFromConfig(cfg *types.Config) (*Client, error) { - var ( - verifier lite.Verifier - home = viper.GetString(types.FlagHome) - ) +func (c *Client) WithBroadcastMode(v string) *Client { c.ctx.BroadcastMode = v; return c } +func (c *Client) WithClient(v rpcclient.Client) *Client { c.ctx.Client = v; return c } +func (c *Client) WithFrom(v string) *Client { c.ctx.From = v; return c } +func (c *Client) WithFromAddress(v sdk.AccAddress) *Client { c.ctx.FromAddress = v; return c } +func (c *Client) WithFromName(v string) *Client { c.ctx.FromName = v; return c } +func (c *Client) WithGenerateOnly(v bool) *Client { c.ctx.GenerateOnly = v; return c } +func (c *Client) WithHeight(v int64) *Client { c.ctx.Height = v; return c } +func (c *Client) WithHomeDir(v string) *Client { c.ctx.HomeDir = v; return c } +func (c *Client) WithInput(v io.Reader) *Client { c.ctx.Input = v; return c } +func (c *Client) WithJSONMarshaler(v codec.JSONMarshaler) *Client { c.ctx.JSONMarshaler = v; return c } +func (c *Client) WithKeyringDir(v string) *Client { c.ctx.KeyringDir = v; return c } +func (c *Client) WithLegacyAmino(v *codec.LegacyAmino) *Client { c.ctx.LegacyAmino = v; return c } +func (c *Client) WithNodeURI(v string) *Client { c.ctx.NodeURI = v; return c } +func (c *Client) WithOffline(v bool) *Client { c.ctx.Offline = v; return c } +func (c *Client) WithOutput(v io.Writer) *Client { c.ctx.Output = v; return c } +func (c *Client) WithOutputFormat(v string) *Client { c.ctx.OutputFormat = v; return c } +func (c *Client) WithSimulate(v bool) *Client { c.ctx.Simulate = v; return c } +func (c *Client) WithSkipConfirm(v bool) *Client { c.ctx.SkipConfirm = v; return c } +func (c *Client) WithUseLedger(v bool) *Client { c.ctx.UseLedger = v; return c } + +func (c *Client) WithAccountRetriever(v client.AccountRetriever) *Client { + c.ctx.AccountRetriever = v + c.txf = c.txf.WithAccountRetriever(v) - node, err := http.New(cfg.Chain.RPCAddress, "/websocket") - if err != nil { - return nil, err - } + return c +} - kb, err := keys.NewKeyBaseFromDir(home) - if err != nil { - return nil, err - } +func (c *Client) WithInterfaceRegistry(v codectypes.InterfaceRegistry) *Client { + c.ctx.InterfaceRegistry = v + return c +} - if !cfg.Chain.TrustNode { - verifierDir, err := ioutil.TempDir(os.TempDir(), "verifier-*") - if err != nil { - return nil, err - } +func (c *Client) WithAccountNumber(v uint64) *Client { c.txf = c.txf.WithAccountNumber(v); return c } +func (c *Client) WithFees(v string) *Client { c.txf = c.txf.WithFees(v); return c } +func (c *Client) WithGas(v uint64) *Client { c.txf = c.txf.WithGas(v); return c } +func (c *Client) WithGasAdjustment(v float64) *Client { c.txf = c.txf.WithGasAdjustment(v); return c } +func (c *Client) WithGasPrices(v string) *Client { c.txf = c.txf.WithGasPrices(v); return c } +func (c *Client) WithMemo(v string) *Client { c.txf = c.txf.WithMemo(v); return c } +func (c *Client) WithSequence(v uint64) *Client { c.txf = c.txf.WithSequence(v); return c } +func (c *Client) WithTimeoutHeight(v uint64) *Client { c.txf = c.txf.WithTimeoutHeight(v); return c } + +func (c *Client) WithSimulateAndExecute(v bool) *Client { + c.txf = c.txf.WithSimulateAndExecute(v) + return c +} - verifier, err = proxy.NewVerifier(cfg.Chain.ID, verifierDir, node, log.NewNopLogger(), 16) - if err != nil { - return nil, err - } - } +func (c *Client) WithChainID(v string) *Client { + c.ctx.ChainID = v + c.txf = c.txf.WithChainID(v) - return NewClient(). - WithBroadcastMode(cfg.Chain.BroadcastMode). - WithSimulateAndExecute(cfg.Chain.SimulateAndExecute). - WithGasAdjustment(cfg.Chain.GasAdjustment). - WithKeybase(kb). - WithNodeURI(cfg.Chain.RPCAddress). - WithNode(node). - WithTrustNode(cfg.Chain.TrustNode). - WithVerifier(verifier). - WithGas(cfg.Chain.Gas). - WithChainID(cfg.Chain.ID). - WithFees(cfg.Chain.Fees). - WithGasPrices(cfg.Chain.GasPrices), nil + return c } -func (c *Client) WithCodec(v *codec.Codec) *Client { c.ctx.Codec = v; return c } -func (c *Client) WithNode(v client.Client) *Client { c.ctx.Client = v; return c } -func (c *Client) WithOutput(v io.Writer) *Client { c.ctx.Output = v; return c } -func (c *Client) WithOutputFormat(s string) *Client { c.ctx.OutputFormat = s; return c } -func (c *Client) WithHeight(s int64) *Client { c.ctx.Height = s; return c } -func (c *Client) WithNodeURI(s string) *Client { c.ctx.NodeURI = s; return c } -func (c *Client) WithFrom(s string) *Client { c.ctx.From = s; return c } -func (c *Client) WithTrustNode(t bool) *Client { c.ctx.TrustNode = t; return c } -func (c *Client) WithUseLedger(t bool) *Client { c.ctx.UseLedger = t; return c } -func (c *Client) WithBroadcastMode(s string) *Client { c.ctx.BroadcastMode = s; return c } -func (c *Client) WithVerifier(v lite.Verifier) *Client { c.ctx.Verifier = v; return c } -func (c *Client) WithSimulate(t bool) *Client { c.ctx.Simulate = t; return c } -func (c *Client) WithGenerateOnly(t bool) *Client { c.ctx.GenerateOnly = t; return c } -func (c *Client) WithFromName(s string) *Client { c.ctx.FromName = s; return c } -func (c *Client) WithIndent(t bool) *Client { c.ctx.Indent = t; return c } -func (c *Client) WithSkipConfirm(t bool) *Client { c.ctx.SkipConfirm = t; return c } -func (c *Client) WithFromAddress(v sdk.AccAddress) *Client { c.ctx.FromAddress = v; return c } -func (c *Client) WithSequence(i uint64) *Client { c.txb = c.txb.WithSequence(i); return c } -func (c *Client) WithGas(i uint64) *Client { c.txb = c.txb.WithGas(i); return c } -func (c *Client) WithChainID(s string) *Client { c.txb = c.txb.WithChainID(s); return c } -func (c *Client) WithMemo(s string) *Client { c.txb = c.txb.WithMemo(s); return c } -func (c *Client) WithFees(s string) *Client { c.txb = c.txb.WithFees(s); return c } -func (c *Client) WithGasPrices(s string) *Client { c.txb = c.txb.WithGasPrices(s); return c } -func (c *Client) WithTxEncoder(v sdk.TxEncoder) *Client { c.txb = c.txb.WithTxEncoder(v); return c } -func (c *Client) WithAccountNumber(i uint64) *Client { c.txb = c.txb.WithAccountNumber(i); return c } - -func (c *Client) WithKeybase(v crypto.Keybase) *Client { - c.ctx.Keybase = v - c.txb = c.txb.WithKeybase(v) +func (c *Client) WithKeyring(v keyring.Keyring) *Client { + c.ctx.Keyring = v + c.txf = c.txf.WithKeybase(v) return c } -func (c *Client) WithGasAdjustment(i float64) *Client { - c.txb = auth.NewTxBuilder( - c.txb.TxEncoder(), - c.txb.AccountNumber(), - c.txb.Sequence(), - c.txb.Gas(), - i, - c.txb.SimulateAndExecute(), - c.txb.ChainID(), - c.txb.Memo(), - c.txb.Fees(), - c.txb.GasPrices(), - ) - c.txb = c.txb.WithKeybase(c.ctx.Keybase) +func (c *Client) WithSignMode(v string) *Client { + c.ctx.SignModeStr = v + + var mode signing.SignMode + switch v { + case flags.SignModeDirect: + mode = signing.SignMode_SIGN_MODE_DIRECT + case flags.SignModeLegacyAminoJSON: + mode = signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON + default: + mode = signing.SignMode_SIGN_MODE_UNSPECIFIED + } + c.txf.WithSignMode(mode) return c } -func (c *Client) WithSimulateAndExecute(t bool) *Client { - c.txb = auth.NewTxBuilder( - c.txb.TxEncoder(), - c.txb.AccountNumber(), - c.txb.Sequence(), - c.txb.Gas(), - c.txb.GasAdjustment(), - t, - c.txb.ChainID(), - c.txb.Memo(), - c.txb.Fees(), - c.txb.GasPrices(), - ) - c.txb = c.txb.WithKeybase(c.ctx.Keybase) +func (c *Client) WithTxConfig(v client.TxConfig) *Client { + c.ctx.TxConfig = v + c.txf = c.txf.WithTxConfig(v) return c } -func (c *Client) ChainID() string { return c.txb.ChainID() } -func (c *Client) Keybase() crypto.Keybase { return c.ctx.Keybase } -func (c *Client) Node() client.Client { return c.ctx.Client } -func (c *Client) FromAddress() sdk.AccAddress { return c.ctx.FromAddress } -func (c *Client) FromAddressHex() string { return bytes.HexBytes(c.ctx.FromAddress.Bytes()).String() } -func (c *Client) FromName() string { return c.ctx.FromName } +func (c *Client) AccountRetriever() client.AccountRetriever { return c.ctx.AccountRetriever } +func (c *Client) ChainID() string { return c.ctx.ChainID } +func (c *Client) Client() rpcclient.Client { return c.ctx.Client } +func (c *Client) From() string { return c.ctx.From } +func (c *Client) FromAddress() sdk.AccAddress { return c.ctx.FromAddress } +func (c *Client) Keyring() keyring.Keyring { return c.ctx.Keyring } +func (c *Client) TxConfig() client.TxConfig { return c.ctx.TxConfig } +func (c *Client) SimulateAndExecute() bool { return c.txf.SimulateAndExecute() } +func (c *Client) LegacyAmino() *codec.LegacyAmino { + return c.ctx.LegacyAmino +} diff --git a/cli/lite/query.go b/cli/lite/query.go index f92fda84..3fa45a9c 100644 --- a/cli/lite/query.go +++ b/cli/lite/query.go @@ -1,296 +1,343 @@ package lite import ( - "fmt" + "context" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/auth/exported" - "github.com/cosmos/cosmos-sdk/x/gov" - "github.com/cosmos/cosmos-sdk/x/staking" - hub "github.com/sentinel-official/hub/types" - "github.com/sentinel-official/hub/x/deposit" - "github.com/sentinel-official/hub/x/node" - "github.com/sentinel-official/hub/x/plan" - "github.com/sentinel-official/hub/x/provider" - "github.com/sentinel-official/hub/x/session" - "github.com/sentinel-official/hub/x/subscription" - "github.com/sentinel-official/hub/x/vpn" + "github.com/cosmos/cosmos-sdk/types/query" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + hubtypes "github.com/sentinel-official/hub/types" + deposittypes "github.com/sentinel-official/hub/x/deposit/types" + nodetypes "github.com/sentinel-official/hub/x/node/types" + plantypes "github.com/sentinel-official/hub/x/plan/types" + providertypes "github.com/sentinel-official/hub/x/provider/types" + sessiontypes "github.com/sentinel-official/hub/x/session/types" + subscriptiontypes "github.com/sentinel-official/hub/x/subscription/types" + + "github.com/sentinel-official/desktop-client/cli/utils" ) -func (c *Client) Query(path string, params, result interface{}) error { - bytes, err := c.ctx.Codec.MarshalJSON(params) - if err != nil { - return err - } +func (c *Client) QueryAccount(address sdk.AccAddress) (authtypes.AccountI, error) { + var ( + account authtypes.AccountI + qc = authtypes.NewQueryClient(c.ctx) + ) - res, _, err := c.ctx.QueryWithData(path, bytes) + res, err := qc.Account(context.Background(), + &authtypes.QueryAccountRequest{ + Address: address.String(), + }, + ) if err != nil { - return err + return nil, utils.IsNotFoundError(err) } - if res == nil { - return nil + + if err := c.ctx.InterfaceRegistry.UnpackAny(res.Account, &account); err != nil { + return nil, err } - return c.ctx.Codec.UnmarshalJSON(res, result) + return account, nil } -func (c *Client) QueryAccount(address sdk.AccAddress) (exported.Account, error) { +func (c *Client) QueryBalance(address sdk.AccAddress, denom string) (*sdk.Coin, error) { var ( - result exported.Account - path = fmt.Sprintf("custom/%s/%s", auth.QuerierRoute, auth.QueryAccount) + qc = banktypes.NewQueryClient(c.ctx) ) - if err := c.Query(path, auth.NewQueryAccountParams(address), &result); err != nil { - return result, err + res, err := qc.Balance(context.Background(), + &banktypes.QueryBalanceRequest{ + Address: address.String(), + Denom: denom, + }, + ) + if err != nil { + return nil, utils.IsNotFoundError(err) } - return result, nil + return res.Balance, nil } -func (c *Client) QueryValidator(address sdk.ValAddress) (staking.Validator, error) { +func (c *Client) QueryValidator(address sdk.ValAddress) (*stakingtypes.Validator, error) { var ( - result staking.Validator - path = fmt.Sprintf("custom/%s/%s", staking.QuerierRoute, staking.QueryValidator) + qc = stakingtypes.NewQueryClient(c.ctx) ) - if err := c.Query(path, staking.NewQueryValidatorParams(address), &result); err != nil { - return result, err + res, err := qc.Validator(context.Background(), + &stakingtypes.QueryValidatorRequest{ + ValidatorAddr: address.String(), + }, + ) + if err != nil { + return nil, utils.IsNotFoundError(err) } - return result, nil + return &res.Validator, nil } -func (c *Client) QueryValidators(page, limit int, status string) (staking.Validators, error) { +func (c *Client) QueryValidators(status string, pagination *query.PageRequest) (stakingtypes.Validators, error) { var ( - result staking.Validators - path = fmt.Sprintf("custom/%s/%s", staking.QuerierRoute, staking.QueryValidators) + qc = stakingtypes.NewQueryClient(c.ctx) ) - if err := c.Query(path, staking.NewQueryValidatorsParams(page, limit, status), &result); err != nil { - return result, err + res, err := qc.Validators(context.Background(), + &stakingtypes.QueryValidatorsRequest{ + Status: status, + Pagination: pagination, + }, + ) + if err != nil { + return nil, utils.IsNotFoundError(err) } - return result, nil + return res.Validators, nil } -func (c *Client) QueryDelegations(address sdk.AccAddress) (staking.Delegations, error) { +func (c *Client) QueryDelegations(address sdk.AccAddress) (stakingtypes.DelegationResponses, error) { var ( - result staking.Delegations - path = fmt.Sprintf("custom/%s/%s", staking.QuerierRoute, staking.QueryDelegatorDelegations) + qc = stakingtypes.NewQueryClient(c.ctx) ) - if err := c.Query(path, staking.NewQueryDelegatorParams(address), &result); err != nil { - return result, err + res, err := qc.DelegatorDelegations(context.Background(), + &stakingtypes.QueryDelegatorDelegationsRequest{ + DelegatorAddr: address.String(), + }, + ) + if err != nil { + return nil, utils.IsNotFoundError(err) } - return result, nil + return res.DelegationResponses, nil } -func (c *Client) QueryProposals() (gov.Proposals, error) { +func (c *Client) QueryProposals() (govtypes.Proposals, error) { var ( - result gov.Proposals - path = fmt.Sprintf("custom/%s/%s", gov.QuerierRoute, gov.QueryProposals) + qc = govtypes.NewQueryClient(c.ctx) ) - if err := c.Query(path, gov.NewQueryProposalsParams(0, 0, gov.StatusNil, nil, nil), &result); err != nil { - return result, err + res, err := qc.Proposals(context.Background(), + &govtypes.QueryProposalsRequest{ + }, + ) + if err != nil { + return nil, utils.IsNotFoundError(err) } - return result, nil + return res.Proposals, nil } -func (c *Client) QueryProposalVote(id uint64, address sdk.AccAddress) (gov.Vote, error) { +func (c *Client) QueryProposalVote(id uint64, address sdk.AccAddress) (*govtypes.Vote, error) { var ( - result gov.Vote - path = fmt.Sprintf("custom/%s/%s", gov.QuerierRoute, gov.QueryVote) + qc = govtypes.NewQueryClient(c.ctx) ) - if err := c.Query(path, gov.NewQueryVoteParams(id, address), &result); err != nil { - return result, err + res, err := qc.Vote(context.Background(), + &govtypes.QueryVoteRequest{ + ProposalId: id, + Voter: address.String(), + }, + ) + if err != nil { + return nil, utils.IsNotFoundError(err) } - return result, nil + return &res.Vote, nil } -func (c *Client) QueryDeposit(address sdk.AccAddress) (deposit.Deposit, error) { +func (c *Client) QueryDeposit(address sdk.AccAddress) (*deposittypes.Deposit, error) { var ( - result deposit.Deposit - path = fmt.Sprintf("custom/%s/%s/%s", vpn.QuerierRoute, deposit.QuerierRoute, deposit.QueryDeposit) + qc = deposittypes.NewQueryServiceClient(c.ctx) ) - if err := c.Query(path, deposit.NewQueryDepositParams(address), &result); err != nil { - return result, err + res, err := qc.QueryDeposit(context.Background(), + deposittypes.NewQueryDepositRequest(address)) + if err != nil { + return nil, utils.IsNotFoundError(err) } - return result, nil + return &res.Deposit, nil } -func (c *Client) QueryProvider(address hub.ProvAddress) (provider.Provider, error) { +func (c *Client) QueryProvider(address hubtypes.ProvAddress) (*providertypes.Provider, error) { var ( - result provider.Provider - path = fmt.Sprintf("custom/%s/%s/%s", vpn.QuerierRoute, provider.QuerierRoute, provider.QueryProvider) + qc = providertypes.NewQueryServiceClient(c.ctx) ) - if err := c.Query(path, provider.NewQueryProviderParams(address), &result); err != nil { - return result, err + res, err := qc.QueryProvider(context.Background(), + providertypes.NewQueryProviderRequest(address)) + if err != nil { + return nil, utils.IsNotFoundError(err) } - return result, nil + return &res.Provider, nil } -func (c *Client) QueryProviders(skip, limit int) (provider.Providers, error) { +func (c *Client) QueryProviders(pagination *query.PageRequest) (providertypes.Providers, error) { var ( - result provider.Providers - path = fmt.Sprintf("custom/%s/%s/%s", vpn.QuerierRoute, provider.QuerierRoute, provider.QueryProviders) + qc = providertypes.NewQueryServiceClient(c.ctx) ) - if err := c.Query(path, provider.NewQueryProvidersParams(skip, limit), &result); err != nil { - return result, err + res, err := qc.QueryProviders(context.Background(), + providertypes.NewQueryProvidersRequest(pagination)) + if err != nil { + return nil, utils.IsNotFoundError(err) } - return result, nil + return res.Providers, nil } -func (c *Client) QueryNode(address hub.NodeAddress) (node.Node, error) { +func (c *Client) QueryNode(address hubtypes.NodeAddress) (*nodetypes.Node, error) { var ( - result node.Node - path = fmt.Sprintf("custom/%s/%s/%s", vpn.QuerierRoute, node.QuerierRoute, node.QueryNode) + qc = nodetypes.NewQueryServiceClient(c.ctx) ) - if err := c.Query(path, node.NewQueryNodeParams(address), &result); err != nil { - return result, err + res, err := qc.QueryNode(context.Background(), + nodetypes.NewQueryNodeRequest(address)) + if err != nil { + return nil, utils.IsNotFoundError(err) } - return result, nil + return &res.Node, nil } -func (c *Client) QueryNodes(status hub.Status, skip, limit int) (node.Nodes, error) { +func (c *Client) QueryNodes(status hubtypes.Status, pagination *query.PageRequest) (nodetypes.Nodes, error) { var ( - result node.Nodes - path = fmt.Sprintf("custom/%s/%s/%s", vpn.QuerierRoute, node.QuerierRoute, node.QueryNodes) + qc = nodetypes.NewQueryServiceClient(c.ctx) ) - if err := c.Query(path, node.NewQueryNodesParams(status, skip, limit), &result); err != nil { - return result, err + res, err := qc.QueryNodes(context.Background(), + nodetypes.NewQueryNodesRequest(status, pagination)) + if err != nil { + return nil, utils.IsNotFoundError(err) } - return result, nil + return res.Nodes, nil } -func (c *Client) QueryNodesForPlan(id uint64, skip, limit int) (node.Nodes, error) { +func (c *Client) QueryNodesForPlan(id uint64, pagination *query.PageRequest) (nodetypes.Nodes, error) { var ( - result node.Nodes - path = fmt.Sprintf("custom/%s/%s/%s", vpn.QuerierRoute, plan.QuerierRoute, plan.QueryNodesForPlan) + qc = plantypes.NewQueryServiceClient(c.ctx) ) - if err := c.Query(path, plan.NewQueryNodesForPlanParams(id, skip, limit), &result); err != nil { - return result, err + res, err := qc.QueryNodesForPlan(context.Background(), + plantypes.NewQueryNodesForPlanRequest(id, pagination)) + if err != nil { + return nil, utils.IsNotFoundError(err) } - return result, nil + return res.Nodes, nil } -func (c *Client) QueryPlan(id uint64) (plan.Plan, error) { +func (c *Client) QueryPlan(id uint64) (*plantypes.Plan, error) { var ( - result plan.Plan - path = fmt.Sprintf("custom/%s/%s/%s", vpn.QuerierRoute, plan.QuerierRoute, plan.QueryPlan) + qc = plantypes.NewQueryServiceClient(c.ctx) ) - if err := c.Query(path, plan.NewQueryPlanParams(id), &result); err != nil { - return result, err + res, err := qc.QueryPlan(context.Background(), + plantypes.NewQueryPlanRequest(id)) + if err != nil { + return nil, utils.IsNotFoundError(err) } - return result, nil + return &res.Plan, nil } -func (c *Client) QueryPlansForProvider(address hub.ProvAddress, status hub.Status, skip, limit int) (plan.Plans, error) { +func (c *Client) QueryPlansForProvider(address hubtypes.ProvAddress, status hubtypes.Status, pagination *query.PageRequest) (plantypes.Plans, error) { var ( - result plan.Plans - path = fmt.Sprintf("custom/%s/%s/%s", vpn.QuerierRoute, plan.QuerierRoute, plan.QueryPlansForProvider) + qc = plantypes.NewQueryServiceClient(c.ctx) ) - if err := c.Query(path, plan.NewQueryPlansForProviderParams(address, status, skip, limit), &result); err != nil { - return result, err + res, err := qc.QueryPlansForProvider(context.Background(), + plantypes.NewQueryPlansForProviderRequest(address, status, pagination)) + if err != nil { + return nil, utils.IsNotFoundError(err) } - return result, nil + return res.Plans, nil } -func (c *Client) QuerySubscription(id uint64) (subscription.Subscription, error) { +func (c *Client) QuerySubscription(id uint64) (*subscriptiontypes.Subscription, error) { var ( - result subscription.Subscription - path = fmt.Sprintf("custom/%s/%s/%s", vpn.QuerierRoute, subscription.QuerierRoute, subscription.QuerySubscription) + qc = subscriptiontypes.NewQueryServiceClient(c.ctx) ) - if err := c.Query(path, subscription.NewQuerySubscriptionParams(id), &result); err != nil { - return result, err + res, err := qc.QuerySubscription(context.Background(), + subscriptiontypes.NewQuerySubscriptionRequest(id)) + if err != nil { + return nil, utils.IsNotFoundError(err) } - return result, nil + return &res.Subscription, nil } -func (c *Client) QuerySubscriptionsForAddress(address sdk.AccAddress, status hub.Status, skip, limit int) (subscription.Subscriptions, error) { +func (c *Client) QuerySubscriptionsForAddress(address sdk.AccAddress, status hubtypes.Status, pagination *query.PageRequest) (subscriptiontypes.Subscriptions, error) { var ( - result subscription.Subscriptions - path = fmt.Sprintf("custom/%s/%s/%s", vpn.QuerierRoute, subscription.QuerierRoute, subscription.QuerySubscriptionsForAddress) + qc = subscriptiontypes.NewQueryServiceClient(c.ctx) ) - if err := c.Query(path, subscription.NewQuerySubscriptionsForAddressParams(address, status, skip, limit), &result); err != nil { - return result, err + res, err := qc.QuerySubscriptionsForAddress(context.Background(), + subscriptiontypes.NewQuerySubscriptionsForAddressRequest(address, status, pagination)) + if err != nil { + return nil, utils.IsNotFoundError(err) } - return result, nil + return res.Subscriptions, nil } -func (c *Client) QueryQuota(id uint64, address sdk.AccAddress) (subscription.Quota, error) { +func (c *Client) QueryQuota(id uint64, address sdk.AccAddress) (*subscriptiontypes.Quota, error) { var ( - result subscription.Quota - path = fmt.Sprintf("custom/%s/%s/%s", vpn.QuerierRoute, subscription.QuerierRoute, subscription.QueryQuota) + qc = subscriptiontypes.NewQueryServiceClient(c.ctx) ) - if err := c.Query(path, subscription.NewQueryQuotaParams(id, address), &result); err != nil { - return result, err + res, err := qc.QueryQuota(context.Background(), + subscriptiontypes.NewQueryQuotaRequest(id, address)) + if err != nil { + return nil, utils.IsNotFoundError(err) } - return result, nil + return &res.Quota, nil } -func (c *Client) QueryQuotas(id uint64, skip, limit int) (subscription.Quotas, error) { +func (c *Client) QueryQuotas(id uint64, pagination *query.PageRequest) (subscriptiontypes.Quotas, error) { var ( - result subscription.Quotas - path = fmt.Sprintf("custom/%s/%s/%s", vpn.QuerierRoute, subscription.QuerierRoute, subscription.QueryQuotas) + qc = subscriptiontypes.NewQueryServiceClient(c.ctx) ) - if err := c.Query(path, subscription.NewQueryQuotasParams(id, skip, limit), &result); err != nil { - return result, err + res, err := qc.QueryQuotas(context.Background(), + subscriptiontypes.NewQueryQuotasRequest(id, pagination)) + if err != nil { + return nil, utils.IsNotFoundError(err) } - return result, nil + return res.Quotas, nil } -func (c *Client) QuerySession(id uint64) (session.Session, error) { +func (c *Client) QuerySession(id uint64) (*sessiontypes.Session, error) { var ( - result session.Session - path = fmt.Sprintf("custom/%s/%s/%s", vpn.QuerierRoute, session.QuerierRoute, session.QuerySession) + qc = sessiontypes.NewQueryServiceClient(c.ctx) ) - if err := c.Query(path, session.NewQuerySessionParams(id), &result); err != nil { - return result, err + res, err := qc.QuerySession(context.Background(), + sessiontypes.NewQuerySessionRequest(id)) + if err != nil { + return nil, utils.IsNotFoundError(err) } - return result, nil + return &res.Session, nil } -func (c *Client) QuerySessionsForAddress(address sdk.AccAddress, status hub.Status, skip, limit int) (session.Sessions, error) { +func (c *Client) QuerySessionsForAddress(address sdk.AccAddress, status hubtypes.Status, pagination *query.PageRequest) (sessiontypes.Sessions, error) { var ( - result session.Sessions - path = fmt.Sprintf("custom/%s/%s/%s", vpn.QuerierRoute, session.QuerierRoute, session.QuerySessionsForAddress) + qc = sessiontypes.NewQueryServiceClient(c.ctx) ) - if err := c.Query(path, session.NewQuerySessionsForAddressParams(address, status, skip, limit), &result); err != nil { - return result, err + res, err := qc.QuerySessionsForAddress(context.Background(), + sessiontypes.NewQuerySessionsForAddressRequest(address, status, pagination)) + if err != nil { + return nil, utils.IsNotFoundError(err) } - return result, nil + return res.Sessions, nil } diff --git a/cli/lite/tx.go b/cli/lite/tx.go index b09dc4e9..e55bc218 100644 --- a/cli/lite/tx.go +++ b/cli/lite/tx.go @@ -1,53 +1,49 @@ package lite import ( - "fmt" - + "github.com/cosmos/cosmos-sdk/client/tx" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/client/utils" ) -func (c *Client) Tx(memo, password string, messages ...sdk.Msg) (sdk.TxResponse, error) { +func (c *Client) BroadcastTx(memo string, messages ...sdk.Msg) (res *sdk.TxResponse, err error) { c.mutex.Lock() defer c.mutex.Unlock() - account, err := c.QueryAccount(c.ctx.FromAddress) + account, err := c.AccountRetriever().GetAccount(c.ctx, c.FromAddress()) if err != nil { - return sdk.TxResponse{}, err + return nil, err } - txb := c.txb. - WithMemo(memo). - WithAccountNumber(account.GetAccountNumber()). - WithSequence(account.GetSequence()) + var ( + name = c.From() + txf = c.txf. + WithAccountNumber(account.GetAccountNumber()). + WithMemo(memo). + WithSequence(account.GetSequence()) + ) - if txb.GasAdjustment() > 0 { - txb, err = utils.EnrichWithGas(txb, c.ctx, messages) + if c.SimulateAndExecute() { + _, adjusted, err := tx.CalculateGas(c.ctx.QueryWithData, txf, messages...) if err != nil { - return sdk.TxResponse{}, err + return nil, err } + + txf = txf.WithGas(adjusted) } - bytes, err := txb.BuildAndSign(c.ctx.From, password, messages) + txb, err := tx.BuildUnsignedTx(txf, messages...) if err != nil { - return sdk.TxResponse{}, err + return nil, err } - node, err := c.ctx.GetNode() - if err != nil { - return sdk.TxResponse{}, err + if err := tx.Sign(txf, name, txb, true); err != nil { + return nil, err } - result, err := node.BroadcastTxCommit(bytes) + txBytes, err := c.TxConfig().TxEncoder()(txb.GetTx()) if err != nil { - return sdk.TxResponse{}, err - } - if !result.CheckTx.IsOK() { - return sdk.TxResponse{}, fmt.Errorf(result.CheckTx.Log) - } - if !result.DeliverTx.IsOK() { - return sdk.TxResponse{}, fmt.Errorf(result.DeliverTx.Log) + return nil, err } - return sdk.NewResponseFormatBroadcastTxCommit(result), nil + return c.ctx.BroadcastTx(txBytes) } diff --git a/cli/main.go b/cli/main.go index d0d080ec..1dd04f91 100644 --- a/cli/main.go +++ b/cli/main.go @@ -42,7 +42,14 @@ func main() { } } - if err := cfg.LoadFromPath(filepath.Join(home, "config.toml")); err != nil { + cfgPath := filepath.Join(home, "config.toml") + if _, err := os.Stat(cfgPath); err != nil { + if err := cfg.SaveToPath(cfgPath); err != nil { + return err + } + } + + if err := cfg.LoadFromPath(cfgPath); err != nil { return err } @@ -50,9 +57,6 @@ func main() { if viper.GetString(flagChainBroadcastMode) != defCfg.Chain.BroadcastMode { cfg.Chain.BroadcastMode = viper.GetString(flagChainBroadcastMode) } - if viper.GetString(flagChainFees) != defCfg.Chain.Fees { - cfg.Chain.Fees = viper.GetString(flagChainFees) - } if viper.GetFloat64(flagChainGasAdjustment) != defCfg.Chain.GasAdjustment { cfg.Chain.GasAdjustment = viper.GetFloat64(flagChainGasAdjustment) } @@ -71,9 +75,6 @@ func main() { if viper.GetBool(flagChainSimulateAndExecute) != defCfg.Chain.SimulateAndExecute { cfg.Chain.SimulateAndExecute = viper.GetBool(flagChainSimulateAndExecute) } - if viper.GetBool(flagChainTrustNode) != defCfg.Chain.TrustNode { - cfg.Chain.TrustNode = viper.GetBool(flagChainTrustNode) - } return cfg.Validate() }, @@ -82,14 +83,12 @@ func main() { root.PersistentFlags().String(types.FlagHome, types.DefaultHomeDirectory, "") root.PersistentFlags().String(flagChainBroadcastMode, cfg.Chain.BroadcastMode, "") - root.PersistentFlags().String(flagChainFees, cfg.Chain.Fees, "") root.PersistentFlags().Float64(flagChainGasAdjustment, cfg.Chain.GasAdjustment, "") root.PersistentFlags().String(flagChainGasPrices, cfg.Chain.GasPrices, "") root.PersistentFlags().Uint64(flagChainGas, cfg.Chain.Gas, "") root.PersistentFlags().String(flagChainID, cfg.Chain.ID, "") root.PersistentFlags().String(flagChainRPCAddress, cfg.Chain.RPCAddress, "") root.PersistentFlags().Bool(flagChainSimulateAndExecute, cfg.Chain.SimulateAndExecute, "") - root.PersistentFlags().Bool(flagChainTrustNode, cfg.Chain.TrustNode, "") _ = viper.BindPFlag(types.FlagHome, root.PersistentFlags().Lookup(types.FlagHome)) _ = viper.BindPFlag(flagChainBroadcastMode, root.PersistentFlags().Lookup(flagChainBroadcastMode)) diff --git a/cli/middlewares/auth.go b/cli/middlewares/auth.go deleted file mode 100644 index 2adef89b..00000000 --- a/cli/middlewares/auth.go +++ /dev/null @@ -1,41 +0,0 @@ -package middlewares - -import ( - "net/http" - "strings" - "time" - - "github.com/gorilla/mux" - - "github.com/sentinel-official/desktop-client/cli/context" - "github.com/sentinel-official/desktop-client/cli/utils" -) - -func TokenVerify(ctx *context.Context) mux.MiddlewareFunc { - return func(next http.Handler) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - auth := r.Header.Get("Authorization") - if len(auth) < 7 || !strings.EqualFold(auth[:7], "Bearer ") { - utils.WriteErrorToResponse(w, http.StatusUnauthorized, -1, "") - return - } - - if ctx.AuthToken() == nil { - utils.WriteErrorToResponse(w, http.StatusUnauthorized, -1, "") - return - } - - access := ctx.AuthToken().Access - if access.Value != auth[7:] { - utils.WriteErrorToResponse(w, http.StatusUnauthorized, -1, "") - return - } - if time.Now().After(access.Expiry) { - utils.WriteErrorToResponse(w, http.StatusUnauthorized, -1, "") - return - } - - next.ServeHTTP(w, r) - }) - } -} diff --git a/cli/rest/account/handlers.go b/cli/rest/account/handlers.go index 487ff832..0a1416a5 100644 --- a/cli/rest/account/handlers.go +++ b/cli/rest/account/handlers.go @@ -1,44 +1,53 @@ package account import ( - "encoding/hex" "net/http" - "strings" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/gorilla/mux" "github.com/sentinel-official/desktop-client/cli/context" + "github.com/sentinel-official/desktop-client/cli/types" "github.com/sentinel-official/desktop-client/cli/utils" "github.com/sentinel-official/desktop-client/cli/x/auth" + "github.com/sentinel-official/desktop-client/cli/x/common" ) func HandlerGetAccount(ctx *context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) + var ( + vars = mux.Vars(r) + ) - if ctx.Client().FromAddressHex() != vars["address"] { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, "") + address, err := sdk.AccAddressFromBech32(vars["address"]) + if err != nil { + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, err.Error()) + return + } + if !ctx.Client().FromAddress().Equals(address) { + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, "") return } - address, err := hex.DecodeString(vars["address"]) + account, err := ctx.Client().QueryAccount(address) if err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, err.Error()) + utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1003, err.Error()) return } - result, err := ctx.Client().QueryAccount(address) - if err != nil { - if strings.Contains(err.Error(), "does not exist") { - utils.WriteResultToResponse(w, http.StatusOK, nil) - return - } + denom := r.URL.Query().Get("denom") + if denom == "" { + denom = types.Denom + } - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1003, err.Error()) + balance, err := ctx.Client().QueryBalance(address, denom) + if err != nil { + utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1004, err.Error()) return } - item := auth.NewAccountFromRaw(result) + item := auth.NewAccountFromRaw(account). + WithBalance(common.NewCoinFromRaw(balance)) utils.WriteResultToResponse(w, http.StatusOK, item) } } diff --git a/cli/rest/account/requests.go b/cli/rest/account/requests.go deleted file mode 100644 index 0bc76357..00000000 --- a/cli/rest/account/requests.go +++ /dev/null @@ -1 +0,0 @@ -package account diff --git a/cli/rest/auth/handlers.go b/cli/rest/auth/handlers.go deleted file mode 100644 index 3ce3ccdd..00000000 --- a/cli/rest/auth/handlers.go +++ /dev/null @@ -1,96 +0,0 @@ -package auth - -import ( - "crypto/rand" - "crypto/sha256" - "fmt" - "net/http" - "time" - - "github.com/sentinel-official/desktop-client/cli/context" - "github.com/sentinel-official/desktop-client/cli/types" - "github.com/sentinel-official/desktop-client/cli/utils" -) - -func HandlerLogin(ctx *context.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - body, err := NewRequestLogin(r) - if err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, err.Error()) - return - } - if err := body.Validate(); err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, err.Error()) - return - } - - if body.Token == "" { - password := fmt.Sprintf("%X", sha256.Sum256([]byte(body.Password))) - if password != ctx.Config().Password { - utils.WriteErrorToResponse(w, http.StatusUnauthorized, 1003, "password does not match") - return - } - - var ( - access = make([]byte, 32) - refresh = make([]byte, 32) - ) - - _, err = rand.Read(access) - if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1004, err.Error()) - return - } - - _, err = rand.Read(refresh) - if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1004, err.Error()) - return - } - - ctx.WithAuthToken(&types.AuthToken{ - Refresh: types.Token{ - Value: fmt.Sprintf("%X", refresh), - Expiry: time.Now().Add(30 * time.Minute), - }, - Access: types.Token{ - Value: fmt.Sprintf("%X", access), - Expiry: time.Now().Add(1 * time.Minute), - }, - }) - } else { - if ctx.AuthToken() == nil { - utils.WriteErrorToResponse(w, http.StatusUnauthorized, 1004, "token does not exist") - return - } - - refresh := ctx.AuthToken().Refresh - if body.Token != refresh.Value { - utils.WriteErrorToResponse(w, http.StatusUnauthorized, 1004, "token does not match") - return - } - if time.Now().After(refresh.Expiry) { - utils.WriteErrorToResponse(w, http.StatusUnauthorized, 1004, "token expired") - return - } - - bytes := make([]byte, 32) - - _, err = rand.Read(bytes) - if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1005, err.Error()) - return - } - - ctx.WithAuthToken(&types.AuthToken{ - Refresh: refresh, - Access: types.Token{ - Value: fmt.Sprintf("%X", bytes), - Expiry: time.Now().Add(1 * time.Minute), - }, - }) - } - - utils.WriteResultToResponse(w, http.StatusOK, ctx.AuthToken()) - } -} diff --git a/cli/rest/auth/requests.go b/cli/rest/auth/requests.go deleted file mode 100644 index 28e190a7..00000000 --- a/cli/rest/auth/requests.go +++ /dev/null @@ -1,24 +0,0 @@ -package auth - -import ( - "encoding/json" - "net/http" -) - -type RequestLogin struct { - Password string `json:"password"` - Token string `json:"token"` -} - -func NewRequestLogin(r *http.Request) (*RequestLogin, error) { - var body RequestLogin - if err := json.NewDecoder(r.Body).Decode(&body); err != nil { - return nil, err - } - - return &body, nil -} - -func (r *RequestLogin) Validate() error { - return nil -} diff --git a/cli/rest/auth/routes.go b/cli/rest/auth/routes.go deleted file mode 100644 index b8518c0d..00000000 --- a/cli/rest/auth/routes.go +++ /dev/null @@ -1,15 +0,0 @@ -package auth - -import ( - "net/http" - - "github.com/gorilla/mux" - - "github.com/sentinel-official/desktop-client/cli/context" -) - -func RegisterRoutes(r *mux.Router, ctx *context.Context) { - r.Name("Login"). - Methods(http.MethodPost).Path("/login"). - HandlerFunc(HandlerLogin(ctx)) -} diff --git a/cli/rest/bank/handlers.go b/cli/rest/bank/handlers.go index 25b2e6d3..3f3cfa6c 100644 --- a/cli/rest/bank/handlers.go +++ b/cli/rest/bank/handlers.go @@ -3,9 +3,11 @@ package bank import ( "net/http" + sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/sentinel-official/desktop-client/cli/context" "github.com/sentinel-official/desktop-client/cli/utils" - "github.com/sentinel-official/desktop-client/cli/x/bank" ) func HandlerSend(ctx *context.Context) http.HandlerFunc { @@ -20,20 +22,25 @@ func HandlerSend(ctx *context.Context) http.HandlerFunc { return } - message, err := bank.NewMsgSend(ctx.AddressHex(), body.To, body.Amount).Raw() - if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1003, err.Error()) - return - } + var ( + to, _ = sdk.AccAddressFromBech32(body.To) + coins, _ = sdk.ParseCoinsNormalized(body.Coins) + ) + + message := banktypes.NewMsgSend( + ctx.Client().FromAddress(), + to, + coins, + ) if err := message.ValidateBasic(); err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1004, err.Error()) + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1003, err.Error()) return } - res, err := ctx.Client().Tx(body.Memo, body.Password, message) + res, err := ctx.Client().BroadcastTx(body.Memo, message) if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1005, err.Error()) + utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1004, err.Error()) return } diff --git a/cli/rest/bank/requests.go b/cli/rest/bank/requests.go index f1e6f08d..31c4e78d 100644 --- a/cli/rest/bank/requests.go +++ b/cli/rest/bank/requests.go @@ -2,18 +2,15 @@ package bank import ( "encoding/json" - "fmt" "net/http" - "github.com/sentinel-official/desktop-client/cli/x/other" + sdk "github.com/cosmos/cosmos-sdk/types" ) type RequestSend struct { - Memo string `json:"memo"` - Password string `json:"password"` - - To string `json:"to"` - Amount other.Coins `json:"amount"` + Memo string `json:"memo"` + To string `json:"to"` + Coins string `json:"coins"` } func NewRequestSend(r *http.Request) (*RequestSend, error) { @@ -26,14 +23,11 @@ func NewRequestSend(r *http.Request) (*RequestSend, error) { } func (r *RequestSend) Validate() error { - if r.Password == "" { - return fmt.Errorf("invalid field Password") - } - if r.To == "" { - return fmt.Errorf("invalid field To") + if _, err := sdk.AccAddressFromBech32(r.To); err != nil { + return err } - if len(r.Amount) == 0 { - return fmt.Errorf("invalid field Amount") + if _, err := sdk.ParseCoinsNormalized(r.Coins); err != nil { + return err } return nil diff --git a/cli/rest/config/handlers.go b/cli/rest/config/handlers.go index df18bdb8..44411c88 100644 --- a/cli/rest/config/handlers.go +++ b/cli/rest/config/handlers.go @@ -1,15 +1,9 @@ package config import ( - "crypto/sha256" - "fmt" - "io/ioutil" "net/http" - "os" "path/filepath" - "github.com/tendermint/tendermint/libs/log" - "github.com/tendermint/tendermint/lite/proxy" rpchttp "github.com/tendermint/tendermint/rpc/client/http" "github.com/sentinel-official/desktop-client/cli/context" @@ -18,10 +12,7 @@ import ( func HandlerGetConfig(ctx *context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - cfg := ctx.Config().Copy() - cfg.Password = "" - - utils.WriteResultToResponse(w, http.StatusOK, cfg) + utils.WriteResultToResponse(w, http.StatusOK, ctx.Config()) } } @@ -45,8 +36,8 @@ func HandlerUpdateConfig(ctx *context.Context) http.HandlerFunc { if body.Setup != cfg.Setup { cfg.Setup = body.Setup } - if body.From != "" && body.From != client.FromName() { - info, err := client.Keybase().Get(body.From) + if body.From != "" && body.From != client.From() { + info, err := client.Keyring().Key(body.From) if err != nil { utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1003, err.Error()) return @@ -56,17 +47,10 @@ func HandlerUpdateConfig(ctx *context.Context) http.HandlerFunc { WithFromName(body.From). WithFromAddress(info.GetAddress()) } - if body.Password != "" && body.Password != cfg.Password { - cfg.Password = fmt.Sprintf("%X", sha256.Sum256([]byte(body.Password))) - } if body.Chain.BroadcastMode != cfg.Chain.BroadcastMode { cfg.Chain.BroadcastMode = body.Chain.BroadcastMode client.WithBroadcastMode(body.Chain.BroadcastMode) } - if body.Chain.Fees != cfg.Chain.Fees { - cfg.Chain.Fees = body.Chain.Fees - client.WithFees(body.Chain.Fees) - } if body.Chain.GasAdjustment != cfg.Chain.GasAdjustment { cfg.Chain.GasAdjustment = body.Chain.GasAdjustment client.WithGasAdjustment(body.Chain.GasAdjustment) @@ -80,19 +64,7 @@ func HandlerUpdateConfig(ctx *context.Context) http.HandlerFunc { client.WithGas(body.Chain.Gas) } if body.Chain.ID != cfg.Chain.ID && body.Chain.RPCAddress != cfg.Chain.RPCAddress { - node, err := rpchttp.New(body.Chain.RPCAddress, "/websocket") - if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1004, err.Error()) - return - } - - verifierDir, err := ioutil.TempDir(os.TempDir(), "verifier-*") - if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1004, err.Error()) - return - } - - verifier, err := proxy.NewVerifier(body.Chain.ID, verifierDir, node, log.NewNopLogger(), 16) + rpcclient, err := rpchttp.New(body.Chain.RPCAddress, "/websocket") if err != nil { utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1004, err.Error()) return @@ -101,41 +73,15 @@ func HandlerUpdateConfig(ctx *context.Context) http.HandlerFunc { cfg.Chain.ID = body.Chain.ID cfg.Chain.RPCAddress = body.Chain.RPCAddress client.WithNodeURI(body.Chain.RPCAddress). - WithNode(node). - WithVerifier(verifier). + WithClient(rpcclient). WithChainID(body.Chain.ID) } if body.Chain.ID != cfg.Chain.ID { - verifierDir, err := ioutil.TempDir(os.TempDir(), "verifier-*") - if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1004, err.Error()) - return - } - - verifier, err := proxy.NewVerifier(body.Chain.ID, verifierDir, client.Node(), log.NewNopLogger(), 16) - if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1004, err.Error()) - return - } - cfg.Chain.ID = body.Chain.ID - client.WithChainID(body.Chain.ID). - WithVerifier(verifier) + client.WithChainID(body.Chain.ID) } if body.Chain.RPCAddress != cfg.Chain.RPCAddress { - node, err := rpchttp.New(body.Chain.RPCAddress, "/websocket") - if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1004, err.Error()) - return - } - - verifierDir, err := ioutil.TempDir(os.TempDir(), "verifier-*") - if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1004, err.Error()) - return - } - - verifier, err := proxy.NewVerifier(client.ChainID(), verifierDir, node, log.NewNopLogger(), 16) + rpcclient, err := rpchttp.New(body.Chain.RPCAddress, "/websocket") if err != nil { utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1004, err.Error()) return @@ -143,41 +89,12 @@ func HandlerUpdateConfig(ctx *context.Context) http.HandlerFunc { cfg.Chain.RPCAddress = body.Chain.RPCAddress client.WithNodeURI(body.Chain.RPCAddress). - WithNode(node). - WithVerifier(verifier) + WithClient(rpcclient) } if body.Chain.SimulateAndExecute != cfg.Chain.SimulateAndExecute { cfg.Chain.SimulateAndExecute = body.Chain.SimulateAndExecute client.WithSimulateAndExecute(body.Chain.SimulateAndExecute) } - if body.Chain.TrustNode != cfg.Chain.TrustNode { - cfg.Chain.TrustNode = body.Chain.TrustNode - client.WithTrustNode(body.Chain.TrustNode) - - if !body.Chain.TrustNode { - node, err := rpchttp.New(cfg.Chain.RPCAddress, "/websocket") - if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1004, err.Error()) - return - } - - verifierDir, err := ioutil.TempDir(os.TempDir(), "verifier-*") - if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1004, err.Error()) - return - } - - verifier, err := proxy.NewVerifier(client.ChainID(), verifierDir, node, log.NewNopLogger(), 16) - if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1004, err.Error()) - return - } - - client.WithVerifier(verifier) - } else { - client.WithVerifier(nil) - } - } if err := cfg.SaveToPath(filepath.Join(ctx.Home(), "config.toml")); err != nil { utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1005, err.Error()) @@ -187,7 +104,6 @@ func HandlerUpdateConfig(ctx *context.Context) http.HandlerFunc { ctx.WithConfig(cfg.Copy()). WithClient(client.Copy()) - cfg.Password = "" utils.WriteResultToResponse(w, http.StatusOK, cfg) } } diff --git a/cli/rest/deposit/handlers.go b/cli/rest/deposit/handlers.go index 5777c1eb..0b46bdaa 100644 --- a/cli/rest/deposit/handlers.go +++ b/cli/rest/deposit/handlers.go @@ -1,38 +1,39 @@ package deposit import ( - "encoding/hex" "net/http" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/gorilla/mux" "github.com/sentinel-official/desktop-client/cli/context" "github.com/sentinel-official/desktop-client/cli/utils" - "github.com/sentinel-official/desktop-client/cli/x/other" + "github.com/sentinel-official/desktop-client/cli/x/common" ) -func HandlerGetDeposit(ctx *context.Context) http.HandlerFunc { +func HandlerGetDeposits(ctx *context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) + var ( + vars = mux.Vars(r) + ) - if ctx.Client().FromAddressHex() != vars["address"] { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, "") + address, err := sdk.AccAddressFromBech32(vars["address"]) + if err != nil { + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, err.Error()) return } - - address, err := hex.DecodeString(vars["address"]) - if err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, err.Error()) + if !ctx.Client().FromAddress().Equals(address) { + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, "") return } - result, err := ctx.Client().QueryDeposit(address) + res, err := ctx.Client().QueryDeposit(address) if err != nil { utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1003, err.Error()) return } - item := other.NewDepositFromRaw(result) + item := common.NewDepositFromRaw(res) utils.WriteResultToResponse(w, http.StatusOK, item) } } diff --git a/cli/rest/deposit/routes.go b/cli/rest/deposit/routes.go index ed035b4e..2968deb0 100644 --- a/cli/rest/deposit/routes.go +++ b/cli/rest/deposit/routes.go @@ -11,5 +11,5 @@ import ( func RegisterRoutes(r *mux.Router, ctx *context.Context) { r.Name("GetDeposit"). Methods(http.MethodGet).Path("/accounts/{address}/deposits"). - HandlerFunc(HandlerGetDeposit(ctx)) + HandlerFunc(HandlerGetDeposits(ctx)) } diff --git a/cli/rest/distribution/handlers.go b/cli/rest/distribution/handlers.go index c3d760df..36d3fdc6 100644 --- a/cli/rest/distribution/handlers.go +++ b/cli/rest/distribution/handlers.go @@ -6,37 +6,47 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/gorilla/mux" + distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + "github.com/sentinel-official/desktop-client/cli/context" "github.com/sentinel-official/desktop-client/cli/utils" - "github.com/sentinel-official/desktop-client/cli/x/distribution" ) func HandlerWithdrawRewards(ctx *context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) + var ( + vars = mux.Vars(r) + ) - if ctx.Client().FromAddressHex() != vars["address"] { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, "") + address, err := sdk.AccAddressFromBech32(vars["address"]) + if err != nil { + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, err.Error()) + return + } + if !ctx.Client().FromAddress().Equals(address) { + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, "") return } body, err := NewRequestWithdrawRewards(r) if err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, err.Error()) + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1003, err.Error()) return } if err := body.Validate(); err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1003, err.Error()) + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1004, err.Error()) return } messages := make([]sdk.Msg, 0, len(body.Validators)) - for _, validator := range body.Validators { - message, err := distribution.NewMsgWithdrawDelegatorReward(ctx.AddressHex(), validator).Raw() - if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1004, err.Error()) - return - } + for _, address := range body.Validators { + var ( + validator, _ = sdk.ValAddressFromBech32(address) + message = distributiontypes.NewMsgWithdrawDelegatorReward( + ctx.Client().FromAddress(), + validator, + ) + ) if err := message.ValidateBasic(); err != nil { utils.WriteErrorToResponse(w, http.StatusBadRequest, 1005, err.Error()) @@ -46,7 +56,7 @@ func HandlerWithdrawRewards(ctx *context.Context) http.HandlerFunc { messages = append(messages, message) } - res, err := ctx.Client().Tx(body.Memo, body.Password, messages...) + res, err := ctx.Client().BroadcastTx(body.Memo, messages...) if err != nil { utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1006, err.Error()) return diff --git a/cli/rest/distribution/requests.go b/cli/rest/distribution/requests.go index 9e4b8de1..c3d57002 100644 --- a/cli/rest/distribution/requests.go +++ b/cli/rest/distribution/requests.go @@ -4,12 +4,12 @@ import ( "encoding/json" "fmt" "net/http" + + sdk "github.com/cosmos/cosmos-sdk/types" ) type RequestWithdrawRewards struct { - Memo string `json:"memo"` - Password string `json:"password"` - + Memo string `json:"memo"` Validators []string `json:"validators"` } @@ -23,11 +23,14 @@ func NewRequestWithdrawRewards(r *http.Request) (*RequestWithdrawRewards, error) } func (r *RequestWithdrawRewards) Validate() error { - if r.Password == "" { - return fmt.Errorf("invalid field Password") - } if len(r.Validators) == 0 { - return fmt.Errorf("invalid field Validators") + return fmt.Errorf("invalid validators length; expected length is more than 0") + } + + for _, address := range r.Validators { + if _, err := sdk.ValAddressFromBech32(address); err != nil { + return err + } } return nil diff --git a/cli/rest/gov/dummy.go b/cli/rest/gov/dummy.go deleted file mode 100644 index cc343c45..00000000 --- a/cli/rest/gov/dummy.go +++ /dev/null @@ -1,83 +0,0 @@ -package gov - -import ( - "time" - - xgov "github.com/cosmos/cosmos-sdk/x/gov" - - "github.com/sentinel-official/desktop-client/cli/x/gov" - "github.com/sentinel-official/desktop-client/cli/x/other" -) - -var DummyProposals = gov.Proposals{ - gov.Proposal{ - Index: 1, - Type: "cosmos-sdk/TextProposal", - Title: "Stargate Upgrade Proposal 1", - Description: `Stargate is our name for the process of ensuring that the widely integrated public network known as the Cosmos Hub is able to execute the cosmoshub-3 -\u003e cosmoshub-4 upgrade with the minimum disruption to its existing ecosystem. This upgrade will also realize the Internet of Blockchains vision from the Cosmos whitepaper.\nIntegrations from ecosystem partners are at risk of breaking changes due to the Stargate changes. These changes drive the need for substantial resource and time requirements to ensure successful migration. Stargate represents a unique set of circumstances and is not intended to set precedent for future upgrades which are expected to be less dramatic.\nThere is a widespread consensus from many Cosmos stakeholders that these changes to core software components will enhance the performance and composability of the software and the value of the Cosmos Hub in a world of many blockchains.\nA Yes result on this proposal provides a clear signal that the Cosmos Hub accepts and understands the Stargate process and is prepared to approve an upgrade with proposed changes if the plan below is executed successfully.\nA No result would force a reconsideration of the tradeoffs in the Alternatives section and the forming a new plan to deliver IBC.\nSee the full proposal here: https://ipfs.io/ipfs/Qmbo3fF54tX3JdoHZNVLcSBrdkXLie56Vh2u29wLfs4PnW"`, - Status: xgov.StatusPassed.String(), - Deposit: other.Coins{ - { - Denom: "uatom", - Value: 512000000, - }, - }, - TallyResult: gov.TallyResult{ - Yes: 101845973043268, - Abstain: 559408864, - No: 21185026706, - NoWithVeto: 106144492, - }, - SubmitTime: func() time.Time { - t, _ := time.Parse(time.RFC3339Nano, "2020-07-12T06:23:02.440964897Z") - return t - }(), - DepositEndTime: func() time.Time { - t, _ := time.Parse(time.RFC3339Nano, "2020-07-26T06:23:02.440964897Z") - return t - }(), - VotingStartTime: func() time.Time { - t, _ := time.Parse(time.RFC3339Nano, "2020-07-13T01:37:47.298505506Z") - return t - }(), - VotingEndTime: func() time.Time { - t, _ := time.Parse(time.RFC3339Nano, "2020-07-27T01:37:47.298505506Z") - return t - }(), - }, - gov.Proposal{ - Index: 2, - Type: "cosmos-sdk/TextProposal", - Title: "Genesis fund recovery proposal on behalf of fundraiser participants unable to access their ATOMs", - Description: `The purpose of this proposal is to restore access to geneis ATOMs for a subset of donors who have been active participants in our community through the last year.\n The view of iqlusion is that this is an important moment for the Cosmos Hub. Stargate brings the fundraiser period to the end with delivery of IBC. This proposal resolves the open business of active members of our community who cannot access their ATOM. This is an opportunity is opporunity to bring this business to a close and setup the agenda for IBC powered innovation coming in 2021.We strongly encourage the Cosmos Community to verify the cryptographic evidence and bring these community members to full ATOM holder status.\n\n\nFull Proposal:https://ipfs.io/ipfs/QmV6pBgDppN7X3BdVW197EUe7dpcmcdLMivPa6xxtPj3aW \nThe original authors of the proposal will be available to answer questions on the Cosmos forum.\nhttps://forum.cosmos.network/t/updated-genesis-atoms-recovery-request-proposal/3905`, - Status: xgov.StatusPassed.String(), - Deposit: other.Coins{ - { - Denom: "uatom", - Value: 512000000, - }, - }, - TallyResult: gov.TallyResult{ - Yes: 60252124759321, - Abstain: 19764603711398, - No: 6614606743206, - NoWithVeto: 998582410890, - }, - SubmitTime: func() time.Time { - t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T06:47:46.521375251Z") - return t - }(), - DepositEndTime: func() time.Time { - t, _ := time.Parse(time.RFC3339Nano, "2020-09-23T06:47:46.521375251Z") - return t - }(), - VotingStartTime: func() time.Time { - t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T06:47:46.521375251Z") - return t - }(), - VotingEndTime: func() time.Time { - t, _ := time.Parse(time.RFC3339Nano, "2020-09-23T06:47:46.521375251Z") - return t - }(), - }, -} diff --git a/cli/rest/gov/handlers.go b/cli/rest/gov/handlers.go index f49c3b26..b392cc9a 100644 --- a/cli/rest/gov/handlers.go +++ b/cli/rest/gov/handlers.go @@ -1,10 +1,11 @@ package gov import ( - "encoding/hex" "net/http" "strconv" + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/gorilla/mux" "github.com/sentinel-official/desktop-client/cli/context" @@ -14,83 +15,89 @@ import ( func HandlerGetProposals(ctx *context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - result, err := ctx.Client().QueryProposals() + res, err := ctx.Client().QueryProposals() if err != nil { utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1001, err.Error()) return } - _ = gov.NewProposalsFromRaw(result) - utils.WriteResultToResponse(w, http.StatusOK, DummyProposals) + items := gov.NewProposalsFromRaw(res) + utils.WriteResultToResponse(w, http.StatusOK, items) } } func HandlerGetVote(ctx *context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) + var ( + vars = mux.Vars(r) + ) - if ctx.Client().FromAddressHex() != vars["address"] { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, "") + address, err := sdk.AccAddressFromBech32(vars["address"]) + if err != nil { + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, err.Error()) return } - - id, err := strconv.ParseUint(vars["id"], 10, 64) - if err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, err.Error()) + if !ctx.Client().FromAddress().Equals(address) { + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, "") return } - address, err := hex.DecodeString(vars["address"]) + id, err := strconv.ParseUint(vars["id"], 10, 64) if err != nil { utils.WriteErrorToResponse(w, http.StatusBadRequest, 1003, err.Error()) return } - result, err := ctx.Client().QueryProposalVote(id, address) + res, err := ctx.Client().QueryProposalVote(id, address) if err != nil { utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1004, err.Error()) return } - item := gov.NewVoteFromRaw(result) + item := gov.NewVoteFromRaw(res) utils.WriteResultToResponse(w, http.StatusOK, item) } } func HandlerVote(ctx *context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - body, err := NewRequestVote(r) + var ( + vars = mux.Vars(r) + ) + + id, err := strconv.ParseUint(vars["id"], 10, 64) if err != nil { utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, err.Error()) return } - if err := body.Validate(); err != nil { + + body, err := NewRequestVote(r) + if err != nil { utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, err.Error()) return } - - vars := mux.Vars(r) - - id, err := strconv.ParseUint(vars["id"], 10, 64) - if err != nil { + if err := body.Validate(); err != nil { utils.WriteErrorToResponse(w, http.StatusBadRequest, 1003, err.Error()) return } - message, err := gov.NewMsgVote(ctx.AddressHex(), id, body.Option).Raw() - if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1004, err.Error()) - return - } + var ( + option, _ = govtypes.VoteOptionFromString(body.Option) + message = govtypes.NewMsgVote( + ctx.Client().FromAddress(), + id, + option, + ) + ) if err := message.ValidateBasic(); err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1005, err.Error()) + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1004, err.Error()) return } - res, err := ctx.Client().Tx(body.Memo, body.Password, message) + res, err := ctx.Client().BroadcastTx(body.Memo, message) if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1006, err.Error()) + utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1005, err.Error()) return } diff --git a/cli/rest/gov/requests.go b/cli/rest/gov/requests.go index 983b54f3..6088585e 100644 --- a/cli/rest/gov/requests.go +++ b/cli/rest/gov/requests.go @@ -2,14 +2,13 @@ package gov import ( "encoding/json" - "fmt" "net/http" + + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) type RequestVote struct { - Memo string `json:"memo"` - Password string `json:"password"` - + Memo string `json:"memo"` Option string `json:"option"` } @@ -23,11 +22,8 @@ func NewRequestVote(r *http.Request) (*RequestVote, error) { } func (r *RequestVote) Validate() error { - if r.Password == "" { - return fmt.Errorf("invalid field Password") - } - if r.Option == "" { - return fmt.Errorf("invalid field Option") + if _, err := govtypes.VoteOptionFromString(r.Option); err != nil { + return err } return nil diff --git a/cli/rest/keys/handlers.go b/cli/rest/keys/handlers.go index e970603e..20cf5652 100644 --- a/cli/rest/keys/handlers.go +++ b/cli/rest/keys/handlers.go @@ -3,44 +3,53 @@ package keys import ( "net/http" - "github.com/cosmos/cosmos-sdk/crypto/keys" + "github.com/cosmos/cosmos-sdk/crypto/hd" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/go-bip39" "github.com/gorilla/mux" "github.com/sentinel-official/desktop-client/cli/context" "github.com/sentinel-official/desktop-client/cli/utils" - "github.com/sentinel-official/desktop-client/cli/x/other" + "github.com/sentinel-official/desktop-client/cli/x/common" ) func HandlerGetKey(ctx *context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) + var ( + vars = mux.Vars(r) + ) - info, err := ctx.Client().Keybase().Get(vars["name"]) + info, err := ctx.Client().Keyring().Key(vars["name"]) if err != nil { utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1001, err.Error()) return } - item := other.NewKeyFromRaw(info, "") + item := common.NewKeyFromRaw(info, "") utils.WriteResultToResponse(w, http.StatusOK, item) } } func HandlerGetKeys(ctx *context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - infos, err := ctx.Client().Keybase().List() + infos, err := ctx.Client().Keyring().List() if err != nil { utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1001, err.Error()) return } - items := other.NewKeysFromRaw(infos, make([]string, len(infos))) + items := common.NewKeysFromRaw(infos, nil) utils.WriteResultToResponse(w, http.StatusOK, items) } } func HandlerAddKey(ctx *context.Context) http.HandlerFunc { + var ( + path = hd.CreateHDPath(sdk.GetConfig().GetCoinType(), 0, 0) + algorithms, _ = ctx.Client().Keyring().SupportedAlgorithms() + ) + return func(w http.ResponseWriter, r *http.Request) { body, err := NewRequestAddKey(r) if err != nil { @@ -52,7 +61,7 @@ func HandlerAddKey(ctx *context.Context) http.HandlerFunc { return } - info, _ := ctx.Client().Keybase().Get(body.Name) + info, _ := ctx.Client().Keyring().Key(body.Name) if info != nil { utils.WriteErrorToResponse(w, http.StatusConflict, 1003, "key already exists") return @@ -72,33 +81,30 @@ func HandlerAddKey(ctx *context.Context) http.HandlerFunc { } } - info, err = ctx.Client().Keybase().CreateAccount(body.Name, body.Mnemonic, body.BIP39Password, body.Password, - keys.CreateHDPath(0, 0).String(), keys.Secp256k1) + algorithm, err := keyring.NewSigningAlgoFromString(string(hd.Secp256k1Type), algorithms) if err != nil { utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1006, err.Error()) return } - item := other.NewKeyFromRaw(info, body.Mnemonic) + info, err = ctx.Client().Keyring().NewAccount(body.Name, body.Mnemonic, body.BIP39Password, path.String(), algorithm) + if err != nil { + utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1007, err.Error()) + return + } + + item := common.NewKeyFromRaw(info, body.Mnemonic) utils.WriteResultToResponse(w, http.StatusCreated, item) } } func HandlerDeleteKey(ctx *context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - body, err := NewRequestDeleteKey(r) - if err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, err.Error()) - return - } - if err := body.Validate(); err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, err.Error()) - return - } - - vars := mux.Vars(r) + var ( + vars = mux.Vars(r) + ) - if err := ctx.Client().Keybase().Delete(vars["name"], body.Password, false); err != nil { + if err := ctx.Client().Keyring().Delete(vars["name"]); err != nil { utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1003, err.Error()) return } diff --git a/cli/rest/keys/requests.go b/cli/rest/keys/requests.go index 0bce18e8..04fef49f 100644 --- a/cli/rest/keys/requests.go +++ b/cli/rest/keys/requests.go @@ -9,7 +9,6 @@ import ( type RequestAddKey struct { Name string `json:"name"` Mnemonic string `json:"mnemonic"` - Password string `json:"password"` BIP39Password string `json:"bip_39_password"` } @@ -26,30 +25,6 @@ func (r *RequestAddKey) Validate() error { if r.Name == "" { return fmt.Errorf("invalid field name") } - if r.Password == "" { - return fmt.Errorf("invalid field password") - } - - return nil -} - -type RequestDeleteKey struct { - Password string `json:"password"` -} - -func NewRequestDeleteKey(r *http.Request) (*RequestDeleteKey, error) { - var body RequestDeleteKey - if err := json.NewDecoder(r.Body).Decode(&body); err != nil { - return nil, err - } - - return &body, nil -} - -func (r *RequestDeleteKey) Validate() error { - if r.Password == "" { - return fmt.Errorf("invalid field password") - } return nil } diff --git a/cli/rest/node/handlers.go b/cli/rest/node/handlers.go index 0d09277b..527e0d76 100644 --- a/cli/rest/node/handlers.go +++ b/cli/rest/node/handlers.go @@ -1,13 +1,11 @@ package node import ( - "encoding/hex" "net/http" - "net/url" "strconv" "github.com/gorilla/mux" - hub "github.com/sentinel-official/hub/types" + hubtypes "github.com/sentinel-official/hub/types" "github.com/sentinel-official/desktop-client/cli/context" "github.com/sentinel-official/desktop-client/cli/utils" @@ -16,92 +14,77 @@ import ( func HandlerGetNode(ctx *context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) + var ( + vars = mux.Vars(r) + ) - address, err := hex.DecodeString(vars["address"]) + address, err := hubtypes.NodeAddressFromBech32(vars["address"]) if err != nil { utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, err.Error()) return } - result, err := ctx.Client().QueryNode(address) + res, err := ctx.Client().QueryNode(address) if err != nil { utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1002, err.Error()) return } - items := node.NewNodeFromRaw(result) - utils.WriteResultToResponse(w, http.StatusOK, items) - } -} - -func parseQuery(query url.Values) (skip, limit int, status hub.Status, err error) { - skip = 0 - if query.Get("skip") != "" { - skip, err = strconv.Atoi(query.Get("skip")) - if err != nil { - return 0, 0, 0, err - } - } - - limit = 25 - if query.Get("limit") != "" { - limit, err = strconv.Atoi(query.Get("limit")) - if err != nil { - return 0, 0, 0, err - } - } - - status = hub.StatusActive - if query.Get("status") != "" { - status = hub.StatusFromString(query.Get("status")) + item := node.NewNodeFromRaw(res) + utils.WriteResultToResponse(w, http.StatusOK, item) } - - return skip, limit, status, nil } func HandlerGetNodes(ctx *context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - skip, limit, status, err := parseQuery(r.URL.Query()) + var ( + values = r.URL.Query() + status = hubtypes.StatusFromString(values.Get("status")) + ) + + pagination, err := utils.ParsePaginationQuery(values) if err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, err.Error()) + utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1001, err.Error()) return } - result, err := ctx.Client().QueryNodes(status, skip, limit) + res, err := ctx.Client().QueryNodes(status, pagination) if err != nil { utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1002, err.Error()) return } - items := node.NewNodesFromRaw(result) + items := node.NewNodesFromRaw(res) utils.WriteResultToResponse(w, http.StatusOK, items) } } func HandlerGetNodesForPlan(ctx *context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - skip, limit, _, err := parseQuery(r.URL.Query()) + var ( + values = r.URL.Query() + vars = mux.Vars(r) + ) + + pagination, err := utils.ParsePaginationQuery(values) if err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, err.Error()) + utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1001, err.Error()) return } - vars := mux.Vars(r) - plan, err := strconv.ParseUint(vars["id"], 10, 64) if err != nil { utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, err.Error()) return } - result, err := ctx.Client().QueryNodesForPlan(plan, skip, limit) + res, err := ctx.Client().QueryNodesForPlan(plan, pagination) if err != nil { utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1003, err.Error()) return } - items := node.NewNodesFromRaw(result) + items := node.NewNodesFromRaw(res) utils.WriteResultToResponse(w, http.StatusOK, items) } } diff --git a/cli/rest/plan/handlers.go b/cli/rest/plan/handlers.go index adaa4f36..a5f255fa 100644 --- a/cli/rest/plan/handlers.go +++ b/cli/rest/plan/handlers.go @@ -1,13 +1,11 @@ package plan import ( - "encoding/hex" "net/http" - "net/url" "strconv" "github.com/gorilla/mux" - hub "github.com/sentinel-official/hub/types" + hubtypes "github.com/sentinel-official/hub/types" "github.com/sentinel-official/desktop-client/cli/context" "github.com/sentinel-official/desktop-client/cli/utils" @@ -16,7 +14,9 @@ import ( func HandlerGetPlan(ctx *context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) + var ( + vars = mux.Vars(r) + ) id, err := strconv.ParseUint(vars["id"], 10, 64) if err != nil { @@ -24,65 +24,44 @@ func HandlerGetPlan(ctx *context.Context) http.HandlerFunc { return } - result, err := ctx.Client().QueryPlan(id) + res, err := ctx.Client().QueryPlan(id) if err != nil { utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1002, err.Error()) return } - items := plan.NewPlanFromRaw(result) - utils.WriteResultToResponse(w, http.StatusOK, items) - } -} - -func parseQuery(query url.Values) (skip, limit int, status hub.Status, err error) { - skip = 0 - if query.Get("skip") != "" { - skip, err = strconv.Atoi(query.Get("skip")) - if err != nil { - return 0, 0, 0, err - } - } - - limit = 25 - if query.Get("limit") != "" { - limit, err = strconv.Atoi(query.Get("limit")) - if err != nil { - return 0, 0, 0, err - } - } - - status = hub.StatusActive - if query.Get("status") != "" { - status = hub.StatusFromString(query.Get("status")) + item := plan.NewPlanFromRaw(res) + utils.WriteResultToResponse(w, http.StatusOK, item) } - - return skip, limit, status, nil } func HandlerGetPlansForProvider(ctx *context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - skip, limit, status, err := parseQuery(r.URL.Query()) + var ( + values = r.URL.Query() + vars = mux.Vars(r) + status = hubtypes.StatusFromString(values.Get("status")) + ) + + pagination, err := utils.ParsePaginationQuery(values) if err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, err.Error()) + utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1001, err.Error()) return } - vars := mux.Vars(r) - - address, err := hex.DecodeString(vars["address"]) + address, err := hubtypes.ProvAddressFromBech32(vars["address"]) if err != nil { utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, err.Error()) return } - result, err := ctx.Client().QueryPlansForProvider(address, status, skip, limit) + res, err := ctx.Client().QueryPlansForProvider(address, status, pagination) if err != nil { utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1003, err.Error()) return } - items := plan.NewPlansFromRaw(result) + items := plan.NewPlansFromRaw(res) utils.WriteResultToResponse(w, http.StatusOK, items) } } diff --git a/cli/rest/provider/handlers.go b/cli/rest/provider/handlers.go index 1a3f4aaa..d5305171 100644 --- a/cli/rest/provider/handlers.go +++ b/cli/rest/provider/handlers.go @@ -1,12 +1,10 @@ package provider import ( - "encoding/hex" "net/http" - "net/url" - "strconv" "github.com/gorilla/mux" + hubtypes "github.com/sentinel-official/hub/types" "github.com/sentinel-official/desktop-client/cli/context" "github.com/sentinel-official/desktop-client/cli/utils" @@ -15,60 +13,46 @@ import ( func HandlerGetProvider(ctx *context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) + var ( + vars = mux.Vars(r) + ) - address, err := hex.DecodeString(vars["address"]) + address, err := hubtypes.ProvAddressFromBech32(vars["address"]) if err != nil { utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, err.Error()) return } - result, err := ctx.Client().QueryProvider(address) + res, err := ctx.Client().QueryProvider(address) if err != nil { utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1002, err.Error()) return } - items := provider.NewProviderFromRaw(result) - utils.WriteResultToResponse(w, http.StatusOK, items) + item := provider.NewProviderFromRaw(res) + utils.WriteResultToResponse(w, http.StatusOK, item) } } -func parseQuery(query url.Values) (skip, limit int, err error) { - skip = 0 - if query.Get("skip") != "" { - skip, err = strconv.Atoi(query.Get("skip")) - if err != nil { - return 0, 0, err - } - } - - limit = 25 - if query.Get("limit") != "" { - limit, err = strconv.Atoi(query.Get("limit")) - if err != nil { - return 0, 0, err - } - } - - return skip, limit, nil -} - func HandlerGetProviders(ctx *context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - skip, limit, err := parseQuery(r.URL.Query()) + var ( + values = r.URL.Query() + ) + + pagination, err := utils.ParsePaginationQuery(values) if err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, err.Error()) + utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1001, err.Error()) return } - result, err := ctx.Client().QueryProviders(skip, limit) + res, err := ctx.Client().QueryProviders(pagination) if err != nil { utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1002, err.Error()) return } - items := provider.NewProvidersFromRaw(result) + items := provider.NewProvidersFromRaw(res) utils.WriteResultToResponse(w, http.StatusOK, items) } } diff --git a/cli/rest/service/handlers.go b/cli/rest/service/handlers.go index 09e5db6f..8ad7d785 100644 --- a/cli/rest/service/handlers.go +++ b/cli/rest/service/handlers.go @@ -9,7 +9,7 @@ import ( "github.com/sentinel-official/desktop-client/cli/context" "github.com/sentinel-official/desktop-client/cli/types" "github.com/sentinel-official/desktop-client/cli/utils" - "github.com/sentinel-official/desktop-client/cli/x/other" + "github.com/sentinel-official/desktop-client/cli/x/common" ) func HandlerStatus(ctx *context.Context) http.HandlerFunc { @@ -38,15 +38,17 @@ func HandlerStatus(ctx *context.Context) http.HandlerFunc { return } - utils.WriteResultToResponse(w, http.StatusOK, ResponseStatus{ - Bandwidth: other.Bandwidth{ - Upload: upload, - Download: download, + utils.WriteResultToResponse(w, http.StatusOK, + ResponseStatus{ + From: status.From, + ID: status.ID, + To: status.To, + Bandwidth: common.Bandwidth{ + Upload: upload, + Download: download, + }, }, - From: status.From, - ID: status.ID, - To: status.To, - }) + ) } } diff --git a/cli/rest/service/responses.go b/cli/rest/service/responses.go index 363acea6..7d947966 100644 --- a/cli/rest/service/responses.go +++ b/cli/rest/service/responses.go @@ -1,12 +1,12 @@ package service import ( - "github.com/sentinel-official/desktop-client/cli/x/other" + "github.com/sentinel-official/desktop-client/cli/x/common" ) type ResponseStatus struct { - Bandwidth other.Bandwidth `json:"bandwidth"` - From string `json:"from"` - ID uint64 `json:"id"` - To string `json:"to"` + Bandwidth common.Bandwidth `json:"bandwidth"` + From string `json:"from"` + ID uint64 `json:"id"` + To string `json:"to"` } diff --git a/cli/rest/session/handlers.go b/cli/rest/session/handlers.go index 6e3e1323..201063bf 100644 --- a/cli/rest/session/handlers.go +++ b/cli/rest/session/handlers.go @@ -10,13 +10,14 @@ import ( "fmt" "net" "net/http" - "net/url" "path/filepath" "strconv" "time" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/go-kit/kit/transport/http/jsonrpc" "github.com/gorilla/mux" - hub "github.com/sentinel-official/hub/types" + hubtypes "github.com/sentinel-official/hub/types" "github.com/sentinel-official/desktop-client/cli/context" "github.com/sentinel-official/desktop-client/cli/services/wireguard" @@ -28,7 +29,9 @@ import ( func HandlerGetSession(ctx *context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) + var ( + vars = mux.Vars(r) + ) id, err := strconv.ParseUint(vars["id"], 10, 64) if err != nil { @@ -36,67 +39,48 @@ func HandlerGetSession(ctx *context.Context) http.HandlerFunc { return } - result, err := ctx.Client().QuerySession(id) + res, err := ctx.Client().QuerySession(id) if err != nil { utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1002, err.Error()) return } - items := session.NewSessionFromRaw(result) - utils.WriteResultToResponse(w, http.StatusOK, items) + item := session.NewSessionFromRaw(res) + utils.WriteResultToResponse(w, http.StatusOK, item) } } -func parseQuery(query url.Values) (skip, limit int, status hub.Status, err error) { - skip = 0 - if query.Get("skip") != "" { - skip, err = strconv.Atoi(query.Get("skip")) - if err != nil { - return 0, 0, status, err - } - } - - limit = 25 - if query.Get("limit") != "" { - limit, err = strconv.Atoi(query.Get("limit")) - if err != nil { - return 0, 0, status, err - } - } - - status = hub.StatusFromString(query.Get("status")) - - return skip, limit, status, nil -} - func HandlerGetSessionsForAddress(ctx *context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - skip, limit, status, err := parseQuery(r.URL.Query()) + var ( + values = r.URL.Query() + vars = mux.Vars(r) + status = hubtypes.StatusFromString(values.Get("status")) + ) + + address, err := sdk.AccAddressFromBech32(vars["address"]) if err != nil { utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, err.Error()) return } - - vars := mux.Vars(r) - - if ctx.Client().FromAddressHex() != vars["address"] { + if !ctx.Client().FromAddress().Equals(address) { utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, "") return } - address, err := hex.DecodeString(vars["address"]) + pagination, err := utils.ParsePaginationQuery(values) if err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1003, err.Error()) + utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1003, err.Error()) return } - result, err := ctx.Client().QuerySessionsForAddress(address, status, skip, limit) + res, err := ctx.Client().QuerySessionsForAddress(address, status, pagination) if err != nil { utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1004, err.Error()) return } - items := session.NewSessionsFromRaw(result) + items := session.NewSessionsFromRaw(res) utils.WriteResultToResponse(w, http.StatusOK, items) } } @@ -114,54 +98,61 @@ func HandlerStartSession(ctx *context.Context) http.HandlerFunc { ) return func(w http.ResponseWriter, r *http.Request) { - service := ctx.Service() + var ( + service = ctx.Service() + vars = mux.Vars(r) + ) + if service != nil { utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, "") return } - vars := mux.Vars(r) - - if ctx.Client().FromAddressHex() != vars["address"] { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, "") + address, err := sdk.AccAddressFromBech32(vars["address"]) + if err != nil { + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, err.Error()) + return + } + if !ctx.Client().FromAddress().Equals(address) { + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1003, "") return } id, err := strconv.ParseUint(vars["id"], 10, 64) if err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1003, err.Error()) + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1004, err.Error()) return } body, err := NewRequestAddSession(r) if err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1004, err.Error()) + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1005, err.Error()) return } if err := body.Validate(); err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1005, err.Error()) + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1006, err.Error()) return } to, err := hex.DecodeString(body.To) if err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1006, err.Error()) + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1007, err.Error()) return } node, err := ctx.Client().QueryNode(to) if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1007, err.Error()) + utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1008, err.Error()) return } - if node.Address == nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1008, "") + if node.Address == "" { + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1009, "") return } privateKey, err := wgt.NewPrivateKey() if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1009, err.Error()) + utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1010, err.Error()) return } @@ -171,15 +162,18 @@ func HandlerStartSession(ctx *context.Context) http.HandlerFunc { }, ) if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1010, err.Error()) + utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1011, err.Error()) return } - endpoint := fmt.Sprintf("%s/accounts/%s/subscriptions/%d/sessions", node.RemoteURL, ctx.AddressHex(), id) + var ( + response types.Response + endpoint = fmt.Sprintf("%s/accounts/%s/subscriptions/%d/sessions", node.RemoteURL, address, id) + ) - resp, err := client.Post(endpoint, "application/json", bytes.NewBuffer(request)) + resp, err := client.Post(endpoint, jsonrpc.ContentType, bytes.NewBuffer(request)) if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1011, err.Error()) + utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1012, err.Error()) return } @@ -187,23 +181,22 @@ func HandlerStartSession(ctx *context.Context) http.HandlerFunc { _ = resp.Body.Close() }() - var response types.Response if err := json.NewDecoder(resp.Body).Decode(&response); err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1012, err.Error()) + utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1013, err.Error()) return } if !response.Success || response.Error != nil { - utils.WriteErrorToResponse(w, resp.StatusCode, 1013, response.Error.Message) + utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1014, "") return } result, err := base64.StdEncoding.DecodeString(response.Result.(string)) if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1014, err.Error()) + utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1015, err.Error()) return } if len(result) != 58 { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1015, "") + utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1016, "") return } @@ -215,7 +208,7 @@ func HandlerStartSession(ctx *context.Context) http.HandlerFunc { listenPort, err := utils.GetFreeUDPPort() if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1016, err.Error()) + utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1017, err.Error()) return } @@ -249,14 +242,14 @@ func HandlerStartSession(ctx *context.Context) http.HandlerFunc { } status := types.NewStatus(). - WithFrom(ctx.Client().FromAddressHex()). + WithFrom(ctx.Client().FromAddress().String()). WithID(id). WithName(cfg.Name). WithTo(body.To) info, err := json.Marshal(status) if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1017, err.Error()) + utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1018, err.Error()) return } @@ -266,20 +259,20 @@ func HandlerStartSession(ctx *context.Context) http.HandlerFunc { WithInfo(info) if err := service.PreUp(); err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1018, err.Error()) + utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1019, err.Error()) return } if err := service.Up(); err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1019, err.Error()) + utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1020, err.Error()) return } if err := service.PostUp(); err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1020, err.Error()) + utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1021, err.Error()) return } if err := status.SaveToPath(filepath.Join(ctx.Home(), "status.json")); err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1021, err.Error()) + utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1022, err.Error()) return } diff --git a/cli/rest/staking/handlers.go b/cli/rest/staking/handlers.go index c037afca..468f009f 100644 --- a/cli/rest/staking/handlers.go +++ b/cli/rest/staking/handlers.go @@ -1,13 +1,10 @@ package staking import ( - "encoding/hex" - "math" "net/http" - "net/url" - "strconv" sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/gorilla/mux" "github.com/sentinel-official/desktop-client/cli/context" @@ -17,156 +14,120 @@ import ( func HandlerGetValidator(ctx *context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) + var ( + vars = mux.Vars(r) + ) - address, err := hex.DecodeString(vars["address"]) + address, err := sdk.ValAddressFromBech32(vars["address"]) if err != nil { utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, err.Error()) return } - validator, err := ctx.Client().QueryValidator(address) + res, err := ctx.Client().QueryValidator(address) if err != nil { utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1002, err.Error()) return } - item := staking.NewValidatorFromRaw(validator) + item := staking.NewValidatorFromRaw(res) utils.WriteResultToResponse(w, http.StatusOK, item) } } -func parseQuery(query url.Values) (page, limit int, status string, err error) { - page = 1 - if query.Get("page") != "" { - page, err = strconv.Atoi(query.Get("page")) - if err != nil { - return 0, 0, "", err - } - } - - limit = 25 - if query.Get("limit") != "" { - limit, err = strconv.Atoi(query.Get("limit")) - if err != nil { - return 0, 0, "", err - } - } - - if query.Get("status") != "" { - status = query.Get("status") - } - - return page, limit, status, nil -} - func HandlerGetValidators(ctx *context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - _, _, status, err := parseQuery(r.URL.Query()) + var ( + values = r.URL.Query() + status = values.Get("status") + ) + + pagination, err := utils.ParsePaginationQuery(values) if err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, err.Error()) + utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1001, err.Error()) return } - var ( - page = 1 - limit = math.MaxInt64 - items staking.Validators - ) - - if status == "" { - bonded, err := ctx.Client().QueryValidators(page, limit, sdk.BondStatusBonded) - if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1002, err.Error()) - return - } - - unbonding, err := ctx.Client().QueryValidators(page, limit, sdk.BondStatusUnbonding) - if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1002, err.Error()) - return - } - - unbonded, err := ctx.Client().QueryValidators(page, limit, sdk.BondStatusUnbonded) - if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1002, err.Error()) - return - } - - items = append(items, staking.NewValidatorsFromRaw(bonded)...) - items = append(items, staking.NewValidatorsFromRaw(unbonding)...) - items = append(items, staking.NewValidatorsFromRaw(unbonded)...) - } else { - result, err := ctx.Client().QueryValidators(page, limit, status) - if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1002, err.Error()) - return - } - - items = append(items, staking.NewValidatorsFromRaw(result)...) + res, err := ctx.Client().QueryValidators(status, pagination) + if err != nil { + utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1002, err.Error()) + return } + items := staking.NewValidatorsFromRaw(res) utils.WriteResultToResponse(w, http.StatusOK, items) } } func HandlerGetDelegations(ctx *context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) + var ( + vars = mux.Vars(r) + ) - if ctx.Client().FromAddressHex() != vars["address"] { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, "") + address, err := sdk.AccAddressFromBech32(vars["address"]) + if err != nil { + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, err.Error()) return } - - address, err := hex.DecodeString(vars["address"]) - if err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, err.Error()) + if !ctx.Client().FromAddress().Equals(address) { + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, "") return } - result, err := ctx.Client().QueryDelegations(address) + res, err := ctx.Client().QueryDelegations(address) if err != nil { utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1003, err.Error()) return } - items := staking.NewDelegationsFromRaw(result) + items := staking.NewDelegationsFromRaw(res) utils.WriteResultToResponse(w, http.StatusOK, items) } } func HandlerDelegate(ctx *context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) + var ( + vars = mux.Vars(r) + ) - if ctx.Client().FromAddressHex() != vars["address"] { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, "") + address, err := sdk.AccAddressFromBech32(vars["address"]) + if err != nil { + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, err.Error()) + return + } + if !ctx.Client().FromAddress().Equals(address) { + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, "") return } body, err := NewRequestDelegate(r) if err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, err.Error()) + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1003, err.Error()) return } if err := body.Validate(); err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1003, err.Error()) + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1004, err.Error()) return } - message, err := staking.NewMsgDelegate(ctx.AddressHex(), body.To, body.Amount).Raw() - if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1004, err.Error()) - return - } + var ( + to, _ = sdk.ValAddressFromBech32(body.To) + coin, _ = sdk.ParseCoinNormalized(body.Coin) + message = stakingtypes.NewMsgDelegate( + ctx.Client().FromAddress(), + to, + coin, + ) + ) if err := message.ValidateBasic(); err != nil { utils.WriteErrorToResponse(w, http.StatusBadRequest, 1005, err.Error()) return } - res, err := ctx.Client().Tx(body.Memo, body.Password, message) + res, err := ctx.Client().BroadcastTx(body.Memo, message) if err != nil { utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1006, err.Error()) return @@ -178,35 +139,48 @@ func HandlerDelegate(ctx *context.Context) http.HandlerFunc { func HandlerRedelegate(ctx *context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) + var ( + vars = mux.Vars(r) + ) - if ctx.Client().FromAddressHex() != vars["address"] { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, "") + address, err := sdk.AccAddressFromBech32(vars["address"]) + if err != nil { + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, err.Error()) + return + } + if !ctx.Client().FromAddress().Equals(address) { + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, "") return } body, err := NewRequestRedelegate(r) if err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, err.Error()) + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1003, err.Error()) return } if err := body.Validate(); err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1003, err.Error()) + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1004, err.Error()) return } - message, err := staking.NewMsgBeginRedelegate(ctx.AddressHex(), body.From, body.To, body.Amount).Raw() - if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1004, err.Error()) - return - } + var ( + from, _ = sdk.ValAddressFromBech32(body.From) + to, _ = sdk.ValAddressFromBech32(body.To) + coin, _ = sdk.ParseCoinNormalized(body.Coin) + message = stakingtypes.NewMsgBeginRedelegate( + ctx.Client().FromAddress(), + from, + to, + coin, + ) + ) if err := message.ValidateBasic(); err != nil { utils.WriteErrorToResponse(w, http.StatusBadRequest, 1005, err.Error()) return } - res, err := ctx.Client().Tx(body.Memo, body.Password, message) + res, err := ctx.Client().BroadcastTx(body.Memo, message) if err != nil { utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1006, err.Error()) return @@ -218,35 +192,46 @@ func HandlerRedelegate(ctx *context.Context) http.HandlerFunc { func HandlerUndelegate(ctx *context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) + var ( + vars = mux.Vars(r) + ) - if ctx.Client().FromAddressHex() != vars["address"] { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, "") + address, err := sdk.AccAddressFromBech32(vars["address"]) + if err != nil { + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, err.Error()) + return + } + if !ctx.Client().FromAddress().Equals(address) { + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, "") return } body, err := NewRequestUnbond(r) if err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, err.Error()) + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1003, err.Error()) return } if err := body.Validate(); err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1003, err.Error()) + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1004, err.Error()) return } - message, err := staking.NewMsgUndelegate(ctx.AddressHex(), body.From, body.Amount).Raw() - if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1004, err.Error()) - return - } + var ( + from, _ = sdk.ValAddressFromBech32(body.From) + coin, _ = sdk.ParseCoinNormalized(body.Coin) + message = stakingtypes.NewMsgUndelegate( + ctx.Client().FromAddress(), + from, + coin, + ) + ) if err := message.ValidateBasic(); err != nil { utils.WriteErrorToResponse(w, http.StatusBadRequest, 1005, err.Error()) return } - res, err := ctx.Client().Tx(body.Memo, body.Password, message) + res, err := ctx.Client().BroadcastTx(body.Memo, message) if err != nil { utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1006, err.Error()) return diff --git a/cli/rest/staking/requests.go b/cli/rest/staking/requests.go index 984753be..48e1f666 100644 --- a/cli/rest/staking/requests.go +++ b/cli/rest/staking/requests.go @@ -2,18 +2,15 @@ package staking import ( "encoding/json" - "fmt" "net/http" - "github.com/sentinel-official/desktop-client/cli/x/other" + sdk "github.com/cosmos/cosmos-sdk/types" ) type RequestDelegate struct { - Memo string `json:"memo"` - Password string `json:"password"` - - To string `json:"to"` - Amount other.Coin `json:"amount"` + Memo string `json:"memo"` + To string `json:"to"` + Coin string `json:"coin"` } func NewRequestDelegate(r *http.Request) (*RequestDelegate, error) { @@ -26,26 +23,21 @@ func NewRequestDelegate(r *http.Request) (*RequestDelegate, error) { } func (r *RequestDelegate) Validate() error { - if r.Password == "" { - return fmt.Errorf("invalid field Password") - } - if r.To == "" { - return fmt.Errorf("invalid field To") + if _, err := sdk.ValAddressFromBech32(r.To); err != nil { + return err } - if r.Amount.Value <= 0 || r.Amount.Denom == "" { - return fmt.Errorf("invalid field Amount") + if _, err := sdk.ParseCoinNormalized(r.Coin); err != nil { + return err } return nil } type RequestRedelegate struct { - Memo string `json:"memo"` - Password string `json:"password"` - - From string `json:"from"` - To string `json:"to"` - Amount other.Coin `json:"amount"` + Memo string `json:"memo"` + From string `json:"from"` + To string `json:"to"` + Coin string `json:"amount"` } func NewRequestRedelegate(r *http.Request) (*RequestRedelegate, error) { @@ -58,28 +50,23 @@ func NewRequestRedelegate(r *http.Request) (*RequestRedelegate, error) { } func (r *RequestRedelegate) Validate() error { - if r.Password == "" { - return fmt.Errorf("invalid field Password") + if _, err := sdk.ValAddressFromBech32(r.From); err != nil { + return err } - if r.From == "" { - return fmt.Errorf("invalid field From") + if _, err := sdk.ValAddressFromBech32(r.To); err != nil { + return err } - if r.To == "" { - return fmt.Errorf("invalid field To") - } - if r.Amount.Value <= 0 || r.Amount.Denom == "" { - return fmt.Errorf("invalid field Amount") + if _, err := sdk.ParseCoinNormalized(r.Coin); err != nil { + return err } return nil } type RequestUnbond struct { - Memo string `json:"memo"` - Password string `json:"password"` - - From string `json:"from"` - Amount other.Coin `json:"amount"` + Memo string `json:"memo"` + From string `json:"from"` + Coin string `json:"coin"` } func NewRequestUnbond(r *http.Request) (*RequestUnbond, error) { @@ -92,14 +79,11 @@ func NewRequestUnbond(r *http.Request) (*RequestUnbond, error) { } func (r *RequestUnbond) Validate() error { - if r.Password == "" { - return fmt.Errorf("invalid field Password") - } - if r.From == "" { - return fmt.Errorf("invalid field From") + if _, err := sdk.ValAddressFromBech32(r.From); err != nil { + return err } - if r.Amount.Value <= 0 || r.Amount.Denom == "" { - return fmt.Errorf("invalid field Amount") + if _, err := sdk.ParseCoinNormalized(r.Coin); err != nil { + return err } return nil diff --git a/cli/rest/subscription/handlers.go b/cli/rest/subscription/handlers.go index bf6d847a..d4e95f2f 100644 --- a/cli/rest/subscription/handlers.go +++ b/cli/rest/subscription/handlers.go @@ -1,14 +1,13 @@ package subscription import ( - "encoding/hex" "net/http" - "net/url" "strconv" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/gorilla/mux" - hub "github.com/sentinel-official/hub/types" + hubtypes "github.com/sentinel-official/hub/types" + subscriptiontypes "github.com/sentinel-official/hub/x/subscription/types" "github.com/sentinel-official/desktop-client/cli/context" "github.com/sentinel-official/desktop-client/cli/utils" @@ -17,7 +16,9 @@ import ( func HandlerGetSubscription(ctx *context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) + var ( + vars = mux.Vars(r) + ) id, err := strconv.ParseUint(vars["id"], 10, 64) if err != nil { @@ -25,105 +26,100 @@ func HandlerGetSubscription(ctx *context.Context) http.HandlerFunc { return } - result, err := ctx.Client().QuerySubscription(id) + res, err := ctx.Client().QuerySubscription(id) if err != nil { utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1002, err.Error()) return } - items := subscription.NewSubscriptionFromRaw(result) - utils.WriteResultToResponse(w, http.StatusOK, items) + item := subscription.NewSubscriptionFromRaw(res) + utils.WriteResultToResponse(w, http.StatusOK, item) } } -func parseQuery(query url.Values) (status hub.Status, skip, limit int, err error) { - skip = 0 - if query.Get("skip") != "" { - skip, err = strconv.Atoi(query.Get("skip")) - if err != nil { - return status, 0, 0, err - } - } - - limit = 25 - if query.Get("limit") != "" { - limit, err = strconv.Atoi(query.Get("limit")) - if err != nil { - return status, 0, 0, err - } - } - - if query.Get("status") != "" { - status = hub.StatusFromString(query.Get("status")) - } - - return status, skip, limit, nil -} - func HandlerGetSubscriptionsForAddress(ctx *context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - status, skip, limit, err := parseQuery(r.URL.Query()) + var ( + values = r.URL.Query() + vars = mux.Vars(r) + status = hubtypes.StatusFromString(values.Get("status")) + ) + + address, err := sdk.AccAddressFromBech32(vars["address"]) if err != nil { utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, err.Error()) return } - - vars := mux.Vars(r) - - if ctx.Client().FromAddressHex() != vars["address"] { + if !ctx.Client().FromAddress().Equals(address) { utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, "") return } - address, err := hex.DecodeString(vars["address"]) + pagination, err := utils.ParsePaginationQuery(values) if err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1003, err.Error()) + utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1003, err.Error()) return } - result, err := ctx.Client().QuerySubscriptionsForAddress(address, status, skip, limit) + res, err := ctx.Client().QuerySubscriptionsForAddress(address, status, pagination) if err != nil { utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1004, err.Error()) return } - items := subscription.NewSubscriptionsFromRaw(result) + items := subscription.NewSubscriptionsFromRaw(res) utils.WriteResultToResponse(w, http.StatusOK, items) } } func HandlerAddSubscription(ctx *context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) + var ( + vars = mux.Vars(r) + ) - if ctx.Client().FromAddressHex() != vars["address"] { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, "") + address, err := sdk.AccAddressFromBech32(vars["address"]) + if err != nil { + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, err.Error()) + return + } + if !ctx.Client().FromAddress().Equals(address) { + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, "") return } body, err := NewRequestAddSubscription(r) if err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, err.Error()) + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1003, err.Error()) return } if err := body.Validate(); err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1003, err.Error()) + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1004, err.Error()) return } - var message sdk.Msg + var ( + message sdk.Msg + from = ctx.Client().FromAddress() + ) + if body.ID == 0 { - message, err = subscription.NewMsgSubscribeToNode(ctx.AddressHex(), body.To, body.Amount).Raw() - if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1004, err.Error()) - return - } + var ( + to, _ = hubtypes.NodeAddressFromBech32(body.To) + coin, _ = sdk.ParseCoinNormalized(body.Coin) + ) + + message = subscriptiontypes.NewMsgSubscribeToNodeRequest( + from, + to, + coin, + ) } else { - message, err = subscription.NewMsgSubscribeToPlan(ctx.AddressHex(), body.ID, body.Denom).Raw() - if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1004, err.Error()) - return - } + message = subscriptiontypes.NewMsgSubscribeToPlanRequest( + from, + body.ID, + body.Denom, + ) } if err := message.ValidateBasic(); err != nil { @@ -131,7 +127,7 @@ func HandlerAddSubscription(ctx *context.Context) http.HandlerFunc { return } - res, err := ctx.Client().Tx(body.Memo, body.Password, message) + res, err := ctx.Client().BroadcastTx(body.Memo, message) if err != nil { utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1006, err.Error()) return @@ -143,41 +139,49 @@ func HandlerAddSubscription(ctx *context.Context) http.HandlerFunc { func HandlerCancelSubscription(ctx *context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) + var ( + vars = mux.Vars(r) + ) - if ctx.Client().FromAddressHex() != vars["address"] { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, "") + address, err := sdk.AccAddressFromBech32(vars["address"]) + if err != nil { + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, err.Error()) + return + } + if !ctx.Client().FromAddress().Equals(address) { + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, "") return } id, err := strconv.ParseUint(vars["id"], 10, 64) if err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, err.Error()) + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1003, err.Error()) return } body, err := NewRequestCancelSubscription(r) if err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1003, err.Error()) + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1004, err.Error()) return } if err := body.Validate(); err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1004, err.Error()) + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1005, err.Error()) return } - message, err := subscription.NewMsgCancel(ctx.AddressHex(), id).Raw() - if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1005, err.Error()) - return - } + var ( + message = subscriptiontypes.NewMsgCancelRequest( + ctx.Client().FromAddress(), + id, + ) + ) if err := message.ValidateBasic(); err != nil { utils.WriteErrorToResponse(w, http.StatusBadRequest, 1006, err.Error()) return } - res, err := ctx.Client().Tx(body.Memo, body.Password, message) + res, err := ctx.Client().BroadcastTx(body.Memo, message) if err != nil { utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1007, err.Error()) return @@ -189,34 +193,43 @@ func HandlerCancelSubscription(ctx *context.Context) http.HandlerFunc { func HandlerGetQuota(ctx *context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) + var ( + vars = mux.Vars(r) + ) - id, err := strconv.ParseUint(vars["id"], 10, 64) + address, err := sdk.AccAddressFromBech32(vars["address"]) if err != nil { utils.WriteErrorToResponse(w, http.StatusBadRequest, 1001, err.Error()) return } + if !ctx.Client().FromAddress().Equals(address) { + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, "") + return + } - address, err := hex.DecodeString(vars["address"]) + id, err := strconv.ParseUint(vars["id"], 10, 64) if err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, err.Error()) + utils.WriteErrorToResponse(w, http.StatusBadRequest, 1003, err.Error()) return } - result, err := ctx.Client().QueryQuota(id, address) + res, err := ctx.Client().QueryQuota(id, address) if err != nil { - utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1003, err.Error()) + utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1004, err.Error()) return } - items := subscription.NewQuotaFromRaw(result) - utils.WriteResultToResponse(w, http.StatusOK, items) + item := subscription.NewQuotaFromRaw(res) + utils.WriteResultToResponse(w, http.StatusOK, item) } } func HandlerGetQuotas(ctx *context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) + var ( + vars = mux.Vars(r) + values = r.URL.Query() + ) id, err := strconv.ParseUint(vars["id"], 10, 64) if err != nil { @@ -224,19 +237,19 @@ func HandlerGetQuotas(ctx *context.Context) http.HandlerFunc { return } - _, skip, limit, err := parseQuery(r.URL.Query()) + pagination, err := utils.ParsePaginationQuery(values) if err != nil { - utils.WriteErrorToResponse(w, http.StatusBadRequest, 1002, err.Error()) + utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1002, err.Error()) return } - result, err := ctx.Client().QueryQuotas(id, skip, limit) + res, err := ctx.Client().QueryQuotas(id, pagination) if err != nil { utils.WriteErrorToResponse(w, http.StatusInternalServerError, 1003, err.Error()) return } - items := subscription.NewQuotasFromRaw(result) + items := subscription.NewQuotasFromRaw(res) utils.WriteResultToResponse(w, http.StatusOK, items) } } diff --git a/cli/rest/subscription/requests.go b/cli/rest/subscription/requests.go index 4543731b..6a77ad39 100644 --- a/cli/rest/subscription/requests.go +++ b/cli/rest/subscription/requests.go @@ -2,19 +2,16 @@ package subscription import ( "encoding/json" - "fmt" "net/http" - "github.com/sentinel-official/desktop-client/cli/x/other" + sdk "github.com/cosmos/cosmos-sdk/types" + hubtypes "github.com/sentinel-official/hub/types" ) type RequestAddSubscription struct { - Memo string `json:"memo"` - Password string `json:"password"` - - To string `json:"to"` - Amount other.Coin `json:"amount"` - + Memo string `json:"memo"` + To string `json:"to"` + Coin string `json:"coin"` ID uint64 `json:"id"` Denom string `json:"denom"` } @@ -29,16 +26,27 @@ func NewRequestAddSubscription(r *http.Request) (*RequestAddSubscription, error) } func (r *RequestAddSubscription) Validate() error { - if r.Password == "" { - return fmt.Errorf("invalid field Password") + if r.To != "" { + if _, err := hubtypes.NodeAddressFromBech32(r.To); err != nil { + return err + } + } + if r.Coin != "" { + if _, err := sdk.ParseCoinNormalized(r.Coin); err != nil { + return err + } + } + if r.Denom != "" { + if err := sdk.ValidateDenom(r.Denom); err != nil { + return err + } } return nil } type RequestCancelSubscription struct { - Memo string `json:"memo"` - Password string `json:"password"` + Memo string `json:"memo"` } func NewRequestCancelSubscription(r *http.Request) (*RequestCancelSubscription, error) { @@ -51,9 +59,5 @@ func NewRequestCancelSubscription(r *http.Request) (*RequestCancelSubscription, } func (r *RequestCancelSubscription) Validate() error { - if r.Password == "" { - return fmt.Errorf("invalid field Password") - } - return nil } diff --git a/cli/services/wireguard/wireguard_darwin.go b/cli/services/wireguard/wireguard_darwin.go index c49f031f..c192183a 100644 --- a/cli/services/wireguard/wireguard_darwin.go +++ b/cli/services/wireguard/wireguard_darwin.go @@ -17,7 +17,9 @@ func (w *WireGuard) RealInterface() (string, error) { return "", err } - scanner := bufio.NewReader(nameFile) + var ( + scanner = bufio.NewReader(nameFile) + ) line, err := scanner.ReadString('\n') if err != nil { diff --git a/cli/types/config.go b/cli/types/config.go index 5b406483..ed700edf 100644 --- a/cli/types/config.go +++ b/cli/types/config.go @@ -2,7 +2,6 @@ package types import ( "bytes" - "crypto/sha256" "encoding/json" "fmt" "io/ioutil" @@ -15,19 +14,16 @@ import ( var ( ct = strings.TrimSpace(` -password = "{{ .Password }}" setup = {{ .Setup }} [chain] broadcast_mode = "{{ .Chain.BroadcastMode }}" -fees = "{{ .Chain.Fees }}" gas_adjustment = {{ .Chain.GasAdjustment }} gas = {{ .Chain.Gas }} gas_prices = "{{ .Chain.GasPrices }}" id = "{{ .Chain.ID }}" rpc_address = "{{ .Chain.RPCAddress }}" simulate_and_execute = {{ .Chain.SimulateAndExecute }} -trust_node = {{ .Chain.TrustNode }} [cors] allowed_origins = "{{ .CORS.AllowedOrigins }}" @@ -44,18 +40,15 @@ allowed_origins = "{{ .CORS.AllowedOrigins }}" ) type Config struct { - Password string `json:"password,omitempty"` - Setup bool `json:"setup"` - Chain struct { + Setup bool `json:"setup"` + Chain struct { BroadcastMode string `json:"broadcast_mode"` - Fees string `json:"fees"` GasAdjustment float64 `json:"gas_adjustment"` GasPrices string `json:"gas_prices"` Gas uint64 `json:"gas"` ID string `json:"id"` RPCAddress string `json:"rpc_address"` SimulateAndExecute bool `json:"simulate_and_execute"` - TrustNode bool `json:"trust_node"` } `json:"chain"` CORS struct { AllowedOrigins string `json:"allowed_origins"` @@ -68,27 +61,21 @@ func NewConfig() *Config { func (c *Config) Copy() *Config { return &Config{ - Password: c.Password, - Setup: c.Setup, - Chain: c.Chain, - CORS: c.CORS, + Setup: c.Setup, + Chain: c.Chain, + CORS: c.CORS, } } func (c *Config) WithDefaultValues() *Config { - c.Password = fmt.Sprintf("%X", sha256.Sum256([]byte("admin"))) c.Setup = true - c.Chain.BroadcastMode = "block" - c.Chain.Fees = "" c.Chain.Gas = 5e5 c.Chain.GasAdjustment = 0 c.Chain.GasPrices = "0.1udvpn" - c.Chain.ID = "sentinelhub-1" + c.Chain.ID = "sentinelhub-2" c.Chain.RPCAddress = "https://rpc.sentinel.co:443" c.Chain.SimulateAndExecute = true - c.Chain.TrustNode = false - c.CORS.AllowedOrigins = "" return c @@ -96,10 +83,7 @@ func (c *Config) WithDefaultValues() *Config { func (c *Config) LoadFromPath(path string) error { if _, err := os.Stat(path); err != nil { - cfg := NewConfig().WithDefaultValues() - if err := cfg.SaveToPath(path); err != nil { - return err - } + return err } data, err := ioutil.ReadFile(path) @@ -144,20 +128,17 @@ func (c *Config) String() string { } func (c *Config) Validate() error { - if len(c.Password) != 64 { - return fmt.Errorf("invalid field Password") - } if c.Chain.BroadcastMode == "" { - return fmt.Errorf("invalid field Chain.BroadcastMode") + return fmt.Errorf("invalid chain->broadcast_mode; expected non-empty value") } if c.Chain.GasAdjustment < 0 { - return fmt.Errorf("invalid field Chain.GasAdjustment") + return fmt.Errorf("invalid chain->gas_adjustment; expected non-negative value") } if c.Chain.ID == "" { - return fmt.Errorf("invalid field Chain.ID") + return fmt.Errorf("invalid chain->id; expected non-empty value") } if c.Chain.RPCAddress == "" { - return fmt.Errorf("invalid field Chain.RPCAddress") + return fmt.Errorf("invalid chain->rpc_address; expected non-empty value") } return nil diff --git a/cli/types/keys.go b/cli/types/keys.go index c6101f1f..82157ad1 100644 --- a/cli/types/keys.go +++ b/cli/types/keys.go @@ -16,4 +16,5 @@ var ( return filepath.Join(home, ".sentinel", "client") }() + Denom = "udvpn" ) diff --git a/cli/utils/errors.go b/cli/utils/errors.go new file mode 100644 index 00000000..4917ce0a --- /dev/null +++ b/cli/utils/errors.go @@ -0,0 +1,14 @@ +package utils + +import ( + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func IsNotFoundError(v error) error { + if status.Code(v) == codes.NotFound { + return nil + } + + return v +} diff --git a/cli/utils/rest.go b/cli/utils/rest.go index 2067af96..d4eba2a6 100644 --- a/cli/utils/rest.go +++ b/cli/utils/rest.go @@ -1,12 +1,22 @@ package utils import ( + "encoding/hex" "encoding/json" "net/http" + "net/url" + "strconv" + + "github.com/cosmos/cosmos-sdk/types/query" "github.com/sentinel-official/desktop-client/cli/types" ) +func write(w http.ResponseWriter, status int, res types.Response) error { + w.WriteHeader(status) + return json.NewEncoder(w).Encode(res) +} + func WriteErrorToResponse(w http.ResponseWriter, status, code int, message string) { _ = write(w, status, types.Response{ Success: false, @@ -21,7 +31,35 @@ func WriteResultToResponse(w http.ResponseWriter, status int, result interface{} }) } -func write(w http.ResponseWriter, status int, res types.Response) error { - w.WriteHeader(status) - return json.NewEncoder(w).Encode(res) +func ParsePaginationQuery(values url.Values) (pagination *query.PageRequest, err error) { + pagination = &query.PageRequest{ + Limit: 25, + } + + if values.Get("key") != "" { + pagination.Key, err = hex.DecodeString(values.Get("key")) + if err != nil { + return nil, err + } + } + + if values.Get("offset") != "" { + pagination.Offset, err = strconv.ParseUint(values.Get("offset"), 0, 64) + if err != nil { + return nil, err + } + } + + if values.Get("limit") != "" { + pagination.Limit, err = strconv.ParseUint(values.Get("limit"), 0, 64) + if err != nil { + return nil, err + } + } + + if values.Get("count_total") != "" { + pagination.CountTotal = true + } + + return pagination, nil } diff --git a/cli/x/auth/account.go b/cli/x/auth/account.go index 72f0d149..7b9e0250 100644 --- a/cli/x/auth/account.go +++ b/cli/x/auth/account.go @@ -1,37 +1,39 @@ package auth import ( - "github.com/cosmos/cosmos-sdk/x/auth/exported" - "github.com/tendermint/tendermint/libs/bytes" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/sentinel-official/desktop-client/cli/x/other" + "github.com/sentinel-official/desktop-client/cli/x/common" ) type Account struct { Address string `json:"address"` PubKey string `json:"pub_key"` - Coins other.Coins `json:"coins"` + Balance common.Coin `json:"balance"` Sequence uint64 `json:"sequence"` Number uint64 `json:"number"` } -func NewAccountFromRaw(item exported.Account) (account Account) { - if item == nil { - return Account{ - Coins: other.Coins{other.Coin{Denom: "", Value: 0}}, - } - } +func (a Account) WithBalance(balance common.Coin) Account { + a.Balance = balance + return a +} - if item.GetPubKey() == nil { - account.PubKey = "" - } else { - account.PubKey = bytes.HexBytes(item.GetPubKey().Bytes()).String() +func NewAccountFromRaw(item authtypes.AccountI) Account { + if item == nil { + return Account{} } - account.Address = bytes.HexBytes(item.GetAddress().Bytes()).String() - account.Coins = other.NewCoinsFromRaw(item.GetCoins()) - account.Sequence = item.GetSequence() - account.Number = item.GetAccountNumber() + return Account{ + Address: item.GetAddress().String(), + PubKey: func() string { + if item.GetPubKey() == nil { + return "" + } - return account + return item.GetPubKey().String() + }(), + Sequence: item.GetSequence(), + Number: item.GetAccountNumber(), + } } diff --git a/cli/x/bank/msgs.go b/cli/x/bank/msgs.go deleted file mode 100644 index 15a4380e..00000000 --- a/cli/x/bank/msgs.go +++ /dev/null @@ -1,38 +0,0 @@ -package bank - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/bank" - - "github.com/sentinel-official/desktop-client/cli/x/other" -) - -type MsgSend struct { - FromAddress string `json:"from_address"` - ToAddress string `json:"to_address"` - Amount other.Coins `json:"amount"` -} - -func NewMsgSend(fromAddress, toAddress string, amount other.Coins) *MsgSend { - return &MsgSend{ - FromAddress: fromAddress, - ToAddress: toAddress, - Amount: amount, - } -} - -func (s *MsgSend) Raw() (send bank.MsgSend, err error) { - send.FromAddress, err = sdk.AccAddressFromHex(s.FromAddress) - if err != nil { - return send, err - } - - send.ToAddress, err = sdk.AccAddressFromHex(s.ToAddress) - if err != nil { - return send, err - } - - send.Amount = s.Amount.Raw() - - return send, nil -} diff --git a/cli/x/other/bandwidth.go b/cli/x/common/bandwidth.go similarity index 60% rename from cli/x/other/bandwidth.go rename to cli/x/common/bandwidth.go index 91967a12..03450d19 100644 --- a/cli/x/other/bandwidth.go +++ b/cli/x/common/bandwidth.go @@ -1,7 +1,7 @@ -package other +package common import ( - hub "github.com/sentinel-official/hub/types" + hubtypes "github.com/sentinel-official/hub/types" ) type Bandwidth struct { @@ -9,7 +9,7 @@ type Bandwidth struct { Download int64 `json:"download"` } -func NewBandwidthFromRaw(item hub.Bandwidth) Bandwidth { +func NewBandwidthFromRaw(item hubtypes.Bandwidth) Bandwidth { return Bandwidth{ Upload: item.Upload.Int64(), Download: item.Download.Int64(), diff --git a/cli/x/other/coin.go b/cli/x/common/coin.go similarity index 85% rename from cli/x/other/coin.go rename to cli/x/common/coin.go index d1bcd773..7fb71e67 100644 --- a/cli/x/other/coin.go +++ b/cli/x/common/coin.go @@ -1,4 +1,4 @@ -package other +package common import ( sdk "github.com/cosmos/cosmos-sdk/types" @@ -9,7 +9,7 @@ type Coin struct { Value int64 `json:"value"` } -func NewCoinFromRaw(item sdk.Coin) Coin { +func NewCoinFromRaw(item *sdk.Coin) Coin { return Coin{ Denom: item.Denom, Value: item.Amount.Int64(), @@ -28,7 +28,7 @@ type Coins []Coin func NewCoinsFromRaw(items sdk.Coins) Coins { coins := make(Coins, 0, items.Len()) for _, item := range items { - coins = append(coins, NewCoinFromRaw(item)) + coins = append(coins, NewCoinFromRaw(&item)) } return coins @@ -48,7 +48,7 @@ type DecCoin struct { Value string `json:"value"` } -func NewDecCoinFromRaw(item sdk.DecCoin) DecCoin { +func NewDecCoinFromRaw(item *sdk.DecCoin) DecCoin { return DecCoin{ Denom: item.Denom, Value: item.Amount.String(), @@ -67,7 +67,7 @@ type DecCoins []DecCoin func NewDecCoinsFromRaw(items sdk.DecCoins) DecCoins { coins := make(DecCoins, 0, items.Len()) for _, item := range items { - coins = append(coins, NewDecCoinFromRaw(item)) + coins = append(coins, NewDecCoinFromRaw(&item)) } return coins diff --git a/cli/x/common/deposit.go b/cli/x/common/deposit.go new file mode 100644 index 00000000..7f6257cf --- /dev/null +++ b/cli/x/common/deposit.go @@ -0,0 +1,28 @@ +package common + +import ( + deposittypes "github.com/sentinel-official/hub/x/deposit/types" +) + +type Deposit struct { + Address string `json:"address"` + Amount Coins `json:"amount"` +} + +func NewDepositFromRaw(item *deposittypes.Deposit) Deposit { + return Deposit{ + Address: item.Address, + Amount: NewCoinsFromRaw(item.Coins), + } +} + +type Deposits []Deposit + +func NewDepositsFromRaw(items deposittypes.Deposits) Deposits { + deposits := make(Deposits, 0, len(items)) + for _, item := range items { + deposits = append(deposits, NewDepositFromRaw(&item)) + } + + return deposits +} diff --git a/cli/x/other/key.go b/cli/x/common/key.go similarity index 63% rename from cli/x/other/key.go rename to cli/x/common/key.go index d3aaf2c6..12abaa9f 100644 --- a/cli/x/other/key.go +++ b/cli/x/common/key.go @@ -1,7 +1,7 @@ -package other +package common import ( - "github.com/cosmos/cosmos-sdk/crypto/keys" + "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/tendermint/tendermint/libs/bytes" ) @@ -12,18 +12,22 @@ type Key struct { Mnemonic string `json:"mnemonic,omitempty"` } -func NewKeyFromRaw(info keys.Info, mnemonic string) Key { +func NewKeyFromRaw(info keyring.Info, mnemonic string) Key { return Key{ Name: info.GetName(), PubKey: bytes.HexBytes(info.GetPubKey().Bytes()).String(), - Address: bytes.HexBytes(info.GetAddress().Bytes()).String(), + Address: info.GetAddress().String(), Mnemonic: mnemonic, } } type Keys []Key -func NewKeysFromRaw(infos []keys.Info, mnemonics []string) Keys { +func NewKeysFromRaw(infos []keyring.Info, mnemonics []string) Keys { + if mnemonics == nil { + mnemonics = make([]string, len(infos)) + } + items := make(Keys, 0, len(infos)) for i := 0; i < len(infos); i++ { items = append(items, NewKeyFromRaw(infos[i], mnemonics[i])) diff --git a/cli/x/distribution/msgs.go b/cli/x/distribution/msgs.go deleted file mode 100644 index cdbeb7ff..00000000 --- a/cli/x/distribution/msgs.go +++ /dev/null @@ -1,32 +0,0 @@ -package distribution - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/distribution" -) - -type MsgWithdrawDelegatorReward struct { - FromAddress string `json:"from_address"` - ValAddress string `json:"val_address"` -} - -func NewMsgWithdrawDelegatorReward(fromAddress, valAddress string) *MsgWithdrawDelegatorReward { - return &MsgWithdrawDelegatorReward{ - FromAddress: fromAddress, - ValAddress: valAddress, - } -} - -func (w *MsgWithdrawDelegatorReward) Raw() (rewards distribution.MsgWithdrawDelegatorReward, err error) { - rewards.DelegatorAddress, err = sdk.AccAddressFromHex(w.FromAddress) - if err != nil { - return rewards, err - } - - rewards.ValidatorAddress, err = sdk.ValAddressFromHex(w.ValAddress) - if err != nil { - return rewards, err - } - - return rewards, nil -} diff --git a/cli/x/gov/msgs.go b/cli/x/gov/msgs.go deleted file mode 100644 index 5f79be19..00000000 --- a/cli/x/gov/msgs.go +++ /dev/null @@ -1,96 +0,0 @@ -package gov - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/gov" - gcutils "github.com/cosmos/cosmos-sdk/x/gov/client/utils" - - "github.com/sentinel-official/desktop-client/cli/x/other" -) - -type MsgSubmitProposal struct { - FromAddress string `json:"from_address"` - Title string `json:"title"` - Description string `json:"description"` - Type string `json:"type"` - InitialDeposit other.Coins `json:"initial_deposit"` -} - -func NewMsgSubmitProposal(fromAddress, title, description, _type string, deposit other.Coins) *MsgSubmitProposal { - return &MsgSubmitProposal{ - FromAddress: fromAddress, - Title: title, - Description: description, - Type: _type, - InitialDeposit: deposit, - } -} - -func (p *MsgSubmitProposal) Raw() (proposal gov.MsgSubmitProposal, err error) { - proposal.Proposer, err = sdk.AccAddressFromHex(p.FromAddress) - if err != nil { - return proposal, err - } - - proposal.Content = gov.ContentFromProposalType(p.Title, p.Description, p.Type) - proposal.InitialDeposit = p.InitialDeposit.Raw() - - return proposal, nil -} - -type MsgDeposit struct { - FromAddress string `json:"from_address"` - ProposalID uint64 `json:"proposal_id"` - Amount other.Coins `json:"amount"` -} - -func NewMsgDeposit(fromAddress string, proposalID uint64, deposit other.Coins) *MsgDeposit { - return &MsgDeposit{ - FromAddress: fromAddress, - ProposalID: proposalID, - Amount: deposit, - } -} - -func (p *MsgDeposit) Raw() (deposit gov.MsgDeposit, err error) { - deposit.Depositor, err = sdk.AccAddressFromHex(p.FromAddress) - if err != nil { - return deposit, err - } - - deposit.ProposalID = p.ProposalID - deposit.Amount = p.Amount.Raw() - - return deposit, nil -} - -type MsgVote struct { - FromAddress string `json:"from_address"` - ProposalID uint64 `json:"proposal_id"` - Option string `json:"option"` -} - -func NewMsgVote(fromAddress string, proposalID uint64, option string) *MsgVote { - return &MsgVote{ - FromAddress: fromAddress, - ProposalID: proposalID, - Option: option, - } -} - -func (p *MsgVote) Raw() (vote gov.MsgVote, err error) { - vote.Voter, err = sdk.AccAddressFromHex(p.FromAddress) - if err != nil { - return vote, err - } - - option, err := gov.VoteOptionFromString(gcutils.NormalizeVoteOption(p.Option)) - if err != nil { - return vote, err - } - - vote.ProposalID = p.ProposalID - vote.Option = option - - return vote, nil -} diff --git a/cli/x/gov/proposal.go b/cli/x/gov/proposal.go index 77a8f40c..d72cec95 100644 --- a/cli/x/gov/proposal.go +++ b/cli/x/gov/proposal.go @@ -3,10 +3,9 @@ package gov import ( "time" - "github.com/cosmos/cosmos-sdk/x/gov" - "github.com/tendermint/tendermint/libs/bytes" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - "github.com/sentinel-official/desktop-client/cli/x/other" + "github.com/sentinel-official/desktop-client/cli/x/common" ) type TallyResult struct { @@ -16,34 +15,42 @@ type TallyResult struct { NoWithVeto int64 `json:"no_with_veto"` } +type Content struct { + Title string `json:"title"` + Description string `json:"description"` + Route string `json:"route"` + Type string `json:"type"` +} + type Proposal struct { - Index uint64 `json:"index"` - Type string `json:"type"` - Title string `json:"title"` - Description string `json:"description"` - Status string `json:"status"` - Deposit other.Coins `json:"deposit"` - TallyResult TallyResult `json:"tally_result"` - SubmitTime time.Time `json:"submit_time"` - DepositEndTime time.Time `json:"deposit_end_time"` - VotingStartTime time.Time `json:"voting_start_time"` - VotingEndTime time.Time `json:"voting_end_time"` + Id uint64 `json:"id"` + Status string `json:"status"` + Content Content `json:"content"` + TallyResult TallyResult `json:"tally_result"` + TotalDeposit common.Coins `json:"total_deposit"` + SubmitTime time.Time `json:"submit_time"` + DepositEndTime time.Time `json:"deposit_end_time"` + VotingStartTime time.Time `json:"voting_start_time"` + VotingEndTime time.Time `json:"voting_end_time"` } -func NewProposalFromRaw(item gov.Proposal) Proposal { +func NewProposalFromRaw(item *govtypes.Proposal) Proposal { return Proposal{ - Index: item.ProposalID, - Type: item.ProposalType(), - Title: item.GetTitle(), - Description: item.GetDescription(), - Status: item.Status.String(), - Deposit: other.NewCoinsFromRaw(item.TotalDeposit), + Id: item.ProposalId, + Status: item.Status.String(), + Content: Content{ + Title: item.GetContent().GetTitle(), + Description: item.GetContent().GetDescription(), + Route: item.GetContent().ProposalRoute(), + Type: item.GetContent().ProposalType(), + }, TallyResult: TallyResult{ Yes: item.FinalTallyResult.Yes.Int64(), Abstain: item.FinalTallyResult.Abstain.Int64(), No: item.FinalTallyResult.No.Int64(), NoWithVeto: item.FinalTallyResult.NoWithVeto.Int64(), }, + TotalDeposit: common.NewCoinsFromRaw(item.TotalDeposit), SubmitTime: item.SubmitTime, DepositEndTime: item.DepositEndTime, VotingStartTime: item.VotingStartTime, @@ -53,26 +60,26 @@ func NewProposalFromRaw(item gov.Proposal) Proposal { type Proposals []Proposal -func NewProposalsFromRaw(items gov.Proposals) Proposals { +func NewProposalsFromRaw(items govtypes.Proposals) Proposals { proposals := make(Proposals, 0, len(items)) for _, proposal := range items { - proposals = append(proposals, NewProposalFromRaw(proposal)) + proposals = append(proposals, NewProposalFromRaw(&proposal)) } return proposals } -func NewDepositFromRaw(deposit gov.Deposit) other.Deposit { - return other.Deposit{ - Address: bytes.HexBytes(deposit.Depositor.Bytes()).String(), - Amount: other.NewCoinsFromRaw(deposit.Amount), +func NewDepositFromRaw(deposit *govtypes.Deposit) common.Deposit { + return common.Deposit{ + Address: deposit.Depositor, + Amount: common.NewCoinsFromRaw(deposit.Amount), } } -func NewDepositsFromRaw(items gov.Deposits) other.Deposits { - deposits := make(other.Deposits, 0, len(items)) +func NewDepositsFromRaw(items govtypes.Deposits) common.Deposits { + deposits := make(common.Deposits, 0, len(items)) for _, deposit := range items { - deposits = append(deposits, NewDepositFromRaw(deposit)) + deposits = append(deposits, NewDepositFromRaw(&deposit)) } return deposits diff --git a/cli/x/gov/vote.go b/cli/x/gov/vote.go index c0e934c0..ee5d89b1 100644 --- a/cli/x/gov/vote.go +++ b/cli/x/gov/vote.go @@ -1,30 +1,29 @@ package gov import ( - "github.com/cosmos/cosmos-sdk/x/gov" - "github.com/tendermint/tendermint/libs/bytes" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) type Vote struct { - ProposalID uint64 `json:"proposal_id"` + ProposalId uint64 `json:"proposal_id"` Voter string `json:"voter"` Option string `json:"option"` } -func NewVoteFromRaw(vote gov.Vote) Vote { +func NewVoteFromRaw(vote *govtypes.Vote) Vote { return Vote{ - ProposalID: vote.ProposalID, - Voter: bytes.HexBytes(vote.Voter.Bytes()).String(), + ProposalId: vote.ProposalId, + Voter: vote.Voter, Option: vote.Option.String(), } } type Votes []Vote -func NewVotesFromRaw(items gov.Votes) Votes { +func NewVotesFromRaw(items govtypes.Votes) Votes { votes := make(Votes, 0, len(items)) for _, item := range items { - votes = append(votes, NewVoteFromRaw(item)) + votes = append(votes, NewVoteFromRaw(&item)) } return votes diff --git a/cli/x/node/node.go b/cli/x/node/node.go index 28d881e4..900b11b3 100644 --- a/cli/x/node/node.go +++ b/cli/x/node/node.go @@ -3,26 +3,25 @@ package node import ( "time" - "github.com/sentinel-official/hub/x/node" - "github.com/tendermint/tendermint/libs/bytes" + nodetypes "github.com/sentinel-official/hub/x/node/types" - "github.com/sentinel-official/desktop-client/cli/x/other" + "github.com/sentinel-official/desktop-client/cli/x/common" ) type Node struct { - Address string `json:"address"` - Provider string `json:"provider"` - Price other.Coins `json:"price"` - RemoteURL string `json:"remote_url"` - Status string `json:"status"` - StatusAt time.Time `json:"status_at"` + Address string `json:"address"` + Provider string `json:"provider"` + Price common.Coins `json:"price"` + RemoteURL string `json:"remote_url"` + Status string `json:"status"` + StatusAt time.Time `json:"status_at"` } -func NewNodeFromRaw(item node.Node) Node { +func NewNodeFromRaw(item *nodetypes.Node) Node { return Node{ - Address: bytes.HexBytes(item.Address.Bytes()).String(), - Provider: bytes.HexBytes(item.Provider.Bytes()).String(), - Price: other.NewCoinsFromRaw(item.Price), + Address: item.Address, + Provider: item.Provider, + Price: common.NewCoinsFromRaw(item.Price), RemoteURL: item.RemoteURL, Status: item.Status.String(), StatusAt: item.StatusAt, @@ -31,10 +30,10 @@ func NewNodeFromRaw(item node.Node) Node { type Nodes []Node -func NewNodesFromRaw(items node.Nodes) Nodes { +func NewNodesFromRaw(items nodetypes.Nodes) Nodes { nodes := make(Nodes, 0, len(items)) for _, item := range items { - nodes = append(nodes, NewNodeFromRaw(item)) + nodes = append(nodes, NewNodeFromRaw(&item)) } return nodes diff --git a/cli/x/other/deposit.go b/cli/x/other/deposit.go deleted file mode 100644 index 227fe252..00000000 --- a/cli/x/other/deposit.go +++ /dev/null @@ -1,29 +0,0 @@ -package other - -import ( - "github.com/sentinel-official/hub/x/deposit" - "github.com/tendermint/tendermint/libs/bytes" -) - -type Deposit struct { - Address string `json:"address"` - Amount []Coin `json:"amount"` -} - -func NewDepositFromRaw(item deposit.Deposit) Deposit { - return Deposit{ - Address: bytes.HexBytes(item.Address.Bytes()).String(), - Amount: NewCoinsFromRaw(item.Coins), - } -} - -type Deposits []Deposit - -func NewDepositsFromRaw(items deposit.Deposits) Deposits { - deposits := make(Deposits, 0, len(items)) - for _, item := range items { - deposits = append(deposits, NewDepositFromRaw(item)) - } - - return deposits -} diff --git a/cli/x/plan/plan.go b/cli/x/plan/plan.go index 8d7298de..d550cfcd 100644 --- a/cli/x/plan/plan.go +++ b/cli/x/plan/plan.go @@ -3,27 +3,26 @@ package plan import ( "time" - "github.com/sentinel-official/hub/x/plan" - "github.com/tendermint/tendermint/libs/bytes" + plantypes "github.com/sentinel-official/hub/x/plan/types" - "github.com/sentinel-official/desktop-client/cli/x/other" + "github.com/sentinel-official/desktop-client/cli/x/common" ) type Plan struct { - ID uint64 `json:"id"` - Provider string `json:"provider"` - Price other.Coins `json:"price"` - Validity int64 `json:"validity"` - Bytes int64 `json:"bytes"` - Status string `json:"status"` - StatusAt time.Time `json:"status_at"` + Id uint64 `json:"id"` + Provider string `json:"provider"` + Price common.Coins `json:"price"` + Validity int64 `json:"validity"` + Bytes int64 `json:"bytes"` + Status string `json:"status"` + StatusAt time.Time `json:"status_at"` } -func NewPlanFromRaw(item plan.Plan) Plan { +func NewPlanFromRaw(item *plantypes.Plan) Plan { return Plan{ - ID: item.ID, - Provider: bytes.HexBytes(item.Provider.Bytes()).String(), - Price: other.NewCoinsFromRaw(item.Price), + Id: item.Id, + Provider: item.Provider, + Price: common.NewCoinsFromRaw(item.Price), Validity: item.Validity.Nanoseconds(), Bytes: item.Bytes.Int64(), Status: item.Status.String(), @@ -33,10 +32,10 @@ func NewPlanFromRaw(item plan.Plan) Plan { type Plans []Plan -func NewPlansFromRaw(items plan.Plans) Plans { +func NewPlansFromRaw(items plantypes.Plans) Plans { plans := make(Plans, 0, len(items)) for _, item := range items { - plans = append(plans, NewPlanFromRaw(item)) + plans = append(plans, NewPlanFromRaw(&item)) } return plans diff --git a/cli/x/provider/provider.go b/cli/x/provider/provider.go index 4edde81d..51bf463d 100644 --- a/cli/x/provider/provider.go +++ b/cli/x/provider/provider.go @@ -1,8 +1,7 @@ package provider import ( - "github.com/sentinel-official/hub/x/provider" - "github.com/tendermint/tendermint/libs/bytes" + providertypes "github.com/sentinel-official/hub/x/provider/types" ) type Provider struct { @@ -13,9 +12,9 @@ type Provider struct { Description string `json:"description"` } -func NewProviderFromRaw(item provider.Provider) Provider { +func NewProviderFromRaw(item *providertypes.Provider) Provider { return Provider{ - Address: bytes.HexBytes(item.Address.Bytes()).String(), + Address: item.Address, Name: item.Name, Identity: item.Identity, Website: item.Website, @@ -25,10 +24,10 @@ func NewProviderFromRaw(item provider.Provider) Provider { type Providers []Provider -func NewProvidersFromRaw(items provider.Providers) Providers { +func NewProvidersFromRaw(items providertypes.Providers) Providers { providers := make(Providers, 0, len(items)) for _, item := range items { - providers = append(providers, NewProviderFromRaw(item)) + providers = append(providers, NewProviderFromRaw(&item)) } return providers diff --git a/cli/x/session/session.go b/cli/x/session/session.go index 3928535c..89ff37da 100644 --- a/cli/x/session/session.go +++ b/cli/x/session/session.go @@ -3,31 +3,30 @@ package session import ( "time" - "github.com/sentinel-official/hub/x/session" - "github.com/tendermint/tendermint/libs/bytes" + sessiontypes "github.com/sentinel-official/hub/x/session/types" - "github.com/sentinel-official/desktop-client/cli/x/other" + "github.com/sentinel-official/desktop-client/cli/x/common" ) type Session struct { - ID uint64 `json:"id"` - Subscription uint64 `json:"subscription"` - Node string `json:"node"` - Address string `json:"address"` - Duration int64 `json:"duration"` - Bandwidth other.Bandwidth `json:"bandwidth"` - Status string `json:"status"` - StatusAt time.Time `json:"status_at"` + Id uint64 `json:"id"` + Subscription uint64 `json:"subscription"` + Node string `json:"node"` + Address string `json:"address"` + Duration int64 `json:"duration"` + Bandwidth common.Bandwidth `json:"bandwidth"` + Status string `json:"status"` + StatusAt time.Time `json:"status_at"` } -func NewSessionFromRaw(item session.Session) Session { +func NewSessionFromRaw(item *sessiontypes.Session) Session { return Session{ - ID: item.ID, + Id: item.Id, Subscription: item.Subscription, - Node: bytes.HexBytes(item.Node.Bytes()).String(), - Address: bytes.HexBytes(item.Address.Bytes()).String(), + Node: item.Node, + Address: item.Address, Duration: item.Duration.Nanoseconds(), - Bandwidth: other.NewBandwidthFromRaw(item.Bandwidth), + Bandwidth: common.NewBandwidthFromRaw(item.Bandwidth), Status: item.Status.String(), StatusAt: item.StatusAt, } @@ -35,10 +34,10 @@ func NewSessionFromRaw(item session.Session) Session { type Sessions []Session -func NewSessionsFromRaw(items session.Sessions) Sessions { +func NewSessionsFromRaw(items sessiontypes.Sessions) Sessions { sessions := make(Sessions, 0, len(items)) for _, item := range items { - sessions = append(sessions, NewSessionFromRaw(item)) + sessions = append(sessions, NewSessionFromRaw(&item)) } return sessions diff --git a/cli/x/staking/delegation.go b/cli/x/staking/delegation.go index 71941c72..eba0a8b7 100644 --- a/cli/x/staking/delegation.go +++ b/cli/x/staking/delegation.go @@ -1,30 +1,34 @@ package staking import ( - "github.com/cosmos/cosmos-sdk/x/staking" - "github.com/tendermint/tendermint/libs/bytes" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + "github.com/sentinel-official/desktop-client/cli/x/common" ) type Delegation struct { - DelegatorAddress string `json:"delegator_address"` - ValidatorAddress string `json:"validator_address"` - Shares string `json:"shares"` + DelegatorAddress string `json:"delegator_address"` + ValidatorAddress string `json:"validator_address"` + Shares string `json:"shares"` + Balance common.Coin `json:"balance"` } -func NewDelegationFromRaw(delegation staking.Delegation) Delegation { +func NewDelegationFromRaw(item stakingtypes.DelegationResponse) Delegation { return Delegation{ - DelegatorAddress: bytes.HexBytes(delegation.DelegatorAddress.Bytes()).String(), - ValidatorAddress: bytes.HexBytes(delegation.ValidatorAddress.Bytes()).String(), - Shares: delegation.Shares.String(), + DelegatorAddress: item.Delegation.DelegatorAddress, + ValidatorAddress: item.Delegation.ValidatorAddress, + Shares: item.Delegation.Shares.String(), + Balance: common.NewCoinFromRaw(&item.Balance), } } type Delegations []Delegation -func NewDelegationsFromRaw(items staking.Delegations) Delegations { +func NewDelegationsFromRaw(items stakingtypes.DelegationResponses) Delegations { delegations := make(Delegations, 0, len(items)) for _, item := range items { delegations = append(delegations, NewDelegationFromRaw(item)) } + return delegations } diff --git a/cli/x/staking/msgs.go b/cli/x/staking/msgs.go deleted file mode 100644 index d118be7f..00000000 --- a/cli/x/staking/msgs.go +++ /dev/null @@ -1,105 +0,0 @@ -package staking - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/staking" - - "github.com/sentinel-official/desktop-client/cli/x/other" -) - -type MsgDelegate struct { - FromAddress string `json:"from_address"` - ValAddress string `json:"val_address"` - Amount other.Coin `json:"amount"` -} - -func NewMsgDelegate(fromAddress, valAddress string, amount other.Coin) *MsgDelegate { - return &MsgDelegate{ - FromAddress: fromAddress, - ValAddress: valAddress, - Amount: amount, - } -} - -func (d *MsgDelegate) Raw() (delegate staking.MsgDelegate, err error) { - delegate.DelegatorAddress, err = sdk.AccAddressFromHex(d.FromAddress) - if err != nil { - return delegate, err - } - - delegate.ValidatorAddress, err = sdk.ValAddressFromHex(d.ValAddress) - if err != nil { - return delegate, err - } - - delegate.Amount = d.Amount.Raw() - - return delegate, nil -} - -type MsgBeginRedelegate struct { - FromAddress string `json:"from_address"` - ValSrcAddress string `json:"val_src_address"` - ValDstAddress string `json:"val_dest_address"` - Amount other.Coin `json:"amount"` -} - -func NewMsgBeginRedelegate(fromAddress, valSrcAddress, valDstAddress string, amount other.Coin) *MsgBeginRedelegate { - return &MsgBeginRedelegate{ - FromAddress: fromAddress, - ValSrcAddress: valSrcAddress, - ValDstAddress: valDstAddress, - Amount: amount, - } -} - -func (d *MsgBeginRedelegate) Raw() (reDelegate staking.MsgBeginRedelegate, err error) { - reDelegate.DelegatorAddress, err = sdk.AccAddressFromHex(d.FromAddress) - if err != nil { - return reDelegate, err - } - - reDelegate.ValidatorSrcAddress, err = sdk.ValAddressFromHex(d.ValSrcAddress) - if err != nil { - return reDelegate, err - } - - reDelegate.ValidatorDstAddress, err = sdk.ValAddressFromHex(d.ValDstAddress) - if err != nil { - return reDelegate, err - } - - reDelegate.Amount = d.Amount.Raw() - - return reDelegate, nil -} - -type MsgUndelegate struct { - FromAddress string `json:"from_address"` - ValAddress string `json:"val_address"` - Amount other.Coin `json:"amount"` -} - -func NewMsgUndelegate(fromAddress, valAddress string, amount other.Coin) *MsgUndelegate { - return &MsgUndelegate{ - FromAddress: fromAddress, - ValAddress: valAddress, - Amount: amount, - } -} - -func (d *MsgUndelegate) Raw() (undelegate staking.MsgUndelegate, err error) { - undelegate.DelegatorAddress, err = sdk.AccAddressFromHex(d.FromAddress) - if err != nil { - return undelegate, err - } - - undelegate.ValidatorAddress, err = sdk.ValAddressFromHex(d.ValAddress) - if err != nil { - return undelegate, err - } - - undelegate.Amount = d.Amount.Raw() - - return undelegate, nil -} diff --git a/cli/x/staking/validator.go b/cli/x/staking/validator.go index 7d0b1ff5..f7d4af43 100644 --- a/cli/x/staking/validator.go +++ b/cli/x/staking/validator.go @@ -3,17 +3,16 @@ package staking import ( "time" - "github.com/cosmos/cosmos-sdk/x/staking" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/tendermint/tendermint/libs/bytes" - - "github.com/sentinel-official/desktop-client/cli/x/other" ) type Description struct { - Moniker string `json:"moniker"` - Identity string `json:"identity"` - Website string `json:"website"` - Details string `json:"details"` + Moniker string `json:"moniker"` + Identity string `json:"identity"` + Website string `json:"website"` + SecurityContact string `json:"security_contact"` + Details string `json:"details"` } type Commission struct { @@ -24,60 +23,58 @@ type Commission struct { } type Validator struct { - Address string `json:"address"` - ConsensusAddress string `json:"consensus_address"` - ConsensusPubKey string `json:"consensus_pub_key"` - - Description Description `json:"description"` - Commission Commission `json:"commission"` - - Jailed bool `json:"jailed"` - BondStatus string `json:"bond_status"` - - Amount other.Coin `json:"amount"` - DelegatorShares string `json:"delegator_shares"` - MinSelfDelegation int64 `json:"min_self_delegation"` - - UnbondingHeight int64 `json:"unbonding_height"` - UnbondingCompletionTime time.Time `json:"unbonding_completion_time"` + OperatorAddress string `json:"operator_address"` + ConsensusPubKey string `json:"consensus_pub_key"` + Jailed bool `json:"jailed"` + Status string `json:"status"` + Tokens int64 `json:"tokens"` + DelegatorShares string `json:"delegator_shares"` + Description Description `json:"description"` + UnbondingHeight int64 `json:"unbonding_height"` + UnbondingTime time.Time `json:"unbonding_time"` + Commission Commission `json:"commission"` + MinSelfDelegation int64 `json:"min_self_delegation"` + ConsensusPower int64 `json:"consensus_power"` } -func NewValidatorFromRaw(v staking.Validator) Validator { +func NewValidatorFromRaw(item *stakingtypes.Validator) Validator { + if item == nil { + return Validator{} + } + return Validator{ - Address: bytes.HexBytes(v.OperatorAddress.Bytes()).String(), - ConsensusAddress: bytes.HexBytes(v.ConsPubKey.Address().Bytes()).String(), - ConsensusPubKey: bytes.HexBytes(v.ConsPubKey.Bytes()).String(), + OperatorAddress: item.OperatorAddress, + ConsensusPubKey: bytes.HexBytes(item.ConsensusPubkey.GetValue()).String(), + Jailed: item.Jailed, + Status: item.Status.String(), + Tokens: item.Tokens.Int64(), + DelegatorShares: item.DelegatorShares.String(), Description: Description{ - Moniker: v.Description.Moniker, - Identity: v.Description.Identity, - Website: v.Description.Website, - Details: v.Description.Details, + Moniker: item.Description.Moniker, + Identity: item.Description.Identity, + Website: item.Description.Website, + SecurityContact: item.Description.SecurityContact, + Details: item.Description.Details, }, + UnbondingHeight: item.UnbondingHeight, + UnbondingTime: item.UnbondingTime, Commission: Commission{ - Rate: v.Commission.Rate.String(), - MaxRate: v.Commission.MaxRate.String(), - MaxChangeRate: v.Commission.MaxChangeRate.String(), - UpdatedAt: v.Commission.UpdateTime, - }, - Jailed: v.Jailed, - BondStatus: v.Status.String(), - Amount: other.Coin{ - Denom: "", - Value: v.Tokens.Int64(), + Rate: item.Commission.Rate.String(), + MaxRate: item.Commission.MaxRate.String(), + MaxChangeRate: item.Commission.MaxChangeRate.String(), + UpdatedAt: item.Commission.UpdateTime, }, - DelegatorShares: v.DelegatorShares.String(), - MinSelfDelegation: v.MinSelfDelegation.Int64(), - UnbondingHeight: v.UnbondingHeight, - UnbondingCompletionTime: v.UnbondingCompletionTime, + MinSelfDelegation: item.MinSelfDelegation.Int64(), + ConsensusPower: item.ConsensusPower(), } } type Validators []Validator -func NewValidatorsFromRaw(items staking.Validators) Validators { +func NewValidatorsFromRaw(items stakingtypes.Validators) Validators { validators := make(Validators, 0, len(items)) for _, item := range items { - validators = append(validators, NewValidatorFromRaw(item)) + validators = append(validators, NewValidatorFromRaw(&item)) } return validators diff --git a/cli/x/subscription/msgs.go b/cli/x/subscription/msgs.go deleted file mode 100644 index 56013cb5..00000000 --- a/cli/x/subscription/msgs.go +++ /dev/null @@ -1,89 +0,0 @@ -package subscription - -import ( - "encoding/hex" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/sentinel-official/hub/x/subscription" - - "github.com/sentinel-official/desktop-client/cli/x/other" -) - -type MsgSubscribeToPlan struct { - From string `json:"from"` - ID uint64 `json:"id"` - Denom string `json:"denom"` -} - -func NewMsgSubscribeToPlan(from string, id uint64, denom string) *MsgSubscribeToPlan { - return &MsgSubscribeToPlan{ - From: from, - ID: id, - Denom: denom, - } -} - -func (m *MsgSubscribeToPlan) Raw() (msg subscription.MsgSubscribeToPlan, err error) { - msg.From, err = sdk.AccAddressFromHex(m.From) - if err != nil { - return msg, err - } - - msg.ID = m.ID - msg.Denom = m.Denom - - return msg, nil -} - -type MsgSubscribeToNode struct { - From string `json:"from"` - Address string `json:"address"` - Deposit other.Coin `json:"deposit"` -} - -func NewMsgSubscribeToNode(from, address string, deposit other.Coin) *MsgSubscribeToNode { - return &MsgSubscribeToNode{ - From: from, - Address: address, - Deposit: deposit, - } -} - -func (m *MsgSubscribeToNode) Raw() (msg subscription.MsgSubscribeToNode, err error) { - msg.From, err = sdk.AccAddressFromHex(m.From) - if err != nil { - return msg, err - } - - msg.Address, err = hex.DecodeString(m.Address) - if err != nil { - return msg, err - } - - msg.Deposit = m.Deposit.Raw() - - return msg, nil -} - -type MsgCancel struct { - From string `json:"from"` - ID uint64 `json:"id"` -} - -func NewMsgCancel(from string, id uint64) *MsgCancel { - return &MsgCancel{ - From: from, - ID: id, - } -} - -func (m *MsgCancel) Raw() (msg subscription.MsgCancel, err error) { - msg.From, err = sdk.AccAddressFromHex(m.From) - if err != nil { - return msg, err - } - - msg.ID = m.ID - - return msg, nil -} diff --git a/cli/x/subscription/quota.go b/cli/x/subscription/quota.go index 0043e494..f23223a1 100644 --- a/cli/x/subscription/quota.go +++ b/cli/x/subscription/quota.go @@ -1,8 +1,7 @@ package subscription import ( - "github.com/sentinel-official/hub/x/subscription" - "github.com/tendermint/tendermint/libs/bytes" + subscriptiontypes "github.com/sentinel-official/hub/x/subscription/types" ) type Quota struct { @@ -11,9 +10,9 @@ type Quota struct { Allocated int64 `json:"allocated"` } -func NewQuotaFromRaw(item subscription.Quota) Quota { +func NewQuotaFromRaw(item *subscriptiontypes.Quota) Quota { return Quota{ - Address: bytes.HexBytes(item.Address.Bytes()).String(), + Address: item.Address, Consumed: item.Consumed.Int64(), Allocated: item.Allocated.Int64(), } @@ -21,10 +20,10 @@ func NewQuotaFromRaw(item subscription.Quota) Quota { type Quotas []Quota -func NewQuotasFromRaw(items subscription.Quotas) Quotas { +func NewQuotasFromRaw(items subscriptiontypes.Quotas) Quotas { quotas := make(Quotas, 0, len(items)) for _, item := range items { - quotas = append(quotas, NewQuotaFromRaw(item)) + quotas = append(quotas, NewQuotaFromRaw(&item)) } return quotas diff --git a/cli/x/subscription/subscription.go b/cli/x/subscription/subscription.go index 9524d025..347cc4ab 100644 --- a/cli/x/subscription/subscription.go +++ b/cli/x/subscription/subscription.go @@ -3,34 +3,35 @@ package subscription import ( "time" - "github.com/sentinel-official/hub/x/subscription" - "github.com/tendermint/tendermint/libs/bytes" + subscriptiontypes "github.com/sentinel-official/hub/x/subscription/types" - "github.com/sentinel-official/desktop-client/cli/x/other" + "github.com/sentinel-official/desktop-client/cli/x/common" ) type Subscription struct { - ID uint64 `json:"id"` - Owner string `json:"owner"` - Plan uint64 `json:"plan,omitempty"` - Expiry time.Time `json:"expiry,omitempty"` - Node string `json:"node,omitempty"` - Price other.Coin `json:"price,omitempty"` - Deposit other.Coin `json:"deposit,omitempty"` - Free int64 `json:"free"` - Status string `json:"status"` - StatusAt time.Time `json:"status_at"` + Id uint64 `json:"id"` + Owner string `json:"owner"` + Plan uint64 `json:"plan,omitempty"` + Expiry time.Time `json:"expiry,omitempty"` + Denom string `json:"denom"` + Node string `json:"node,omitempty"` + Price common.Coin `json:"price,omitempty"` + Deposit common.Coin `json:"deposit,omitempty"` + Free int64 `json:"free"` + Status string `json:"status"` + StatusAt time.Time `json:"status_at"` } -func NewSubscriptionFromRaw(item subscription.Subscription) Subscription { +func NewSubscriptionFromRaw(item *subscriptiontypes.Subscription) Subscription { return Subscription{ - ID: item.ID, - Owner: bytes.HexBytes(item.Owner.Bytes()).String(), + Id: item.Id, + Owner: item.Owner, Plan: item.Plan, Expiry: item.Expiry, - Node: bytes.HexBytes(item.Node.Bytes()).String(), - Price: other.NewCoinFromRaw(item.Price), - Deposit: other.NewCoinFromRaw(item.Deposit), + Denom: item.Denom, + Node: item.Node, + Price: common.NewCoinFromRaw(&item.Price), + Deposit: common.NewCoinFromRaw(&item.Deposit), Free: item.Free.Int64(), Status: item.Status.String(), StatusAt: item.StatusAt, @@ -39,10 +40,10 @@ func NewSubscriptionFromRaw(item subscription.Subscription) Subscription { type Subscriptions []Subscription -func NewSubscriptionsFromRaw(items subscription.Subscriptions) Subscriptions { +func NewSubscriptionsFromRaw(items subscriptiontypes.Subscriptions) Subscriptions { subscriptions := make(Subscriptions, 0, len(items)) for _, item := range items { - subscriptions = append(subscriptions, NewSubscriptionFromRaw(item)) + subscriptions = append(subscriptions, NewSubscriptionFromRaw(&item)) } return subscriptions From 88e1475b5f249b8f369cb02d479902cd4991b63e Mon Sep 17 00:00:00 2001 From: Srinivas Baride Date: Mon, 31 May 2021 00:14:15 +0530 Subject: [PATCH 2/5] Upgraded UI which supports latest UI --- package.json | 14 +- src/App.js | 12 - src/actions/account.js | 25 +- src/actions/authentication.js | 105 ------ src/actions/configuration.js | 40 +-- src/actions/delegations.js | 2 +- src/actions/keys.js | 47 +-- src/actions/proposals.js | 2 +- src/actions/transactions/delegate.js | 4 +- src/actions/transactions/redelegate.js | 7 +- src/actions/transactions/send.js | 7 +- src/actions/transactions/unbond.js | 4 +- src/actions/transactions/vote.js | 4 +- src/actions/transactions/withdraw.js | 4 +- src/actions/validators.js | 6 +- src/components/SelectField/index.js | 2 +- src/components/Snackbar/index.js | 2 +- src/components/Table/Header.js | 20 +- src/constants/authentication.js | 17 - src/containers/Authentication/Password.js | 67 ---- src/containers/Authentication/Submit.js | 65 ---- src/containers/Authentication/ViewPassword.js | 37 -- src/containers/Authentication/_validation.js | 8 - src/containers/Authentication/index.js | 51 --- src/containers/Configuration/Fees.js | 53 --- src/containers/Configuration/Password.js | 53 --- src/containers/Configuration/PasswordView.js | 37 -- src/containers/Configuration/Submit.js | 20 +- src/containers/Configuration/TrustNode.js | 72 ---- src/containers/Configuration/_validation.js | 12 - src/containers/Configuration/index.js | 28 -- src/containers/CreateKey/Password.js | 54 --- src/containers/CreateKey/Submit.js | 12 +- src/containers/CreateKey/ViewPassword.js | 37 -- src/containers/CreateKey/_validation.js | 9 - src/containers/CreateKey/index.js | 12 - src/containers/KeyInfo/Address.js | 5 +- src/containers/KeyInfo/AddressCopy.js | 5 +- src/containers/KeyInfo/PublicKey.js | 5 +- src/containers/KeyInfo/PublicKeyCopy.js | 5 +- src/containers/PrivateRoute.js | 43 --- src/containers/Wallet/Balance.js | 14 +- .../Wallet/Keys/ModalCreate/Submit.js | 12 +- .../Wallet/Keys/ModalCreate/index.js | 12 - .../Keys/ModalList/Row/Delete/Password.js | 54 --- .../Keys/ModalList/Row/Delete/Submit.js | 14 +- .../Keys/ModalList/Row/Delete/ViewPassword.js | 37 -- .../Wallet/Keys/ModalList/Row/Delete/index.js | 13 - .../Wallet/Keys/ModalList/Row/index.js | 3 - .../Wallet/Proposals/Modal/Password.js | 53 --- src/containers/Wallet/Receive/index.js | 8 +- src/containers/Wallet/Refresh.js | 24 +- src/containers/Wallet/Send/Amount.js | 16 +- src/containers/Wallet/Send/Modal/Send.js | 12 +- src/containers/Wallet/Send/Modal/index.js | 12 - .../Wallet/Validators/ModalDelegate/Amount.js | 16 +- .../Validators/ModalDelegate/Delegate.js | 12 +- .../Validators/ModalDelegate/ToAddress.js | 5 +- .../Wallet/Validators/ModalDelegate/ToName.js | 4 +- .../Wallet/Validators/ModalDelegate/index.js | 12 - .../Validators/ModalRedelegate/FromAddress.js | 5 +- .../Validators/ModalRedelegate/FromName.js | 4 +- .../Validators/ModalRedelegate/Redelegate.js | 12 +- .../Validators/ModalRedelegate/index.js | 12 - .../Validators/ModalUnbond/FromAddress.js | 5 +- .../Wallet/Validators/ModalUnbond/FromName.js | 4 +- .../Wallet/Validators/ModalUnbond/Unbond.js | 12 +- .../Wallet/Validators/ModalUnbond/index.js | 12 - src/containers/Wallet/Validators/Row/index.js | 26 +- src/containers/Wallet/Validators/index.js | 23 +- .../WithdrawRewards/Modal/FromAddress.js | 5 +- .../Wallet/WithdrawRewards/Modal/FromName.js | 4 +- .../Wallet/WithdrawRewards/Modal/Password.js | 53 --- .../Wallet/WithdrawRewards/Modal/Withdraw.js | 12 +- .../WithdrawRewards/Modal/_validation.js | 9 - .../Wallet/WithdrawRewards/Modal/index.js | 12 - .../Wallet/WithdrawRewards/Validators.js | 4 +- src/containers/common/AccountPassword.js | 54 --- src/containers/common/AccountPasswordView.js | 37 -- .../common/ModalConfiguration/Submit.js | 20 +- .../common/ModalConfiguration/index.js | 28 -- src/containers/common/_validation.js | 9 - src/index.js | 4 +- src/pages/Authentication/index.css | 39 -- src/pages/Authentication/index.js | 4 - src/reducers/account.js | 98 +---- src/reducers/authentication.js | 133 ------- src/reducers/configuration/chain.js | 64 ---- src/reducers/configuration/index.js | 42 --- src/reducers/index.js | 2 - src/reducers/keys/delete.js | 47 --- src/reducers/keys/post.js | 50 +-- src/reducers/snackbar.js | 2 - src/reducers/transactions/unbond.js | 2 +- src/reducers/validators.js | 4 +- src/routes.js | 10 - src/services/axios.js | 58 --- src/utils/amount.js | 11 +- src/utils/validator.js | 2 +- yarn.lock | 339 ++++++++++++++++-- 100 files changed, 446 insertions(+), 2174 deletions(-) delete mode 100644 src/actions/authentication.js delete mode 100644 src/constants/authentication.js delete mode 100644 src/containers/Authentication/Password.js delete mode 100644 src/containers/Authentication/Submit.js delete mode 100644 src/containers/Authentication/ViewPassword.js delete mode 100644 src/containers/Authentication/_validation.js delete mode 100644 src/containers/Authentication/index.js delete mode 100644 src/containers/Configuration/Fees.js delete mode 100644 src/containers/Configuration/Password.js delete mode 100644 src/containers/Configuration/PasswordView.js delete mode 100644 src/containers/Configuration/TrustNode.js delete mode 100644 src/containers/CreateKey/Password.js delete mode 100644 src/containers/CreateKey/ViewPassword.js delete mode 100644 src/containers/PrivateRoute.js delete mode 100644 src/containers/Wallet/Keys/ModalList/Row/Delete/Password.js delete mode 100644 src/containers/Wallet/Keys/ModalList/Row/Delete/ViewPassword.js delete mode 100644 src/containers/Wallet/Proposals/Modal/Password.js delete mode 100644 src/containers/Wallet/WithdrawRewards/Modal/Password.js delete mode 100644 src/containers/common/AccountPassword.js delete mode 100644 src/containers/common/AccountPasswordView.js delete mode 100644 src/pages/Authentication/index.css delete mode 100644 src/pages/Authentication/index.js delete mode 100644 src/reducers/authentication.js delete mode 100644 src/services/axios.js diff --git a/package.json b/package.json index d9ce5f3b..63847312 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,8 @@ }, "private": false, "dependencies": { - "electron-log": "^4.3.4", - "electron-updater": "^4.3.8" + "electron-log": "^4.3.5", + "electron-updater": "^4.3.9" }, "devDependencies": { "@material-ui/core": "^4.11.4", @@ -23,15 +23,15 @@ "bech32": "^2.0.0", "bignumber.js": "^9.0.1", "bootstrap": "^4.6.0", - "electron": "^12.0.5", + "electron": "^13.0.1", "electron-builder": "^22.10.5", "env-cmd": "^10.1.0", - "eslint": "^7.25.0", - "eslint-config-standard": "^16.0.2", - "eslint-plugin-import": "^2.22.1", + "eslint": "^7.27.0", + "eslint-config-standard": "^16.0.3", + "eslint-plugin-import": "^2.23.4", "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^5.1.0", - "eslint-plugin-react": "^7.23.2", + "eslint-plugin-react": "^7.24.0", "eslint-plugin-sort-exports": "^0.4.0", "eslint-plugin-sort-imports-es6-autofix": "^0.6.0", "lodash": "^4.17.21", diff --git a/src/App.js b/src/App.js index 5fc80f95..f6f11a7a 100644 --- a/src/App.js +++ b/src/App.js @@ -1,6 +1,5 @@ import './App.css'; import { Redirect, Route, Switch, withRouter } from 'react-router-dom'; -import PrivateRoute from './containers/PrivateRoute'; import React from 'react'; import Snackbar from './containers/common/Snackbar'; import routes from './routes'; @@ -11,17 +10,6 @@ const App = () => { { routes.map((route) => { - if (route.private) { - return ( - - ); - } - return ( { @@ -67,17 +60,3 @@ export const getAccount = (cb = emptyFunc) => (dispatch, getState) => { }, ], cb); }; - -export const setAccountPassword = (data) => { - return { - type: ACCOUNT_PASSWORD_SET, - data, - }; -}; - -export const setAccountPasswordVisible = (data) => { - return { - type: ACCOUNT_PASSWORD_VISIBLE_SET, - data, - }; -}; diff --git a/src/actions/authentication.js b/src/actions/authentication.js deleted file mode 100644 index 8a20d7b9..00000000 --- a/src/actions/authentication.js +++ /dev/null @@ -1,105 +0,0 @@ -import { - AUTHENTICATION_INFO_CLEAR, - AUTHENTICATION_INFO_SET, - AUTHENTICATION_PASSWORD_SET, - AUTHENTICATION_PASSWORD_VISIBLE_SET, - AUTHENTICATION_POST_ERROR, - AUTHENTICATION_POST_IN_PROGRESS, - AUTHENTICATION_POST_SUBMIT, - AUTHENTICATION_POST_SUCCESS, - authenticationPostURL, -} from '../constants/authentication'; -import { emptyFunc } from '../constants/common'; -import Async from 'async'; -import Axios from 'axios'; - -export const setAuthenticationPassword = (data) => { - return { - type: AUTHENTICATION_PASSWORD_SET, - data, - }; -}; - -export const setAuthenticationPasswordVisible = (data) => { - return { - type: AUTHENTICATION_PASSWORD_VISIBLE_SET, - data, - }; -}; - -export const postAuthenticationInProgress = (data) => { - return { - type: AUTHENTICATION_POST_IN_PROGRESS, - data, - }; -}; - -export const postAuthenticationSuccess = (data) => { - return { - type: AUTHENTICATION_POST_SUCCESS, - data, - }; -}; - -export const postAuthenticationError = (data) => { - return { - type: AUTHENTICATION_POST_ERROR, - data, - }; -}; - -export const postAuthentication = (history, cb = emptyFunc) => (dispatch, getState) => { - Async.waterfall([ - (next) => { - dispatch(postAuthenticationInProgress()); - next(null); - }, (next) => { - const { authentication: { password } } = getState(); - - const url = authenticationPostURL(); - Axios.post(url, { - password: password.value.trim(), - }) - .then((res) => { - try { - next(null, res?.data?.result); - } catch (e) { - console.error(e); - } - }) - .catch((error) => { - console.error(error); - - dispatch(postAuthenticationError(error?.response?.data?.error || error)); - next(error); - }); - }, (result, next) => { - dispatch(postAuthenticationSuccess(result)); - next(null); - }, (next) => { - history.push('/dashboard/wallet'); - next(null); - }, - ], cb); -}; - -export const setAuthenticationInfo = (data) => { - return { - type: AUTHENTICATION_INFO_SET, - data, - }; -}; - -export const clearAuthenticationInfo = (data) => { - return { - type: AUTHENTICATION_INFO_CLEAR, - data, - }; -}; - -export const submitAuthenticationPost = (data) => { - return { - type: AUTHENTICATION_POST_SUBMIT, - data, - }; -}; diff --git a/src/actions/configuration.js b/src/actions/configuration.js index 5928c54f..073fbddb 100644 --- a/src/actions/configuration.js +++ b/src/actions/configuration.js @@ -1,20 +1,16 @@ import { CONFIGURATION_CHAIN_BROADCAST_MODE_SET, - CONFIGURATION_CHAIN_FEES_SET, CONFIGURATION_CHAIN_GAS_ADJUSTMENT_SET, CONFIGURATION_CHAIN_GAS_PRICES_SET, CONFIGURATION_CHAIN_GAS_SET, CONFIGURATION_CHAIN_ID_SET, CONFIGURATION_CHAIN_RPC_ADDRESS_SET, CONFIGURATION_CHAIN_SIMULATE_AND_EXECUTE_SET, - CONFIGURATION_CHAIN_TRUST_NODE_SET, CONFIGURATION_GET_ERROR, CONFIGURATION_GET_IN_PROGRESS, CONFIGURATION_GET_SUCCESS, CONFIGURATION_MODAL_HIDE, CONFIGURATION_MODAL_SHOW, - CONFIGURATION_PASSWORD_SET, - CONFIGURATION_PASSWORD_VISIBLE_SET, CONFIGURATION_PUT_ERROR, CONFIGURATION_PUT_IN_PROGRESS, CONFIGURATION_PUT_SUCCESS, @@ -24,7 +20,7 @@ import { } from '../constants/configuration'; import { emptyFunc } from '../constants/common'; import Async from 'async'; -import Axios from '../services/axios'; +import Axios from 'axios'; export const setConfigurationSetup = (data) => { return { @@ -40,13 +36,6 @@ export const setConfigurationChainBroadcastMode = (data) => { }; }; -export const setConfigurationChainFees = (data) => { - return { - type: CONFIGURATION_CHAIN_FEES_SET, - data, - }; -}; - export const setConfigurationChainGasAdjustment = (data) => { return { type: CONFIGURATION_CHAIN_GAS_ADJUSTMENT_SET, @@ -89,27 +78,6 @@ export const setConfigurationChainSimulateAndExecute = (data) => { }; }; -export const setConfigurationChainTrustNode = (data) => { - return { - type: CONFIGURATION_CHAIN_TRUST_NODE_SET, - data, - }; -}; - -export const setConfigurationPassword = (data) => { - return { - type: CONFIGURATION_PASSWORD_SET, - data, - }; -}; - -export const setConfigurationPasswordVisible = (data) => { - return { - type: CONFIGURATION_PASSWORD_VISIBLE_SET, - data, - }; -}; - export const getConfigurationInProgress = (data) => { return { type: CONFIGURATION_GET_IN_PROGRESS, @@ -202,33 +170,27 @@ export const putConfiguration = (from, cb = emptyFunc) => (dispatch, getState) = configuration: { chain: { broadcastMode, - fees, gasAdjustment, gasPrices, gas, id, RPCAddress, simulateAndExecute, - trustNode, }, - password, }, } = getState(); const url = configurationPutURL(); Axios.put(url, { from: from || name, - password: password.value.trim() || '', chain: { broadcast_mode: broadcastMode.value.trim(), - fees: fees.value.trim(), gas_adjustment: gasAdjustment.value, gas_prices: gasPrices.value.trim(), gas: gas.value, id: id.value.trim(), rpc_address: RPCAddress.value.trim(), simulate_and_execute: simulateAndExecute.value, - trust_node: trustNode.value, }, setup: false, }) diff --git a/src/actions/delegations.js b/src/actions/delegations.js index 8bdcd802..7b60de04 100644 --- a/src/actions/delegations.js +++ b/src/actions/delegations.js @@ -6,7 +6,7 @@ import { } from '../constants/delegations'; import { emptyFunc } from '../constants/common'; import Async from 'async'; -import Axios from '../services/axios'; +import Axios from 'axios'; import Lodash from 'lodash'; export const getDelegationsInProgress = (data) => { diff --git a/src/actions/keys.js b/src/actions/keys.js index 2c6ee004..84d53c9f 100644 --- a/src/actions/keys.js +++ b/src/actions/keys.js @@ -1,11 +1,12 @@ import { + KEY_MNEMONIC_SAVED_SET, + KEY_MNEMONIC_SET, + KEY_NAME_SET, KEYS_CREATE_MODAL_HIDE, KEYS_CREATE_MODAL_SHOW, KEYS_DELETE_ERROR, KEYS_DELETE_IN_PROGRESS, KEYS_DELETE_NAME_SET, - KEYS_DELETE_PASSWORD_SET, - KEYS_DELETE_PASSWORD_VISIBLE_SET, KEYS_DELETE_SUCCESS, KEYS_GET_ERROR, KEYS_GET_IN_PROGRESS, @@ -15,21 +16,16 @@ import { KEYS_LIST_MODAL_HIDE, KEYS_LIST_MODAL_SHOW, KEYS_NAME_SET, - KEYS_PASSWORD_VISIBLE_SET, KEYS_POST_ERROR, KEYS_POST_IN_PROGRESS, KEYS_POST_SUCCESS, - KEY_MNEMONIC_SAVED_SET, - KEY_MNEMONIC_SET, - KEY_NAME_SET, - KEY_PASSWORD_SET, keysDeleteURL, keysGetURL, keysPostURL, } from '../constants/keys'; import { emptyFunc } from '../constants/common'; import Async from 'async'; -import Axios from '../services/axios'; +import Axios from 'axios'; export const getKeysInProgress = (data) => { return { @@ -96,20 +92,6 @@ export const setKeyName = (data) => { }; }; -export const setKeyPassword = (data) => { - return { - type: KEY_PASSWORD_SET, - data, - }; -}; - -export const setKeyPasswordVisible = (data) => { - return { - type: KEYS_PASSWORD_VISIBLE_SET, - data, - }; -}; - export const setKeyMnemonic = (data) => { return { type: KEY_MNEMONIC_SET, @@ -156,7 +138,6 @@ export const postKeys = (history, cb = emptyFunc) => (dispatch, getState) => { post: { mnemonic, name, - password, }, }, } = getState(); @@ -165,7 +146,6 @@ export const postKeys = (history, cb = emptyFunc) => (dispatch, getState) => { Axios.post(url, { mnemonic: mnemonic.value.trim(), name: name.value.trim(), - password: password.value.trim(), }).then((res) => { try { next(null, res?.data?.result); @@ -222,20 +202,6 @@ export const hideKeysCreateModal = (data) => { }; }; -export const setKeysDeletePassword = (data) => { - return { - type: KEYS_DELETE_PASSWORD_SET, - data, - }; -}; - -export const setKeysDeletePasswordVisible = (data) => { - return { - type: KEYS_DELETE_PASSWORD_VISIBLE_SET, - data, - }; -}; - export const setKeysDeleteNameSet = (data) => { return { type: KEYS_DELETE_NAME_SET, @@ -295,15 +261,12 @@ export const deleteKeys = (cb = emptyFunc) => (dispatch, getState) => { keys: { delete: { name, - password, }, }, } = getState(); const url = keysDeleteURL(name); - Axios.post(url, { - password: password.value.trim(), - }).then((res) => { + Axios.post(url, {}).then((res) => { try { next(null, res?.data?.result); } catch (e) { diff --git a/src/actions/proposals.js b/src/actions/proposals.js index 9a755bde..bc9525fe 100644 --- a/src/actions/proposals.js +++ b/src/actions/proposals.js @@ -6,7 +6,7 @@ import { } from '../constants/proposals'; import { emptyFunc } from '../constants/common'; import Async from 'async'; -import Axios from '../services/axios'; +import Axios from 'axios'; export const getProposalsInProgress = (data) => { return { diff --git a/src/actions/transactions/delegate.js b/src/actions/transactions/delegate.js index f956ea91..d31c8769 100644 --- a/src/actions/transactions/delegate.js +++ b/src/actions/transactions/delegate.js @@ -11,7 +11,7 @@ import { txDelegateURL, } from '../../constants/transactions'; import Async from 'async'; -import Axios from '../../services/axios'; +import Axios from 'axios'; import Lodash from 'lodash'; export const setTxDelegateTo = (data) => { @@ -63,7 +63,6 @@ export const txDelegate = (cb = emptyFunc) => (dispatch, getState) => { next(null); }, (next) => { const { - account: { password }, keys: { items, name, @@ -86,7 +85,6 @@ export const txDelegate = (cb = emptyFunc) => (dispatch, getState) => { value: amount.value * Math.pow(10, COIN_DECIMALS), }, memo: memo.value.trim(), - password: password.value.trim(), }) .then((res) => { try { diff --git a/src/actions/transactions/redelegate.js b/src/actions/transactions/redelegate.js index 7431a314..d234286e 100644 --- a/src/actions/transactions/redelegate.js +++ b/src/actions/transactions/redelegate.js @@ -11,9 +11,8 @@ import { TX_REDELEGATE_TO_SET, txRedelegateURL, } from '../../constants/transactions'; -import { decodeFromBech32 } from '../../utils/bech32'; import Async from 'async'; -import Axios from '../../services/axios'; +import Axios from 'axios'; import Lodash from 'lodash'; export const setTxRedelegateFrom = (data) => { @@ -72,7 +71,6 @@ export const txRedelegate = (cb = emptyFunc) => (dispatch, getState) => { next(null); }, (next) => { const { - account: { password }, keys: { items, name, @@ -91,13 +89,12 @@ export const txRedelegate = (cb = emptyFunc) => (dispatch, getState) => { const url = txRedelegateURL(item.address); Axios.post(url, { from: from.value.trim(), - to: decodeFromBech32(to.value.trim()), + to: to.value.trim(), amount: { denom: COIN_DENOM, value: amount.value * Math.pow(10, COIN_DECIMALS), }, memo: memo.value.trim(), - password: password.value.trim(), }) .then((res) => { try { diff --git a/src/actions/transactions/send.js b/src/actions/transactions/send.js index cda09817..d3bc1f8f 100644 --- a/src/actions/transactions/send.js +++ b/src/actions/transactions/send.js @@ -10,9 +10,8 @@ import { TX_SEND_TO_SET, txSendURL, } from '../../constants/transactions'; -import { decodeFromBech32 } from '../../utils/bech32'; import Async from 'async'; -import Axios from '../../services/axios'; +import Axios from 'axios'; export const setTxSendTo = (data) => { return { @@ -70,18 +69,16 @@ export const txSend = (cb = emptyFunc) => (dispatch, getState) => { memo, }, }, - account: { password }, } = getState(); const url = txSendURL(); Axios.post(url, { - to: decodeFromBech32(to.value.trim()), + to: to.value.trim(), amount: [{ denom: COIN_DENOM, value: amount.value * Math.pow(10, COIN_DECIMALS), }], memo: memo.value.trim(), - password: password.value.trim(), }) .then((res) => { try { diff --git a/src/actions/transactions/unbond.js b/src/actions/transactions/unbond.js index 7451e88e..4d0ec20d 100644 --- a/src/actions/transactions/unbond.js +++ b/src/actions/transactions/unbond.js @@ -11,7 +11,7 @@ import { txUnbondURL, } from '../../constants/transactions'; import Async from 'async'; -import Axios from '../../services/axios'; +import Axios from 'axios'; import Lodash from 'lodash'; export const setTxUnbondFrom = (data) => { @@ -63,7 +63,6 @@ export const txUnbond = (cb = emptyFunc) => (dispatch, getState) => { next(null); }, (next) => { const { - account: { password }, keys: { items, name, @@ -86,7 +85,6 @@ export const txUnbond = (cb = emptyFunc) => (dispatch, getState) => { value: amount.value * Math.pow(10, COIN_DECIMALS), }, memo: memo.value.trim(), - password: password.value.trim(), }) .then((res) => { try { diff --git a/src/actions/transactions/vote.js b/src/actions/transactions/vote.js index 51de2319..5641bce5 100644 --- a/src/actions/transactions/vote.js +++ b/src/actions/transactions/vote.js @@ -11,7 +11,7 @@ import { } from '../../constants/transactions'; import { emptyFunc } from '../../constants/common'; import Async from 'async'; -import Axios from '../../services/axios'; +import Axios from 'axios'; export const setTxVoteID = (data) => { return { @@ -62,7 +62,6 @@ export const txVote = (cb = emptyFunc) => (dispatch, getState) => { next(null); }, (next) => { const { - account: { password }, transactions: { vote: { id, @@ -76,7 +75,6 @@ export const txVote = (cb = emptyFunc) => (dispatch, getState) => { Axios.post(url, { option: option.value.trim(), memo: memo.value.trim(), - password: password.value.trim(), }) .then((res) => { try { diff --git a/src/actions/transactions/withdraw.js b/src/actions/transactions/withdraw.js index dd916463..a9ff78c1 100644 --- a/src/actions/transactions/withdraw.js +++ b/src/actions/transactions/withdraw.js @@ -10,7 +10,7 @@ import { } from '../../constants/transactions'; import { emptyFunc } from '../../constants/common'; import Async from 'async'; -import Axios from '../../services/axios'; +import Axios from 'axios'; import Lodash from 'lodash'; export const setTxWithdrawFrom = (data) => { @@ -55,7 +55,6 @@ export const txWithdraw = (cb = emptyFunc) => (dispatch, getState) => { next(null); }, (next) => { const { - account: { password }, keys: { items, name, @@ -75,7 +74,6 @@ export const txWithdraw = (cb = emptyFunc) => (dispatch, getState) => { Axios.post(url, { validators, memo: memo.value.trim(), - password: password.value.trim(), }) .then((res) => { try { diff --git a/src/actions/validators.js b/src/actions/validators.js index dd280952..2af9cfd7 100644 --- a/src/actions/validators.js +++ b/src/actions/validators.js @@ -9,7 +9,7 @@ import { import { emptyFunc } from '../constants/common'; import { isActive } from '../utils/validator'; import Async from 'async'; -import Axios from '../services/axios'; +import Axios from 'axios'; import Lodash from 'lodash'; export const getValidatorsInProgress = (data) => { @@ -39,7 +39,7 @@ export const getValidators = (cb = emptyFunc) => (dispatch, getState) => { dispatch(getValidatorsInProgress(null)); next(null); }, (next) => { - const url = validatorsGetURL(); + const url = `${validatorsGetURL()}?limit=1000`; Axios.get(url) .then((res) => { try { @@ -55,7 +55,7 @@ export const getValidators = (cb = emptyFunc) => (dispatch, getState) => { next(error); }); }, (result, next) => { - result = Lodash.orderBy(result, ['amount.value'], ['desc']); + result = Lodash.orderBy(result, ['tokens'], ['desc']); let activeIndex = 0; let inactiveIndex = 0; diff --git a/src/components/SelectField/index.js b/src/components/SelectField/index.js index b8437112..808eb8ca 100644 --- a/src/components/SelectField/index.js +++ b/src/components/SelectField/index.js @@ -28,7 +28,7 @@ const SelectField = ({ + value={item['operator_address']}> {item.description.moniker} )) diff --git a/src/components/Snackbar/index.js b/src/components/Snackbar/index.js index 15cfd44e..88dc6ef8 100644 --- a/src/components/Snackbar/index.js +++ b/src/components/Snackbar/index.js @@ -1,6 +1,6 @@ import './index.css'; import * as PropTypes from 'prop-types'; -import { Snackbar as MaterialSnackbar, Slide } from '@material-ui/core'; +import { Slide, Snackbar as MaterialSnackbar } from '@material-ui/core'; import React from 'react'; const TransitionUp = (props) => { diff --git a/src/components/Table/Header.js b/src/components/Table/Header.js index f104f859..0ed26a95 100644 --- a/src/components/Table/Header.js +++ b/src/components/Table/Header.js @@ -25,16 +25,16 @@ const Header = ({ { item.key === sort.by ? sort.order === 'asc' - ?
- -
- :
- -
+ ?
+ +
+ :
+ +
: null } diff --git a/src/constants/authentication.js b/src/constants/authentication.js deleted file mode 100644 index 5932c9fe..00000000 --- a/src/constants/authentication.js +++ /dev/null @@ -1,17 +0,0 @@ -import { managerBaseURL } from './common'; - -export const AUTHENTICATION_PASSWORD_SET = 'AUTHENTICATION_PASSWORD_SET'; -export const AUTHENTICATION_PASSWORD_VISIBLE_SET = 'AUTHENTICATION_PASSWORD_VISIBLE_SET'; - -export const AUTHENTICATION_POST_SUBMIT = 'AUTHENTICATION_POST_SUBMIT'; -export const AUTHENTICATION_POST_IN_PROGRESS = 'AUTHENTICATION_POST_IN_PROGRESS'; -export const AUTHENTICATION_POST_SUCCESS = 'AUTHENTICATION_POST_SUCCESS'; -export const AUTHENTICATION_POST_ERROR = 'AUTHENTICATION_POST_ERROR'; - -export const authenticationPostURL = () => { - const baseURL = managerBaseURL(); - return `${baseURL}/login`; -}; - -export const AUTHENTICATION_INFO_SET = 'AUTHENTICATION_INFO_SET'; -export const AUTHENTICATION_INFO_CLEAR = 'AUTHENTICATION_INFO_CLEAR'; diff --git a/src/containers/Authentication/Password.js b/src/containers/Authentication/Password.js deleted file mode 100644 index 337c37cd..00000000 --- a/src/containers/Authentication/Password.js +++ /dev/null @@ -1,67 +0,0 @@ -import * as PropTypes from 'prop-types'; -import { ValidatePassword } from './_validation'; -import { connect } from 'react-redux'; -import { setAuthenticationPassword, submitAuthenticationPost } from '../../actions/authentication'; -import React from 'react'; -import TextInputField from '../../components/TextInputField'; - -const Password = (props) => { - const onChange = ({ target: { value } }) => { - value = value.toString(); - props.onChange({ - value, - error: ValidatePassword(value), - }); - }; - - const onKeyDown = ({ key }) => { - if (props.submit) { - return; - } - if (key === 'Enter') { - props.onKeyDown(); - } - }; - - return ( - - ); -}; - -Password.propTypes = { - input: PropTypes.shape({ - value: PropTypes.string.isRequired, - error: PropTypes.shape({ - message: PropTypes.string.isRequired, - }).isRequired, - visible: PropTypes.bool.isRequired, - }).isRequired, - submit: PropTypes.bool.isRequired, - onChange: PropTypes.func.isRequired, - onKeyDown: PropTypes.func.isRequired, -}; - -const stateToProps = (state) => { - return { - input: state.authentication.password, - submit: state.authentication.submit, - }; -}; - -const actionsToProps = { - onChange: setAuthenticationPassword, - onKeyDown: submitAuthenticationPost, -}; - -export default connect(stateToProps, actionsToProps)(Password); diff --git a/src/containers/Authentication/Submit.js b/src/containers/Authentication/Submit.js deleted file mode 100644 index 688972c0..00000000 --- a/src/containers/Authentication/Submit.js +++ /dev/null @@ -1,65 +0,0 @@ -import * as PropTypes from 'prop-types'; -import { ValidatePassword } from './_validation'; -import { connect } from 'react-redux'; -import { postAuthentication } from '../../actions/authentication'; -import Button from '../../components/Button'; -import React, { useEffect } from 'react'; - -const Submit = (props) => { - const disabled = ( - ValidatePassword(props.password.value).message !== '' - ); - - const onClick = () => { - if (props.inProgress || disabled) { - return; - } - - props.onClick(props.history); - }; - - useEffect(() => { - if (props.submit) { - onClick(); - } - }, [props.submit]); - - return ( -