Skip to content

Commit

Permalink
feat: add query proto wrap
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmic-vagabond committed Aug 31, 2023
1 parent c246d33 commit d9d4200
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 1 deletion.
19 changes: 18 additions & 1 deletion x/amm/types/query.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

67 changes: 67 additions & 0 deletions x/oracle/client/grpc/grpc_query.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package grpc

import (
"context"

"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

"github.com/elys-network/elys/x/oracle/client"
"github.com/elys-network/elys/x/oracle/types"

sdk "github.com/cosmos/cosmos-sdk/types"
)

type Querier struct {
Q client.Querier
}

var _ types.QueryServer = Querier{}

func (q Querier) PriceAll(grpcCtx context.Context, req *types.QueryAllPriceRequest) (*types.QueryAllPriceResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}
ctx := sdk.UnwrapSDKContext(grpcCtx)
return q.Q.PriceAll(ctx, *req)
}

// implment those functions
func (q Querier) Params(context.Context, *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
panic("implement me")
}

// BandPriceResult defines a rpc handler method for MsgRequestBandPrice.
func (q Querier) BandPriceResult(context.Context, *types.QueryBandPriceRequest) (*types.QueryBandPriceResponse, error) {
panic("implement me")
}

// LastBandRequestId query the last BandPrice result id
func (q Querier) LastBandRequestId(context.Context, *types.QueryLastBandRequestIdRequest) (*types.QueryLastBandRequestIdResponse, error) {
panic("implement me")
}

// Queries a AssetInfo by denom.
func (q Querier) AssetInfo(context.Context, *types.QueryGetAssetInfoRequest) (*types.QueryGetAssetInfoResponse, error) {
panic("implement me")
}

// Queries a list of AssetInfo items.
func (q Querier) AssetInfoAll(context.Context, *types.QueryAllAssetInfoRequest) (*types.QueryAllAssetInfoResponse, error) {
panic("implement me")
}

// Queries a Price by asset.
func (q Querier) Price(context.Context, *types.QueryGetPriceRequest) (*types.QueryGetPriceResponse, error) {
panic("implement me")
}

// Queries a PriceFeeder by feeder.
func (q Querier) PriceFeeder(context.Context, *types.QueryGetPriceFeederRequest) (*types.QueryGetPriceFeederResponse, error) {
panic("implement me")
}

// Queries a list of PriceFeeder items.
func (q Querier) PriceFeederAll(context.Context, *types.QueryAllPriceFeederRequest) (*types.QueryAllPriceFeederResponse, error) {
panic("implement me")
}
19 changes: 19 additions & 0 deletions x/oracle/client/query_proto_wrap.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package client

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/elys-network/elys/x/oracle/keeper"
"github.com/elys-network/elys/x/oracle/types"
)

type Querier struct {
K keeper.Keeper
}

func NewQuerier(k keeper.Keeper) Querier {
return Querier{K: k}
}

func (q Querier) PriceAll(ctx sdk.Context, req types.QueryAllPriceRequest) (*types.QueryAllPriceResponse, error) {
return q.K.PriceAll(ctx, &req)
}

0 comments on commit d9d4200

Please sign in to comment.