diff --git a/rpcprotos/gen_protos.sh b/rpcprotos/gen_protos.sh new file mode 100755 index 00000000..b04f9191 --- /dev/null +++ b/rpcprotos/gen_protos.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +protoc -I . rpc.proto --go_out=plugins=grpc:. diff --git a/rpcprotos/rpc.pb.go b/rpcprotos/rpc.pb.go new file mode 100644 index 00000000..cf2a9dcb --- /dev/null +++ b/rpcprotos/rpc.pb.go @@ -0,0 +1,156 @@ +// Code generated by protoc-gen-go. +// source: rpc.proto +// DO NOT EDIT! + +/* +Package lnrpc is a generated protocol buffer package. + +It is generated from these files: + rpc.proto + +It has these top-level messages: + SendManyRequest + SendManyResponse + NewAddressRequest + NewAddressResponse +*/ +package lnrpc + +import proto "github.com/golang/protobuf/proto" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal + +type SendManyRequest struct { + AddrToAmount map[string]uint64 `protobuf:"bytes,1,rep" json:"AddrToAmount,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` +} + +func (m *SendManyRequest) Reset() { *m = SendManyRequest{} } +func (m *SendManyRequest) String() string { return proto.CompactTextString(m) } +func (*SendManyRequest) ProtoMessage() {} + +func (m *SendManyRequest) GetAddrToAmount() map[string]uint64 { + if m != nil { + return m.AddrToAmount + } + return nil +} + +type SendManyResponse struct { + Txid string `protobuf:"bytes,1,opt,name=txid" json:"txid,omitempty"` +} + +func (m *SendManyResponse) Reset() { *m = SendManyResponse{} } +func (m *SendManyResponse) String() string { return proto.CompactTextString(m) } +func (*SendManyResponse) ProtoMessage() {} + +type NewAddressRequest struct { +} + +func (m *NewAddressRequest) Reset() { *m = NewAddressRequest{} } +func (m *NewAddressRequest) String() string { return proto.CompactTextString(m) } +func (*NewAddressRequest) ProtoMessage() {} + +type NewAddressResponse struct { + Address string `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"` +} + +func (m *NewAddressResponse) Reset() { *m = NewAddressResponse{} } +func (m *NewAddressResponse) String() string { return proto.CompactTextString(m) } +func (*NewAddressResponse) ProtoMessage() {} + +func init() { +} + +// Client API for LightningServer service + +type LightningServerClient interface { + SendMany(ctx context.Context, in *SendManyRequest, opts ...grpc.CallOption) (*SendManyResponse, error) + NewAddress(ctx context.Context, in *NewAddressRequest, opts ...grpc.CallOption) (*NewAddressResponse, error) +} + +type lightningServerClient struct { + cc *grpc.ClientConn +} + +func NewLightningServerClient(cc *grpc.ClientConn) LightningServerClient { + return &lightningServerClient{cc} +} + +func (c *lightningServerClient) SendMany(ctx context.Context, in *SendManyRequest, opts ...grpc.CallOption) (*SendManyResponse, error) { + out := new(SendManyResponse) + err := grpc.Invoke(ctx, "/lnrpc.LightningServer/SendMany", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *lightningServerClient) NewAddress(ctx context.Context, in *NewAddressRequest, opts ...grpc.CallOption) (*NewAddressResponse, error) { + out := new(NewAddressResponse) + err := grpc.Invoke(ctx, "/lnrpc.LightningServer/NewAddress", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for LightningServer service + +type LightningServerServer interface { + SendMany(context.Context, *SendManyRequest) (*SendManyResponse, error) + NewAddress(context.Context, *NewAddressRequest) (*NewAddressResponse, error) +} + +func RegisterLightningServerServer(s *grpc.Server, srv LightningServerServer) { + s.RegisterService(&_LightningServer_serviceDesc, srv) +} + +func _LightningServer_SendMany_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) { + in := new(SendManyRequest) + if err := codec.Unmarshal(buf, in); err != nil { + return nil, err + } + out, err := srv.(LightningServerServer).SendMany(ctx, in) + if err != nil { + return nil, err + } + return out, nil +} + +func _LightningServer_NewAddress_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) { + in := new(NewAddressRequest) + if err := codec.Unmarshal(buf, in); err != nil { + return nil, err + } + out, err := srv.(LightningServerServer).NewAddress(ctx, in) + if err != nil { + return nil, err + } + return out, nil +} + +var _LightningServer_serviceDesc = grpc.ServiceDesc{ + ServiceName: "lnrpc.LightningServer", + HandlerType: (*LightningServerServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SendMany", + Handler: _LightningServer_SendMany_Handler, + }, + { + MethodName: "NewAddress", + Handler: _LightningServer_NewAddress_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, +} diff --git a/rpcprotos/rpc.proto b/rpcprotos/rpc.proto new file mode 100644 index 00000000..bd0d57e6 --- /dev/null +++ b/rpcprotos/rpc.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; + +package lnrpc; + +service LightningServer { + rpc SendMany(SendManyRequest) returns (SendManyResponse); + rpc NewAddress(NewAddressRequest) returns (NewAddressResponse); +} + +message SendManyRequest { + map AddrToAmount = 1; +} +message SendManyResponse { + string txid = 1; +} + + +message NewAddressRequest {} +message NewAddressResponse { + string address = 1; +}