From 883dceb04e7d1492c82df292c6730d31b85c3764 Mon Sep 17 00:00:00 2001 From: godismercilex <98415576+godismercilex@users.noreply.github.com> Date: Mon, 23 May 2022 00:04:33 +0200 Subject: [PATCH] add: lockup query server (#442) * add: finalize lockup module * chore: lint * bring back msg server Co-authored-by: Mat-Cosmos <97468149+matthiasmatt@users.noreply.github.com> Co-authored-by: Walter White <101130700+MatrixHeisenberg@users.noreply.github.com> Co-authored-by: AgentSmithMatrix <98403347+AgentSmithMatrix@users.noreply.github.com> Co-authored-by: Agent Smith --- app/app.go | 4 +- proto/lockup/v1/query.proto | 27 + x/incentivization/keeper/keeper.go | 4 +- x/lockup/abci.go | 4 +- x/lockup/genesis.go | 4 +- x/lockup/keeper/keeper.go | 28 +- x/lockup/keeper/msg_server.go | 61 +- x/lockup/keeper/msg_server_test.go | 221 +++++++ x/lockup/keeper/state.go | 14 +- x/lockup/keeper/state_test.go | 13 +- x/lockup/module.go | 7 +- x/lockup/types/query.pb.go | 978 ++++++++++++++++++++++++++--- x/lockup/types/query.pb.gw.go | 160 +++++ 13 files changed, 1418 insertions(+), 107 deletions(-) create mode 100644 x/lockup/keeper/msg_server_test.go diff --git a/app/app.go b/app/app.go index befdd6dad..911d20884 100644 --- a/app/app.go +++ b/app/app.go @@ -216,7 +216,7 @@ type NibiruApp struct { PerpKeeper perpkeeper.Keeper PriceKeeper pricekeeper.Keeper EpochsKeeper epochskeeper.Keeper - LockupKeeper lockupkeeper.LockupKeeper + LockupKeeper lockupkeeper.Keeper IncentivizationKeeper incentivizationkeeper.Keeper VpoolKeeper vpoolkeeper.Keeper @@ -410,7 +410,7 @@ func NewNibiruApp( appCodec, app.StablecoinKeeper, app.AccountKeeper, app.BankKeeper, app.PriceKeeper, ) - lockupModule := lockup.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper) + lockupModule := lockup.NewAppModule(appCodec, app.LockupKeeper, app.AccountKeeper, app.BankKeeper) perpModule := perp.NewAppModule( appCodec, app.PerpKeeper, app.AccountKeeper, app.BankKeeper, app.PriceKeeper, diff --git a/proto/lockup/v1/query.proto b/proto/lockup/v1/query.proto index 41846963b..18fe4ef29 100644 --- a/proto/lockup/v1/query.proto +++ b/proto/lockup/v1/query.proto @@ -4,6 +4,9 @@ package nibiru.lockup.v1; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; + +import "lockup/v1/lock.proto"; option go_package = "github.com/NibiruChain/nibiru/x/lockup/types"; @@ -12,6 +15,13 @@ service Query { option (google.api.http).get = "/nibiru/lockup/locked_coins"; } + rpc Lock(QueryLockRequest) returns (QueryLockResponse) { + option (google.api.http).get = "/nibiru/lockup/lock"; + } + + rpc LocksByAddress(QueryLocksByAddress) returns (QueryLocksByAddressResponse) { + option (google.api.http).get = "/nibiru/lockup/locks_by_address"; + }; } message QueryLockedCoinsRequest { @@ -23,4 +33,21 @@ message QueryLockedCoinsResponse { (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; +} + +message QueryLockRequest { + uint64 id = 1; +} + +message QueryLockResponse { + nibiru.lockup.v1.Lock lock = 1; +} + +message QueryLocksByAddress { + string address = 1; + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +message QueryLocksByAddressResponse { + repeated nibiru.lockup.v1.Lock locks = 1; } \ No newline at end of file diff --git a/x/incentivization/keeper/keeper.go b/x/incentivization/keeper/keeper.go index 0b2b6b5b3..34a279c28 100644 --- a/x/incentivization/keeper/keeper.go +++ b/x/incentivization/keeper/keeper.go @@ -31,7 +31,7 @@ const ( FundsModuleAccountAddressPrefix = "incentivization_escrow_" ) -func NewKeeper(cdc codec.Codec, storeKey sdk.StoreKey, ak authkeeper.AccountKeeper, bk bankkeeper.Keeper, dk dexkeeper.Keeper, lk lockupkeeper.LockupKeeper) Keeper { +func NewKeeper(cdc codec.Codec, storeKey sdk.StoreKey, ak authkeeper.AccountKeeper, bk bankkeeper.Keeper, dk dexkeeper.Keeper, lk lockupkeeper.Keeper) Keeper { return Keeper{ cdc: cdc, storeKey: storeKey, @@ -49,7 +49,7 @@ type Keeper struct { ak authkeeper.AccountKeeper bk bankkeeper.Keeper dk dexkeeper.Keeper - lk lockupkeeper.LockupKeeper + lk lockupkeeper.Keeper } func (k Keeper) CreateIncentivizationProgram( diff --git a/x/lockup/abci.go b/x/lockup/abci.go index 776234830..ac23f5ce9 100644 --- a/x/lockup/abci.go +++ b/x/lockup/abci.go @@ -9,10 +9,10 @@ import ( ) // BeginBlocker is called on every block. -func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.LockupKeeper) { +func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper) { } // Called every block to automatically unlock matured locks. -func EndBlocker(ctx sdk.Context, k keeper.LockupKeeper) []abci.ValidatorUpdate { +func EndBlocker(ctx sdk.Context, k keeper.Keeper) []abci.ValidatorUpdate { return []abci.ValidatorUpdate{} } diff --git a/x/lockup/genesis.go b/x/lockup/genesis.go index 3b6b1c28b..9320d72db 100644 --- a/x/lockup/genesis.go +++ b/x/lockup/genesis.go @@ -9,11 +9,11 @@ import ( // InitGenesis initializes the capability module's state from a provided genesis // state. -func InitGenesis(ctx sdk.Context, k keeper.LockupKeeper, genState types.GenesisState) { +func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { } // ExportGenesis returns the capability module's exported genesis. -func ExportGenesis(ctx sdk.Context, k keeper.LockupKeeper) *types.GenesisState { +func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { return &types.GenesisState{} } diff --git a/x/lockup/keeper/keeper.go b/x/lockup/keeper/keeper.go index 7a3bba8d2..f87db2840 100644 --- a/x/lockup/keeper/keeper.go +++ b/x/lockup/keeper/keeper.go @@ -22,8 +22,8 @@ var ( MaxTime = time.Unix(253402297199, 0).UTC() ) -// LockupKeeper provides a way to manage module storage. -type LockupKeeper struct { +// Keeper provides a way to manage module storage. +type Keeper struct { cdc codec.Codec storeKey sdk.StoreKey @@ -34,8 +34,8 @@ type LockupKeeper struct { // NewLockupKeeper returns an instance of Keeper. func NewLockupKeeper(cdc codec.Codec, storeKey sdk.StoreKey, ak types.AccountKeeper, - bk types.BankKeeper, dk types.DistrKeeper) LockupKeeper { - return LockupKeeper{ + bk types.BankKeeper, dk types.DistrKeeper) Keeper { + return Keeper{ cdc: cdc, storeKey: storeKey, ak: ak, @@ -45,12 +45,12 @@ func NewLockupKeeper(cdc codec.Codec, storeKey sdk.StoreKey, ak types.AccountKee } // Logger returns a logger instance. -func (k LockupKeeper) Logger(ctx sdk.Context) log.Logger { +func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } // LockTokens lock tokens from an account for specified duration. -func (k LockupKeeper) LockTokens(ctx sdk.Context, owner sdk.AccAddress, +func (k Keeper) LockTokens(ctx sdk.Context, owner sdk.AccAddress, coins sdk.Coins, duration time.Duration) (*types.Lock, error) { // create new lock object lock := &types.Lock{ @@ -71,7 +71,7 @@ func (k LockupKeeper) LockTokens(ctx sdk.Context, owner sdk.AccAddress, // UnlockTokens returns tokens back from the module account address to the lock owner. // The ID associated with the lock must exist, and the current block time must be after lock end time. -func (k LockupKeeper) UnlockTokens(ctx sdk.Context, lockID uint64) (unlockedTokens sdk.Coins, err error) { +func (k Keeper) UnlockTokens(ctx sdk.Context, lockID uint64) (unlockedTokens sdk.Coins, err error) { lock, err := k.LocksState(ctx).Get(lockID) if err != nil { return nil, err @@ -101,7 +101,7 @@ func (k LockupKeeper) UnlockTokens(ctx sdk.Context, lockID uint64) (unlockedToke } // InitiateUnlocking starts the unlocking process of a lockup. -func (k LockupKeeper) InitiateUnlocking(ctx sdk.Context, lockID uint64) (updatedLock *types.Lock, err error) { +func (k Keeper) InitiateUnlocking(ctx sdk.Context, lockID uint64) (updatedLock *types.Lock, err error) { // we get the lockup lock, err := k.LocksState(ctx).Get(lockID) if err != nil { @@ -125,7 +125,7 @@ func (k LockupKeeper) InitiateUnlocking(ctx sdk.Context, lockID uint64) (updated } // UnlockAvailableCoins unlocks all the available coins for the provided account sdk.AccAddress. -func (k LockupKeeper) UnlockAvailableCoins(ctx sdk.Context, account sdk.AccAddress) (coins sdk.Coins, err error) { +func (k Keeper) UnlockAvailableCoins(ctx sdk.Context, account sdk.AccAddress) (coins sdk.Coins, err error) { ids := k.LocksState(ctx).UnlockedIDsByAddress(account) coins = sdk.NewCoins() @@ -142,30 +142,30 @@ func (k LockupKeeper) UnlockAvailableCoins(ctx sdk.Context, account sdk.AccAddre } // AccountLockedCoins returns the locked coins of the given sdk.AccAddress -func (k LockupKeeper) AccountLockedCoins(ctx sdk.Context, account sdk.AccAddress) (coins sdk.Coins, err error) { +func (k Keeper) AccountLockedCoins(ctx sdk.Context, account sdk.AccAddress) (coins sdk.Coins, err error) { return k.LocksState(ctx).IterateLockedCoins(account), nil } // AccountUnlockedCoins returns the unlocked coins of the given sdk.AccAddress -func (k LockupKeeper) AccountUnlockedCoins(ctx sdk.Context, account sdk.AccAddress) (coins sdk.Coins, err error) { +func (k Keeper) AccountUnlockedCoins(ctx sdk.Context, account sdk.AccAddress) (coins sdk.Coins, err error) { return k.LocksState(ctx).IterateUnlockedCoins(account), nil } // TotalLockedCoins returns the module account locked coins. -func (k LockupKeeper) TotalLockedCoins(ctx sdk.Context) (coins sdk.Coins, err error) { +func (k Keeper) TotalLockedCoins(ctx sdk.Context) (coins sdk.Coins, err error) { return k.LocksState(ctx).IterateTotalLockedCoins(), nil } // LocksByDenom allows to iterate over types.Lock associated with a denom. // CONTRACT: no writes on store can happen until the function exits. -func (k LockupKeeper) LocksByDenom(ctx sdk.Context, do func(lock *types.Lock) (stop bool)) (coins sdk.Coins, err error) { +func (k Keeper) LocksByDenom(ctx sdk.Context, do func(lock *types.Lock) (stop bool)) (coins sdk.Coins, err error) { panic("impl") } // LocksByDenomUnlockingAfter allows to iterate over types.Lock associated with a denom that unlock // after the provided duration. // CONTRACT: no writes on store can happen until the function exits. -func (k LockupKeeper) LocksByDenomUnlockingAfter(ctx sdk.Context, denom string, duration time.Duration, do func(lock *types.Lock) (stop bool)) { +func (k Keeper) LocksByDenomUnlockingAfter(ctx sdk.Context, denom string, duration time.Duration, do func(lock *types.Lock) (stop bool)) { endTime := ctx.BlockTime().Add(duration) state := k.LocksState(ctx) state.IterateCoinsByDenomUnlockingAfter(denom, endTime, func(id uint64) (stop bool) { diff --git a/x/lockup/keeper/msg_server.go b/x/lockup/keeper/msg_server.go index 2efca61cd..c05d79c09 100644 --- a/x/lockup/keeper/msg_server.go +++ b/x/lockup/keeper/msg_server.go @@ -8,17 +8,17 @@ import ( "github.com/NibiruChain/nibiru/x/lockup/types" ) -type msgServer struct { - keeper *LockupKeeper -} - // NewMsgServerImpl returns an instance of MsgServer. -func NewMsgServerImpl(keeper *LockupKeeper) types.MsgServer { +func NewMsgServerImpl(keeper Keeper) types.MsgServer { return &msgServer{ keeper: keeper, } } +type msgServer struct { + keeper Keeper +} + var _ types.MsgServer = msgServer{} func (server msgServer) LockTokens(goCtx context.Context, msg *types.MsgLockTokens) (*types.MsgLockTokensResponse, error) { @@ -43,3 +43,54 @@ func (server msgServer) InitiateUnlock(ctx context.Context, unlock *types.MsgIni _, err := server.keeper.UnlockTokens(sdkCtx, unlock.LockId) return &types.MsgInitiateUnlockResponse{}, err } + +func NewQueryServerImpl(k Keeper) types.QueryServer { + return queryServer{k: k} +} + +type queryServer struct { + k Keeper +} + +func (q queryServer) LocksByAddress(ctx context.Context, address *types.QueryLocksByAddress) (*types.QueryLocksByAddressResponse, error) { + // TODO(mercilex): make efficient with pagination + sdkCtx := sdk.UnwrapSDKContext(ctx) + addr, err := sdk.AccAddressFromBech32(address.Address) + if err != nil { + return nil, err + } + + var locks []*types.Lock + state := q.k.LocksState(sdkCtx) + state.IterateLocksByAddress(addr, func(id uint64) (stop bool) { + lock, err := state.Get(id) + if err != nil { + panic(err) + } + locks = append(locks, lock) + return false + }) + + return &types.QueryLocksByAddressResponse{Locks: locks}, nil +} + +func (q queryServer) LockedCoins(ctx context.Context, request *types.QueryLockedCoinsRequest) (*types.QueryLockedCoinsResponse, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + addr, err := sdk.AccAddressFromBech32(request.Address) + if err != nil { + return nil, err + } + coins := q.k.LocksState(sdkCtx).IterateLockedCoins(addr) + return &types.QueryLockedCoinsResponse{LockedCoins: coins}, nil +} + +func (q queryServer) Lock(ctx context.Context, request *types.QueryLockRequest) (*types.QueryLockResponse, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + + lock, err := q.k.LocksState(sdkCtx).Get(request.Id) + if err != nil { + return nil, err + } + + return &types.QueryLockResponse{Lock: lock}, nil +} diff --git a/x/lockup/keeper/msg_server_test.go b/x/lockup/keeper/msg_server_test.go new file mode 100644 index 000000000..fa3d06ad4 --- /dev/null +++ b/x/lockup/keeper/msg_server_test.go @@ -0,0 +1,221 @@ +package keeper + +import ( + "context" + "reflect" + "testing" + + "github.com/NibiruChain/nibiru/x/lockup/types" +) + +// TODO(mercilex): test + +func TestNewMsgServerImpl(t *testing.T) { + type args struct { + keeper Keeper + } + tests := []struct { + name string + args args + want types.MsgServer + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := NewMsgServerImpl(tt.args.keeper); !reflect.DeepEqual(got, tt.want) { + t.Errorf("NewMsgServerImpl() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestNewQueryServerImpl(t *testing.T) { + type args struct { + k Keeper + } + tests := []struct { + name string + args args + want types.QueryServer + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := NewQueryServerImpl(tt.args.k); !reflect.DeepEqual(got, tt.want) { + t.Errorf("NewQueryServerImpl() = %v, want %v", got, tt.want) + } + }) + } +} + +func Test_msgServer_InitiateUnlock(t *testing.T) { + type fields struct { + keeper Keeper + } + type args struct { + ctx context.Context + unlock *types.MsgInitiateUnlock + } + tests := []struct { + name string + fields fields + args args + want *types.MsgInitiateUnlockResponse + wantErr bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + server := msgServer{ + keeper: tt.fields.keeper, + } + got, err := server.InitiateUnlock(tt.args.ctx, tt.args.unlock) + if (err != nil) != tt.wantErr { + t.Errorf("InitiateUnlock() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("InitiateUnlock() got = %v, want %v", got, tt.want) + } + }) + } +} + +func Test_msgServer_LockTokens(t *testing.T) { + type fields struct { + keeper Keeper + } + type args struct { + goCtx context.Context + msg *types.MsgLockTokens + } + tests := []struct { + name string + fields fields + args args + want *types.MsgLockTokensResponse + wantErr bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + server := msgServer{ + keeper: tt.fields.keeper, + } + got, err := server.LockTokens(tt.args.goCtx, tt.args.msg) + if (err != nil) != tt.wantErr { + t.Errorf("LockTokens() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("LockTokens() got = %v, want %v", got, tt.want) + } + }) + } +} + +func Test_queryServer_Lock(t *testing.T) { + type fields struct { + k Keeper + } + type args struct { + ctx context.Context + request *types.QueryLockRequest + } + tests := []struct { + name string + fields fields + args args + want *types.QueryLockResponse + wantErr bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + q := queryServer{ + k: tt.fields.k, + } + got, err := q.Lock(tt.args.ctx, tt.args.request) + if (err != nil) != tt.wantErr { + t.Errorf("Lock() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("Lock() got = %v, want %v", got, tt.want) + } + }) + } +} + +func Test_queryServer_LockedCoins(t *testing.T) { + type fields struct { + k Keeper + } + type args struct { + ctx context.Context + request *types.QueryLockedCoinsRequest + } + tests := []struct { + name string + fields fields + args args + want *types.QueryLockedCoinsResponse + wantErr bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + q := queryServer{ + k: tt.fields.k, + } + got, err := q.LockedCoins(tt.args.ctx, tt.args.request) + if (err != nil) != tt.wantErr { + t.Errorf("LockedCoins() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("LockedCoins() got = %v, want %v", got, tt.want) + } + }) + } +} + +func Test_queryServer_LocksByAddress(t *testing.T) { + type fields struct { + k Keeper + } + type args struct { + ctx context.Context + address *types.QueryLocksByAddress + } + tests := []struct { + name string + fields fields + args args + want *types.QueryLocksByAddressResponse + wantErr bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + q := queryServer{ + k: tt.fields.k, + } + got, err := q.LocksByAddress(tt.args.ctx, tt.args.address) + if (err != nil) != tt.wantErr { + t.Errorf("LocksByAddress() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("LocksByAddress() got = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/x/lockup/keeper/state.go b/x/lockup/keeper/state.go index 7b049d6f9..d79ed78e1 100644 --- a/x/lockup/keeper/state.go +++ b/x/lockup/keeper/state.go @@ -29,7 +29,7 @@ const ( LockStartID uint64 = 0 ) -func (k LockupKeeper) LocksState(ctx sdk.Context) LockState { +func (k Keeper) LocksState(ctx sdk.Context) LockState { return newLockState(ctx, k.storeKey, k.cdc) } @@ -247,6 +247,18 @@ func (s LockState) IterateCoinsByDenomUnlockingBefore(denom string, unlockingBef } } +func (s LockState) IterateLocksByAddress(addr sdk.AccAddress, do func(id uint64) (stop bool)) { + key := s.keyAddr(addr.String(), nil) + iter := prefix.NewStore(s.addrIndex, key).Iterator(nil, nil) + defer iter.Close() + + for ; iter.Valid(); iter.Next() { + if !do(sdk.BigEndianToUint64(iter.Key())) { + break + } + } +} + func (s LockState) nextPrimaryKey() uint64 { idBytes := s.id.Get(lockIDKey) var id uint64 diff --git a/x/lockup/keeper/state_test.go b/x/lockup/keeper/state_test.go index 732a2e434..45d30d56b 100644 --- a/x/lockup/keeper/state_test.go +++ b/x/lockup/keeper/state_test.go @@ -17,9 +17,10 @@ import ( func TestLockState(t *testing.T) { app, ctx := testutil.NewNibiruApp(true) + addr := sample.AccAddress() lock := &types.Lock{ LockId: 0, - Owner: sample.AccAddress().String(), + Owner: addr.String(), Duration: 1000 * time.Second, EndTime: ctx.BlockTime(), Coins: sdk.NewCoins(sdk.NewCoin("test", sdk.NewInt(1000))), @@ -31,6 +32,16 @@ func TestLockState(t *testing.T) { getLock, err := app.LockupKeeper.LocksState(ctx).Get(keeper.LockStartID) // we're getting the first starting require.NoError(t, err) require.Equal(t, lock, getLock) + // test get by addr + var found = 0 + app.LockupKeeper.LocksState(ctx).IterateLocksByAddress(addr, func(id uint64) (stop bool) { + iterLock, err := app.LockupKeeper.LocksState(ctx).Get(id) + require.NoError(t, err) + require.Equal(t, lock, iterLock) + found++ + return false + }) + require.Equal(t, found, 1) // test delete err = app.LockupKeeper.LocksState(ctx).Delete(getLock) require.NoError(t, err) diff --git a/x/lockup/module.go b/x/lockup/module.go index 4de8a5892..9e642d34d 100644 --- a/x/lockup/module.go +++ b/x/lockup/module.go @@ -13,13 +13,14 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/cosmos/cosmos-sdk/x/gov/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" + "github.com/NibiruChain/nibiru/x/lockup/keeper" + "github.com/NibiruChain/nibiru/x/lockup/types" ) @@ -143,8 +144,8 @@ func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sd // RegisterServices registers module services. func (am AppModule) RegisterServices(cfg module.Configurator) { - // types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(&am.keeper)) - // types.RegisterQueryServer(cfg.QueryServer(), keeper.NewQuerier(am.keeper)) + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) + types.RegisterQueryServer(cfg.QueryServer(), keeper.NewQueryServerImpl(am.keeper)) } // RegisterInvariants registers the capability module's invariants. diff --git a/x/lockup/types/query.pb.go b/x/lockup/types/query.pb.go index bd64ee20e..7f7242dd9 100644 --- a/x/lockup/types/query.pb.go +++ b/x/lockup/types/query.pb.go @@ -8,6 +8,7 @@ import ( fmt "fmt" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" + query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" @@ -119,38 +120,237 @@ func (m *QueryLockedCoinsResponse) GetLockedCoins() github_com_cosmos_cosmos_sdk return nil } +type QueryLockRequest struct { + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (m *QueryLockRequest) Reset() { *m = QueryLockRequest{} } +func (m *QueryLockRequest) String() string { return proto.CompactTextString(m) } +func (*QueryLockRequest) ProtoMessage() {} +func (*QueryLockRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b1812eb66ff92e55, []int{2} +} +func (m *QueryLockRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryLockRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryLockRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryLockRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryLockRequest.Merge(m, src) +} +func (m *QueryLockRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryLockRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryLockRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryLockRequest proto.InternalMessageInfo + +func (m *QueryLockRequest) GetId() uint64 { + if m != nil { + return m.Id + } + return 0 +} + +type QueryLockResponse struct { + Lock *Lock `protobuf:"bytes,1,opt,name=lock,proto3" json:"lock,omitempty"` +} + +func (m *QueryLockResponse) Reset() { *m = QueryLockResponse{} } +func (m *QueryLockResponse) String() string { return proto.CompactTextString(m) } +func (*QueryLockResponse) ProtoMessage() {} +func (*QueryLockResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b1812eb66ff92e55, []int{3} +} +func (m *QueryLockResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryLockResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryLockResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryLockResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryLockResponse.Merge(m, src) +} +func (m *QueryLockResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryLockResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryLockResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryLockResponse proto.InternalMessageInfo + +func (m *QueryLockResponse) GetLock() *Lock { + if m != nil { + return m.Lock + } + return nil +} + +type QueryLocksByAddress struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryLocksByAddress) Reset() { *m = QueryLocksByAddress{} } +func (m *QueryLocksByAddress) String() string { return proto.CompactTextString(m) } +func (*QueryLocksByAddress) ProtoMessage() {} +func (*QueryLocksByAddress) Descriptor() ([]byte, []int) { + return fileDescriptor_b1812eb66ff92e55, []int{4} +} +func (m *QueryLocksByAddress) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryLocksByAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryLocksByAddress.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryLocksByAddress) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryLocksByAddress.Merge(m, src) +} +func (m *QueryLocksByAddress) XXX_Size() int { + return m.Size() +} +func (m *QueryLocksByAddress) XXX_DiscardUnknown() { + xxx_messageInfo_QueryLocksByAddress.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryLocksByAddress proto.InternalMessageInfo + +func (m *QueryLocksByAddress) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *QueryLocksByAddress) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryLocksByAddressResponse struct { + Locks []*Lock `protobuf:"bytes,1,rep,name=locks,proto3" json:"locks,omitempty"` +} + +func (m *QueryLocksByAddressResponse) Reset() { *m = QueryLocksByAddressResponse{} } +func (m *QueryLocksByAddressResponse) String() string { return proto.CompactTextString(m) } +func (*QueryLocksByAddressResponse) ProtoMessage() {} +func (*QueryLocksByAddressResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b1812eb66ff92e55, []int{5} +} +func (m *QueryLocksByAddressResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryLocksByAddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryLocksByAddressResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryLocksByAddressResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryLocksByAddressResponse.Merge(m, src) +} +func (m *QueryLocksByAddressResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryLocksByAddressResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryLocksByAddressResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryLocksByAddressResponse proto.InternalMessageInfo + +func (m *QueryLocksByAddressResponse) GetLocks() []*Lock { + if m != nil { + return m.Locks + } + return nil +} + func init() { proto.RegisterType((*QueryLockedCoinsRequest)(nil), "nibiru.lockup.v1.QueryLockedCoinsRequest") proto.RegisterType((*QueryLockedCoinsResponse)(nil), "nibiru.lockup.v1.QueryLockedCoinsResponse") + proto.RegisterType((*QueryLockRequest)(nil), "nibiru.lockup.v1.QueryLockRequest") + proto.RegisterType((*QueryLockResponse)(nil), "nibiru.lockup.v1.QueryLockResponse") + proto.RegisterType((*QueryLocksByAddress)(nil), "nibiru.lockup.v1.QueryLocksByAddress") + proto.RegisterType((*QueryLocksByAddressResponse)(nil), "nibiru.lockup.v1.QueryLocksByAddressResponse") } func init() { proto.RegisterFile("lockup/v1/query.proto", fileDescriptor_b1812eb66ff92e55) } var fileDescriptor_b1812eb66ff92e55 = []byte{ - // 358 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xc1, 0x4a, 0xeb, 0x40, - 0x14, 0x86, 0x33, 0xb7, 0xdc, 0x7b, 0x31, 0x75, 0x21, 0x41, 0x31, 0x56, 0x4d, 0x4b, 0xdd, 0x54, - 0xd1, 0x19, 0xd3, 0xbe, 0x41, 0x0b, 0xae, 0x44, 0xb0, 0x4b, 0x37, 0x32, 0x49, 0x86, 0x74, 0x68, - 0x3a, 0x27, 0xcd, 0x4c, 0x8a, 0xdd, 0xba, 0xd3, 0x95, 0xd0, 0xb7, 0xf0, 0x49, 0xba, 0x2c, 0xb8, - 0x71, 0xa5, 0xd2, 0xfa, 0x20, 0x92, 0x4c, 0x8a, 0x45, 0x11, 0x5c, 0x25, 0x33, 0xff, 0x39, 0xe7, - 0xff, 0xfe, 0x39, 0xe6, 0x56, 0x04, 0x7e, 0x3f, 0x8d, 0xc9, 0xc8, 0x25, 0xc3, 0x94, 0x25, 0x63, - 0x1c, 0x27, 0xa0, 0xc0, 0xda, 0x10, 0xdc, 0xe3, 0x49, 0x8a, 0xb5, 0x8a, 0x47, 0x6e, 0x65, 0x33, - 0x84, 0x10, 0x72, 0x91, 0x64, 0x7f, 0xba, 0xae, 0xb2, 0x17, 0x02, 0x84, 0x11, 0x23, 0x34, 0xe6, - 0x84, 0x0a, 0x01, 0x8a, 0x2a, 0x0e, 0x42, 0x16, 0xaa, 0xe3, 0x83, 0x1c, 0x80, 0x24, 0x1e, 0x95, - 0x8c, 0x8c, 0x5c, 0x8f, 0x29, 0xea, 0x12, 0x1f, 0xb8, 0xd0, 0x7a, 0xbd, 0x65, 0x6e, 0x5f, 0x66, - 0xa6, 0xe7, 0xe0, 0xf7, 0x59, 0xd0, 0x01, 0x2e, 0x64, 0x97, 0x0d, 0x53, 0x26, 0x95, 0x65, 0x9b, - 0xff, 0x69, 0x10, 0x24, 0x4c, 0x4a, 0x1b, 0xd5, 0x50, 0x63, 0xad, 0xbb, 0x3c, 0xd6, 0xef, 0x91, - 0x69, 0x7f, 0xef, 0x92, 0x31, 0x08, 0xc9, 0x2c, 0x61, 0xae, 0x47, 0xf9, 0xf5, 0x75, 0x66, 0x23, - 0xed, 0x52, 0xad, 0xd4, 0x28, 0x37, 0x77, 0xb0, 0x06, 0xc1, 0x19, 0x08, 0x2e, 0x40, 0x70, 0xd6, - 0xd9, 0x3e, 0x9d, 0xbe, 0x54, 0x8d, 0xc7, 0xd7, 0x6a, 0x23, 0xe4, 0xaa, 0x97, 0x7a, 0xd8, 0x87, - 0x01, 0x29, 0xa8, 0xf5, 0xe7, 0x44, 0x06, 0x7d, 0xa2, 0xc6, 0x31, 0x93, 0x58, 0x5b, 0x95, 0xa3, - 0x4f, 0xdf, 0xe6, 0x04, 0x99, 0x7f, 0x73, 0x18, 0xeb, 0x0e, 0x99, 0xe5, 0x15, 0x22, 0xeb, 0x10, - 0x7f, 0x7d, 0x42, 0xfc, 0x43, 0xd6, 0xca, 0xd1, 0x6f, 0x4a, 0x75, 0xc0, 0xfa, 0xc1, 0xed, 0xd3, - 0xfb, 0xe4, 0xcf, 0xbe, 0xb5, 0x4b, 0x74, 0x0f, 0x29, 0xf6, 0xb7, 0x9a, 0xba, 0x7d, 0x36, 0x9d, - 0x3b, 0x68, 0x36, 0x77, 0xd0, 0xdb, 0xdc, 0x41, 0x0f, 0x0b, 0xc7, 0x98, 0x2d, 0x1c, 0xe3, 0x79, - 0xe1, 0x18, 0x57, 0xc7, 0x2b, 0x31, 0x2f, 0xf2, 0x01, 0x9d, 0x1e, 0xe5, 0x62, 0x39, 0xec, 0x66, - 0x39, 0x2e, 0x0f, 0xec, 0xfd, 0xcb, 0xd7, 0xd4, 0xfa, 0x08, 0x00, 0x00, 0xff, 0xff, 0x9a, 0x32, - 0xa0, 0x64, 0x25, 0x02, 0x00, 0x00, + // 538 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x4f, 0x6f, 0xd3, 0x30, + 0x18, 0xc6, 0x9b, 0x76, 0x03, 0xe1, 0xa2, 0x69, 0x78, 0x1b, 0x94, 0x16, 0xd2, 0x91, 0x09, 0x28, + 0xd5, 0x66, 0xd3, 0xee, 0x03, 0x20, 0x3a, 0x69, 0x17, 0x10, 0x82, 0x1e, 0xb9, 0x54, 0xf9, 0x63, + 0x65, 0x56, 0x33, 0x3b, 0xab, 0x93, 0x42, 0xaf, 0xdc, 0xe0, 0x02, 0xd2, 0xbe, 0x05, 0x9f, 0x64, + 0xc7, 0x49, 0x5c, 0x38, 0x01, 0x6a, 0xf9, 0x20, 0xc8, 0x7f, 0x92, 0x86, 0xad, 0xab, 0x76, 0x6a, + 0xea, 0xf7, 0x79, 0x9f, 0xe7, 0x67, 0xfb, 0x35, 0xd8, 0x8a, 0xb8, 0x3f, 0x4c, 0x63, 0x3c, 0xee, + 0xe0, 0x93, 0x94, 0x8c, 0x26, 0x28, 0x1e, 0xf1, 0x84, 0xc3, 0x75, 0x46, 0x3d, 0x3a, 0x4a, 0x91, + 0xae, 0xa2, 0x71, 0xa7, 0xbe, 0x19, 0xf2, 0x90, 0xab, 0x22, 0x96, 0x5f, 0x5a, 0x57, 0x7f, 0x10, + 0x72, 0x1e, 0x46, 0x04, 0xbb, 0x31, 0xc5, 0x2e, 0x63, 0x3c, 0x71, 0x13, 0xca, 0x99, 0x30, 0x55, + 0xdb, 0xe7, 0xe2, 0x98, 0x0b, 0xec, 0xb9, 0x82, 0xe0, 0x71, 0xc7, 0x23, 0x89, 0xdb, 0xc1, 0x3e, + 0xa7, 0xcc, 0xd4, 0xdb, 0xc5, 0xba, 0x8a, 0xcf, 0x55, 0xb1, 0x1b, 0x52, 0xa6, 0xcc, 0x8c, 0x76, + 0x73, 0x0e, 0x2a, 0xbf, 0xf4, 0xaa, 0xb3, 0x0f, 0xee, 0xbd, 0x93, 0x7d, 0xaf, 0xb9, 0x3f, 0x24, + 0xc1, 0x01, 0xa7, 0x4c, 0xf4, 0xc9, 0x49, 0x4a, 0x44, 0x02, 0x6b, 0xe0, 0xa6, 0x1b, 0x04, 0x23, + 0x22, 0x44, 0xcd, 0xda, 0xb6, 0x5a, 0xb7, 0xfa, 0xd9, 0x5f, 0xe7, 0x8b, 0x05, 0x6a, 0x97, 0xbb, + 0x44, 0xcc, 0x99, 0x20, 0x90, 0x81, 0xdb, 0x91, 0x5a, 0x1e, 0x48, 0x50, 0x51, 0xab, 0x6c, 0x57, + 0x5a, 0xd5, 0xee, 0x7d, 0xa4, 0x51, 0x91, 0x44, 0x45, 0x06, 0x12, 0xc9, 0xce, 0xde, 0xf3, 0xb3, + 0x5f, 0xcd, 0xd2, 0xf7, 0xdf, 0xcd, 0x56, 0x48, 0x93, 0xa3, 0xd4, 0x43, 0x3e, 0x3f, 0xc6, 0x66, + 0x5f, 0xfa, 0x67, 0x4f, 0x04, 0x43, 0x9c, 0x4c, 0x62, 0x22, 0x90, 0x8e, 0xaa, 0x46, 0xf3, 0x5c, + 0xc7, 0x01, 0xeb, 0x39, 0x4b, 0x86, 0xbe, 0x06, 0xca, 0x34, 0x50, 0xd4, 0x2b, 0xfd, 0x32, 0x0d, + 0x9c, 0x17, 0xe0, 0x4e, 0x41, 0x63, 0x40, 0xdb, 0x60, 0x45, 0xfa, 0x28, 0x59, 0xb5, 0x7b, 0x17, + 0x5d, 0xbc, 0x31, 0xa4, 0xd4, 0x4a, 0xe3, 0x7c, 0x00, 0x1b, 0xb9, 0x81, 0xe8, 0x4d, 0x5e, 0xea, + 0x83, 0xb8, 0xfa, 0x88, 0xe0, 0x21, 0x00, 0xf3, 0x1b, 0xa8, 0x95, 0x55, 0xc4, 0x93, 0xff, 0xce, + 0x40, 0x4f, 0x4b, 0x76, 0x12, 0x6f, 0xdd, 0x90, 0x18, 0xfa, 0x7e, 0xa1, 0xd3, 0x79, 0x05, 0x1a, + 0x0b, 0x82, 0xf3, 0x3d, 0xec, 0x82, 0x55, 0xc9, 0x27, 0xe3, 0x2b, 0x4b, 0x36, 0xa1, 0x45, 0xdd, + 0xd3, 0x0a, 0x58, 0x55, 0x6e, 0xf0, 0xb3, 0x05, 0xaa, 0x85, 0xcb, 0x83, 0xcf, 0x2e, 0x37, 0x5e, + 0x31, 0x16, 0xf5, 0xf6, 0x75, 0xa4, 0x1a, 0xcf, 0xd9, 0xf9, 0xf4, 0xe3, 0xef, 0x69, 0xf9, 0x21, + 0x6c, 0x60, 0xdd, 0x83, 0xcd, 0x0c, 0x16, 0x07, 0x04, 0x46, 0x60, 0x45, 0xf6, 0x42, 0x67, 0x89, + 0x71, 0x16, 0xbe, 0xb3, 0x54, 0x63, 0x52, 0x1b, 0x2a, 0x75, 0x0b, 0x6e, 0x2c, 0x48, 0x85, 0x5f, + 0x2d, 0xb0, 0x76, 0xe1, 0x16, 0x1f, 0x2f, 0x31, 0x9d, 0xcb, 0xea, 0x7b, 0xd7, 0x92, 0xe5, 0x14, + 0x4f, 0x15, 0xc5, 0x23, 0xd8, 0x5c, 0x40, 0x21, 0x06, 0xde, 0x64, 0x60, 0x46, 0xa5, 0x77, 0x78, + 0x36, 0xb5, 0xad, 0xf3, 0xa9, 0x6d, 0xfd, 0x99, 0xda, 0xd6, 0xb7, 0x99, 0x5d, 0x3a, 0x9f, 0xd9, + 0xa5, 0x9f, 0x33, 0xbb, 0xf4, 0x7e, 0xb7, 0xf0, 0x22, 0xde, 0x28, 0x93, 0x83, 0x23, 0x97, 0xb2, + 0xcc, 0xf0, 0x63, 0x66, 0xa9, 0xde, 0x86, 0x77, 0x43, 0xbd, 0xe8, 0xfd, 0x7f, 0x01, 0x00, 0x00, + 0xff, 0xff, 0x44, 0x46, 0x00, 0xd0, 0x92, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -166,6 +366,8 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { LockedCoins(ctx context.Context, in *QueryLockedCoinsRequest, opts ...grpc.CallOption) (*QueryLockedCoinsResponse, error) + Lock(ctx context.Context, in *QueryLockRequest, opts ...grpc.CallOption) (*QueryLockResponse, error) + LocksByAddress(ctx context.Context, in *QueryLocksByAddress, opts ...grpc.CallOption) (*QueryLocksByAddressResponse, error) } type queryClient struct { @@ -185,9 +387,29 @@ func (c *queryClient) LockedCoins(ctx context.Context, in *QueryLockedCoinsReque return out, nil } +func (c *queryClient) Lock(ctx context.Context, in *QueryLockRequest, opts ...grpc.CallOption) (*QueryLockResponse, error) { + out := new(QueryLockResponse) + err := c.cc.Invoke(ctx, "/nibiru.lockup.v1.Query/Lock", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) LocksByAddress(ctx context.Context, in *QueryLocksByAddress, opts ...grpc.CallOption) (*QueryLocksByAddressResponse, error) { + out := new(QueryLocksByAddressResponse) + err := c.cc.Invoke(ctx, "/nibiru.lockup.v1.Query/LocksByAddress", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { LockedCoins(context.Context, *QueryLockedCoinsRequest) (*QueryLockedCoinsResponse, error) + Lock(context.Context, *QueryLockRequest) (*QueryLockResponse, error) + LocksByAddress(context.Context, *QueryLocksByAddress) (*QueryLocksByAddressResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -197,6 +419,12 @@ type UnimplementedQueryServer struct { func (*UnimplementedQueryServer) LockedCoins(ctx context.Context, req *QueryLockedCoinsRequest) (*QueryLockedCoinsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method LockedCoins not implemented") } +func (*UnimplementedQueryServer) Lock(ctx context.Context, req *QueryLockRequest) (*QueryLockResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Lock not implemented") +} +func (*UnimplementedQueryServer) LocksByAddress(ctx context.Context, req *QueryLocksByAddress) (*QueryLocksByAddressResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LocksByAddress not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -220,6 +448,42 @@ func _Query_LockedCoins_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +func _Query_Lock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryLockRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Lock(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nibiru.lockup.v1.Query/Lock", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Lock(ctx, req.(*QueryLockRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_LocksByAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryLocksByAddress) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).LocksByAddress(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nibiru.lockup.v1.Query/LocksByAddress", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).LocksByAddress(ctx, req.(*QueryLocksByAddress)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "nibiru.lockup.v1.Query", HandlerType: (*QueryServer)(nil), @@ -228,6 +492,14 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "LockedCoins", Handler: _Query_LockedCoins_Handler, }, + { + MethodName: "Lock", + Handler: _Query_Lock_Handler, + }, + { + MethodName: "LocksByAddress", + Handler: _Query_LocksByAddress_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "lockup/v1/query.proto", @@ -300,75 +572,274 @@ func (m *QueryLockedCoinsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *QueryLockRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *QueryLockedCoinsRequest) Size() (n int) { - if m == nil { - return 0 - } + +func (m *QueryLockRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryLockRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if m.Id != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 } - return n + return len(dAtA) - i, nil } -func (m *QueryLockedCoinsResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryLockResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryLockResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryLockResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.LockedCoins) > 0 { - for _, e := range m.LockedCoins { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) + if m.Lock != nil { + { + size, err := m.Lock.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 +func (m *QueryLocksByAddress) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil } -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + +func (m *QueryLocksByAddress) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryLockedCoinsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + +func (m *QueryLocksByAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryLockedCoinsRequest: wiretype end group for non-group") + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryLocksByAddressResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryLocksByAddressResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryLocksByAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Locks) > 0 { + for iNdEx := len(m.Locks) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Locks[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryLockedCoinsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryLockedCoinsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.LockedCoins) > 0 { + for _, e := range m.LockedCoins { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryLockRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovQuery(uint64(m.Id)) + } + return n +} + +func (m *QueryLockResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Lock != nil { + l = m.Lock.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryLocksByAddress) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryLocksByAddressResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Locks) > 0 { + for _, e := range m.Locks { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryLockedCoinsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryLockedCoinsRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: QueryLockedCoinsRequest: illegal tag %d (wire type %d)", fieldNum, wire) @@ -511,6 +982,363 @@ func (m *QueryLockedCoinsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryLockRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryLockRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryLockRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryLockResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryLockResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryLockResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Lock", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Lock == nil { + m.Lock = &Lock{} + } + if err := m.Lock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryLocksByAddress) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryLocksByAddress: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryLocksByAddress: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryLocksByAddressResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryLocksByAddressResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryLocksByAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Locks", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Locks = append(m.Locks, &Lock{}) + if err := m.Locks[len(m.Locks)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/lockup/types/query.pb.gw.go b/x/lockup/types/query.pb.gw.go index d22d66f45..b71fc142b 100644 --- a/x/lockup/types/query.pb.gw.go +++ b/x/lockup/types/query.pb.gw.go @@ -67,6 +67,78 @@ func local_request_Query_LockedCoins_0(ctx context.Context, marshaler runtime.Ma } +var ( + filter_Query_Lock_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Lock_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryLockRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Lock_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Lock(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Lock_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryLockRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Lock_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Lock(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_LocksByAddress_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_LocksByAddress_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryLocksByAddress + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LocksByAddress_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.LocksByAddress(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_LocksByAddress_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryLocksByAddress + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LocksByAddress_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.LocksByAddress(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -93,6 +165,46 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_Lock_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Lock_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Lock_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_LocksByAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_LocksByAddress_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_LocksByAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -154,13 +266,61 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_Lock_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Lock_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Lock_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_LocksByAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_LocksByAddress_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_LocksByAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } var ( pattern_Query_LockedCoins_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"nibiru", "lockup", "locked_coins"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Lock_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"nibiru", "lockup", "lock"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_LocksByAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"nibiru", "lockup", "locks_by_address"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( forward_Query_LockedCoins_0 = runtime.ForwardResponseMessage + + forward_Query_Lock_0 = runtime.ForwardResponseMessage + + forward_Query_LocksByAddress_0 = runtime.ForwardResponseMessage )