diff --git a/release/go/spacemesh/v2alpha1/reward.pb.go b/release/go/spacemesh/v2alpha1/reward.pb.go new file mode 100644 index 00000000..220dd92c --- /dev/null +++ b/release/go/spacemesh/v2alpha1/reward.pb.go @@ -0,0 +1,641 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc (unknown) +// source: spacemesh/v2alpha1/reward.proto + +package spacemeshv2alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + 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) +) + +type Reward struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Versioned: + // + // *Reward_V1 + Versioned isReward_Versioned `protobuf_oneof:"versioned"` +} + +func (x *Reward) Reset() { + *x = Reward{} + if protoimpl.UnsafeEnabled { + mi := &file_spacemesh_v2alpha1_reward_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Reward) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Reward) ProtoMessage() {} + +func (x *Reward) ProtoReflect() protoreflect.Message { + mi := &file_spacemesh_v2alpha1_reward_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 Reward.ProtoReflect.Descriptor instead. +func (*Reward) Descriptor() ([]byte, []int) { + return file_spacemesh_v2alpha1_reward_proto_rawDescGZIP(), []int{0} +} + +func (m *Reward) GetVersioned() isReward_Versioned { + if m != nil { + return m.Versioned + } + return nil +} + +func (x *Reward) GetV1() *RewardV1 { + if x, ok := x.GetVersioned().(*Reward_V1); ok { + return x.V1 + } + return nil +} + +type isReward_Versioned interface { + isReward_Versioned() +} + +type Reward_V1 struct { + V1 *RewardV1 `protobuf:"bytes,1,opt,name=v1,proto3,oneof"` +} + +func (*Reward_V1) isReward_Versioned() {} + +type RewardV1 struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Layer uint32 `protobuf:"varint,1,opt,name=layer,proto3" json:"layer,omitempty"` // layer award was paid in + Total uint64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` // total reward paid in smidge (sum of tx fee and layer reward) + LayerReward uint64 `protobuf:"varint,3,opt,name=layer_reward,json=layerReward,proto3" json:"layer_reward,omitempty"` // tx_fee = total - layer_reward + Coinbase string `protobuf:"bytes,5,opt,name=coinbase,proto3" json:"coinbase,omitempty"` // account awarded this reward + Smesher []byte `protobuf:"bytes,6,opt,name=smesher,proto3" json:"smesher,omitempty"` // id of smesher who earned this reward +} + +func (x *RewardV1) Reset() { + *x = RewardV1{} + if protoimpl.UnsafeEnabled { + mi := &file_spacemesh_v2alpha1_reward_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RewardV1) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RewardV1) ProtoMessage() {} + +func (x *RewardV1) ProtoReflect() protoreflect.Message { + mi := &file_spacemesh_v2alpha1_reward_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 RewardV1.ProtoReflect.Descriptor instead. +func (*RewardV1) Descriptor() ([]byte, []int) { + return file_spacemesh_v2alpha1_reward_proto_rawDescGZIP(), []int{1} +} + +func (x *RewardV1) GetLayer() uint32 { + if x != nil { + return x.Layer + } + return 0 +} + +func (x *RewardV1) GetTotal() uint64 { + if x != nil { + return x.Total + } + return 0 +} + +func (x *RewardV1) GetLayerReward() uint64 { + if x != nil { + return x.LayerReward + } + return 0 +} + +func (x *RewardV1) GetCoinbase() string { + if x != nil { + return x.Coinbase + } + return "" +} + +func (x *RewardV1) GetSmesher() []byte { + if x != nil { + return x.Smesher + } + return nil +} + +type RewardRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + StartLayer uint32 `protobuf:"varint,1,opt,name=start_layer,json=startLayer,proto3" json:"start_layer,omitempty"` + EndLayer uint32 `protobuf:"varint,2,opt,name=end_layer,json=endLayer,proto3" json:"end_layer,omitempty"` + // Types that are assignable to FilterBy: + // + // *RewardRequest_Coinbase + // *RewardRequest_Smesher + FilterBy isRewardRequest_FilterBy `protobuf_oneof:"filter_by"` + Offset uint64 `protobuf:"varint,5,opt,name=offset,proto3" json:"offset,omitempty"` // adjusts the starting point for data + Limit uint64 `protobuf:"varint,6,opt,name=limit,proto3" json:"limit,omitempty"` // specifies max number of items to fetch +} + +func (x *RewardRequest) Reset() { + *x = RewardRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_spacemesh_v2alpha1_reward_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RewardRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RewardRequest) ProtoMessage() {} + +func (x *RewardRequest) ProtoReflect() protoreflect.Message { + mi := &file_spacemesh_v2alpha1_reward_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 RewardRequest.ProtoReflect.Descriptor instead. +func (*RewardRequest) Descriptor() ([]byte, []int) { + return file_spacemesh_v2alpha1_reward_proto_rawDescGZIP(), []int{2} +} + +func (x *RewardRequest) GetStartLayer() uint32 { + if x != nil { + return x.StartLayer + } + return 0 +} + +func (x *RewardRequest) GetEndLayer() uint32 { + if x != nil { + return x.EndLayer + } + return 0 +} + +func (m *RewardRequest) GetFilterBy() isRewardRequest_FilterBy { + if m != nil { + return m.FilterBy + } + return nil +} + +func (x *RewardRequest) GetCoinbase() string { + if x, ok := x.GetFilterBy().(*RewardRequest_Coinbase); ok { + return x.Coinbase + } + return "" +} + +func (x *RewardRequest) GetSmesher() []byte { + if x, ok := x.GetFilterBy().(*RewardRequest_Smesher); ok { + return x.Smesher + } + return nil +} + +func (x *RewardRequest) GetOffset() uint64 { + if x != nil { + return x.Offset + } + return 0 +} + +func (x *RewardRequest) GetLimit() uint64 { + if x != nil { + return x.Limit + } + return 0 +} + +type isRewardRequest_FilterBy interface { + isRewardRequest_FilterBy() +} + +type RewardRequest_Coinbase struct { + Coinbase string `protobuf:"bytes,3,opt,name=coinbase,proto3,oneof"` +} + +type RewardRequest_Smesher struct { + Smesher []byte `protobuf:"bytes,4,opt,name=smesher,proto3,oneof"` +} + +func (*RewardRequest_Coinbase) isRewardRequest_FilterBy() {} + +func (*RewardRequest_Smesher) isRewardRequest_FilterBy() {} + +type RewardList struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Rewards []*Reward `protobuf:"bytes,1,rep,name=rewards,proto3" json:"rewards,omitempty"` +} + +func (x *RewardList) Reset() { + *x = RewardList{} + if protoimpl.UnsafeEnabled { + mi := &file_spacemesh_v2alpha1_reward_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RewardList) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RewardList) ProtoMessage() {} + +func (x *RewardList) ProtoReflect() protoreflect.Message { + mi := &file_spacemesh_v2alpha1_reward_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 RewardList.ProtoReflect.Descriptor instead. +func (*RewardList) Descriptor() ([]byte, []int) { + return file_spacemesh_v2alpha1_reward_proto_rawDescGZIP(), []int{3} +} + +func (x *RewardList) GetRewards() []*Reward { + if x != nil { + return x.Rewards + } + return nil +} + +type RewardStreamRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + StartLayer uint32 `protobuf:"varint,1,opt,name=start_layer,json=startLayer,proto3" json:"start_layer,omitempty"` + EndLayer uint32 `protobuf:"varint,2,opt,name=end_layer,json=endLayer,proto3" json:"end_layer,omitempty"` + // Types that are assignable to FilterBy: + // + // *RewardStreamRequest_Coinbase + // *RewardStreamRequest_Smesher + FilterBy isRewardStreamRequest_FilterBy `protobuf_oneof:"filter_by"` + Watch bool `protobuf:"varint,5,opt,name=watch,proto3" json:"watch,omitempty"` +} + +func (x *RewardStreamRequest) Reset() { + *x = RewardStreamRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_spacemesh_v2alpha1_reward_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RewardStreamRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RewardStreamRequest) ProtoMessage() {} + +func (x *RewardStreamRequest) ProtoReflect() protoreflect.Message { + mi := &file_spacemesh_v2alpha1_reward_proto_msgTypes[4] + 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 RewardStreamRequest.ProtoReflect.Descriptor instead. +func (*RewardStreamRequest) Descriptor() ([]byte, []int) { + return file_spacemesh_v2alpha1_reward_proto_rawDescGZIP(), []int{4} +} + +func (x *RewardStreamRequest) GetStartLayer() uint32 { + if x != nil { + return x.StartLayer + } + return 0 +} + +func (x *RewardStreamRequest) GetEndLayer() uint32 { + if x != nil { + return x.EndLayer + } + return 0 +} + +func (m *RewardStreamRequest) GetFilterBy() isRewardStreamRequest_FilterBy { + if m != nil { + return m.FilterBy + } + return nil +} + +func (x *RewardStreamRequest) GetCoinbase() string { + if x, ok := x.GetFilterBy().(*RewardStreamRequest_Coinbase); ok { + return x.Coinbase + } + return "" +} + +func (x *RewardStreamRequest) GetSmesher() []byte { + if x, ok := x.GetFilterBy().(*RewardStreamRequest_Smesher); ok { + return x.Smesher + } + return nil +} + +func (x *RewardStreamRequest) GetWatch() bool { + if x != nil { + return x.Watch + } + return false +} + +type isRewardStreamRequest_FilterBy interface { + isRewardStreamRequest_FilterBy() +} + +type RewardStreamRequest_Coinbase struct { + Coinbase string `protobuf:"bytes,3,opt,name=coinbase,proto3,oneof"` +} + +type RewardStreamRequest_Smesher struct { + Smesher []byte `protobuf:"bytes,4,opt,name=smesher,proto3,oneof"` +} + +func (*RewardStreamRequest_Coinbase) isRewardStreamRequest_FilterBy() {} + +func (*RewardStreamRequest_Smesher) isRewardStreamRequest_FilterBy() {} + +var File_spacemesh_v2alpha1_reward_proto protoreflect.FileDescriptor + +var file_spacemesh_v2alpha1_reward_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x6d, 0x65, 0x73, 0x68, 0x2f, 0x76, 0x32, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2f, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x12, 0x73, 0x70, 0x61, 0x63, 0x65, 0x6d, 0x65, 0x73, 0x68, 0x2e, 0x76, 0x32, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x22, 0x45, 0x0a, 0x06, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, + 0x2e, 0x0a, 0x02, 0x76, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x6d, 0x65, 0x73, 0x68, 0x2e, 0x76, 0x32, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x56, 0x31, 0x48, 0x00, 0x52, 0x02, 0x76, 0x31, 0x42, + 0x0b, 0x0a, 0x09, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x64, 0x22, 0x8f, 0x01, 0x0a, + 0x08, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x56, 0x31, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x61, 0x79, + 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x12, + 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, + 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x21, 0x0a, 0x0c, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x72, + 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6c, 0x61, 0x79, + 0x65, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x69, 0x6e, + 0x62, 0x61, 0x73, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x69, 0x6e, + 0x62, 0x61, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x6d, 0x65, 0x73, 0x68, 0x65, 0x72, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x6d, 0x65, 0x73, 0x68, 0x65, 0x72, 0x22, 0xc2, + 0x01, 0x0a, 0x0d, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4c, 0x61, 0x79, 0x65, + 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x5f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x12, 0x1c, + 0x0a, 0x08, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x48, 0x00, 0x52, 0x08, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x07, + 0x73, 0x6d, 0x65, 0x73, 0x68, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, + 0x07, 0x73, 0x6d, 0x65, 0x73, 0x68, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, + 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x42, 0x0b, 0x0a, 0x09, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, + 0x5f, 0x62, 0x79, 0x22, 0x42, 0x0a, 0x0a, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x4c, 0x69, 0x73, + 0x74, 0x12, 0x34, 0x0a, 0x07, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x6d, 0x65, 0x73, 0x68, 0x2e, 0x76, + 0x32, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x07, + 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, 0x22, 0xb0, 0x01, 0x0a, 0x13, 0x52, 0x65, 0x77, 0x61, + 0x72, 0x64, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x1f, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4c, 0x61, 0x79, 0x65, 0x72, + 0x12, 0x1b, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x5f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x12, 0x1c, 0x0a, + 0x08, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, + 0x00, 0x52, 0x08, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x07, 0x73, + 0x6d, 0x65, 0x73, 0x68, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x07, + 0x73, 0x6d, 0x65, 0x73, 0x68, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x61, 0x74, 0x63, 0x68, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x77, 0x61, 0x74, 0x63, 0x68, 0x42, 0x0b, 0x0a, + 0x09, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x5f, 0x62, 0x79, 0x32, 0x5a, 0x0a, 0x0d, 0x52, 0x65, + 0x77, 0x61, 0x72, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x49, 0x0a, 0x04, 0x4c, + 0x69, 0x73, 0x74, 0x12, 0x21, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x6d, 0x65, 0x73, 0x68, 0x2e, + 0x76, 0x32, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x6d, 0x65, + 0x73, 0x68, 0x2e, 0x76, 0x32, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x77, 0x61, + 0x72, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x32, 0x66, 0x0a, 0x13, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, + 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4f, 0x0a, + 0x06, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x27, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x6d, + 0x65, 0x73, 0x68, 0x2e, 0x76, 0x32, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x77, + 0x61, 0x72, 0x64, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1a, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x6d, 0x65, 0x73, 0x68, 0x2e, 0x76, 0x32, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x30, 0x01, 0x42, 0xda, + 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x6d, 0x65, 0x73, 0x68, + 0x2e, 0x76, 0x32, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x0b, 0x52, 0x65, 0x77, 0x61, 0x72, + 0x64, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x4a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x6d, 0x65, 0x73, 0x68, 0x6f, 0x73, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x2f, 0x67, 0x6f, 0x2f, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x6d, 0x65, 0x73, 0x68, 0x2f, 0x76, 0x32, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x3b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x6d, 0x65, 0x73, 0x68, 0x76, 0x32, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x53, 0x58, 0x58, 0xaa, 0x02, 0x12, 0x53, 0x70, 0x61, + 0x63, 0x65, 0x6d, 0x65, 0x73, 0x68, 0x2e, 0x56, 0x32, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, + 0x02, 0x12, 0x53, 0x70, 0x61, 0x63, 0x65, 0x6d, 0x65, 0x73, 0x68, 0x5c, 0x56, 0x32, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x1e, 0x53, 0x70, 0x61, 0x63, 0x65, 0x6d, 0x65, 0x73, 0x68, + 0x5c, 0x56, 0x32, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x13, 0x53, 0x70, 0x61, 0x63, 0x65, 0x6d, 0x65, 0x73, + 0x68, 0x3a, 0x3a, 0x56, 0x32, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var ( + file_spacemesh_v2alpha1_reward_proto_rawDescOnce sync.Once + file_spacemesh_v2alpha1_reward_proto_rawDescData = file_spacemesh_v2alpha1_reward_proto_rawDesc +) + +func file_spacemesh_v2alpha1_reward_proto_rawDescGZIP() []byte { + file_spacemesh_v2alpha1_reward_proto_rawDescOnce.Do(func() { + file_spacemesh_v2alpha1_reward_proto_rawDescData = protoimpl.X.CompressGZIP(file_spacemesh_v2alpha1_reward_proto_rawDescData) + }) + return file_spacemesh_v2alpha1_reward_proto_rawDescData +} + +var file_spacemesh_v2alpha1_reward_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_spacemesh_v2alpha1_reward_proto_goTypes = []interface{}{ + (*Reward)(nil), // 0: spacemesh.v2alpha1.Reward + (*RewardV1)(nil), // 1: spacemesh.v2alpha1.RewardV1 + (*RewardRequest)(nil), // 2: spacemesh.v2alpha1.RewardRequest + (*RewardList)(nil), // 3: spacemesh.v2alpha1.RewardList + (*RewardStreamRequest)(nil), // 4: spacemesh.v2alpha1.RewardStreamRequest +} +var file_spacemesh_v2alpha1_reward_proto_depIdxs = []int32{ + 1, // 0: spacemesh.v2alpha1.Reward.v1:type_name -> spacemesh.v2alpha1.RewardV1 + 0, // 1: spacemesh.v2alpha1.RewardList.rewards:type_name -> spacemesh.v2alpha1.Reward + 2, // 2: spacemesh.v2alpha1.RewardService.List:input_type -> spacemesh.v2alpha1.RewardRequest + 4, // 3: spacemesh.v2alpha1.RewardStreamService.Stream:input_type -> spacemesh.v2alpha1.RewardStreamRequest + 3, // 4: spacemesh.v2alpha1.RewardService.List:output_type -> spacemesh.v2alpha1.RewardList + 0, // 5: spacemesh.v2alpha1.RewardStreamService.Stream:output_type -> spacemesh.v2alpha1.Reward + 4, // [4:6] is the sub-list for method output_type + 2, // [2:4] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_spacemesh_v2alpha1_reward_proto_init() } +func file_spacemesh_v2alpha1_reward_proto_init() { + if File_spacemesh_v2alpha1_reward_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_spacemesh_v2alpha1_reward_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Reward); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_spacemesh_v2alpha1_reward_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RewardV1); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_spacemesh_v2alpha1_reward_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RewardRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_spacemesh_v2alpha1_reward_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RewardList); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_spacemesh_v2alpha1_reward_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RewardStreamRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_spacemesh_v2alpha1_reward_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*Reward_V1)(nil), + } + file_spacemesh_v2alpha1_reward_proto_msgTypes[2].OneofWrappers = []interface{}{ + (*RewardRequest_Coinbase)(nil), + (*RewardRequest_Smesher)(nil), + } + file_spacemesh_v2alpha1_reward_proto_msgTypes[4].OneofWrappers = []interface{}{ + (*RewardStreamRequest_Coinbase)(nil), + (*RewardStreamRequest_Smesher)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_spacemesh_v2alpha1_reward_proto_rawDesc, + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 2, + }, + GoTypes: file_spacemesh_v2alpha1_reward_proto_goTypes, + DependencyIndexes: file_spacemesh_v2alpha1_reward_proto_depIdxs, + MessageInfos: file_spacemesh_v2alpha1_reward_proto_msgTypes, + }.Build() + File_spacemesh_v2alpha1_reward_proto = out.File + file_spacemesh_v2alpha1_reward_proto_rawDesc = nil + file_spacemesh_v2alpha1_reward_proto_goTypes = nil + file_spacemesh_v2alpha1_reward_proto_depIdxs = nil +} diff --git a/release/go/spacemesh/v2alpha1/reward.pb.gw.go b/release/go/spacemesh/v2alpha1/reward.pb.gw.go new file mode 100644 index 00000000..21a515ea --- /dev/null +++ b/release/go/spacemesh/v2alpha1/reward.pb.gw.go @@ -0,0 +1,283 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: spacemesh/v2alpha1/reward.proto + +/* +Package spacemeshv2alpha1 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package spacemeshv2alpha1 + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_RewardService_List_0(ctx context.Context, marshaler runtime.Marshaler, client RewardServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq RewardRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.List(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_RewardService_List_0(ctx context.Context, marshaler runtime.Marshaler, server RewardServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq RewardRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.List(ctx, &protoReq) + return msg, metadata, err + +} + +func request_RewardStreamService_Stream_0(ctx context.Context, marshaler runtime.Marshaler, client RewardStreamServiceClient, req *http.Request, pathParams map[string]string) (RewardStreamService_StreamClient, runtime.ServerMetadata, error) { + var protoReq RewardStreamRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + stream, err := client.Stream(ctx, &protoReq) + if err != nil { + return nil, metadata, err + } + header, err := stream.Header() + if err != nil { + return nil, metadata, err + } + metadata.HeaderMD = header + return stream, metadata, nil + +} + +// RegisterRewardServiceHandlerServer registers the http handlers for service RewardService to "mux". +// UnaryRPC :call RewardServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterRewardServiceHandlerFromEndpoint instead. +func RegisterRewardServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server RewardServiceServer) error { + + mux.Handle("POST", pattern_RewardService_List_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) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/spacemesh.v2alpha1.RewardService/List", runtime.WithHTTPPathPattern("/spacemesh.v2alpha1.RewardService/List")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_RewardService_List_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_RewardService_List_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterRewardStreamServiceHandlerServer registers the http handlers for service RewardStreamService to "mux". +// UnaryRPC :call RewardStreamServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterRewardStreamServiceHandlerFromEndpoint instead. +func RegisterRewardStreamServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server RewardStreamServiceServer) error { + + mux.Handle("POST", pattern_RewardStreamService_Stream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") + _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + }) + + return nil +} + +// RegisterRewardServiceHandlerFromEndpoint is same as RegisterRewardServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterRewardServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.DialContext(ctx, endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterRewardServiceHandler(ctx, mux, conn) +} + +// RegisterRewardServiceHandler registers the http handlers for service RewardService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterRewardServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterRewardServiceHandlerClient(ctx, mux, NewRewardServiceClient(conn)) +} + +// RegisterRewardServiceHandlerClient registers the http handlers for service RewardService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "RewardServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "RewardServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "RewardServiceClient" to call the correct interceptors. +func RegisterRewardServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client RewardServiceClient) error { + + mux.Handle("POST", pattern_RewardService_List_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) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/spacemesh.v2alpha1.RewardService/List", runtime.WithHTTPPathPattern("/spacemesh.v2alpha1.RewardService/List")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_RewardService_List_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_RewardService_List_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_RewardService_List_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"spacemesh.v2alpha1.RewardService", "List"}, "")) +) + +var ( + forward_RewardService_List_0 = runtime.ForwardResponseMessage +) + +// RegisterRewardStreamServiceHandlerFromEndpoint is same as RegisterRewardStreamServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterRewardStreamServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.DialContext(ctx, endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterRewardStreamServiceHandler(ctx, mux, conn) +} + +// RegisterRewardStreamServiceHandler registers the http handlers for service RewardStreamService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterRewardStreamServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterRewardStreamServiceHandlerClient(ctx, mux, NewRewardStreamServiceClient(conn)) +} + +// RegisterRewardStreamServiceHandlerClient registers the http handlers for service RewardStreamService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "RewardStreamServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "RewardStreamServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "RewardStreamServiceClient" to call the correct interceptors. +func RegisterRewardStreamServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client RewardStreamServiceClient) error { + + mux.Handle("POST", pattern_RewardStreamService_Stream_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) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/spacemesh.v2alpha1.RewardStreamService/Stream", runtime.WithHTTPPathPattern("/spacemesh.v2alpha1.RewardStreamService/Stream")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_RewardStreamService_Stream_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_RewardStreamService_Stream_0(annotatedContext, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_RewardStreamService_Stream_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"spacemesh.v2alpha1.RewardStreamService", "Stream"}, "")) +) + +var ( + forward_RewardStreamService_Stream_0 = runtime.ForwardResponseStream +) diff --git a/release/go/spacemesh/v2alpha1/reward_grpc.pb.go b/release/go/spacemesh/v2alpha1/reward_grpc.pb.go new file mode 100644 index 00000000..c3ea40c5 --- /dev/null +++ b/release/go/spacemesh/v2alpha1/reward_grpc.pb.go @@ -0,0 +1,222 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: spacemesh/v2alpha1/reward.proto + +package spacemeshv2alpha1 + +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 ( + RewardService_List_FullMethodName = "/spacemesh.v2alpha1.RewardService/List" +) + +// RewardServiceClient is the client API for RewardService 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 RewardServiceClient interface { + List(ctx context.Context, in *RewardRequest, opts ...grpc.CallOption) (*RewardList, error) +} + +type rewardServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewRewardServiceClient(cc grpc.ClientConnInterface) RewardServiceClient { + return &rewardServiceClient{cc} +} + +func (c *rewardServiceClient) List(ctx context.Context, in *RewardRequest, opts ...grpc.CallOption) (*RewardList, error) { + out := new(RewardList) + err := c.cc.Invoke(ctx, RewardService_List_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// RewardServiceServer is the server API for RewardService service. +// All implementations should embed UnimplementedRewardServiceServer +// for forward compatibility +type RewardServiceServer interface { + List(context.Context, *RewardRequest) (*RewardList, error) +} + +// UnimplementedRewardServiceServer should be embedded to have forward compatible implementations. +type UnimplementedRewardServiceServer struct { +} + +func (UnimplementedRewardServiceServer) List(context.Context, *RewardRequest) (*RewardList, error) { + return nil, status.Errorf(codes.Unimplemented, "method List not implemented") +} + +// UnsafeRewardServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to RewardServiceServer will +// result in compilation errors. +type UnsafeRewardServiceServer interface { + mustEmbedUnimplementedRewardServiceServer() +} + +func RegisterRewardServiceServer(s grpc.ServiceRegistrar, srv RewardServiceServer) { + s.RegisterService(&RewardService_ServiceDesc, srv) +} + +func _RewardService_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RewardRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RewardServiceServer).List(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RewardService_List_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RewardServiceServer).List(ctx, req.(*RewardRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// RewardService_ServiceDesc is the grpc.ServiceDesc for RewardService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var RewardService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "spacemesh.v2alpha1.RewardService", + HandlerType: (*RewardServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "List", + Handler: _RewardService_List_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "spacemesh/v2alpha1/reward.proto", +} + +const ( + RewardStreamService_Stream_FullMethodName = "/spacemesh.v2alpha1.RewardStreamService/Stream" +) + +// RewardStreamServiceClient is the client API for RewardStreamService 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 RewardStreamServiceClient interface { + Stream(ctx context.Context, in *RewardStreamRequest, opts ...grpc.CallOption) (RewardStreamService_StreamClient, error) +} + +type rewardStreamServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewRewardStreamServiceClient(cc grpc.ClientConnInterface) RewardStreamServiceClient { + return &rewardStreamServiceClient{cc} +} + +func (c *rewardStreamServiceClient) Stream(ctx context.Context, in *RewardStreamRequest, opts ...grpc.CallOption) (RewardStreamService_StreamClient, error) { + stream, err := c.cc.NewStream(ctx, &RewardStreamService_ServiceDesc.Streams[0], RewardStreamService_Stream_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &rewardStreamServiceStreamClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type RewardStreamService_StreamClient interface { + Recv() (*Reward, error) + grpc.ClientStream +} + +type rewardStreamServiceStreamClient struct { + grpc.ClientStream +} + +func (x *rewardStreamServiceStreamClient) Recv() (*Reward, error) { + m := new(Reward) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// RewardStreamServiceServer is the server API for RewardStreamService service. +// All implementations should embed UnimplementedRewardStreamServiceServer +// for forward compatibility +type RewardStreamServiceServer interface { + Stream(*RewardStreamRequest, RewardStreamService_StreamServer) error +} + +// UnimplementedRewardStreamServiceServer should be embedded to have forward compatible implementations. +type UnimplementedRewardStreamServiceServer struct { +} + +func (UnimplementedRewardStreamServiceServer) Stream(*RewardStreamRequest, RewardStreamService_StreamServer) error { + return status.Errorf(codes.Unimplemented, "method Stream not implemented") +} + +// UnsafeRewardStreamServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to RewardStreamServiceServer will +// result in compilation errors. +type UnsafeRewardStreamServiceServer interface { + mustEmbedUnimplementedRewardStreamServiceServer() +} + +func RegisterRewardStreamServiceServer(s grpc.ServiceRegistrar, srv RewardStreamServiceServer) { + s.RegisterService(&RewardStreamService_ServiceDesc, srv) +} + +func _RewardStreamService_Stream_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(RewardStreamRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(RewardStreamServiceServer).Stream(m, &rewardStreamServiceStreamServer{stream}) +} + +type RewardStreamService_StreamServer interface { + Send(*Reward) error + grpc.ServerStream +} + +type rewardStreamServiceStreamServer struct { + grpc.ServerStream +} + +func (x *rewardStreamServiceStreamServer) Send(m *Reward) error { + return x.ServerStream.SendMsg(m) +} + +// RewardStreamService_ServiceDesc is the grpc.ServiceDesc for RewardStreamService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var RewardStreamService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "spacemesh.v2alpha1.RewardStreamService", + HandlerType: (*RewardStreamServiceServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "Stream", + Handler: _RewardStreamService_Stream_Handler, + ServerStreams: true, + }, + }, + Metadata: "spacemesh/v2alpha1/reward.proto", +} diff --git a/spacemesh/v2alpha1/reward.proto b/spacemesh/v2alpha1/reward.proto new file mode 100644 index 00000000..a47f6c4f --- /dev/null +++ b/spacemesh/v2alpha1/reward.proto @@ -0,0 +1,50 @@ +syntax = "proto3"; + +package spacemesh.v2alpha1; + +message Reward { + oneof versioned { + RewardV1 v1 = 1; + } +} + +message RewardV1 { + uint32 layer = 1; // layer award was paid in + uint64 total = 2; // total reward paid in smidge (sum of tx fee and layer reward) + uint64 layer_reward = 3; // tx_fee = total - layer_reward + string coinbase = 5; // account awarded this reward + bytes smesher = 6; // id of smesher who earned this reward +} + +message RewardRequest { + uint32 start_layer = 1; + uint32 end_layer = 2; + oneof filter_by { + string coinbase = 3; + bytes smesher = 4; + } + uint64 offset = 5; // adjusts the starting point for data + uint64 limit = 6; // specifies max number of items to fetch +} + +message RewardList { + repeated Reward rewards = 1; +} + +service RewardService { + rpc List(RewardRequest) returns (RewardList); +} + +message RewardStreamRequest { + uint32 start_layer = 1; + uint32 end_layer = 2; + oneof filter_by { + string coinbase = 3; + bytes smesher = 4; + } + bool watch = 5; +} + +service RewardStreamService { + rpc Stream(RewardStreamRequest) returns (stream Reward); +} \ No newline at end of file