-
Notifications
You must be signed in to change notification settings - Fork 22
/
MsgUnjail.ts
98 lines (86 loc) 路 2.56 KB
/
MsgUnjail.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
94
95
96
97
98
import { JSONSerializable } from '../../../util/json';
import { ValAddress } from '../../bech32';
import { Any } from '@terra-money/terra.proto/google/protobuf/any';
import { MsgUnjail as MsgUnjail_pb } from '@terra-money/terra.proto/cosmos/slashing/v1beta1/tx';
/**
* A validator can be jailed by the blockchain if misbehavior is detected, such as
* double-signing or having missed too many vote periods in the Oracle ballot.
*
* This is done to protect delegators' funds from getting slashed further, until the
* validator's issues have been addressed. A jailed validator cannot participate in
* block rewards, and must be manually unjailed by submitting this message.
*/
export class MsgUnjail extends JSONSerializable<
MsgUnjail.Amino,
MsgUnjail.Data,
MsgUnjail.Proto
> {
/**
* @param address validator's operator address
*/
constructor(public address: ValAddress) {
super();
}
public static fromAmino(data: MsgUnjail.Amino, _?: boolean): MsgUnjail {
_;
const {
value: { address },
} = data;
return new MsgUnjail(address);
}
public toAmino(isClassic?: boolean): MsgUnjail.Amino {
const { address } = this;
return {
type: isClassic ? 'slashing/MsgUnjail' : 'cosmos-sdk/MsgUnjail',
value: {
address,
},
};
}
public static fromData(proto: MsgUnjail.Data, _?: boolean): MsgUnjail {
_;
const { address } = proto;
return new MsgUnjail(address);
}
public toData(_?: boolean): MsgUnjail.Data {
_;
const { address } = this;
return {
'@type': '/cosmos.slashing.v1beta1.MsgUnjail',
address,
};
}
public static fromProto(proto: MsgUnjail.Proto, _?: boolean): MsgUnjail {
_;
return new MsgUnjail(proto.validatorAddr);
}
public toProto(_?: boolean): MsgUnjail.Proto {
_;
const { address } = this;
return MsgUnjail_pb.fromPartial({
validatorAddr: address,
});
}
public packAny(isClassic?: boolean): Any {
return Any.fromPartial({
typeUrl: '/cosmos.slashing.v1beta1.MsgUnjail',
value: MsgUnjail_pb.encode(this.toProto(isClassic)).finish(),
});
}
public static unpackAny(msgAny: Any, isClassic?: boolean): MsgUnjail {
return MsgUnjail.fromProto(MsgUnjail_pb.decode(msgAny.value), isClassic);
}
}
export namespace MsgUnjail {
export interface Amino {
type: 'slashing/MsgUnjail' | 'cosmos-sdk/MsgUnjail';
value: {
address: ValAddress;
};
}
export interface Data {
'@type': '/cosmos.slashing.v1beta1.MsgUnjail';
address: ValAddress;
}
export type Proto = MsgUnjail_pb;
}