-
Notifications
You must be signed in to change notification settings - Fork 39
/
evidence.ts
93 lines (77 loc) · 2.55 KB
/
evidence.ts
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
/* eslint-disable */
import { Timestamp } from "../../../google/protobuf/timestamp";
import { Long, DeepPartial, Exact } from "../../../helpers";
import * as _m0 from "protobufjs/minimal";
export const protobufPackage = "cosmos.evidence.v1beta1";
/**
* Equivocation implements the Evidence interface and defines evidence of double
* signing misbehavior.
*/
export interface Equivocation {
height: Long;
time?: Timestamp;
power: Long;
consensusAddress: string;
}
function createBaseEquivocation(): Equivocation {
return {
height: Long.ZERO,
time: undefined,
power: Long.ZERO,
consensusAddress: "",
};
}
export const Equivocation = {
encode(message: Equivocation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (!message.height.isZero()) {
writer.uint32(8).int64(message.height);
}
if (message.time !== undefined) {
Timestamp.encode(message.time, writer.uint32(18).fork()).ldelim();
}
if (!message.power.isZero()) {
writer.uint32(24).int64(message.power);
}
if (message.consensusAddress !== "") {
writer.uint32(34).string(message.consensusAddress);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): Equivocation {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseEquivocation();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.height = reader.int64() as Long;
break;
case 2:
message.time = Timestamp.decode(reader, reader.uint32());
break;
case 3:
message.power = reader.int64() as Long;
break;
case 4:
message.consensusAddress = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial<I extends Exact<DeepPartial<Equivocation>, I>>(object: I): Equivocation {
const message = createBaseEquivocation();
message.height =
object.height !== undefined && object.height !== null ? Long.fromValue(object.height) : Long.ZERO;
message.time =
object.time !== undefined && object.time !== null ? Timestamp.fromPartial(object.time) : undefined;
message.power =
object.power !== undefined && object.power !== null ? Long.fromValue(object.power) : Long.ZERO;
message.consensusAddress = object.consensusAddress ?? "";
return message;
},
};