From 7de4efcbb86350f9902e0870aa334cdb0bd054a4 Mon Sep 17 00:00:00 2001 From: Artur Troian Date: Tue, 12 Mar 2024 15:50:59 -0400 Subject: [PATCH] feat(go/client): integrate cosmos sdk query clients into api (#135) Signed-off-by: Artur Troian --- go/node/client/v1beta2/client.go | 27 + go/node/client/v1beta2/mocks/query_client.go | 588 +++++++++++++++++++ go/node/client/v1beta2/query.go | 119 +++- 3 files changed, 705 insertions(+), 29 deletions(-) diff --git a/go/node/client/v1beta2/client.go b/go/node/client/v1beta2/client.go index 7eb4ee58..c8dad9a4 100644 --- a/go/node/client/v1beta2/client.go +++ b/go/node/client/v1beta2/client.go @@ -5,6 +5,20 @@ import ( "fmt" sdkclient "github.com/cosmos/cosmos-sdk/client" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + disttypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + evdtypes "github.com/cosmos/cosmos-sdk/x/evidence/types" + feegranttypes "github.com/cosmos/cosmos-sdk/x/feegrant" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types/proposal" + slashtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + staketypes "github.com/cosmos/cosmos-sdk/x/staking/types" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + + "github.com/cosmos/cosmos-sdk/x/authz" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/gogo/protobuf/proto" tmrpc "github.com/tendermint/tendermint/rpc/core/types" @@ -24,6 +38,19 @@ type QueryClient interface { ptypes.QueryClient atypes.QueryClient ctypes.QueryClient + Auth() authtypes.QueryClient + Authz() authz.QueryClient + Bank() banktypes.QueryClient + Distribution() disttypes.QueryClient + Evidence() evdtypes.QueryClient + Feegrant() feegranttypes.QueryClient + Gov() govtypes.QueryClient + Mint() minttypes.QueryClient + Params() paramtypes.QueryClient + Slashing() slashtypes.QueryClient + Staking() staketypes.QueryClient + Upgrade() upgradetypes.QueryClient + ClientContext() sdkclient.Context } diff --git a/go/node/client/v1beta2/mocks/query_client.go b/go/node/client/v1beta2/mocks/query_client.go index 527ea87b..2d6f4733 100644 --- a/go/node/client/v1beta2/mocks/query_client.go +++ b/go/node/client/v1beta2/mocks/query_client.go @@ -3,19 +3,43 @@ package mocks import ( + authz "github.com/cosmos/cosmos-sdk/x/authz" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + certv1beta3 "github.com/akash-network/akash-api/go/node/cert/v1beta3" + client "github.com/cosmos/cosmos-sdk/client" context "context" deploymentv1beta3 "github.com/akash-network/akash-api/go/node/deployment/v1beta3" + distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + + evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" + + feegrant "github.com/cosmos/cosmos-sdk/x/feegrant" + + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + grpc "google.golang.org/grpc" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + mock "github.com/stretchr/testify/mock" + proposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" + providerv1beta3 "github.com/akash-network/akash-api/go/node/provider/v1beta3" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + types "github.com/cosmos/cosmos-sdk/x/auth/types" + + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + v1beta3 "github.com/akash-network/akash-api/go/node/audit/v1beta3" v1beta4 "github.com/akash-network/akash-api/go/node/market/v1beta4" @@ -182,6 +206,147 @@ func (_c *QueryClient_AuditorAttributes_Call) RunAndReturn(run func(context.Cont return _c } +// Auth provides a mock function with given fields: +func (_m *QueryClient) Auth() types.QueryClient { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Auth") + } + + var r0 types.QueryClient + if rf, ok := ret.Get(0).(func() types.QueryClient); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(types.QueryClient) + } + } + + return r0 +} + +// QueryClient_Auth_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Auth' +type QueryClient_Auth_Call struct { + *mock.Call +} + +// Auth is a helper method to define mock.On call +func (_e *QueryClient_Expecter) Auth() *QueryClient_Auth_Call { + return &QueryClient_Auth_Call{Call: _e.mock.On("Auth")} +} + +func (_c *QueryClient_Auth_Call) Run(run func()) *QueryClient_Auth_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *QueryClient_Auth_Call) Return(_a0 types.QueryClient) *QueryClient_Auth_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *QueryClient_Auth_Call) RunAndReturn(run func() types.QueryClient) *QueryClient_Auth_Call { + _c.Call.Return(run) + return _c +} + +// Authz provides a mock function with given fields: +func (_m *QueryClient) Authz() authz.QueryClient { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Authz") + } + + var r0 authz.QueryClient + if rf, ok := ret.Get(0).(func() authz.QueryClient); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(authz.QueryClient) + } + } + + return r0 +} + +// QueryClient_Authz_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Authz' +type QueryClient_Authz_Call struct { + *mock.Call +} + +// Authz is a helper method to define mock.On call +func (_e *QueryClient_Expecter) Authz() *QueryClient_Authz_Call { + return &QueryClient_Authz_Call{Call: _e.mock.On("Authz")} +} + +func (_c *QueryClient_Authz_Call) Run(run func()) *QueryClient_Authz_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *QueryClient_Authz_Call) Return(_a0 authz.QueryClient) *QueryClient_Authz_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *QueryClient_Authz_Call) RunAndReturn(run func() authz.QueryClient) *QueryClient_Authz_Call { + _c.Call.Return(run) + return _c +} + +// Bank provides a mock function with given fields: +func (_m *QueryClient) Bank() banktypes.QueryClient { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Bank") + } + + var r0 banktypes.QueryClient + if rf, ok := ret.Get(0).(func() banktypes.QueryClient); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(banktypes.QueryClient) + } + } + + return r0 +} + +// QueryClient_Bank_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Bank' +type QueryClient_Bank_Call struct { + *mock.Call +} + +// Bank is a helper method to define mock.On call +func (_e *QueryClient_Expecter) Bank() *QueryClient_Bank_Call { + return &QueryClient_Bank_Call{Call: _e.mock.On("Bank")} +} + +func (_c *QueryClient_Bank_Call) Run(run func()) *QueryClient_Bank_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *QueryClient_Bank_Call) Return(_a0 banktypes.QueryClient) *QueryClient_Bank_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *QueryClient_Bank_Call) RunAndReturn(run func() banktypes.QueryClient) *QueryClient_Bank_Call { + _c.Call.Return(run) + return _c +} + // Bid provides a mock function with given fields: ctx, in, opts func (_m *QueryClient) Bid(ctx context.Context, in *v1beta4.QueryBidRequest, opts ...grpc.CallOption) (*v1beta4.QueryBidResponse, error) { _va := make([]interface{}, len(opts)) @@ -597,6 +762,194 @@ func (_c *QueryClient_Deployments_Call) RunAndReturn(run func(context.Context, * return _c } +// Distribution provides a mock function with given fields: +func (_m *QueryClient) Distribution() distributiontypes.QueryClient { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Distribution") + } + + var r0 distributiontypes.QueryClient + if rf, ok := ret.Get(0).(func() distributiontypes.QueryClient); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(distributiontypes.QueryClient) + } + } + + return r0 +} + +// QueryClient_Distribution_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Distribution' +type QueryClient_Distribution_Call struct { + *mock.Call +} + +// Distribution is a helper method to define mock.On call +func (_e *QueryClient_Expecter) Distribution() *QueryClient_Distribution_Call { + return &QueryClient_Distribution_Call{Call: _e.mock.On("Distribution")} +} + +func (_c *QueryClient_Distribution_Call) Run(run func()) *QueryClient_Distribution_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *QueryClient_Distribution_Call) Return(_a0 distributiontypes.QueryClient) *QueryClient_Distribution_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *QueryClient_Distribution_Call) RunAndReturn(run func() distributiontypes.QueryClient) *QueryClient_Distribution_Call { + _c.Call.Return(run) + return _c +} + +// Evidence provides a mock function with given fields: +func (_m *QueryClient) Evidence() evidencetypes.QueryClient { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Evidence") + } + + var r0 evidencetypes.QueryClient + if rf, ok := ret.Get(0).(func() evidencetypes.QueryClient); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(evidencetypes.QueryClient) + } + } + + return r0 +} + +// QueryClient_Evidence_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Evidence' +type QueryClient_Evidence_Call struct { + *mock.Call +} + +// Evidence is a helper method to define mock.On call +func (_e *QueryClient_Expecter) Evidence() *QueryClient_Evidence_Call { + return &QueryClient_Evidence_Call{Call: _e.mock.On("Evidence")} +} + +func (_c *QueryClient_Evidence_Call) Run(run func()) *QueryClient_Evidence_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *QueryClient_Evidence_Call) Return(_a0 evidencetypes.QueryClient) *QueryClient_Evidence_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *QueryClient_Evidence_Call) RunAndReturn(run func() evidencetypes.QueryClient) *QueryClient_Evidence_Call { + _c.Call.Return(run) + return _c +} + +// Feegrant provides a mock function with given fields: +func (_m *QueryClient) Feegrant() feegrant.QueryClient { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Feegrant") + } + + var r0 feegrant.QueryClient + if rf, ok := ret.Get(0).(func() feegrant.QueryClient); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(feegrant.QueryClient) + } + } + + return r0 +} + +// QueryClient_Feegrant_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Feegrant' +type QueryClient_Feegrant_Call struct { + *mock.Call +} + +// Feegrant is a helper method to define mock.On call +func (_e *QueryClient_Expecter) Feegrant() *QueryClient_Feegrant_Call { + return &QueryClient_Feegrant_Call{Call: _e.mock.On("Feegrant")} +} + +func (_c *QueryClient_Feegrant_Call) Run(run func()) *QueryClient_Feegrant_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *QueryClient_Feegrant_Call) Return(_a0 feegrant.QueryClient) *QueryClient_Feegrant_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *QueryClient_Feegrant_Call) RunAndReturn(run func() feegrant.QueryClient) *QueryClient_Feegrant_Call { + _c.Call.Return(run) + return _c +} + +// Gov provides a mock function with given fields: +func (_m *QueryClient) Gov() govtypes.QueryClient { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Gov") + } + + var r0 govtypes.QueryClient + if rf, ok := ret.Get(0).(func() govtypes.QueryClient); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(govtypes.QueryClient) + } + } + + return r0 +} + +// QueryClient_Gov_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Gov' +type QueryClient_Gov_Call struct { + *mock.Call +} + +// Gov is a helper method to define mock.On call +func (_e *QueryClient_Expecter) Gov() *QueryClient_Gov_Call { + return &QueryClient_Gov_Call{Call: _e.mock.On("Gov")} +} + +func (_c *QueryClient_Gov_Call) Run(run func()) *QueryClient_Gov_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *QueryClient_Gov_Call) Return(_a0 govtypes.QueryClient) *QueryClient_Gov_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *QueryClient_Gov_Call) RunAndReturn(run func() govtypes.QueryClient) *QueryClient_Gov_Call { + _c.Call.Return(run) + return _c +} + // Group provides a mock function with given fields: ctx, in, opts func (_m *QueryClient) Group(ctx context.Context, in *deploymentv1beta3.QueryGroupRequest, opts ...grpc.CallOption) (*deploymentv1beta3.QueryGroupResponse, error) { _va := make([]interface{}, len(opts)) @@ -819,6 +1172,53 @@ func (_c *QueryClient_Leases_Call) RunAndReturn(run func(context.Context, *v1bet return _c } +// Mint provides a mock function with given fields: +func (_m *QueryClient) Mint() minttypes.QueryClient { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Mint") + } + + var r0 minttypes.QueryClient + if rf, ok := ret.Get(0).(func() minttypes.QueryClient); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(minttypes.QueryClient) + } + } + + return r0 +} + +// QueryClient_Mint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Mint' +type QueryClient_Mint_Call struct { + *mock.Call +} + +// Mint is a helper method to define mock.On call +func (_e *QueryClient_Expecter) Mint() *QueryClient_Mint_Call { + return &QueryClient_Mint_Call{Call: _e.mock.On("Mint")} +} + +func (_c *QueryClient_Mint_Call) Run(run func()) *QueryClient_Mint_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *QueryClient_Mint_Call) Return(_a0 minttypes.QueryClient) *QueryClient_Mint_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *QueryClient_Mint_Call) RunAndReturn(run func() minttypes.QueryClient) *QueryClient_Mint_Call { + _c.Call.Return(run) + return _c +} + // Order provides a mock function with given fields: ctx, in, opts func (_m *QueryClient) Order(ctx context.Context, in *v1beta4.QueryOrderRequest, opts ...grpc.CallOption) (*v1beta4.QueryOrderResponse, error) { _va := make([]interface{}, len(opts)) @@ -967,6 +1367,53 @@ func (_c *QueryClient_Orders_Call) RunAndReturn(run func(context.Context, *v1bet return _c } +// Params provides a mock function with given fields: +func (_m *QueryClient) Params() proposal.QueryClient { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Params") + } + + var r0 proposal.QueryClient + if rf, ok := ret.Get(0).(func() proposal.QueryClient); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(proposal.QueryClient) + } + } + + return r0 +} + +// QueryClient_Params_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Params' +type QueryClient_Params_Call struct { + *mock.Call +} + +// Params is a helper method to define mock.On call +func (_e *QueryClient_Expecter) Params() *QueryClient_Params_Call { + return &QueryClient_Params_Call{Call: _e.mock.On("Params")} +} + +func (_c *QueryClient_Params_Call) Run(run func()) *QueryClient_Params_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *QueryClient_Params_Call) Return(_a0 proposal.QueryClient) *QueryClient_Params_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *QueryClient_Params_Call) RunAndReturn(run func() proposal.QueryClient) *QueryClient_Params_Call { + _c.Call.Return(run) + return _c +} + // Provider provides a mock function with given fields: ctx, in, opts func (_m *QueryClient) Provider(ctx context.Context, in *providerv1beta3.QueryProviderRequest, opts ...grpc.CallOption) (*providerv1beta3.QueryProviderResponse, error) { _va := make([]interface{}, len(opts)) @@ -1263,6 +1710,147 @@ func (_c *QueryClient_Providers_Call) RunAndReturn(run func(context.Context, *pr return _c } +// Slashing provides a mock function with given fields: +func (_m *QueryClient) Slashing() slashingtypes.QueryClient { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Slashing") + } + + var r0 slashingtypes.QueryClient + if rf, ok := ret.Get(0).(func() slashingtypes.QueryClient); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(slashingtypes.QueryClient) + } + } + + return r0 +} + +// QueryClient_Slashing_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Slashing' +type QueryClient_Slashing_Call struct { + *mock.Call +} + +// Slashing is a helper method to define mock.On call +func (_e *QueryClient_Expecter) Slashing() *QueryClient_Slashing_Call { + return &QueryClient_Slashing_Call{Call: _e.mock.On("Slashing")} +} + +func (_c *QueryClient_Slashing_Call) Run(run func()) *QueryClient_Slashing_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *QueryClient_Slashing_Call) Return(_a0 slashingtypes.QueryClient) *QueryClient_Slashing_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *QueryClient_Slashing_Call) RunAndReturn(run func() slashingtypes.QueryClient) *QueryClient_Slashing_Call { + _c.Call.Return(run) + return _c +} + +// Staking provides a mock function with given fields: +func (_m *QueryClient) Staking() stakingtypes.QueryClient { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Staking") + } + + var r0 stakingtypes.QueryClient + if rf, ok := ret.Get(0).(func() stakingtypes.QueryClient); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(stakingtypes.QueryClient) + } + } + + return r0 +} + +// QueryClient_Staking_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Staking' +type QueryClient_Staking_Call struct { + *mock.Call +} + +// Staking is a helper method to define mock.On call +func (_e *QueryClient_Expecter) Staking() *QueryClient_Staking_Call { + return &QueryClient_Staking_Call{Call: _e.mock.On("Staking")} +} + +func (_c *QueryClient_Staking_Call) Run(run func()) *QueryClient_Staking_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *QueryClient_Staking_Call) Return(_a0 stakingtypes.QueryClient) *QueryClient_Staking_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *QueryClient_Staking_Call) RunAndReturn(run func() stakingtypes.QueryClient) *QueryClient_Staking_Call { + _c.Call.Return(run) + return _c +} + +// Upgrade provides a mock function with given fields: +func (_m *QueryClient) Upgrade() upgradetypes.QueryClient { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Upgrade") + } + + var r0 upgradetypes.QueryClient + if rf, ok := ret.Get(0).(func() upgradetypes.QueryClient); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(upgradetypes.QueryClient) + } + } + + return r0 +} + +// QueryClient_Upgrade_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Upgrade' +type QueryClient_Upgrade_Call struct { + *mock.Call +} + +// Upgrade is a helper method to define mock.On call +func (_e *QueryClient_Expecter) Upgrade() *QueryClient_Upgrade_Call { + return &QueryClient_Upgrade_Call{Call: _e.mock.On("Upgrade")} +} + +func (_c *QueryClient_Upgrade_Call) Run(run func()) *QueryClient_Upgrade_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *QueryClient_Upgrade_Call) Return(_a0 upgradetypes.QueryClient) *QueryClient_Upgrade_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *QueryClient_Upgrade_Call) RunAndReturn(run func() upgradetypes.QueryClient) *QueryClient_Upgrade_Call { + _c.Call.Return(run) + return _c +} + // NewQueryClient creates a new instance of QueryClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewQueryClient(t interface { diff --git a/go/node/client/v1beta2/query.go b/go/node/client/v1beta2/query.go index f846cf85..510d2776 100644 --- a/go/node/client/v1beta2/query.go +++ b/go/node/client/v1beta2/query.go @@ -6,6 +6,18 @@ import ( "google.golang.org/grpc" sdkclient "github.com/cosmos/cosmos-sdk/client" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/cosmos/cosmos-sdk/x/authz" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + disttypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + evdtypes "github.com/cosmos/cosmos-sdk/x/evidence/types" + feegranttypes "github.com/cosmos/cosmos-sdk/x/feegrant" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types/proposal" + slashtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + staketypes "github.com/cosmos/cosmos-sdk/x/staking/types" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" atypes "github.com/akash-network/akash-api/go/node/audit/v1beta3" ctypes "github.com/akash-network/akash-api/go/node/cert/v1beta3" @@ -14,12 +26,28 @@ import ( ptypes "github.com/akash-network/akash-api/go/node/provider/v1beta3" ) +type sdkQueryClient struct { + auth authtypes.QueryClient + authz authz.QueryClient + bank banktypes.QueryClient + distr disttypes.QueryClient + evidence evdtypes.QueryClient + feegrant feegranttypes.QueryClient + gov govtypes.QueryClient + mint minttypes.QueryClient + params paramtypes.QueryClient + slashing slashtypes.QueryClient + staking staketypes.QueryClient + upgrade upgradetypes.QueryClient +} + type queryClient struct { dclient dtypes.QueryClient mclient mtypes.QueryClient pclient ptypes.QueryClient aclient atypes.QueryClient cclient ctypes.QueryClient + sdk sdkQueryClient cctx sdkclient.Context } @@ -35,7 +63,21 @@ func newQueryClient(cctx sdkclient.Context) *queryClient { pclient: ptypes.NewQueryClient(cctx), aclient: atypes.NewQueryClient(cctx), cclient: ctypes.NewQueryClient(cctx), - cctx: cctx, + sdk: sdkQueryClient{ + auth: authtypes.NewQueryClient(cctx), + authz: authz.NewQueryClient(cctx), + bank: banktypes.NewQueryClient(cctx), + distr: disttypes.NewQueryClient(cctx), + evidence: evdtypes.NewQueryClient(cctx), + feegrant: feegranttypes.NewQueryClient(cctx), + gov: govtypes.NewQueryClient(cctx), + mint: minttypes.NewQueryClient(cctx), + params: paramtypes.NewQueryClient(cctx), + slashing: slashtypes.NewQueryClient(cctx), + staking: staketypes.NewQueryClient(cctx), + upgrade: upgradetypes.NewQueryClient(cctx), + }, + cctx: cctx, } } @@ -159,31 +201,50 @@ func (c *queryClient) Certificates(ctx context.Context, in *ctypes.QueryCertific return c.cclient.Certificates(ctx, in, opts...) } -// func (c *queryClient) Accounts(ctx context.Context, in *authtypes.QueryAccountsRequest, opts ...grpc.CallOption) (*authtypes.QueryAccountsResponse, error) { -// if c.cclient == nil { -// return &authtypes.QueryAccountsResponse{}, ErrClientNotFound -// } -// -// return c.sdk.auth.Accounts(ctx, in, opts...) -// } -// -// func (c *queryClient) Account(ctx context.Context, in *authtypes.QueryAccountRequest, opts ...grpc.CallOption) (*authtypes.QueryAccountResponse, error) { -// if c.cclient == nil { -// return &authtypes.QueryAccountResponse{}, ErrClientNotFound -// } -// -// return c.sdk.auth.Account(ctx, in, opts...) -// } -// -// func (c *queryClient) Params(ctx context.Context, in *authtypes.QueryParamsRequest, opts ...grpc.CallOption) (*authtypes.QueryParamsResponse, error) { -// if c.cclient == nil { -// return &authtypes.QueryParamsResponse{}, ErrClientNotFound -// } -// -// return c.sdk.auth.Accounts(ctx, in, opts...) -// } -// -// func (c *queryClient) ModuleAccountByName(ctx context.Context, in *authtypes.QueryModuleAccountByNameRequest, opts ...grpc.CallOption) (*authtypes.QueryModuleAccountByNameResponse, error) { -// // TODO implement me -// panic("implement me") -// } +func (c *queryClient) Auth() authtypes.QueryClient { + return c.sdk.auth +} + +func (c *queryClient) Authz() authz.QueryClient { + return c.sdk.authz +} + +func (c *queryClient) Bank() banktypes.QueryClient { + return c.sdk.bank +} + +func (c *queryClient) Distribution() disttypes.QueryClient { + return c.sdk.distr +} + +func (c *queryClient) Evidence() evdtypes.QueryClient { + return c.sdk.evidence +} + +func (c *queryClient) Feegrant() feegranttypes.QueryClient { + return c.sdk.feegrant +} + +func (c *queryClient) Gov() govtypes.QueryClient { + return c.sdk.gov +} + +func (c *queryClient) Mint() minttypes.QueryClient { + return c.sdk.mint +} + +func (c *queryClient) Params() paramtypes.QueryClient { + return c.sdk.params +} + +func (c *queryClient) Slashing() slashtypes.QueryClient { + return c.sdk.slashing +} + +func (c *queryClient) Staking() staketypes.QueryClient { + return c.sdk.staking +} + +func (c *queryClient) Upgrade() upgradetypes.QueryClient { + return c.sdk.upgrade +}