-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathtx.ts
444 lines (444 loc) · 17.4 KB
/
tx.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any";
import { BasicAllowance, BasicAllowanceProtoMsg, BasicAllowanceSDKType, PeriodicAllowance, PeriodicAllowanceProtoMsg, PeriodicAllowanceSDKType, AllowedMsgAllowance, AllowedMsgAllowanceProtoMsg, AllowedMsgAllowanceSDKType } from "./feegrant";
import { BinaryReader, BinaryWriter } from "../../../binary";
/**
* MsgGrantAllowance adds permission for Grantee to spend up to Allowance
* of fees from the account of Granter.
*/
export interface MsgGrantAllowance {
/** granter is the address of the user granting an allowance of their funds. */
granter: string;
/** grantee is the address of the user being granted an allowance of another user's funds. */
grantee: string;
/** allowance can be any of basic and filtered fee allowance. */
allowance?: BasicAllowance | PeriodicAllowance | AllowedMsgAllowance | Any | undefined;
}
export interface MsgGrantAllowanceProtoMsg {
typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowance";
value: Uint8Array;
}
export type MsgGrantAllowanceEncoded = Omit<MsgGrantAllowance, "allowance"> & {
/** allowance can be any of basic and filtered fee allowance. */allowance?: BasicAllowanceProtoMsg | PeriodicAllowanceProtoMsg | AllowedMsgAllowanceProtoMsg | AnyProtoMsg | undefined;
};
/**
* MsgGrantAllowance adds permission for Grantee to spend up to Allowance
* of fees from the account of Granter.
*/
export interface MsgGrantAllowanceAmino {
/** granter is the address of the user granting an allowance of their funds. */
granter?: string;
/** grantee is the address of the user being granted an allowance of another user's funds. */
grantee?: string;
/** allowance can be any of basic and filtered fee allowance. */
allowance?: AnyAmino | undefined;
}
export interface MsgGrantAllowanceAminoMsg {
type: "cosmos-sdk/MsgGrantAllowance";
value: MsgGrantAllowanceAmino;
}
/**
* MsgGrantAllowance adds permission for Grantee to spend up to Allowance
* of fees from the account of Granter.
*/
export interface MsgGrantAllowanceSDKType {
granter: string;
grantee: string;
allowance?: BasicAllowanceSDKType | PeriodicAllowanceSDKType | AllowedMsgAllowanceSDKType | AnySDKType | undefined;
}
/** MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response type. */
export interface MsgGrantAllowanceResponse {}
export interface MsgGrantAllowanceResponseProtoMsg {
typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse";
value: Uint8Array;
}
/** MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response type. */
export interface MsgGrantAllowanceResponseAmino {}
export interface MsgGrantAllowanceResponseAminoMsg {
type: "cosmos-sdk/MsgGrantAllowanceResponse";
value: MsgGrantAllowanceResponseAmino;
}
/** MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response type. */
export interface MsgGrantAllowanceResponseSDKType {}
/** MsgRevokeAllowance removes any existing Allowance from Granter to Grantee. */
export interface MsgRevokeAllowance {
/** granter is the address of the user granting an allowance of their funds. */
granter: string;
/** grantee is the address of the user being granted an allowance of another user's funds. */
grantee: string;
}
export interface MsgRevokeAllowanceProtoMsg {
typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowance";
value: Uint8Array;
}
/** MsgRevokeAllowance removes any existing Allowance from Granter to Grantee. */
export interface MsgRevokeAllowanceAmino {
/** granter is the address of the user granting an allowance of their funds. */
granter?: string;
/** grantee is the address of the user being granted an allowance of another user's funds. */
grantee?: string;
}
export interface MsgRevokeAllowanceAminoMsg {
type: "cosmos-sdk/MsgRevokeAllowance";
value: MsgRevokeAllowanceAmino;
}
/** MsgRevokeAllowance removes any existing Allowance from Granter to Grantee. */
export interface MsgRevokeAllowanceSDKType {
granter: string;
grantee: string;
}
/** MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse response type. */
export interface MsgRevokeAllowanceResponse {}
export interface MsgRevokeAllowanceResponseProtoMsg {
typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse";
value: Uint8Array;
}
/** MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse response type. */
export interface MsgRevokeAllowanceResponseAmino {}
export interface MsgRevokeAllowanceResponseAminoMsg {
type: "cosmos-sdk/MsgRevokeAllowanceResponse";
value: MsgRevokeAllowanceResponseAmino;
}
/** MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse response type. */
export interface MsgRevokeAllowanceResponseSDKType {}
function createBaseMsgGrantAllowance(): MsgGrantAllowance {
return {
granter: "",
grantee: "",
allowance: undefined
};
}
export const MsgGrantAllowance = {
typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowance",
encode(message: MsgGrantAllowance, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
if (message.granter !== "") {
writer.uint32(10).string(message.granter);
}
if (message.grantee !== "") {
writer.uint32(18).string(message.grantee);
}
if (message.allowance !== undefined) {
Any.encode((message.allowance as Any), writer.uint32(26).fork()).ldelim();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): MsgGrantAllowance {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgGrantAllowance();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.granter = reader.string();
break;
case 2:
message.grantee = reader.string();
break;
case 3:
message.allowance = (FeeAllowanceI_InterfaceDecoder(reader) as Any);
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(object: Partial<MsgGrantAllowance>): MsgGrantAllowance {
const message = createBaseMsgGrantAllowance();
message.granter = object.granter ?? "";
message.grantee = object.grantee ?? "";
message.allowance = object.allowance !== undefined && object.allowance !== null ? Any.fromPartial(object.allowance) : undefined;
return message;
},
fromAmino(object: MsgGrantAllowanceAmino): MsgGrantAllowance {
const message = createBaseMsgGrantAllowance();
if (object.granter !== undefined && object.granter !== null) {
message.granter = object.granter;
}
if (object.grantee !== undefined && object.grantee !== null) {
message.grantee = object.grantee;
}
if (object.allowance !== undefined && object.allowance !== null) {
message.allowance = FeeAllowanceI_FromAmino(object.allowance);
}
return message;
},
toAmino(message: MsgGrantAllowance): MsgGrantAllowanceAmino {
const obj: any = {};
obj.granter = message.granter === "" ? undefined : message.granter;
obj.grantee = message.grantee === "" ? undefined : message.grantee;
obj.allowance = message.allowance ? FeeAllowanceI_ToAmino((message.allowance as Any)) : undefined;
return obj;
},
fromAminoMsg(object: MsgGrantAllowanceAminoMsg): MsgGrantAllowance {
return MsgGrantAllowance.fromAmino(object.value);
},
toAminoMsg(message: MsgGrantAllowance): MsgGrantAllowanceAminoMsg {
return {
type: "cosmos-sdk/MsgGrantAllowance",
value: MsgGrantAllowance.toAmino(message)
};
},
fromProtoMsg(message: MsgGrantAllowanceProtoMsg): MsgGrantAllowance {
return MsgGrantAllowance.decode(message.value);
},
toProto(message: MsgGrantAllowance): Uint8Array {
return MsgGrantAllowance.encode(message).finish();
},
toProtoMsg(message: MsgGrantAllowance): MsgGrantAllowanceProtoMsg {
return {
typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowance",
value: MsgGrantAllowance.encode(message).finish()
};
}
};
function createBaseMsgGrantAllowanceResponse(): MsgGrantAllowanceResponse {
return {};
}
export const MsgGrantAllowanceResponse = {
typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse",
encode(_: MsgGrantAllowanceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): MsgGrantAllowanceResponse {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgGrantAllowanceResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(_: Partial<MsgGrantAllowanceResponse>): MsgGrantAllowanceResponse {
const message = createBaseMsgGrantAllowanceResponse();
return message;
},
fromAmino(_: MsgGrantAllowanceResponseAmino): MsgGrantAllowanceResponse {
const message = createBaseMsgGrantAllowanceResponse();
return message;
},
toAmino(_: MsgGrantAllowanceResponse): MsgGrantAllowanceResponseAmino {
const obj: any = {};
return obj;
},
fromAminoMsg(object: MsgGrantAllowanceResponseAminoMsg): MsgGrantAllowanceResponse {
return MsgGrantAllowanceResponse.fromAmino(object.value);
},
toAminoMsg(message: MsgGrantAllowanceResponse): MsgGrantAllowanceResponseAminoMsg {
return {
type: "cosmos-sdk/MsgGrantAllowanceResponse",
value: MsgGrantAllowanceResponse.toAmino(message)
};
},
fromProtoMsg(message: MsgGrantAllowanceResponseProtoMsg): MsgGrantAllowanceResponse {
return MsgGrantAllowanceResponse.decode(message.value);
},
toProto(message: MsgGrantAllowanceResponse): Uint8Array {
return MsgGrantAllowanceResponse.encode(message).finish();
},
toProtoMsg(message: MsgGrantAllowanceResponse): MsgGrantAllowanceResponseProtoMsg {
return {
typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse",
value: MsgGrantAllowanceResponse.encode(message).finish()
};
}
};
function createBaseMsgRevokeAllowance(): MsgRevokeAllowance {
return {
granter: "",
grantee: ""
};
}
export const MsgRevokeAllowance = {
typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowance",
encode(message: MsgRevokeAllowance, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
if (message.granter !== "") {
writer.uint32(10).string(message.granter);
}
if (message.grantee !== "") {
writer.uint32(18).string(message.grantee);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeAllowance {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgRevokeAllowance();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.granter = reader.string();
break;
case 2:
message.grantee = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(object: Partial<MsgRevokeAllowance>): MsgRevokeAllowance {
const message = createBaseMsgRevokeAllowance();
message.granter = object.granter ?? "";
message.grantee = object.grantee ?? "";
return message;
},
fromAmino(object: MsgRevokeAllowanceAmino): MsgRevokeAllowance {
const message = createBaseMsgRevokeAllowance();
if (object.granter !== undefined && object.granter !== null) {
message.granter = object.granter;
}
if (object.grantee !== undefined && object.grantee !== null) {
message.grantee = object.grantee;
}
return message;
},
toAmino(message: MsgRevokeAllowance): MsgRevokeAllowanceAmino {
const obj: any = {};
obj.granter = message.granter === "" ? undefined : message.granter;
obj.grantee = message.grantee === "" ? undefined : message.grantee;
return obj;
},
fromAminoMsg(object: MsgRevokeAllowanceAminoMsg): MsgRevokeAllowance {
return MsgRevokeAllowance.fromAmino(object.value);
},
toAminoMsg(message: MsgRevokeAllowance): MsgRevokeAllowanceAminoMsg {
return {
type: "cosmos-sdk/MsgRevokeAllowance",
value: MsgRevokeAllowance.toAmino(message)
};
},
fromProtoMsg(message: MsgRevokeAllowanceProtoMsg): MsgRevokeAllowance {
return MsgRevokeAllowance.decode(message.value);
},
toProto(message: MsgRevokeAllowance): Uint8Array {
return MsgRevokeAllowance.encode(message).finish();
},
toProtoMsg(message: MsgRevokeAllowance): MsgRevokeAllowanceProtoMsg {
return {
typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowance",
value: MsgRevokeAllowance.encode(message).finish()
};
}
};
function createBaseMsgRevokeAllowanceResponse(): MsgRevokeAllowanceResponse {
return {};
}
export const MsgRevokeAllowanceResponse = {
typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse",
encode(_: MsgRevokeAllowanceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeAllowanceResponse {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgRevokeAllowanceResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(_: Partial<MsgRevokeAllowanceResponse>): MsgRevokeAllowanceResponse {
const message = createBaseMsgRevokeAllowanceResponse();
return message;
},
fromAmino(_: MsgRevokeAllowanceResponseAmino): MsgRevokeAllowanceResponse {
const message = createBaseMsgRevokeAllowanceResponse();
return message;
},
toAmino(_: MsgRevokeAllowanceResponse): MsgRevokeAllowanceResponseAmino {
const obj: any = {};
return obj;
},
fromAminoMsg(object: MsgRevokeAllowanceResponseAminoMsg): MsgRevokeAllowanceResponse {
return MsgRevokeAllowanceResponse.fromAmino(object.value);
},
toAminoMsg(message: MsgRevokeAllowanceResponse): MsgRevokeAllowanceResponseAminoMsg {
return {
type: "cosmos-sdk/MsgRevokeAllowanceResponse",
value: MsgRevokeAllowanceResponse.toAmino(message)
};
},
fromProtoMsg(message: MsgRevokeAllowanceResponseProtoMsg): MsgRevokeAllowanceResponse {
return MsgRevokeAllowanceResponse.decode(message.value);
},
toProto(message: MsgRevokeAllowanceResponse): Uint8Array {
return MsgRevokeAllowanceResponse.encode(message).finish();
},
toProtoMsg(message: MsgRevokeAllowanceResponse): MsgRevokeAllowanceResponseProtoMsg {
return {
typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse",
value: MsgRevokeAllowanceResponse.encode(message).finish()
};
}
};
export const FeeAllowanceI_InterfaceDecoder = (input: BinaryReader | Uint8Array): BasicAllowance | PeriodicAllowance | AllowedMsgAllowance | Any => {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const data = Any.decode(reader, reader.uint32());
switch (data.typeUrl) {
case "/cosmos.feegrant.v1beta1.BasicAllowance":
return BasicAllowance.decode(data.value);
case "/cosmos.feegrant.v1beta1.PeriodicAllowance":
return PeriodicAllowance.decode(data.value);
case "/cosmos.feegrant.v1beta1.AllowedMsgAllowance":
return AllowedMsgAllowance.decode(data.value);
default:
return data;
}
};
export const FeeAllowanceI_FromAmino = (content: AnyAmino): Any => {
switch (content.type) {
case "cosmos-sdk/BasicAllowance":
return Any.fromPartial({
typeUrl: "/cosmos.feegrant.v1beta1.BasicAllowance",
value: BasicAllowance.encode(BasicAllowance.fromPartial(BasicAllowance.fromAmino(content.value))).finish()
});
case "cosmos-sdk/PeriodicAllowance":
return Any.fromPartial({
typeUrl: "/cosmos.feegrant.v1beta1.PeriodicAllowance",
value: PeriodicAllowance.encode(PeriodicAllowance.fromPartial(PeriodicAllowance.fromAmino(content.value))).finish()
});
case "cosmos-sdk/AllowedMsgAllowance":
return Any.fromPartial({
typeUrl: "/cosmos.feegrant.v1beta1.AllowedMsgAllowance",
value: AllowedMsgAllowance.encode(AllowedMsgAllowance.fromPartial(AllowedMsgAllowance.fromAmino(content.value))).finish()
});
default:
return Any.fromAmino(content);
}
};
export const FeeAllowanceI_ToAmino = (content: Any) => {
switch (content.typeUrl) {
case "/cosmos.feegrant.v1beta1.BasicAllowance":
return {
type: "cosmos-sdk/BasicAllowance",
value: BasicAllowance.toAmino(BasicAllowance.decode(content.value, undefined))
};
case "/cosmos.feegrant.v1beta1.PeriodicAllowance":
return {
type: "cosmos-sdk/PeriodicAllowance",
value: PeriodicAllowance.toAmino(PeriodicAllowance.decode(content.value, undefined))
};
case "/cosmos.feegrant.v1beta1.AllowedMsgAllowance":
return {
type: "cosmos-sdk/AllowedMsgAllowance",
value: AllowedMsgAllowance.toAmino(AllowedMsgAllowance.decode(content.value, undefined))
};
default:
return Any.toAmino(content);
}
};