-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
chainkit_grpc.pb.go
229 lines (209 loc) · 8.56 KB
/
chainkit_grpc.pb.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
package chainrpc
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
// ChainKitClient is the client API for ChainKit 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 ChainKitClient interface {
// lncli: `chain getblock`
// GetBlock returns a block given the corresponding block hash.
GetBlock(ctx context.Context, in *GetBlockRequest, opts ...grpc.CallOption) (*GetBlockResponse, error)
// lncli: `chain getblockheader`
// GetBlockHeader returns a block header with a particular block hash.
GetBlockHeader(ctx context.Context, in *GetBlockHeaderRequest, opts ...grpc.CallOption) (*GetBlockHeaderResponse, error)
// lncli: `chain getbestblock`
// GetBestBlock returns the block hash and current height from the valid
// most-work chain.
GetBestBlock(ctx context.Context, in *GetBestBlockRequest, opts ...grpc.CallOption) (*GetBestBlockResponse, error)
// lncli: `chain getblockhash`
// GetBlockHash returns the hash of the block in the best blockchain
// at the given height.
GetBlockHash(ctx context.Context, in *GetBlockHashRequest, opts ...grpc.CallOption) (*GetBlockHashResponse, error)
}
type chainKitClient struct {
cc grpc.ClientConnInterface
}
func NewChainKitClient(cc grpc.ClientConnInterface) ChainKitClient {
return &chainKitClient{cc}
}
func (c *chainKitClient) GetBlock(ctx context.Context, in *GetBlockRequest, opts ...grpc.CallOption) (*GetBlockResponse, error) {
out := new(GetBlockResponse)
err := c.cc.Invoke(ctx, "/chainrpc.ChainKit/GetBlock", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *chainKitClient) GetBlockHeader(ctx context.Context, in *GetBlockHeaderRequest, opts ...grpc.CallOption) (*GetBlockHeaderResponse, error) {
out := new(GetBlockHeaderResponse)
err := c.cc.Invoke(ctx, "/chainrpc.ChainKit/GetBlockHeader", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *chainKitClient) GetBestBlock(ctx context.Context, in *GetBestBlockRequest, opts ...grpc.CallOption) (*GetBestBlockResponse, error) {
out := new(GetBestBlockResponse)
err := c.cc.Invoke(ctx, "/chainrpc.ChainKit/GetBestBlock", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *chainKitClient) GetBlockHash(ctx context.Context, in *GetBlockHashRequest, opts ...grpc.CallOption) (*GetBlockHashResponse, error) {
out := new(GetBlockHashResponse)
err := c.cc.Invoke(ctx, "/chainrpc.ChainKit/GetBlockHash", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// ChainKitServer is the server API for ChainKit service.
// All implementations must embed UnimplementedChainKitServer
// for forward compatibility
type ChainKitServer interface {
// lncli: `chain getblock`
// GetBlock returns a block given the corresponding block hash.
GetBlock(context.Context, *GetBlockRequest) (*GetBlockResponse, error)
// lncli: `chain getblockheader`
// GetBlockHeader returns a block header with a particular block hash.
GetBlockHeader(context.Context, *GetBlockHeaderRequest) (*GetBlockHeaderResponse, error)
// lncli: `chain getbestblock`
// GetBestBlock returns the block hash and current height from the valid
// most-work chain.
GetBestBlock(context.Context, *GetBestBlockRequest) (*GetBestBlockResponse, error)
// lncli: `chain getblockhash`
// GetBlockHash returns the hash of the block in the best blockchain
// at the given height.
GetBlockHash(context.Context, *GetBlockHashRequest) (*GetBlockHashResponse, error)
mustEmbedUnimplementedChainKitServer()
}
// UnimplementedChainKitServer must be embedded to have forward compatible implementations.
type UnimplementedChainKitServer struct {
}
func (UnimplementedChainKitServer) GetBlock(context.Context, *GetBlockRequest) (*GetBlockResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetBlock not implemented")
}
func (UnimplementedChainKitServer) GetBlockHeader(context.Context, *GetBlockHeaderRequest) (*GetBlockHeaderResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetBlockHeader not implemented")
}
func (UnimplementedChainKitServer) GetBestBlock(context.Context, *GetBestBlockRequest) (*GetBestBlockResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetBestBlock not implemented")
}
func (UnimplementedChainKitServer) GetBlockHash(context.Context, *GetBlockHashRequest) (*GetBlockHashResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetBlockHash not implemented")
}
func (UnimplementedChainKitServer) mustEmbedUnimplementedChainKitServer() {}
// UnsafeChainKitServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ChainKitServer will
// result in compilation errors.
type UnsafeChainKitServer interface {
mustEmbedUnimplementedChainKitServer()
}
func RegisterChainKitServer(s grpc.ServiceRegistrar, srv ChainKitServer) {
s.RegisterService(&ChainKit_ServiceDesc, srv)
}
func _ChainKit_GetBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetBlockRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ChainKitServer).GetBlock(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/chainrpc.ChainKit/GetBlock",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ChainKitServer).GetBlock(ctx, req.(*GetBlockRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ChainKit_GetBlockHeader_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetBlockHeaderRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ChainKitServer).GetBlockHeader(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/chainrpc.ChainKit/GetBlockHeader",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ChainKitServer).GetBlockHeader(ctx, req.(*GetBlockHeaderRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ChainKit_GetBestBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetBestBlockRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ChainKitServer).GetBestBlock(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/chainrpc.ChainKit/GetBestBlock",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ChainKitServer).GetBestBlock(ctx, req.(*GetBestBlockRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ChainKit_GetBlockHash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetBlockHashRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ChainKitServer).GetBlockHash(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/chainrpc.ChainKit/GetBlockHash",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ChainKitServer).GetBlockHash(ctx, req.(*GetBlockHashRequest))
}
return interceptor(ctx, in, info, handler)
}
// ChainKit_ServiceDesc is the grpc.ServiceDesc for ChainKit service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var ChainKit_ServiceDesc = grpc.ServiceDesc{
ServiceName: "chainrpc.ChainKit",
HandlerType: (*ChainKitServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetBlock",
Handler: _ChainKit_GetBlock_Handler,
},
{
MethodName: "GetBlockHeader",
Handler: _ChainKit_GetBlockHeader_Handler,
},
{
MethodName: "GetBestBlock",
Handler: _ChainKit_GetBestBlock_Handler,
},
{
MethodName: "GetBlockHash",
Handler: _ChainKit_GetBlockHash_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "chainrpc/chainkit.proto",
}