diff --git a/entity/domain/account/model/account.pb.go b/entity/domain/account/model/account.pb.go new file mode 100644 index 0000000..5b726c9 --- /dev/null +++ b/entity/domain/account/model/account.pb.go @@ -0,0 +1,380 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.2 +// protoc v4.25.3 +// source: entity/domain/account/model/account.proto + +package model + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Represents a blockchain account. +type Account struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Balance float64 `protobuf:"fixed64,2,opt,name=balance,proto3" json:"balance,omitempty"` + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` +} + +func (x *Account) Reset() { + *x = Account{} + if protoimpl.UnsafeEnabled { + mi := &file_entity_domain_account_model_account_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Account) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Account) ProtoMessage() {} + +func (x *Account) ProtoReflect() protoreflect.Message { + mi := &file_entity_domain_account_model_account_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Account.ProtoReflect.Descriptor instead. +func (*Account) Descriptor() ([]byte, []int) { + return file_entity_domain_account_model_account_proto_rawDescGZIP(), []int{0} +} + +func (x *Account) GetAddress() []byte { + if x != nil { + return x.Address + } + return nil +} + +func (x *Account) GetBalance() float64 { + if x != nil { + return x.Balance + } + return 0 +} + +func (x *Account) GetCreatedAt() *timestamppb.Timestamp { + if x != nil { + return x.CreatedAt + } + return nil +} + +// Request message for retrieving account details. +type GetAccountRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (x *GetAccountRequest) Reset() { + *x = GetAccountRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_entity_domain_account_model_account_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetAccountRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAccountRequest) ProtoMessage() {} + +func (x *GetAccountRequest) ProtoReflect() protoreflect.Message { + mi := &file_entity_domain_account_model_account_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAccountRequest.ProtoReflect.Descriptor instead. +func (*GetAccountRequest) Descriptor() ([]byte, []int) { + return file_entity_domain_account_model_account_proto_rawDescGZIP(), []int{1} +} + +func (x *GetAccountRequest) GetAddress() []byte { + if x != nil { + return x.Address + } + return nil +} + +// Request message for creating a new account. +type CreateAccountRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (x *CreateAccountRequest) Reset() { + *x = CreateAccountRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_entity_domain_account_model_account_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateAccountRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateAccountRequest) ProtoMessage() {} + +func (x *CreateAccountRequest) ProtoReflect() protoreflect.Message { + mi := &file_entity_domain_account_model_account_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateAccountRequest.ProtoReflect.Descriptor instead. +func (*CreateAccountRequest) Descriptor() ([]byte, []int) { + return file_entity_domain_account_model_account_proto_rawDescGZIP(), []int{2} +} + +func (x *CreateAccountRequest) GetAddress() []byte { + if x != nil { + return x.Address + } + return nil +} + +// Request message for retrieving transactions of an account. +type GetAccountTransactionsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (x *GetAccountTransactionsRequest) Reset() { + *x = GetAccountTransactionsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_entity_domain_account_model_account_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetAccountTransactionsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAccountTransactionsRequest) ProtoMessage() {} + +func (x *GetAccountTransactionsRequest) ProtoReflect() protoreflect.Message { + mi := &file_entity_domain_account_model_account_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAccountTransactionsRequest.ProtoReflect.Descriptor instead. +func (*GetAccountTransactionsRequest) Descriptor() ([]byte, []int) { + return file_entity_domain_account_model_account_proto_rawDescGZIP(), []int{3} +} + +func (x *GetAccountTransactionsRequest) GetAddress() []byte { + if x != nil { + return x.Address + } + return nil +} + +var File_entity_domain_account_model_account_proto protoreflect.FileDescriptor + +var file_entity_domain_account_model_account_proto_rawDesc = []byte{ + 0x0a, 0x29, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2f, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x2f, + 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x61, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x61, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x78, 0x0a, 0x07, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x61, + 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x62, 0x61, 0x6c, + 0x61, 0x6e, 0x63, 0x65, 0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, + 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, + 0x2d, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x30, + 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x22, 0x39, 0x0a, 0x1d, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x72, + 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x32, 0x92, 0x01, 0x0a, 0x0e, + 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3c, + 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x2e, 0x61, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x00, 0x12, 0x42, 0x0a, 0x0d, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1d, 0x2e, + 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x61, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x00, + 0x42, 0x3a, 0x5a, 0x38, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, + 0x6c, 0x61, 0x63, 0x6b, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x79, 0x61, 0x2f, 0x72, 0x79, 0x7a, 0x65, + 0x2f, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2f, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x2f, 0x61, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_entity_domain_account_model_account_proto_rawDescOnce sync.Once + file_entity_domain_account_model_account_proto_rawDescData = file_entity_domain_account_model_account_proto_rawDesc +) + +func file_entity_domain_account_model_account_proto_rawDescGZIP() []byte { + file_entity_domain_account_model_account_proto_rawDescOnce.Do(func() { + file_entity_domain_account_model_account_proto_rawDescData = protoimpl.X.CompressGZIP(file_entity_domain_account_model_account_proto_rawDescData) + }) + return file_entity_domain_account_model_account_proto_rawDescData +} + +var file_entity_domain_account_model_account_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_entity_domain_account_model_account_proto_goTypes = []any{ + (*Account)(nil), // 0: account.Account + (*GetAccountRequest)(nil), // 1: account.GetAccountRequest + (*CreateAccountRequest)(nil), // 2: account.CreateAccountRequest + (*GetAccountTransactionsRequest)(nil), // 3: account.GetAccountTransactionsRequest + (*timestamppb.Timestamp)(nil), // 4: google.protobuf.Timestamp +} +var file_entity_domain_account_model_account_proto_depIdxs = []int32{ + 4, // 0: account.Account.created_at:type_name -> google.protobuf.Timestamp + 1, // 1: account.AccountService.GetAccount:input_type -> account.GetAccountRequest + 2, // 2: account.AccountService.CreateAccount:input_type -> account.CreateAccountRequest + 0, // 3: account.AccountService.GetAccount:output_type -> account.Account + 0, // 4: account.AccountService.CreateAccount:output_type -> account.Account + 3, // [3:5] is the sub-list for method output_type + 1, // [1:3] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_entity_domain_account_model_account_proto_init() } +func file_entity_domain_account_model_account_proto_init() { + if File_entity_domain_account_model_account_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_entity_domain_account_model_account_proto_msgTypes[0].Exporter = func(v any, i int) any { + switch v := v.(*Account); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_entity_domain_account_model_account_proto_msgTypes[1].Exporter = func(v any, i int) any { + switch v := v.(*GetAccountRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_entity_domain_account_model_account_proto_msgTypes[2].Exporter = func(v any, i int) any { + switch v := v.(*CreateAccountRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_entity_domain_account_model_account_proto_msgTypes[3].Exporter = func(v any, i int) any { + switch v := v.(*GetAccountTransactionsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_entity_domain_account_model_account_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_entity_domain_account_model_account_proto_goTypes, + DependencyIndexes: file_entity_domain_account_model_account_proto_depIdxs, + MessageInfos: file_entity_domain_account_model_account_proto_msgTypes, + }.Build() + File_entity_domain_account_model_account_proto = out.File + file_entity_domain_account_model_account_proto_rawDesc = nil + file_entity_domain_account_model_account_proto_goTypes = nil + file_entity_domain_account_model_account_proto_depIdxs = nil +} diff --git a/entity/domain/account/model/account_grpc.pb.go b/entity/domain/account/model/account_grpc.pb.go new file mode 100644 index 0000000..d9b9afd --- /dev/null +++ b/entity/domain/account/model/account_grpc.pb.go @@ -0,0 +1,148 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v4.25.3 +// source: entity/domain/account/model/account.proto + +package model + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + AccountService_GetAccount_FullMethodName = "/account.AccountService/GetAccount" + AccountService_CreateAccount_FullMethodName = "/account.AccountService/CreateAccount" +) + +// AccountServiceClient is the client API for AccountService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type AccountServiceClient interface { + // Retrieves the details of an account by address. + GetAccount(ctx context.Context, in *GetAccountRequest, opts ...grpc.CallOption) (*Account, error) + // Creates a new account with the specified address. + CreateAccount(ctx context.Context, in *CreateAccountRequest, opts ...grpc.CallOption) (*Account, error) +} + +type accountServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewAccountServiceClient(cc grpc.ClientConnInterface) AccountServiceClient { + return &accountServiceClient{cc} +} + +func (c *accountServiceClient) GetAccount(ctx context.Context, in *GetAccountRequest, opts ...grpc.CallOption) (*Account, error) { + out := new(Account) + err := c.cc.Invoke(ctx, AccountService_GetAccount_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *accountServiceClient) CreateAccount(ctx context.Context, in *CreateAccountRequest, opts ...grpc.CallOption) (*Account, error) { + out := new(Account) + err := c.cc.Invoke(ctx, AccountService_CreateAccount_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AccountServiceServer is the server API for AccountService service. +// All implementations should embed UnimplementedAccountServiceServer +// for forward compatibility +type AccountServiceServer interface { + // Retrieves the details of an account by address. + GetAccount(context.Context, *GetAccountRequest) (*Account, error) + // Creates a new account with the specified address. + CreateAccount(context.Context, *CreateAccountRequest) (*Account, error) +} + +// UnimplementedAccountServiceServer should be embedded to have forward compatible implementations. +type UnimplementedAccountServiceServer struct { +} + +func (UnimplementedAccountServiceServer) GetAccount(context.Context, *GetAccountRequest) (*Account, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAccount not implemented") +} +func (UnimplementedAccountServiceServer) CreateAccount(context.Context, *CreateAccountRequest) (*Account, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateAccount not implemented") +} + +// UnsafeAccountServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AccountServiceServer will +// result in compilation errors. +type UnsafeAccountServiceServer interface { + mustEmbedUnimplementedAccountServiceServer() +} + +func RegisterAccountServiceServer(s grpc.ServiceRegistrar, srv AccountServiceServer) { + s.RegisterService(&AccountService_ServiceDesc, srv) +} + +func _AccountService_GetAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetAccountRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AccountServiceServer).GetAccount(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AccountService_GetAccount_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AccountServiceServer).GetAccount(ctx, req.(*GetAccountRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AccountService_CreateAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateAccountRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AccountServiceServer).CreateAccount(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AccountService_CreateAccount_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AccountServiceServer).CreateAccount(ctx, req.(*CreateAccountRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// AccountService_ServiceDesc is the grpc.ServiceDesc for AccountService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var AccountService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "account.AccountService", + HandlerType: (*AccountServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetAccount", + Handler: _AccountService_GetAccount_Handler, + }, + { + MethodName: "CreateAccount", + Handler: _AccountService_CreateAccount_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "entity/domain/account/model/account.proto", +} diff --git a/entity/domain/account/model/account_grpc_mock.pb.go b/entity/domain/account/model/account_grpc_mock.pb.go new file mode 100644 index 0000000..5a7e719 --- /dev/null +++ b/entity/domain/account/model/account_grpc_mock.pb.go @@ -0,0 +1,128 @@ +// Code generated by protoc-gen-go-grpc-mock. DO NOT EDIT. +// source: entity/domain/account/model/account.proto + +package model + +import ( + context "context" + reflect "reflect" + + gomock "go.uber.org/mock/gomock" + grpc "google.golang.org/grpc" +) + +// MockAccountServiceClient is a mock of AccountServiceClient interface. +type MockAccountServiceClient struct { + ctrl *gomock.Controller + recorder *MockAccountServiceClientMockRecorder +} + +// MockAccountServiceClientMockRecorder is the mock recorder for MockAccountServiceClient. +type MockAccountServiceClientMockRecorder struct { + mock *MockAccountServiceClient +} + +// NewMockAccountServiceClient creates a new mock instance. +func NewMockAccountServiceClient(ctrl *gomock.Controller) *MockAccountServiceClient { + mock := &MockAccountServiceClient{ctrl: ctrl} + mock.recorder = &MockAccountServiceClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockAccountServiceClient) EXPECT() *MockAccountServiceClientMockRecorder { + return m.recorder +} + +// CreateAccount mocks base method. +func (m *MockAccountServiceClient) CreateAccount(ctx context.Context, in *CreateAccountRequest, opts ...grpc.CallOption) (*Account, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateAccount", varargs...) + ret0, _ := ret[0].(*Account) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateAccount indicates an expected call of CreateAccount. +func (mr *MockAccountServiceClientMockRecorder) CreateAccount(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateAccount", reflect.TypeOf((*MockAccountServiceClient)(nil).CreateAccount), varargs...) +} + +// GetAccount mocks base method. +func (m *MockAccountServiceClient) GetAccount(ctx context.Context, in *GetAccountRequest, opts ...grpc.CallOption) (*Account, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetAccount", varargs...) + ret0, _ := ret[0].(*Account) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetAccount indicates an expected call of GetAccount. +func (mr *MockAccountServiceClientMockRecorder) GetAccount(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccount", reflect.TypeOf((*MockAccountServiceClient)(nil).GetAccount), varargs...) +} + +// MockAccountServiceServer is a mock of AccountServiceServer interface. +type MockAccountServiceServer struct { + ctrl *gomock.Controller + recorder *MockAccountServiceServerMockRecorder +} + +// MockAccountServiceServerMockRecorder is the mock recorder for MockAccountServiceServer. +type MockAccountServiceServerMockRecorder struct { + mock *MockAccountServiceServer +} + +// NewMockAccountServiceServer creates a new mock instance. +func NewMockAccountServiceServer(ctrl *gomock.Controller) *MockAccountServiceServer { + mock := &MockAccountServiceServer{ctrl: ctrl} + mock.recorder = &MockAccountServiceServerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockAccountServiceServer) EXPECT() *MockAccountServiceServerMockRecorder { + return m.recorder +} + +// CreateAccount mocks base method. +func (m *MockAccountServiceServer) CreateAccount(ctx context.Context, in *CreateAccountRequest) (*Account, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateAccount", ctx, in) + ret0, _ := ret[0].(*Account) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateAccount indicates an expected call of CreateAccount. +func (mr *MockAccountServiceServerMockRecorder) CreateAccount(ctx, in interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateAccount", reflect.TypeOf((*MockAccountServiceServer)(nil).CreateAccount), ctx, in) +} + +// GetAccount mocks base method. +func (m *MockAccountServiceServer) GetAccount(ctx context.Context, in *GetAccountRequest) (*Account, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAccount", ctx, in) + ret0, _ := ret[0].(*Account) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetAccount indicates an expected call of GetAccount. +func (mr *MockAccountServiceServerMockRecorder) GetAccount(ctx, in interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccount", reflect.TypeOf((*MockAccountServiceServer)(nil).GetAccount), ctx, in) +} diff --git a/pb/entity/domain/account/model/account.proto b/pb/entity/domain/account/model/account.proto new file mode 100644 index 0000000..87b124f --- /dev/null +++ b/pb/entity/domain/account/model/account.proto @@ -0,0 +1,37 @@ +syntax = "proto3"; +package account; + +option go_package = "github.com/blackhorseya/ryze/entity/domain/account/model"; + +import "google/protobuf/timestamp.proto"; + +// Represents a blockchain account. +message Account { + bytes address = 1; + double balance = 2; + google.protobuf.Timestamp created_at = 3; +} + +// Request message for retrieving account details. +message GetAccountRequest { + bytes address = 1; +} + +// Request message for creating a new account. +message CreateAccountRequest { + bytes address = 1; +} + +// Request message for retrieving transactions of an account. +message GetAccountTransactionsRequest { + bytes address = 1; +} + +// Service definition for managing accounts. +service AccountService { + // Retrieves the details of an account by address. + rpc GetAccount(GetAccountRequest) returns (Account) {} + + // Creates a new account with the specified address. + rpc CreateAccount(CreateAccountRequest) returns (Account) {} +}