1
1
package types
2
2
3
3
type ExpectedJSONSize interface {
4
+ // ExpectedJSONSize returns the expected JSON size in bytes when using
5
+ // json.Marshal with the given value.
6
+ // Since JSON marshalling does not have a guaranteed output format,
7
+ // this should be understood as a best guess and correct in most cases.
8
+ // Do not use it when a precise value is required.
4
9
ExpectedJSONSize () int
5
10
}
6
11
12
+ // ExpectedJSONSizeString returns the expected JSON size in bytes when using
13
+ // json.Marshal with the given value.
14
+ // Since JSON marshalling does not have a guaranteed output format,
15
+ // this should be understood as a best guess and correct in most cases.
16
+ // Do not use it when a precise value is required.
7
17
func ExpectedJSONSizeString (s string ) int {
8
18
// 2x quote + length of string + escaping overhead
9
19
var out int = quotes + len (s )
@@ -25,6 +35,11 @@ func ExpectedJSONSizeString(s string) int {
25
35
return out
26
36
}
27
37
38
+ // ExpectedJSONSizeBinary returns the expected JSON size in bytes when using
39
+ // json.Marshal with the given value.
40
+ // Since JSON marshalling does not have a guaranteed output format,
41
+ // this should be understood as a best guess and correct in most cases.
42
+ // Do not use it when a precise value is required.
28
43
func ExpectedJSONSizeBinary (b []byte ) int {
29
44
if b == nil {
30
45
return null
@@ -34,6 +49,11 @@ func ExpectedJSONSizeBinary(b []byte) int {
34
49
return b64Len + quotes
35
50
}
36
51
52
+ // ExpectedJSONSizeInt returns the expected JSON size in bytes when using
53
+ // json.Marshal with the given value.
54
+ // Since JSON marshalling does not have a guaranteed output format,
55
+ // this should be understood as a best guess and correct in most cases.
56
+ // Do not use it when a precise value is required.
37
57
func ExpectedJSONSizeInt (i int ) int {
38
58
out := 0
39
59
// minus sign or zero
@@ -48,6 +68,11 @@ func ExpectedJSONSizeInt(i int) int {
48
68
return out
49
69
}
50
70
71
+ // ExpectedJSONSizeUint64 returns the expected JSON size in bytes when using
72
+ // json.Marshal with the given value.
73
+ // Since JSON marshalling does not have a guaranteed output format,
74
+ // this should be understood as a best guess and correct in most cases.
75
+ // Do not use it when a precise value is required.
51
76
func ExpectedJSONSizeUint64 (i uint64 ) int {
52
77
if i == 0 {
53
78
return 1
@@ -61,6 +86,11 @@ func ExpectedJSONSizeUint64(i uint64) int {
61
86
return out
62
87
}
63
88
89
+ // ExpectedJSONSizeBool returns the expected JSON size in bytes when using
90
+ // json.Marshal with the given value.
91
+ // Since JSON marshalling does not have a guaranteed output format,
92
+ // this should be understood as a best guess and correct in most cases.
93
+ // Do not use it when a precise value is required.
64
94
func ExpectedJSONSizeBool (b bool ) int {
65
95
if b {
66
96
return 4 // true
@@ -78,6 +108,11 @@ const (
78
108
null int = 4 // null
79
109
)
80
110
111
+ // ExpectedJSONSize returns the expected JSON size in bytes when using
112
+ // json.Marshal with the given value.
113
+ // Since JSON marshalling does not have a guaranteed output format,
114
+ // this should be understood as a best guess and correct in most cases.
115
+ // Do not use it when a precise value is required.
81
116
func (t IBCEndpoint ) ExpectedJSONSize () int {
82
117
// PortID string `json:"port_id"`
83
118
// ChannelID string `json:"channel_id"`
@@ -86,6 +121,11 @@ func (t IBCEndpoint) ExpectedJSONSize() int {
86
121
12 + colon + ExpectedJSONSizeString (t .ChannelID )
87
122
}
88
123
124
+ // ExpectedJSONSize returns the expected JSON size in bytes when using
125
+ // json.Marshal with the given value.
126
+ // Since JSON marshalling does not have a guaranteed output format,
127
+ // this should be understood as a best guess and correct in most cases.
128
+ // Do not use it when a precise value is required.
89
129
func (t IBCChannel ) ExpectedJSONSize () int {
90
130
// Endpoint IBCEndpoint `json:"endpoint"`
91
131
// CounterpartyEndpoint IBCEndpoint `json:"counterparty_endpoint"`
@@ -100,11 +140,21 @@ func (t IBCChannel) ExpectedJSONSize() int {
100
140
15 + colon + ExpectedJSONSizeString (t .ConnectionID )
101
141
}
102
142
143
+ // ExpectedJSONSize returns the expected JSON size in bytes when using
144
+ // json.Marshal with the given value.
145
+ // Since JSON marshalling does not have a guaranteed output format,
146
+ // this should be understood as a best guess and correct in most cases.
147
+ // Do not use it when a precise value is required.
103
148
func (t IBCOpenInit ) ExpectedJSONSize () int {
104
149
// Channel IBCChannel `json:"channel"`
105
150
return brackets + 9 + colon + t .Channel .ExpectedJSONSize ()
106
151
}
107
152
153
+ // ExpectedJSONSize returns the expected JSON size in bytes when using
154
+ // json.Marshal with the given value.
155
+ // Since JSON marshalling does not have a guaranteed output format,
156
+ // this should be understood as a best guess and correct in most cases.
157
+ // Do not use it when a precise value is required.
108
158
func (t IBCOpenTry ) ExpectedJSONSize () int {
109
159
// Channel IBCChannel `json:"channel"`
110
160
// CounterpartyVersion string `json:"counterparty_version"`
@@ -113,6 +163,11 @@ func (t IBCOpenTry) ExpectedJSONSize() int {
113
163
22 + colon + ExpectedJSONSizeString (t .CounterpartyVersion )
114
164
}
115
165
166
+ // ExpectedJSONSize returns the expected JSON size in bytes when using
167
+ // json.Marshal with the given value.
168
+ // Since JSON marshalling does not have a guaranteed output format,
169
+ // this should be understood as a best guess and correct in most cases.
170
+ // Do not use it when a precise value is required.
116
171
func (t IBCChannelOpenMsg ) ExpectedJSONSize () int {
117
172
// OpenInit *IBCOpenInit `json:"open_init,omitempty"`
118
173
// OpenTry *IBCOpenTry `json:"open_try,omitempty"`
@@ -130,6 +185,11 @@ func (t IBCChannelOpenMsg) ExpectedJSONSize() int {
130
185
return out
131
186
}
132
187
188
+ // ExpectedJSONSize returns the expected JSON size in bytes when using
189
+ // json.Marshal with the given value.
190
+ // Since JSON marshalling does not have a guaranteed output format,
191
+ // this should be understood as a best guess and correct in most cases.
192
+ // Do not use it when a precise value is required.
133
193
func (t IBCOpenAck ) ExpectedJSONSize () int {
134
194
// Channel IBCChannel `json:"channel"`
135
195
// CounterpartyVersion string `json:"counterparty_version"`
@@ -138,11 +198,21 @@ func (t IBCOpenAck) ExpectedJSONSize() int {
138
198
22 + colon + ExpectedJSONSizeString (t .CounterpartyVersion )
139
199
}
140
200
201
+ // ExpectedJSONSize returns the expected JSON size in bytes when using
202
+ // json.Marshal with the given value.
203
+ // Since JSON marshalling does not have a guaranteed output format,
204
+ // this should be understood as a best guess and correct in most cases.
205
+ // Do not use it when a precise value is required.
141
206
func (t IBCOpenConfirm ) ExpectedJSONSize () int {
142
207
// Channel IBCChannel `json:"channel"`
143
208
return brackets + 9 + colon + t .Channel .ExpectedJSONSize ()
144
209
}
145
210
211
+ // ExpectedJSONSize returns the expected JSON size in bytes when using
212
+ // json.Marshal with the given value.
213
+ // Since JSON marshalling does not have a guaranteed output format,
214
+ // this should be understood as a best guess and correct in most cases.
215
+ // Do not use it when a precise value is required.
146
216
func (t IBCChannelConnectMsg ) ExpectedJSONSize () int {
147
217
// OpenAck *IBCOpenAck `json:"open_ack,omitempty"`
148
218
// OpenConfirm *IBCOpenConfirm `json:"open_confirm,omitempty"`
@@ -160,16 +230,31 @@ func (t IBCChannelConnectMsg) ExpectedJSONSize() int {
160
230
return out
161
231
}
162
232
233
+ // ExpectedJSONSize returns the expected JSON size in bytes when using
234
+ // json.Marshal with the given value.
235
+ // Since JSON marshalling does not have a guaranteed output format,
236
+ // this should be understood as a best guess and correct in most cases.
237
+ // Do not use it when a precise value is required.
163
238
func (t IBCCloseInit ) ExpectedJSONSize () int {
164
239
// Channel IBCChannel `json:"channel"`
165
240
return brackets + 9 + colon + t .Channel .ExpectedJSONSize ()
166
241
}
167
242
243
+ // ExpectedJSONSize returns the expected JSON size in bytes when using
244
+ // json.Marshal with the given value.
245
+ // Since JSON marshalling does not have a guaranteed output format,
246
+ // this should be understood as a best guess and correct in most cases.
247
+ // Do not use it when a precise value is required.
168
248
func (t IBCCloseConfirm ) ExpectedJSONSize () int {
169
249
// Channel IBCChannel `json:"channel"`
170
250
return brackets + 9 + colon + t .Channel .ExpectedJSONSize ()
171
251
}
172
252
253
+ // ExpectedJSONSize returns the expected JSON size in bytes when using
254
+ // json.Marshal with the given value.
255
+ // Since JSON marshalling does not have a guaranteed output format,
256
+ // this should be understood as a best guess and correct in most cases.
257
+ // Do not use it when a precise value is required.
173
258
func (t IBCChannelCloseMsg ) ExpectedJSONSize () int {
174
259
// CloseInit *IBCCloseInit `json:"close_init,omitempty"`
175
260
// CloseConfirm *IBCCloseConfirm `json:"close_confirm,omitempty"`
@@ -187,6 +272,11 @@ func (t IBCChannelCloseMsg) ExpectedJSONSize() int {
187
272
return out
188
273
}
189
274
275
+ // ExpectedJSONSize returns the expected JSON size in bytes when using
276
+ // json.Marshal with the given value.
277
+ // Since JSON marshalling does not have a guaranteed output format,
278
+ // this should be understood as a best guess and correct in most cases.
279
+ // Do not use it when a precise value is required.
190
280
func (t IBCTimeoutBlock ) ExpectedJSONSize () int {
191
281
// Revision uint64 `json:"revision"`
192
282
// Height uint64 `json:"height"`
@@ -195,6 +285,11 @@ func (t IBCTimeoutBlock) ExpectedJSONSize() int {
195
285
8 + colon + ExpectedJSONSizeUint64 (t .Height )
196
286
}
197
287
288
+ // ExpectedJSONSize returns the expected JSON size in bytes when using
289
+ // json.Marshal with the given value.
290
+ // Since JSON marshalling does not have a guaranteed output format,
291
+ // this should be understood as a best guess and correct in most cases.
292
+ // Do not use it when a precise value is required.
198
293
func (t IBCTimeout ) ExpectedJSONSize () int {
199
294
// Block *IBCTimeoutBlock `json:"block"`
200
295
// Timestamp uint64 `json:"timestamp,string,omitempty"`
@@ -213,6 +308,11 @@ func (t IBCTimeout) ExpectedJSONSize() int {
213
308
return out
214
309
}
215
310
311
+ // ExpectedJSONSize returns the expected JSON size in bytes when using
312
+ // json.Marshal with the given value.
313
+ // Since JSON marshalling does not have a guaranteed output format,
314
+ // this should be understood as a best guess and correct in most cases.
315
+ // Do not use it when a precise value is required.
216
316
func (t IBCPacket ) ExpectedJSONSize () int {
217
317
// Data []byte `json:"data"`
218
318
// Src IBCEndpoint `json:"src"`
@@ -227,12 +327,22 @@ func (t IBCPacket) ExpectedJSONSize() int {
227
327
9 + colon + t .Timeout .ExpectedJSONSize ()
228
328
}
229
329
330
+ // ExpectedJSONSize returns the expected JSON size in bytes when using
331
+ // json.Marshal with the given value.
332
+ // Since JSON marshalling does not have a guaranteed output format,
333
+ // this should be understood as a best guess and correct in most cases.
334
+ // Do not use it when a precise value is required.
230
335
func (t IBCAcknowledgement ) ExpectedJSONSize () int {
231
336
// Data []byte `json:"data"`
232
337
return brackets +
233
338
6 + colon + ExpectedJSONSizeBinary (t .Data )
234
339
}
235
340
341
+ // ExpectedJSONSize returns the expected JSON size in bytes when using
342
+ // json.Marshal with the given value.
343
+ // Since JSON marshalling does not have a guaranteed output format,
344
+ // this should be understood as a best guess and correct in most cases.
345
+ // Do not use it when a precise value is required.
236
346
func (t IBCPacketReceiveMsg ) ExpectedJSONSize () int {
237
347
// Packet IBCPacket `json:"packet"`
238
348
// Relayer string `json:"relayer"`
@@ -241,6 +351,11 @@ func (t IBCPacketReceiveMsg) ExpectedJSONSize() int {
241
351
9 + colon + ExpectedJSONSizeString (t .Relayer )
242
352
}
243
353
354
+ // ExpectedJSONSize returns the expected JSON size in bytes when using
355
+ // json.Marshal with the given value.
356
+ // Since JSON marshalling does not have a guaranteed output format,
357
+ // this should be understood as a best guess and correct in most cases.
358
+ // Do not use it when a precise value is required.
244
359
func (t IBCPacketAckMsg ) ExpectedJSONSize () int {
245
360
// Acknowledgement IBCAcknowledgement `json:"acknowledgement"`
246
361
// OriginalPacket IBCPacket `json:"original_packet"`
@@ -251,6 +366,11 @@ func (t IBCPacketAckMsg) ExpectedJSONSize() int {
251
366
9 + colon + ExpectedJSONSizeString (t .Relayer )
252
367
}
253
368
369
+ // ExpectedJSONSize returns the expected JSON size in bytes when using
370
+ // json.Marshal with the given value.
371
+ // Since JSON marshalling does not have a guaranteed output format,
372
+ // this should be understood as a best guess and correct in most cases.
373
+ // Do not use it when a precise value is required.
254
374
func (t IBCPacketTimeoutMsg ) ExpectedJSONSize () int {
255
375
// Packet IBCPacket `json:"packet"`
256
376
// Relayer string `json:"relayer"`
@@ -259,6 +379,11 @@ func (t IBCPacketTimeoutMsg) ExpectedJSONSize() int {
259
379
9 + colon + ExpectedJSONSizeString (t .Relayer )
260
380
}
261
381
382
+ // ExpectedJSONSize returns the expected JSON size in bytes when using
383
+ // json.Marshal with the given value.
384
+ // Since JSON marshalling does not have a guaranteed output format,
385
+ // this should be understood as a best guess and correct in most cases.
386
+ // Do not use it when a precise value is required.
262
387
func (t IBCAckCallbackMsg ) ExpectedJSONSize () int {
263
388
// Acknowledgement IBCAcknowledgement `json:"acknowledgement"`
264
389
// OriginalPacket IBCPacket `json:"original_packet"`
@@ -269,6 +394,11 @@ func (t IBCAckCallbackMsg) ExpectedJSONSize() int {
269
394
9 + colon + ExpectedJSONSizeString (t .Relayer )
270
395
}
271
396
397
+ // ExpectedJSONSize returns the expected JSON size in bytes when using
398
+ // json.Marshal with the given value.
399
+ // Since JSON marshalling does not have a guaranteed output format,
400
+ // this should be understood as a best guess and correct in most cases.
401
+ // Do not use it when a precise value is required.
272
402
func (t IBCTimeoutCallbackMsg ) ExpectedJSONSize () int {
273
403
// Packet IBCPacket `json:"packet"`
274
404
// Relayer string `json:"relayer"`
@@ -277,6 +407,11 @@ func (t IBCTimeoutCallbackMsg) ExpectedJSONSize() int {
277
407
9 + colon + ExpectedJSONSizeString (t .Relayer )
278
408
}
279
409
410
+ // ExpectedJSONSize returns the expected JSON size in bytes when using
411
+ // json.Marshal with the given value.
412
+ // Since JSON marshalling does not have a guaranteed output format,
413
+ // this should be understood as a best guess and correct in most cases.
414
+ // Do not use it when a precise value is required.
280
415
func (t IBCSourceCallbackMsg ) ExpectedJSONSize () int {
281
416
// Acknowledgement *IBCAckCallbackMsg `json:"acknowledgement,omitempty"`
282
417
// Timeout *IBCTimeoutCallbackMsg `json:"timeout,omitempty"`
@@ -297,6 +432,11 @@ func (t IBCSourceCallbackMsg) ExpectedJSONSize() int {
297
432
return out
298
433
}
299
434
435
+ // ExpectedJSONSize returns the expected JSON size in bytes when using
436
+ // json.Marshal with the given value.
437
+ // Since JSON marshalling does not have a guaranteed output format,
438
+ // this should be understood as a best guess and correct in most cases.
439
+ // Do not use it when a precise value is required.
300
440
func (t IBCDestinationCallbackMsg ) ExpectedJSONSize () int {
301
441
// Ack IBCAcknowledgement `json:"ack"`
302
442
// Packet IBCPacket `json:"packet"`
0 commit comments