rpcprotos: add protos for basic wallet usage

This commit is contained in:
Olaoluwa Osuntokun 2015-12-29 16:47:24 -06:00
parent e07e7cfec9
commit dcd9e69d90
3 changed files with 180 additions and 0 deletions

3
rpcprotos/gen_protos.sh Executable file

@ -0,0 +1,3 @@
#!/bin/sh
protoc -I . rpc.proto --go_out=plugins=grpc:.

156
rpcprotos/rpc.pb.go Normal file

@ -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{},
}

21
rpcprotos/rpc.proto Normal file

@ -0,0 +1,21 @@
syntax = "proto3";
package lnrpc;
service LightningServer {
rpc SendMany(SendManyRequest) returns (SendManyResponse);
rpc NewAddress(NewAddressRequest) returns (NewAddressResponse);
}
message SendManyRequest {
map<string, uint64> AddrToAmount = 1;
}
message SendManyResponse {
string txid = 1;
}
message NewAddressRequest {}
message NewAddressResponse {
string address = 1;
}