-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathibc.ts
251 lines (251 loc) · 8.31 KB
/
ibc.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
import { BinaryReader, BinaryWriter } from "../../../binary";
import { bytesFromBase64, base64FromBytes } from "../../../helpers";
/** MsgIBCSend */
export interface MsgIBCSend {
/** the channel by which the packet will be sent */
channel: string;
/**
* Timeout height relative to the current block height.
* The timeout is disabled when set to 0.
*/
timeoutHeight: bigint;
/**
* Timeout timestamp (in nanoseconds) relative to the current block timestamp.
* The timeout is disabled when set to 0.
*/
timeoutTimestamp: bigint;
/**
* Data is the payload to transfer. We must not make assumption what format or
* content is in here.
*/
data: Uint8Array;
}
export interface MsgIBCSendProtoMsg {
typeUrl: "/cosmwasm.wasm.v1.MsgIBCSend";
value: Uint8Array;
}
/** MsgIBCSend */
export interface MsgIBCSendAmino {
/** the channel by which the packet will be sent */
channel?: string;
/**
* Timeout height relative to the current block height.
* The timeout is disabled when set to 0.
*/
timeout_height?: string;
/**
* Timeout timestamp (in nanoseconds) relative to the current block timestamp.
* The timeout is disabled when set to 0.
*/
timeout_timestamp?: string;
/**
* Data is the payload to transfer. We must not make assumption what format or
* content is in here.
*/
data?: string;
}
export interface MsgIBCSendAminoMsg {
type: "wasm/MsgIBCSend";
value: MsgIBCSendAmino;
}
/** MsgIBCSend */
export interface MsgIBCSendSDKType {
channel: string;
timeout_height: bigint;
timeout_timestamp: bigint;
data: Uint8Array;
}
/** MsgIBCCloseChannel port and channel need to be owned by the contract */
export interface MsgIBCCloseChannel {
channel: string;
}
export interface MsgIBCCloseChannelProtoMsg {
typeUrl: "/cosmwasm.wasm.v1.MsgIBCCloseChannel";
value: Uint8Array;
}
/** MsgIBCCloseChannel port and channel need to be owned by the contract */
export interface MsgIBCCloseChannelAmino {
channel?: string;
}
export interface MsgIBCCloseChannelAminoMsg {
type: "wasm/MsgIBCCloseChannel";
value: MsgIBCCloseChannelAmino;
}
/** MsgIBCCloseChannel port and channel need to be owned by the contract */
export interface MsgIBCCloseChannelSDKType {
channel: string;
}
function createBaseMsgIBCSend(): MsgIBCSend {
return {
channel: "",
timeoutHeight: BigInt(0),
timeoutTimestamp: BigInt(0),
data: new Uint8Array()
};
}
export const MsgIBCSend = {
typeUrl: "/cosmwasm.wasm.v1.MsgIBCSend",
encode(message: MsgIBCSend, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
if (message.channel !== "") {
writer.uint32(18).string(message.channel);
}
if (message.timeoutHeight !== BigInt(0)) {
writer.uint32(32).uint64(message.timeoutHeight);
}
if (message.timeoutTimestamp !== BigInt(0)) {
writer.uint32(40).uint64(message.timeoutTimestamp);
}
if (message.data.length !== 0) {
writer.uint32(50).bytes(message.data);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): MsgIBCSend {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgIBCSend();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 2:
message.channel = reader.string();
break;
case 4:
message.timeoutHeight = reader.uint64();
break;
case 5:
message.timeoutTimestamp = reader.uint64();
break;
case 6:
message.data = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(object: Partial<MsgIBCSend>): MsgIBCSend {
const message = createBaseMsgIBCSend();
message.channel = object.channel ?? "";
message.timeoutHeight = object.timeoutHeight !== undefined && object.timeoutHeight !== null ? BigInt(object.timeoutHeight.toString()) : BigInt(0);
message.timeoutTimestamp = object.timeoutTimestamp !== undefined && object.timeoutTimestamp !== null ? BigInt(object.timeoutTimestamp.toString()) : BigInt(0);
message.data = object.data ?? new Uint8Array();
return message;
},
fromAmino(object: MsgIBCSendAmino): MsgIBCSend {
const message = createBaseMsgIBCSend();
if (object.channel !== undefined && object.channel !== null) {
message.channel = object.channel;
}
if (object.timeout_height !== undefined && object.timeout_height !== null) {
message.timeoutHeight = BigInt(object.timeout_height);
}
if (object.timeout_timestamp !== undefined && object.timeout_timestamp !== null) {
message.timeoutTimestamp = BigInt(object.timeout_timestamp);
}
if (object.data !== undefined && object.data !== null) {
message.data = bytesFromBase64(object.data);
}
return message;
},
toAmino(message: MsgIBCSend): MsgIBCSendAmino {
const obj: any = {};
obj.channel = message.channel === "" ? undefined : message.channel;
obj.timeout_height = message.timeoutHeight !== BigInt(0) ? message.timeoutHeight.toString() : undefined;
obj.timeout_timestamp = message.timeoutTimestamp !== BigInt(0) ? message.timeoutTimestamp.toString() : undefined;
obj.data = message.data ? base64FromBytes(message.data) : undefined;
return obj;
},
fromAminoMsg(object: MsgIBCSendAminoMsg): MsgIBCSend {
return MsgIBCSend.fromAmino(object.value);
},
toAminoMsg(message: MsgIBCSend): MsgIBCSendAminoMsg {
return {
type: "wasm/MsgIBCSend",
value: MsgIBCSend.toAmino(message)
};
},
fromProtoMsg(message: MsgIBCSendProtoMsg): MsgIBCSend {
return MsgIBCSend.decode(message.value);
},
toProto(message: MsgIBCSend): Uint8Array {
return MsgIBCSend.encode(message).finish();
},
toProtoMsg(message: MsgIBCSend): MsgIBCSendProtoMsg {
return {
typeUrl: "/cosmwasm.wasm.v1.MsgIBCSend",
value: MsgIBCSend.encode(message).finish()
};
}
};
function createBaseMsgIBCCloseChannel(): MsgIBCCloseChannel {
return {
channel: ""
};
}
export const MsgIBCCloseChannel = {
typeUrl: "/cosmwasm.wasm.v1.MsgIBCCloseChannel",
encode(message: MsgIBCCloseChannel, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
if (message.channel !== "") {
writer.uint32(18).string(message.channel);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): MsgIBCCloseChannel {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgIBCCloseChannel();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 2:
message.channel = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(object: Partial<MsgIBCCloseChannel>): MsgIBCCloseChannel {
const message = createBaseMsgIBCCloseChannel();
message.channel = object.channel ?? "";
return message;
},
fromAmino(object: MsgIBCCloseChannelAmino): MsgIBCCloseChannel {
const message = createBaseMsgIBCCloseChannel();
if (object.channel !== undefined && object.channel !== null) {
message.channel = object.channel;
}
return message;
},
toAmino(message: MsgIBCCloseChannel): MsgIBCCloseChannelAmino {
const obj: any = {};
obj.channel = message.channel === "" ? undefined : message.channel;
return obj;
},
fromAminoMsg(object: MsgIBCCloseChannelAminoMsg): MsgIBCCloseChannel {
return MsgIBCCloseChannel.fromAmino(object.value);
},
toAminoMsg(message: MsgIBCCloseChannel): MsgIBCCloseChannelAminoMsg {
return {
type: "wasm/MsgIBCCloseChannel",
value: MsgIBCCloseChannel.toAmino(message)
};
},
fromProtoMsg(message: MsgIBCCloseChannelProtoMsg): MsgIBCCloseChannel {
return MsgIBCCloseChannel.decode(message.value);
},
toProto(message: MsgIBCCloseChannel): Uint8Array {
return MsgIBCCloseChannel.encode(message).finish();
},
toProtoMsg(message: MsgIBCCloseChannel): MsgIBCCloseChannelProtoMsg {
return {
typeUrl: "/cosmwasm.wasm.v1.MsgIBCCloseChannel",
value: MsgIBCCloseChannel.encode(message).finish()
};
}
};