/
MsgAggregateExchangeRatePrevote.ts
116 lines (104 loc) · 3.1 KB
/
MsgAggregateExchangeRatePrevote.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import { JSONSerializable } from '../../../util/json';
import { AccAddress, ValAddress } from '../../bech32';
import { Any } from '@terra-money/terra.proto/google/protobuf/any';
import { MsgAggregateExchangeRatePrevote as MsgAggregateExchangeRatePrevote_pb } from '@terra-money/terra.proto/terra/oracle/v1beta1/tx';
/**
* Aggregate analog of MsgExchangeRatePrevote
*/
export class MsgAggregateExchangeRatePrevote extends JSONSerializable<
MsgAggregateExchangeRatePrevote.Amino,
MsgAggregateExchangeRatePrevote.Data,
MsgAggregateExchangeRatePrevote.Proto
> {
/**
* @param hash vote hash
* @param feeder validator's feeder account address
* @param validator validator's operator address
*/
constructor(
public hash: string,
public feeder: AccAddress,
public validator: ValAddress
) {
super();
}
public static fromAmino(
data: MsgAggregateExchangeRatePrevote.Amino
): MsgAggregateExchangeRatePrevote {
const {
value: { hash, feeder, validator },
} = data;
return new MsgAggregateExchangeRatePrevote(hash, feeder, validator);
}
public toAmino(): MsgAggregateExchangeRatePrevote.Amino {
const { hash, feeder, validator } = this;
return {
type: 'oracle/MsgAggregateExchangeRatePrevote',
value: {
hash,
feeder,
validator,
},
};
}
public static fromData(
data: MsgAggregateExchangeRatePrevote.Data
): MsgAggregateExchangeRatePrevote {
const { hash, feeder, validator } = data;
return new MsgAggregateExchangeRatePrevote(hash, feeder, validator);
}
public toData(): MsgAggregateExchangeRatePrevote.Data {
const { hash, feeder, validator } = this;
return {
'@type': '/terra.oracle.v1beta1.MsgAggregateExchangeRatePrevote',
hash,
feeder,
validator,
};
}
public static fromProto(
proto: MsgAggregateExchangeRatePrevote.Proto
): MsgAggregateExchangeRatePrevote {
return new MsgAggregateExchangeRatePrevote(
proto.hash,
proto.feeder,
proto.validator
);
}
public toProto(): MsgAggregateExchangeRatePrevote.Proto {
const { hash, feeder, validator } = this;
return MsgAggregateExchangeRatePrevote_pb.fromPartial({
hash,
feeder,
validator,
});
}
public packAny(): Any {
return Any.fromPartial({
typeUrl: '/terra.oracle.v1beta1.MsgAggregateExchangeRatePrevote',
value: MsgAggregateExchangeRatePrevote_pb.encode(this.toProto()).finish(),
});
}
public static unpackAny(msgAny: Any): MsgAggregateExchangeRatePrevote {
return MsgAggregateExchangeRatePrevote.fromProto(
MsgAggregateExchangeRatePrevote_pb.decode(msgAny.value)
);
}
}
export namespace MsgAggregateExchangeRatePrevote {
export interface Amino {
type: 'oracle/MsgAggregateExchangeRatePrevote';
value: {
hash: string;
feeder: AccAddress;
validator: ValAddress;
};
}
export interface Data {
'@type': '/terra.oracle.v1beta1.MsgAggregateExchangeRatePrevote';
hash: string;
feeder: AccAddress;
validator: ValAddress;
}
export type Proto = MsgAggregateExchangeRatePrevote_pb;
}