-
Notifications
You must be signed in to change notification settings - Fork 0
/
mock_client.go
69 lines (57 loc) · 2.27 KB
/
mock_client.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
//nolint:lll
package tendermintv1beta1
import (
"context"
tendermintv1beta1 "cosmossdk.io/api/cosmos/base/tendermint/v1beta1"
types "cosmossdk.io/api/tendermint/types"
"google.golang.org/grpc"
)
type MockClient struct {
// Client represents network client
Client tendermintv1beta1.ServiceClient
}
func (c MockClient) GetLatestBlock(ctx context.Context, in *tendermintv1beta1.GetLatestBlockRequest, opts ...grpc.CallOption) (*tendermintv1beta1.GetLatestBlockResponse, error) {
block := &types.Block{
Header: &types.Header{
Height: 10,
},
}
blockID := &types.BlockID{
Hash: []byte{},
}
resp := &tendermintv1beta1.GetLatestBlockResponse{
Block: block,
BlockId: blockID,
}
return resp, nil
}
func (c MockClient) GetNodeInfo(ctx context.Context, in *tendermintv1beta1.GetNodeInfoRequest, opts ...grpc.CallOption) (*tendermintv1beta1.GetNodeInfoResponse, error) {
return &tendermintv1beta1.GetNodeInfoResponse{}, nil
}
func (c MockClient) GetSyncing(ctx context.Context, in *tendermintv1beta1.GetSyncingRequest, opts ...grpc.CallOption) (*tendermintv1beta1.GetSyncingResponse, error) {
return &tendermintv1beta1.GetSyncingResponse{}, nil
}
func (c MockClient) GetBlockByHeight(ctx context.Context, in *tendermintv1beta1.GetBlockByHeightRequest, opts ...grpc.CallOption) (*tendermintv1beta1.GetBlockByHeightResponse, error) {
block := &types.Block{
Header: &types.Header{
Height: 10,
},
}
blockID := &types.BlockID{
Hash: []byte{},
}
resp := &tendermintv1beta1.GetBlockByHeightResponse{
Block: block,
BlockId: blockID,
}
return resp, nil
}
func (c MockClient) GetLatestValidatorSet(ctx context.Context, in *tendermintv1beta1.GetLatestValidatorSetRequest, opts ...grpc.CallOption) (*tendermintv1beta1.GetLatestValidatorSetResponse, error) {
return &tendermintv1beta1.GetLatestValidatorSetResponse{}, nil
}
func (c MockClient) GetValidatorSetByHeight(ctx context.Context, in *tendermintv1beta1.GetValidatorSetByHeightRequest, opts ...grpc.CallOption) (*tendermintv1beta1.GetValidatorSetByHeightResponse, error) {
return &tendermintv1beta1.GetValidatorSetByHeightResponse{}, nil
}
func (c MockClient) ABCIQuery(ctx context.Context, in *tendermintv1beta1.ABCIQueryRequest, opts ...grpc.CallOption) (*tendermintv1beta1.ABCIQueryResponse, error) {
return nil, nil
}