diff --git a/CHANGELOG.md b/CHANGELOG.md index 11c2f305458..028912f474d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### State Compatible +* [#8142](https://github.com/osmosis-labs/osmosis/pull/8142) Add query for getting single authenticator and add stargate whitelist for the query. + ## v24.0.3 * [#21](https://github.com/osmosis-labs/cometbft/pull/21) Move websocket logs to Debug diff --git a/proto/osmosis/smartaccount/v1beta1/query.proto b/proto/osmosis/smartaccount/v1beta1/query.proto index aa7cc881bb0..74ab0d7b527 100644 --- a/proto/osmosis/smartaccount/v1beta1/query.proto +++ b/proto/osmosis/smartaccount/v1beta1/query.proto @@ -16,6 +16,12 @@ service Query { option (google.api.http).get = "/osmosis/smartaccount/params"; } + rpc GetAuthenticator(GetAuthenticatorRequest) + returns (GetAuthenticatorResponse) { + option (google.api.http).get = + "/osmosis/smartaccount/authenticator/{account}/{authenticator_id}"; + } + rpc GetAuthenticators(GetAuthenticatorsRequest) returns (GetAuthenticatorsResponse) { option (google.api.http).get = @@ -38,4 +44,15 @@ message GetAuthenticatorsRequest { string account = 1; } // MsgGetAuthenticatorsResponse defines the Msg/GetAuthenticators response type. message GetAuthenticatorsResponse { repeated AccountAuthenticator account_authenticators = 1; +} + +// MsgGetAuthenticatorRequest defines the Msg/GetAuthenticator request type. +message GetAuthenticatorRequest { + string account = 1; + uint64 authenticator_id = 2; +} + +// MsgGetAuthenticatorResponse defines the Msg/GetAuthenticator response type. +message GetAuthenticatorResponse { + AccountAuthenticator account_authenticator = 1; } \ No newline at end of file diff --git a/wasmbinding/stargate_whitelist.go b/wasmbinding/stargate_whitelist.go index d8375766c9a..58b26d7834a 100644 --- a/wasmbinding/stargate_whitelist.go +++ b/wasmbinding/stargate_whitelist.go @@ -26,6 +26,7 @@ import ( minttypes "github.com/osmosis-labs/osmosis/v24/x/mint/types" poolincentivestypes "github.com/osmosis-labs/osmosis/v24/x/pool-incentives/types" poolmanagerqueryproto "github.com/osmosis-labs/osmosis/v24/x/poolmanager/client/queryproto" + smartaccounttypes "github.com/osmosis-labs/osmosis/v24/x/smart-account/types" superfluidtypes "github.com/osmosis-labs/osmosis/v24/x/superfluid/types" tokenfactorytypes "github.com/osmosis-labs/osmosis/v24/x/tokenfactory/types" twapquerytypes "github.com/osmosis-labs/osmosis/v24/x/twap/client/queryproto" @@ -139,6 +140,10 @@ func init() { setWhitelistedQuery("/osmosis.superfluid.Query/AllAssets", &superfluidtypes.AllAssetsResponse{}) setWhitelistedQuery("/osmosis.superfluid.Query/AssetMultiplier", &superfluidtypes.AssetMultiplierResponse{}) + // smartaccount + setWhitelistedQuery("/osmosis.smartaccount.v1beta1.Query/GetAuthenticator", &smartaccounttypes.GetAuthenticatorResponse{}) + setWhitelistedQuery("/osmosis.smartaccount.v1beta1.Query/GetAuthenticators", &smartaccounttypes.GetAuthenticatorsResponse{}) + // poolmanager setWhitelistedQuery("/osmosis.poolmanager.v1beta1.Query/NumPools", &poolmanagerqueryproto.NumPoolsResponse{}) setWhitelistedQuery("/osmosis.poolmanager.v1beta1.Query/EstimateSwapExactAmountIn", &poolmanagerqueryproto.EstimateSwapExactAmountInResponse{}) diff --git a/x/smart-account/keeper/query.go b/x/smart-account/keeper/query.go index d3f24d5791e..d1c0293a16c 100644 --- a/x/smart-account/keeper/query.go +++ b/x/smart-account/keeper/query.go @@ -33,3 +33,25 @@ func (k Keeper) GetAuthenticators( return &types.GetAuthenticatorsResponse{AccountAuthenticators: authenticators}, nil } + +func (k Keeper) GetAuthenticator( + ctx context.Context, + request *types.GetAuthenticatorRequest, +) (*types.GetAuthenticatorResponse, error) { + if request == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + sdkCtx := sdk.UnwrapSDKContext(ctx) + acc, err := sdk.AccAddressFromBech32(request.Account) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + authenticator, err := k.GetSelectedAuthenticatorData(sdkCtx, acc, int(request.AuthenticatorId)) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.GetAuthenticatorResponse{AccountAuthenticator: authenticator}, nil +} diff --git a/x/smart-account/types/query.pb.go b/x/smart-account/types/query.pb.go index bda76c02342..bff97868e15 100644 --- a/x/smart-account/types/query.pb.go +++ b/x/smart-account/types/query.pb.go @@ -203,11 +203,111 @@ func (m *GetAuthenticatorsResponse) GetAccountAuthenticators() []*AccountAuthent return nil } +// MsgGetAuthenticatorRequest defines the Msg/GetAuthenticator request type. +type GetAuthenticatorRequest struct { + Account string `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"` + AuthenticatorId uint64 `protobuf:"varint,2,opt,name=authenticator_id,json=authenticatorId,proto3" json:"authenticator_id,omitempty"` +} + +func (m *GetAuthenticatorRequest) Reset() { *m = GetAuthenticatorRequest{} } +func (m *GetAuthenticatorRequest) String() string { return proto.CompactTextString(m) } +func (*GetAuthenticatorRequest) ProtoMessage() {} +func (*GetAuthenticatorRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_aab2e1fc442f3cc3, []int{4} +} +func (m *GetAuthenticatorRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetAuthenticatorRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetAuthenticatorRequest.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 *GetAuthenticatorRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetAuthenticatorRequest.Merge(m, src) +} +func (m *GetAuthenticatorRequest) XXX_Size() int { + return m.Size() +} +func (m *GetAuthenticatorRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetAuthenticatorRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetAuthenticatorRequest proto.InternalMessageInfo + +func (m *GetAuthenticatorRequest) GetAccount() string { + if m != nil { + return m.Account + } + return "" +} + +func (m *GetAuthenticatorRequest) GetAuthenticatorId() uint64 { + if m != nil { + return m.AuthenticatorId + } + return 0 +} + +// MsgGetAuthenticatorResponse defines the Msg/GetAuthenticator response type. +type GetAuthenticatorResponse struct { + AccountAuthenticator *AccountAuthenticator `protobuf:"bytes,1,opt,name=account_authenticator,json=accountAuthenticator,proto3" json:"account_authenticator,omitempty"` +} + +func (m *GetAuthenticatorResponse) Reset() { *m = GetAuthenticatorResponse{} } +func (m *GetAuthenticatorResponse) String() string { return proto.CompactTextString(m) } +func (*GetAuthenticatorResponse) ProtoMessage() {} +func (*GetAuthenticatorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_aab2e1fc442f3cc3, []int{5} +} +func (m *GetAuthenticatorResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetAuthenticatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetAuthenticatorResponse.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 *GetAuthenticatorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetAuthenticatorResponse.Merge(m, src) +} +func (m *GetAuthenticatorResponse) XXX_Size() int { + return m.Size() +} +func (m *GetAuthenticatorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetAuthenticatorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetAuthenticatorResponse proto.InternalMessageInfo + +func (m *GetAuthenticatorResponse) GetAccountAuthenticator() *AccountAuthenticator { + if m != nil { + return m.AccountAuthenticator + } + return nil +} + func init() { proto.RegisterType((*QueryParamsRequest)(nil), "osmosis.smartaccount.v1beta1.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "osmosis.smartaccount.v1beta1.QueryParamsResponse") proto.RegisterType((*GetAuthenticatorsRequest)(nil), "osmosis.smartaccount.v1beta1.GetAuthenticatorsRequest") proto.RegisterType((*GetAuthenticatorsResponse)(nil), "osmosis.smartaccount.v1beta1.GetAuthenticatorsResponse") + proto.RegisterType((*GetAuthenticatorRequest)(nil), "osmosis.smartaccount.v1beta1.GetAuthenticatorRequest") + proto.RegisterType((*GetAuthenticatorResponse)(nil), "osmosis.smartaccount.v1beta1.GetAuthenticatorResponse") } func init() { @@ -215,34 +315,40 @@ func init() { } var fileDescriptor_aab2e1fc442f3cc3 = []byte{ - // 430 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xb1, 0xae, 0xd3, 0x30, - 0x14, 0x86, 0xe3, 0x0b, 0x14, 0xe1, 0x3b, 0x61, 0x2e, 0x28, 0x44, 0x55, 0xa8, 0xa2, 0x0e, 0x05, - 0xa9, 0x71, 0x1b, 0xaa, 0x22, 0xc6, 0x76, 0x61, 0x85, 0x30, 0xc1, 0x82, 0x9c, 0x60, 0xa5, 0x91, - 0x9a, 0x38, 0x8d, 0x9d, 0x8a, 0x0a, 0xb1, 0x30, 0x30, 0x23, 0xf5, 0x75, 0x78, 0x80, 0x8e, 0x95, - 0x58, 0x18, 0x10, 0x42, 0x2d, 0x0f, 0x82, 0x6a, 0x3b, 0x15, 0x51, 0x43, 0x74, 0xbb, 0xc5, 0x27, - 0xff, 0x7f, 0xbe, 0xdf, 0xe7, 0x18, 0xf6, 0x18, 0x4f, 0x18, 0x8f, 0x39, 0xe6, 0x09, 0xc9, 0x05, - 0x09, 0x43, 0x56, 0xa4, 0x02, 0x2f, 0x87, 0x01, 0x15, 0x64, 0x88, 0x17, 0x05, 0xcd, 0x57, 0x6e, - 0x96, 0x33, 0xc1, 0x50, 0x5b, 0x2b, 0xdd, 0x7f, 0x95, 0xae, 0x56, 0x5a, 0x57, 0x11, 0x8b, 0x98, - 0x14, 0xe2, 0xc3, 0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x97, 0x74, 0xba, 0x9f, 0xbf, 0xff, 0x59, - 0x5f, 0xd8, 0xa8, 0x8d, 0x6b, 0xb7, 0xab, 0xc6, 0x8b, 0xbe, 0x01, 0x78, 0xf7, 0x64, 0x50, 0x68, - 0xdc, 0x8c, 0xfb, 0xdf, 0x42, 0xac, 0x67, 0x67, 0xfb, 0x74, 0xd8, 0xb1, 0x0c, 0x3b, 0x40, 0x6e, - 0x7d, 0xd8, 0xea, 0x96, 0xf0, 0x47, 0x5d, 0xff, 0x34, 0x7d, 0xbd, 0xd9, 0xd9, 0x60, 0xbb, 0xb3, - 0xc1, 0xef, 0x9d, 0x0d, 0xbe, 0xee, 0x6d, 0x63, 0xbb, 0xb7, 0x8d, 0x1f, 0x7b, 0xdb, 0x78, 0xfb, - 0x3c, 0x8a, 0xc5, 0xac, 0x08, 0xdc, 0x90, 0x25, 0x65, 0xcf, 0xfe, 0x9c, 0x04, 0xfc, 0x08, 0x58, - 0x7a, 0x23, 0xfc, 0x41, 0x61, 0xfa, 0x25, 0x47, 0xac, 0x32, 0xca, 0x83, 0x96, 0x7c, 0xea, 0x4f, - 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xb2, 0x19, 0xec, 0x28, 0xea, 0x03, 0x00, 0x00, + // 519 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x41, 0x6f, 0xd3, 0x30, + 0x14, 0xae, 0x47, 0x29, 0xc2, 0x3b, 0x30, 0x4c, 0x07, 0xa1, 0xaa, 0x42, 0x15, 0xed, 0xd0, 0x21, + 0x2d, 0x5e, 0xc3, 0x18, 0xe2, 0xc6, 0x7a, 0x01, 0x6e, 0x10, 0x4e, 0x70, 0x60, 0x72, 0x52, 0x2b, + 0xb3, 0xd4, 0xc4, 0x59, 0xec, 0x4c, 0x4c, 0xd3, 0x2e, 0x20, 0x71, 0x46, 0xda, 0xbf, 0xe0, 0x37,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b4, 0xa0, 0xaf, 0xe9, 0xd0, + 0x1f, 0x2d, 0xcc, 0x33, 0x81, 0xb6, 0x55, 0xa0, 0x4d, 0xe4, 0x5e, 0x20, 0x90, 0xf8, 0x93, 0xa8, + 0xff, 0xea, 0x74, 0x64, 0x83, 0xb3, 0x91, 0x0d, 0x7e, 0x8e, 0x6c, 0xf0, 0x69, 0x6c, 0xd7, 0xce, + 0xc6, 0x76, 0xed, 0xfb, 0xd8, 0xae, 0xbd, 0x79, 0x1c, 0x31, 0xb9, 0x97, 0x07, 0x6e, 0xc8, 0xe3, + 0x49, 0xcf, 0x8d, 0x21, 0x09, 0xc4, 0x54, 0xe0, 0xc0, 0xdb, 0xc2, 0xef, 0xb4, 0xcc, 0xc6, 0x44, + 0x47, 0x1e, 0xa6, 0x54, 0x04, 0x0d, 0xf5, 0x79, 0x7a, 0xf0, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x9a, + 0x94, 0x72, 0xfa, 0x9e, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -259,6 +365,7 @@ const _ = grpc.SupportPackageIsVersion4 type QueryClient interface { // Parameters queries the parameters of the module. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + GetAuthenticator(ctx context.Context, in *GetAuthenticatorRequest, opts ...grpc.CallOption) (*GetAuthenticatorResponse, error) GetAuthenticators(ctx context.Context, in *GetAuthenticatorsRequest, opts ...grpc.CallOption) (*GetAuthenticatorsResponse, error) } @@ -279,6 +386,15 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . return out, nil } +func (c *queryClient) GetAuthenticator(ctx context.Context, in *GetAuthenticatorRequest, opts ...grpc.CallOption) (*GetAuthenticatorResponse, error) { + out := new(GetAuthenticatorResponse) + err := c.cc.Invoke(ctx, "/osmosis.smartaccount.v1beta1.Query/GetAuthenticator", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *queryClient) GetAuthenticators(ctx context.Context, in *GetAuthenticatorsRequest, opts ...grpc.CallOption) (*GetAuthenticatorsResponse, error) { out := new(GetAuthenticatorsResponse) err := c.cc.Invoke(ctx, "/osmosis.smartaccount.v1beta1.Query/GetAuthenticators", in, out, opts...) @@ -292,6 +408,7 @@ func (c *queryClient) GetAuthenticators(ctx context.Context, in *GetAuthenticato type QueryServer interface { // Parameters queries the parameters of the module. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + GetAuthenticator(context.Context, *GetAuthenticatorRequest) (*GetAuthenticatorResponse, error) GetAuthenticators(context.Context, *GetAuthenticatorsRequest) (*GetAuthenticatorsResponse, error) } @@ -302,6 +419,9 @@ type UnimplementedQueryServer struct { func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } +func (*UnimplementedQueryServer) GetAuthenticator(ctx context.Context, req *GetAuthenticatorRequest) (*GetAuthenticatorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAuthenticator not implemented") +} func (*UnimplementedQueryServer) GetAuthenticators(ctx context.Context, req *GetAuthenticatorsRequest) (*GetAuthenticatorsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetAuthenticators not implemented") } @@ -328,6 +448,24 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } +func _Query_GetAuthenticator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetAuthenticatorRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetAuthenticator(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/osmosis.smartaccount.v1beta1.Query/GetAuthenticator", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetAuthenticator(ctx, req.(*GetAuthenticatorRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Query_GetAuthenticators_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetAuthenticatorsRequest) if err := dec(in); err != nil { @@ -354,6 +492,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "Params", Handler: _Query_Params_Handler, }, + { + MethodName: "GetAuthenticator", + Handler: _Query_GetAuthenticator_Handler, + }, { MethodName: "GetAuthenticators", Handler: _Query_GetAuthenticators_Handler, @@ -486,6 +628,76 @@ func (m *GetAuthenticatorsResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } +func (m *GetAuthenticatorRequest) 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 *GetAuthenticatorRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetAuthenticatorRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AuthenticatorId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.AuthenticatorId)) + i-- + dAtA[i] = 0x10 + } + if len(m.Account) > 0 { + i -= len(m.Account) + copy(dAtA[i:], m.Account) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Account))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetAuthenticatorResponse) 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 *GetAuthenticatorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetAuthenticatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AccountAuthenticator != nil { + { + size, err := m.AccountAuthenticator.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 @@ -545,6 +757,35 @@ func (m *GetAuthenticatorsResponse) Size() (n int) { return n } +func (m *GetAuthenticatorRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Account) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.AuthenticatorId != 0 { + n += 1 + sovQuery(uint64(m.AuthenticatorId)) + } + return n +} + +func (m *GetAuthenticatorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.AccountAuthenticator != nil { + l = m.AccountAuthenticator.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -850,6 +1091,193 @@ func (m *GetAuthenticatorsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *GetAuthenticatorRequest) 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: GetAuthenticatorRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetAuthenticatorRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Account", 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.Account = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AuthenticatorId", wireType) + } + m.AuthenticatorId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AuthenticatorId |= 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 *GetAuthenticatorResponse) 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: GetAuthenticatorResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetAuthenticatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AccountAuthenticator", 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.AccountAuthenticator == nil { + m.AccountAuthenticator = &AccountAuthenticator{} + } + if err := m.AccountAuthenticator.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/smart-account/types/query.pb.gw.go b/x/smart-account/types/query.pb.gw.go index acdc2eb44e9..9f9d6b207dc 100644 --- a/x/smart-account/types/query.pb.gw.go +++ b/x/smart-account/types/query.pb.gw.go @@ -51,6 +51,82 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal } +func request_Query_GetAuthenticator_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetAuthenticatorRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["account"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "account") + } + + protoReq.Account, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "account", err) + } + + val, ok = pathParams["authenticator_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "authenticator_id") + } + + protoReq.AuthenticatorId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "authenticator_id", err) + } + + msg, err := client.GetAuthenticator(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetAuthenticator_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetAuthenticatorRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["account"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "account") + } + + protoReq.Account, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "account", err) + } + + val, ok = pathParams["authenticator_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "authenticator_id") + } + + protoReq.AuthenticatorId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "authenticator_id", err) + } + + msg, err := server.GetAuthenticator(ctx, &protoReq) + return msg, metadata, err + +} + func request_Query_GetAuthenticators_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq GetAuthenticatorsRequest var metadata runtime.ServerMetadata @@ -134,6 +210,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_GetAuthenticator_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_GetAuthenticator_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_GetAuthenticator_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_GetAuthenticators_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -218,6 +317,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_GetAuthenticator_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_GetAuthenticator_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_GetAuthenticator_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_GetAuthenticators_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -244,11 +363,15 @@ 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}, []string{"osmosis", "smartaccount", "params"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_GetAuthenticator_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"osmosis", "smartaccount", "authenticator", "account", "authenticator_id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_GetAuthenticators_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"osmosis", "smartaccount", "authenticators", "account"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( forward_Query_Params_0 = runtime.ForwardResponseMessage + forward_Query_GetAuthenticator_0 = runtime.ForwardResponseMessage + forward_Query_GetAuthenticators_0 = runtime.ForwardResponseMessage )