Unverified Commit 99f770f2 authored by mergify[bot]'s avatar mergify[bot] Committed by GitHub
Browse files

Add TWAP params queries (#2678) (#2682)

(cherry picked from commit 4bbd3fb4

)

Co-authored-by: default avatarDev Ojha <ValarDragon@users.noreply.github.com>
parent 385abb8b
Showing with 465 additions and 40 deletions
+465 -40
......@@ -3,6 +3,7 @@ package osmosis.twap.v1beta1;
import "gogoproto/gogo.proto";
import "osmosis/twap/v1beta1/twap_record.proto";
import "osmosis/twap/v1beta1/genesis.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
......@@ -14,6 +15,9 @@ import "google/protobuf/timestamp.proto";
option go_package = "github.com/osmosis-labs/osmosis/v12/x/twap/client/queryproto";
service Query {
rpc Params(ParamsRequest) returns (ParamsResponse) {
option (google.api.http).get = "/osmosis/twap/v1beta1/Params";
}
rpc GetArithmeticTwap(GetArithmeticTwapRequest)
returns (GetArithmeticTwapResponse) {
option (google.api.http).get = "/osmosis/twap/v1beta1/GetArithmeticTwap";
......@@ -65,3 +69,6 @@ message GetArithmeticTwapToNowResponse {
(gogoproto.nullable) = false
];
}
message ParamsRequest {}
message ParamsResponse { Params params = 1 [ (gogoproto.nullable) = false ]; }
......@@ -13,5 +13,10 @@ queries:
GetArithmeticTwapToNow:
proto_wrapper:
query_func: "k.GetArithmeticTwapToNow"
cli:
cmd: "GetArithmeticTwapToNow"
Params:
proto_wrapper:
query_func: "k.GetParams"
cli:
cmd: "GetArithmeticTwapToNow"
\ No newline at end of file
......@@ -38,3 +38,12 @@ func (q Querier) GetArithmeticTwapToNow(grpcCtx context.Context,
ctx := sdk.UnwrapSDKContext(grpcCtx)
return q.Q.GetArithmeticTwapToNow(ctx, *req)
}
func (q Querier) Params(grpcCtx context.Context,
req *queryproto.ParamsRequest,
) (*queryproto.ParamsResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}
ctx := sdk.UnwrapSDKContext(grpcCtx)
return q.Q.Params(ctx, *req)
}
......@@ -32,3 +32,10 @@ func (q Querier) GetArithmeticTwapToNow(ctx sdk.Context,
twap, err := q.K.GetArithmeticTwapToNow(ctx, req.PoolId, req.BaseAsset, req.QuoteAsset, req.StartTime)
return &queryproto.GetArithmeticTwapToNowResponse{ArithmeticTwap: twap}, err
}
func (q Querier) Params(ctx sdk.Context,
req queryproto.ParamsRequest,
) (*queryproto.ParamsResponse, error) {
params := q.K.GetParams(ctx)
return &queryproto.ParamsResponse{Params: params}, nil
}
......@@ -16,7 +16,7 @@ import (
proto "github.com/gogo/protobuf/proto"
_ "github.com/gogo/protobuf/types"
github_com_gogo_protobuf_types "github.com/gogo/protobuf/types"
_ "github.com/osmosis-labs/osmosis/v12/x/twap/types"
types1 "github.com/osmosis-labs/osmosis/v12/x/twap/types"
_ "google.golang.org/genproto/googleapis/api/annotations"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
......@@ -257,55 +257,142 @@ func (m *GetArithmeticTwapToNowResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_GetArithmeticTwapToNowResponse proto.InternalMessageInfo
type ParamsRequest struct {
}
func (m *ParamsRequest) Reset() { *m = ParamsRequest{} }
func (m *ParamsRequest) String() string { return proto.CompactTextString(m) }
func (*ParamsRequest) ProtoMessage() {}
func (*ParamsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_141a22dba58615af, []int{4}
}
func (m *ParamsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *ParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_ParamsRequest.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 *ParamsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_ParamsRequest.Merge(m, src)
}
func (m *ParamsRequest) XXX_Size() int {
return m.Size()
}
func (m *ParamsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_ParamsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_ParamsRequest proto.InternalMessageInfo
type ParamsResponse struct {
Params types1.Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
}
func (m *ParamsResponse) Reset() { *m = ParamsResponse{} }
func (m *ParamsResponse) String() string { return proto.CompactTextString(m) }
func (*ParamsResponse) ProtoMessage() {}
func (*ParamsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_141a22dba58615af, []int{5}
}
func (m *ParamsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *ParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_ParamsResponse.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 *ParamsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_ParamsResponse.Merge(m, src)
}
func (m *ParamsResponse) XXX_Size() int {
return m.Size()
}
func (m *ParamsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_ParamsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_ParamsResponse proto.InternalMessageInfo
func (m *ParamsResponse) GetParams() types1.Params {
if m != nil {
return m.Params
}
return types1.Params{}
}
func init() {
proto.RegisterType((*GetArithmeticTwapRequest)(nil), "osmosis.twap.v1beta1.GetArithmeticTwapRequest")
proto.RegisterType((*GetArithmeticTwapResponse)(nil), "osmosis.twap.v1beta1.GetArithmeticTwapResponse")
proto.RegisterType((*GetArithmeticTwapToNowRequest)(nil), "osmosis.twap.v1beta1.GetArithmeticTwapToNowRequest")
proto.RegisterType((*GetArithmeticTwapToNowResponse)(nil), "osmosis.twap.v1beta1.GetArithmeticTwapToNowResponse")
proto.RegisterType((*ParamsRequest)(nil), "osmosis.twap.v1beta1.ParamsRequest")
proto.RegisterType((*ParamsResponse)(nil), "osmosis.twap.v1beta1.ParamsResponse")
}
func init() { proto.RegisterFile("osmosis/twap/v1beta1/query.proto", fileDescriptor_141a22dba58615af) }
var fileDescriptor_141a22dba58615af = []byte{
// 601 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0xcb, 0x6e, 0xd3, 0x40,
0x14, 0xcd, 0x84, 0x3e, 0xc8, 0x54, 0xa2, 0xaa, 0x55, 0x95, 0x34, 0x50, 0x3b, 0xf2, 0xa2, 0x14,
0x44, 0x67, 0xd4, 0xc7, 0x0a, 0xb1, 0x69, 0x85, 0x04, 0x6c, 0x90, 0xb0, 0x2a, 0x84, 0xd8, 0x58,
0x13, 0x7b, 0x70, 0x2d, 0x62, 0x8f, 0xe3, 0x99, 0x34, 0x64, 0xcb, 0x07, 0xa0, 0x4a, 0xfd, 0x02,
0x16, 0x7c, 0x04, 0x7f, 0x90, 0x65, 0x05, 0x1b, 0xc4, 0xc2, 0xa0, 0x84, 0x1d, 0xbb, 0x7c, 0x01,
0x9a, 0x19, 0x3b, 0x84, 0x26, 0x15, 0x61, 0x85, 0x58, 0xd9, 0x73, 0xcf, 0xb9, 0xe7, 0x9e, 0x7b,
0xe7, 0x01, 0xeb, 0x8c, 0x47, 0x8c, 0x87, 0x1c, 0x8b, 0x0e, 0x49, 0xf0, 0xc9, 0x4e, 0x83, 0x0a,
0xb2, 0x83, 0x5b, 0x6d, 0x9a, 0x76, 0x51, 0x92, 0x32, 0xc1, 0x8c, 0xd5, 0x9c, 0x81, 0x24, 0x03,
0xe5, 0x8c, 0xda, 0x6a, 0xc0, 0x02, 0xa6, 0x08, 0x58, 0xfe, 0x69, 0x6e, 0x6d, 0x73, 0xaa, 0x9a,
0x5c, 0xb8, 0x29, 0xf5, 0x58, 0xea, 0xe7, 0x3c, 0xd3, 0x53, 0x44, 0xdc, 0x20, 0x9c, 0x8e, 0x68,
0x1e, 0x0b, 0xe3, 0x1c, 0xbf, 0x33, 0x8e, 0x2b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x26, 0xf8, 0xd6, 0x37,
0xc1, 0xe9, 0xc0, 0x2c, 0x9d, 0x0f, 0xcc, 0xd2, 0xe7, 0x81, 0x59, 0x7a, 0x71, 0x7f, 0x6c, 0x67,
0x73, 0xc5, 0xed, 0x26, 0x69, 0xf0, 0x91, 0xfc, 0xc9, 0xce, 0x2e, 0x7e, 0xad, 0x8b, 0x78, 0xcd,
0x90, 0xc6, 0x42, 0x3f, 0xb7, 0xfa, 0x48, 0x2e, 0xa8, 0xcf, 0xde, 0xcf, 0x00, 0x00, 0x00, 0xff,
0xff, 0x30, 0xf4, 0xe3, 0xf7, 0x25, 0x06, 0x00, 0x00,
// 674 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x95, 0xdd, 0x4e, 0x13, 0x41,
0x14, 0xc7, 0x3b, 0x7c, 0x14, 0x3b, 0x44, 0x08, 0x13, 0x82, 0xa5, 0xc2, 0x6e, 0xb3, 0x12, 0x44,
0x23, 0x3b, 0xa1, 0x70, 0x45, 0xbc, 0xa1, 0x31, 0x51, 0x13, 0x63, 0x74, 0x43, 0x8c, 0xf1, 0xa6,
0x99, 0x6e, 0xc7, 0x65, 0x63, 0x77, 0x67, 0xbb, 0x33, 0x05, 0x7b, 0xeb, 0x03, 0x18, 0x12, 0x9e,
0xc0, 0x0b, 0x1f, 0xc2, 0x37, 0xe0, 0x92, 0xe8, 0x8d, 0xf1, 0xa2, 0x1a, 0x30, 0x3e, 0x00, 0x4f,
0x60, 0xe6, 0x63, 0x2b, 0xc2, 0x82, 0x78, 0x65, 0xbc, 0xda, 0xce, 0xf9, 0xff, 0xcf, 0x39, 0xbf,
0x39, 0x3b, 0x3b, 0x85, 0x55, 0xc6, 0x23, 0xc6, 0x43, 0x8e, 0xc5, 0x0e, 0x49, 0xf0, 0xf6, 0x4a,
0x93, 0x0a, 0xb2, 0x82, 0x3b, 0x5d, 0x9a, 0xf6, 0xd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reference imports to suppress errors if they are not otherwise used.
......@@ -320,6 +407,7 @@ 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 {
Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error)
GetArithmeticTwap(ctx context.Context, in *GetArithmeticTwapRequest, opts ...grpc.CallOption) (*GetArithmeticTwapResponse, error)
GetArithmeticTwapToNow(ctx context.Context, in *GetArithmeticTwapToNowRequest, opts ...grpc.CallOption) (*GetArithmeticTwapToNowResponse, error)
}
......@@ -332,6 +420,15 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient {
return &queryClient{cc}
}
func (c *queryClient) Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) {
out := new(ParamsResponse)
err := c.cc.Invoke(ctx, "/osmosis.twap.v1beta1.Query/Params", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) GetArithmeticTwap(ctx context.Context, in *GetArithmeticTwapRequest, opts ...grpc.CallOption) (*GetArithmeticTwapResponse, error) {
out := new(GetArithmeticTwapResponse)
err := c.cc.Invoke(ctx, "/osmosis.twap.v1beta1.Query/GetArithmeticTwap", in, out, opts...)
......@@ -352,6 +449,7 @@ func (c *queryClient) GetArithmeticTwapToNow(ctx context.Context, in *GetArithme
// QueryServer is the server API for Query service.
type QueryServer interface {
Params(context.Context, *ParamsRequest) (*ParamsResponse, error)
GetArithmeticTwap(context.Context, *GetArithmeticTwapRequest) (*GetArithmeticTwapResponse, error)
GetArithmeticTwapToNow(context.Context, *GetArithmeticTwapToNowRequest) (*GetArithmeticTwapToNowResponse, error)
}
......@@ -360,6 +458,9 @@ type QueryServer interface {
type UnimplementedQueryServer struct {
}
func (*UnimplementedQueryServer) Params(ctx context.Context, req *ParamsRequest) (*ParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
}
func (*UnimplementedQueryServer) GetArithmeticTwap(ctx context.Context, req *GetArithmeticTwapRequest) (*GetArithmeticTwapResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetArithmeticTwap not implemented")
}
......@@ -371,6 +472,24 @@ func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
s.RegisterService(&_Query_serviceDesc, srv)
}
func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ParamsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Params(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/osmosis.twap.v1beta1.Query/Params",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Params(ctx, req.(*ParamsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_GetArithmeticTwap_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetArithmeticTwapRequest)
if err := dec(in); err != nil {
......@@ -411,6 +530,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "osmosis.twap.v1beta1.Query",
HandlerType: (*QueryServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Params",
Handler: _Query_Params_Handler,
},
{
MethodName: "GetArithmeticTwap",
Handler: _Query_GetArithmeticTwap_Handler,
......@@ -600,6 +723,62 @@ func (m *GetArithmeticTwapToNowResponse) MarshalToSizedBuffer(dAtA []byte) (int,
return len(dAtA) - i, nil
}
func (m *ParamsRequest) 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 *ParamsRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *ParamsResponse) 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 *ParamsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.Params.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
......@@ -681,6 +860,26 @@ func (m *GetArithmeticTwapToNowResponse) Size() (n int) {
return n
}
func (m *ParamsRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *ParamsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.Params.Size()
n += 1 + l + sovQuery(uint64(l))
return n
}
func sovQuery(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
......@@ -1223,6 +1422,139 @@ func (m *GetArithmeticTwapToNowResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *ParamsRequest) 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: ParamsRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: ParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
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 *ParamsResponse) 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: ParamsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: ParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Params", 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 err := m.Params.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
......
......@@ -33,6 +33,24 @@ var _ = utilities.NewDoubleArray
var _ = descriptor.ForMessage
var _ = metadata.Join
func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ParamsRequest
var metadata runtime.ServerMetadata
msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ParamsRequest
var metadata runtime.ServerMetadata
msg, err := server.Params(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_Query_GetArithmeticTwap_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
......@@ -111,6 +129,29 @@ func local_request_Query_GetArithmeticTwapToNow_0(ctx context.Context, marshaler
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.
func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error {
mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
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_Params_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GetArithmeticTwap_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
......@@ -198,6 +239,26 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc
// "QueryClient" to call the correct interceptors.
func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error {
mux.Handle("GET", pattern_Query_Params_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_Params_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_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GetArithmeticTwap_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
......@@ -242,12 +303,16 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
}
var (
pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"osmosis", "twap", "v1beta1", "Params"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_GetArithmeticTwap_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"osmosis", "twap", "v1beta1", "GetArithmeticTwap"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_GetArithmeticTwapToNow_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"osmosis", "twap", "v1beta1", "GetArithmeticTwapToNow"}, "", runtime.AssumeColonVerbOpt(false)))
)
var (
forward_Query_Params_0 = runtime.ForwardResponseMessage
forward_Query_GetArithmeticTwap_0 = runtime.ForwardResponseMessage
forward_Query_GetArithmeticTwapToNow_0 = runtime.ForwardResponseMessage
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment