Skip to content

Commit 85200cd

Browse files
committed
Register new upgrade module messages
1 parent ddcc772 commit 85200cd

File tree

3 files changed

+300
-0
lines changed

3 files changed

+300
-0
lines changed

scripts/define-proto.sh

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ protoc \
7171
"$COSMOS_PROTO_DIR/cosmos/tx/v1beta1/tx.proto" \
7272
"$COSMOS_PROTO_DIR/cosmos/upgrade/v1beta1/query.proto" \
7373
"$COSMOS_PROTO_DIR/cosmos/upgrade/v1beta1/upgrade.proto" \
74+
"$COSMOS_PROTO_DIR/cosmos/upgrade/v1beta1/tx.proto" \
7475
"$COSMOS_PROTO_DIR/cosmos/vesting/v1beta1/tx.proto" \
7576
"$COSMOS_PROTO_DIR/cosmos/vesting/v1beta1/vesting.proto" \
7677
"$IBC_PROTO_DIR/ibc/applications/interchain_accounts/controller/v1/controller.proto" \
+296
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,296 @@
1+
/* eslint-disable */
2+
import Long from 'long';
3+
import _m0 from 'protobufjs/minimal';
4+
import { Plan } from '../../../cosmos/upgrade/v1beta1/upgrade';
5+
6+
export const protobufPackage = 'cosmos.upgrade.v1beta1';
7+
8+
/** Since: cosmos-sdk 0.46 */
9+
10+
/**
11+
* MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type.
12+
*
13+
* Since: cosmos-sdk 0.46
14+
*/
15+
export interface MsgSoftwareUpgrade {
16+
/** authority is the address of the governance account. */
17+
authority: string;
18+
/** plan is the upgrade plan. */
19+
plan?: Plan;
20+
}
21+
22+
/**
23+
* MsgSoftwareUpgradeResponse is the Msg/SoftwareUpgrade response type.
24+
*
25+
* Since: cosmos-sdk 0.46
26+
*/
27+
export interface MsgSoftwareUpgradeResponse {}
28+
29+
/**
30+
* MsgCancelUpgrade is the Msg/CancelUpgrade request type.
31+
*
32+
* Since: cosmos-sdk 0.46
33+
*/
34+
export interface MsgCancelUpgrade {
35+
/** authority is the address of the governance account. */
36+
authority: string;
37+
}
38+
39+
/**
40+
* MsgCancelUpgradeResponse is the Msg/CancelUpgrade response type.
41+
*
42+
* Since: cosmos-sdk 0.46
43+
*/
44+
export interface MsgCancelUpgradeResponse {}
45+
46+
const baseMsgSoftwareUpgrade: object = { authority: '' };
47+
48+
export const MsgSoftwareUpgrade = {
49+
encode(message: MsgSoftwareUpgrade, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
50+
if (message.authority !== '') {
51+
writer.uint32(10).string(message.authority);
52+
}
53+
if (message.plan !== undefined) {
54+
Plan.encode(message.plan, writer.uint32(18).fork()).ldelim();
55+
}
56+
return writer;
57+
},
58+
59+
decode(input: _m0.Reader | Uint8Array, length?: number): MsgSoftwareUpgrade {
60+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
61+
let end = length === undefined ? reader.len : reader.pos + length;
62+
const message = { ...baseMsgSoftwareUpgrade } as MsgSoftwareUpgrade;
63+
while (reader.pos < end) {
64+
const tag = reader.uint32();
65+
switch (tag >>> 3) {
66+
case 1:
67+
message.authority = reader.string();
68+
break;
69+
case 2:
70+
message.plan = Plan.decode(reader, reader.uint32());
71+
break;
72+
default:
73+
reader.skipType(tag & 7);
74+
break;
75+
}
76+
}
77+
return message;
78+
},
79+
80+
fromJSON(object: any): MsgSoftwareUpgrade {
81+
const message = { ...baseMsgSoftwareUpgrade } as MsgSoftwareUpgrade;
82+
if (object.authority !== undefined && object.authority !== null) {
83+
message.authority = String(object.authority);
84+
} else {
85+
message.authority = '';
86+
}
87+
if (object.plan !== undefined && object.plan !== null) {
88+
message.plan = Plan.fromJSON(object.plan);
89+
} else {
90+
message.plan = undefined;
91+
}
92+
return message;
93+
},
94+
95+
toJSON(message: MsgSoftwareUpgrade): unknown {
96+
const obj: any = {};
97+
message.authority !== undefined && (obj.authority = message.authority);
98+
message.plan !== undefined && (obj.plan = message.plan ? Plan.toJSON(message.plan) : undefined);
99+
return obj;
100+
},
101+
102+
fromPartial(object: DeepPartial<MsgSoftwareUpgrade>): MsgSoftwareUpgrade {
103+
const message = { ...baseMsgSoftwareUpgrade } as MsgSoftwareUpgrade;
104+
message.authority = object.authority ?? '';
105+
if (object.plan !== undefined && object.plan !== null) {
106+
message.plan = Plan.fromPartial(object.plan);
107+
} else {
108+
message.plan = undefined;
109+
}
110+
return message;
111+
},
112+
};
113+
114+
const baseMsgSoftwareUpgradeResponse: object = {};
115+
116+
export const MsgSoftwareUpgradeResponse = {
117+
encode(_: MsgSoftwareUpgradeResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
118+
return writer;
119+
},
120+
121+
decode(input: _m0.Reader | Uint8Array, length?: number): MsgSoftwareUpgradeResponse {
122+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
123+
let end = length === undefined ? reader.len : reader.pos + length;
124+
const message = { ...baseMsgSoftwareUpgradeResponse } as MsgSoftwareUpgradeResponse;
125+
while (reader.pos < end) {
126+
const tag = reader.uint32();
127+
switch (tag >>> 3) {
128+
default:
129+
reader.skipType(tag & 7);
130+
break;
131+
}
132+
}
133+
return message;
134+
},
135+
136+
fromJSON(_: any): MsgSoftwareUpgradeResponse {
137+
const message = { ...baseMsgSoftwareUpgradeResponse } as MsgSoftwareUpgradeResponse;
138+
return message;
139+
},
140+
141+
toJSON(_: MsgSoftwareUpgradeResponse): unknown {
142+
const obj: any = {};
143+
return obj;
144+
},
145+
146+
fromPartial(_: DeepPartial<MsgSoftwareUpgradeResponse>): MsgSoftwareUpgradeResponse {
147+
const message = { ...baseMsgSoftwareUpgradeResponse } as MsgSoftwareUpgradeResponse;
148+
return message;
149+
},
150+
};
151+
152+
const baseMsgCancelUpgrade: object = { authority: '' };
153+
154+
export const MsgCancelUpgrade = {
155+
encode(message: MsgCancelUpgrade, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
156+
if (message.authority !== '') {
157+
writer.uint32(10).string(message.authority);
158+
}
159+
return writer;
160+
},
161+
162+
decode(input: _m0.Reader | Uint8Array, length?: number): MsgCancelUpgrade {
163+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
164+
let end = length === undefined ? reader.len : reader.pos + length;
165+
const message = { ...baseMsgCancelUpgrade } as MsgCancelUpgrade;
166+
while (reader.pos < end) {
167+
const tag = reader.uint32();
168+
switch (tag >>> 3) {
169+
case 1:
170+
message.authority = reader.string();
171+
break;
172+
default:
173+
reader.skipType(tag & 7);
174+
break;
175+
}
176+
}
177+
return message;
178+
},
179+
180+
fromJSON(object: any): MsgCancelUpgrade {
181+
const message = { ...baseMsgCancelUpgrade } as MsgCancelUpgrade;
182+
if (object.authority !== undefined && object.authority !== null) {
183+
message.authority = String(object.authority);
184+
} else {
185+
message.authority = '';
186+
}
187+
return message;
188+
},
189+
190+
toJSON(message: MsgCancelUpgrade): unknown {
191+
const obj: any = {};
192+
message.authority !== undefined && (obj.authority = message.authority);
193+
return obj;
194+
},
195+
196+
fromPartial(object: DeepPartial<MsgCancelUpgrade>): MsgCancelUpgrade {
197+
const message = { ...baseMsgCancelUpgrade } as MsgCancelUpgrade;
198+
message.authority = object.authority ?? '';
199+
return message;
200+
},
201+
};
202+
203+
const baseMsgCancelUpgradeResponse: object = {};
204+
205+
export const MsgCancelUpgradeResponse = {
206+
encode(_: MsgCancelUpgradeResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
207+
return writer;
208+
},
209+
210+
decode(input: _m0.Reader | Uint8Array, length?: number): MsgCancelUpgradeResponse {
211+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
212+
let end = length === undefined ? reader.len : reader.pos + length;
213+
const message = { ...baseMsgCancelUpgradeResponse } as MsgCancelUpgradeResponse;
214+
while (reader.pos < end) {
215+
const tag = reader.uint32();
216+
switch (tag >>> 3) {
217+
default:
218+
reader.skipType(tag & 7);
219+
break;
220+
}
221+
}
222+
return message;
223+
},
224+
225+
fromJSON(_: any): MsgCancelUpgradeResponse {
226+
const message = { ...baseMsgCancelUpgradeResponse } as MsgCancelUpgradeResponse;
227+
return message;
228+
},
229+
230+
toJSON(_: MsgCancelUpgradeResponse): unknown {
231+
const obj: any = {};
232+
return obj;
233+
},
234+
235+
fromPartial(_: DeepPartial<MsgCancelUpgradeResponse>): MsgCancelUpgradeResponse {
236+
const message = { ...baseMsgCancelUpgradeResponse } as MsgCancelUpgradeResponse;
237+
return message;
238+
},
239+
};
240+
241+
/** Msg defines the upgrade Msg service. */
242+
export interface Msg {
243+
/**
244+
* SoftwareUpgrade is a governance operation for initiating a software upgrade.
245+
*
246+
* Since: cosmos-sdk 0.46
247+
*/
248+
SoftwareUpgrade(request: MsgSoftwareUpgrade): Promise<MsgSoftwareUpgradeResponse>;
249+
/**
250+
* CancelUpgrade is a governance operation for cancelling a previously
251+
* approvid software upgrade.
252+
*
253+
* Since: cosmos-sdk 0.46
254+
*/
255+
CancelUpgrade(request: MsgCancelUpgrade): Promise<MsgCancelUpgradeResponse>;
256+
}
257+
258+
export class MsgClientImpl implements Msg {
259+
private readonly rpc: Rpc;
260+
constructor(rpc: Rpc) {
261+
this.rpc = rpc;
262+
this.SoftwareUpgrade = this.SoftwareUpgrade.bind(this);
263+
this.CancelUpgrade = this.CancelUpgrade.bind(this);
264+
}
265+
SoftwareUpgrade(request: MsgSoftwareUpgrade): Promise<MsgSoftwareUpgradeResponse> {
266+
const data = MsgSoftwareUpgrade.encode(request).finish();
267+
const promise = this.rpc.request('cosmos.upgrade.v1beta1.Msg', 'SoftwareUpgrade', data);
268+
return promise.then((data) => MsgSoftwareUpgradeResponse.decode(new _m0.Reader(data)));
269+
}
270+
271+
CancelUpgrade(request: MsgCancelUpgrade): Promise<MsgCancelUpgradeResponse> {
272+
const data = MsgCancelUpgrade.encode(request).finish();
273+
const promise = this.rpc.request('cosmos.upgrade.v1beta1.Msg', 'CancelUpgrade', data);
274+
return promise.then((data) => MsgCancelUpgradeResponse.decode(new _m0.Reader(data)));
275+
}
276+
}
277+
278+
interface Rpc {
279+
request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
280+
}
281+
282+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined | Long;
283+
export type DeepPartial<T> = T extends Builtin
284+
? T
285+
: T extends Array<infer U>
286+
? Array<DeepPartial<U>>
287+
: T extends ReadonlyArray<infer U>
288+
? ReadonlyArray<DeepPartial<U>>
289+
: T extends {}
290+
? { [K in keyof T]?: DeepPartial<T[K]> }
291+
: Partial<T>;
292+
293+
if (_m0.util.Long !== Long) {
294+
_m0.util.Long = Long as any;
295+
_m0.configure();
296+
}

src/registry/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { Proposal as ProposalV1 } from '../codec/cosmos/gov/v1/gov';
1818
import { ParameterChangeProposal } from '../codec/cosmos/params/v1beta1/params';
1919
import { MsgUnjail } from '../codec/cosmos/slashing/v1beta1/tx';
2020
import { MsgBeginRedelegate, MsgCreateValidator, MsgDelegate, MsgEditValidator, MsgUndelegate } from '../codec/cosmos/staking/v1beta1/tx';
21+
import { MsgCancelUpgrade, MsgSoftwareUpgrade } from '../codec/cosmos/upgrade/v1beta1/tx';
2122
import { CancelSoftwareUpgradeProposal, SoftwareUpgradeProposal } from '../codec/cosmos/upgrade/v1beta1/upgrade';
2223
import { BaseVestingAccount, ContinuousVestingAccount, DelayedVestingAccount, PeriodicVestingAccount } from '../codec/cosmos/vesting/v1beta1/vesting';
2324
import { MsgCreateVestingAccount } from '../codec/cosmos/vesting/v1beta1/tx';
@@ -82,6 +83,8 @@ const registryTypes: Iterable<[string, GeneratedType]> = [
8283
['/cosmos.staking.v1beta1.MsgDelegate', MsgDelegate],
8384
['/cosmos.staking.v1beta1.MsgEditValidator', MsgEditValidator],
8485
['/cosmos.staking.v1beta1.MsgUndelegate', MsgUndelegate],
86+
['/cosmos.upgrade.v1beta1.MsgCancelUpgrade', MsgCancelUpgrade],
87+
['/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade', MsgSoftwareUpgrade],
8588
['/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal', SoftwareUpgradeProposal],
8689
['/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal', CancelSoftwareUpgradeProposal],
8790
['/cosmos.vesting.v1beta1.BaseVestingAccount', BaseVestingAccount],

0 commit comments

Comments
 (0)