-
Notifications
You must be signed in to change notification settings - Fork 39
/
tx.ts
163 lines (134 loc) · 4.67 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
/* eslint-disable */
import { Coin } from "../../base/v1beta1/coin";
import { Long, DeepPartial, Exact, Rpc } from "../../../helpers";
import * as _m0 from "protobufjs/minimal";
export const protobufPackage = "cosmos.vesting.v1beta1";
/**
* MsgCreateVestingAccount defines a message that enables creating a vesting
* account.
*/
export interface MsgCreateVestingAccount {
fromAddress: string;
toAddress: string;
amount: Coin[];
endTime: Long;
delayed: boolean;
}
/** MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. */
export interface MsgCreateVestingAccountResponse {}
function createBaseMsgCreateVestingAccount(): MsgCreateVestingAccount {
return {
fromAddress: "",
toAddress: "",
amount: [],
endTime: Long.ZERO,
delayed: false,
};
}
export const MsgCreateVestingAccount = {
encode(message: MsgCreateVestingAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.fromAddress !== "") {
writer.uint32(10).string(message.fromAddress);
}
if (message.toAddress !== "") {
writer.uint32(18).string(message.toAddress);
}
for (const v of message.amount) {
Coin.encode(v!, writer.uint32(26).fork()).ldelim();
}
if (!message.endTime.isZero()) {
writer.uint32(32).int64(message.endTime);
}
if (message.delayed === true) {
writer.uint32(40).bool(message.delayed);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateVestingAccount {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgCreateVestingAccount();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.fromAddress = reader.string();
break;
case 2:
message.toAddress = reader.string();
break;
case 3:
message.amount.push(Coin.decode(reader, reader.uint32()));
break;
case 4:
message.endTime = reader.int64() as Long;
break;
case 5:
message.delayed = reader.bool();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial<I extends Exact<DeepPartial<MsgCreateVestingAccount>, I>>(object: I): MsgCreateVestingAccount {
const message = createBaseMsgCreateVestingAccount();
message.fromAddress = object.fromAddress ?? "";
message.toAddress = object.toAddress ?? "";
message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || [];
message.endTime =
object.endTime !== undefined && object.endTime !== null ? Long.fromValue(object.endTime) : Long.ZERO;
message.delayed = object.delayed ?? false;
return message;
},
};
function createBaseMsgCreateVestingAccountResponse(): MsgCreateVestingAccountResponse {
return {};
}
export const MsgCreateVestingAccountResponse = {
encode(_: MsgCreateVestingAccountResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateVestingAccountResponse {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgCreateVestingAccountResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial<I extends Exact<DeepPartial<MsgCreateVestingAccountResponse>, I>>(
_: I,
): MsgCreateVestingAccountResponse {
const message = createBaseMsgCreateVestingAccountResponse();
return message;
},
};
/** Msg defines the bank Msg service. */
export interface Msg {
/**
* CreateVestingAccount defines a method that enables creating a vesting
* account.
*/
CreateVestingAccount(request: MsgCreateVestingAccount): Promise<MsgCreateVestingAccountResponse>;
}
export class MsgClientImpl implements Msg {
private readonly rpc: Rpc;
constructor(rpc: Rpc) {
this.rpc = rpc;
this.CreateVestingAccount = this.CreateVestingAccount.bind(this);
}
CreateVestingAccount(request: MsgCreateVestingAccount): Promise<MsgCreateVestingAccountResponse> {
const data = MsgCreateVestingAccount.encode(request).finish();
const promise = this.rpc.request("cosmos.vesting.v1beta1.Msg", "CreateVestingAccount", data);
return promise.then((data) => MsgCreateVestingAccountResponse.decode(new _m0.Reader(data)));
}
}