@agoric/client-utils 0.1.1-dev-c393dc4.0.c393dc4 → 0.1.1-other-dev-fbe72e7.0.fbe72e7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,6 +5,55 @@ import { isSet } from '../../helpers.js';
5
5
  import {} from '../../json-safe.js';
6
6
  import { decodeBase64 as bytesFromBase64 } from '@endo/base64';
7
7
  import { encodeBase64 as base64FromBytes } from '@endo/base64';
8
+ /** Current state of this chunk. */
9
+ export var ChunkState;
10
+ (function (ChunkState) {
11
+ /** CHUNK_STATE_UNSPECIFIED - Unknown state. */
12
+ ChunkState[ChunkState["CHUNK_STATE_UNSPECIFIED"] = 0] = "CHUNK_STATE_UNSPECIFIED";
13
+ /** CHUNK_STATE_IN_FLIGHT - The chunk is still in-flight. */
14
+ ChunkState[ChunkState["CHUNK_STATE_IN_FLIGHT"] = 1] = "CHUNK_STATE_IN_FLIGHT";
15
+ /** CHUNK_STATE_RECEIVED - The chunk has been received. */
16
+ ChunkState[ChunkState["CHUNK_STATE_RECEIVED"] = 2] = "CHUNK_STATE_RECEIVED";
17
+ /** CHUNK_STATE_PROCESSED - The chunk has been processed. */
18
+ ChunkState[ChunkState["CHUNK_STATE_PROCESSED"] = 3] = "CHUNK_STATE_PROCESSED";
19
+ ChunkState[ChunkState["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
20
+ })(ChunkState || (ChunkState = {}));
21
+ export const ChunkStateSDKType = ChunkState;
22
+ export function chunkStateFromJSON(object) {
23
+ switch (object) {
24
+ case 0:
25
+ case 'CHUNK_STATE_UNSPECIFIED':
26
+ return ChunkState.CHUNK_STATE_UNSPECIFIED;
27
+ case 1:
28
+ case 'CHUNK_STATE_IN_FLIGHT':
29
+ return ChunkState.CHUNK_STATE_IN_FLIGHT;
30
+ case 2:
31
+ case 'CHUNK_STATE_RECEIVED':
32
+ return ChunkState.CHUNK_STATE_RECEIVED;
33
+ case 3:
34
+ case 'CHUNK_STATE_PROCESSED':
35
+ return ChunkState.CHUNK_STATE_PROCESSED;
36
+ case -1:
37
+ case 'UNRECOGNIZED':
38
+ default:
39
+ return ChunkState.UNRECOGNIZED;
40
+ }
41
+ }
42
+ export function chunkStateToJSON(object) {
43
+ switch (object) {
44
+ case ChunkState.CHUNK_STATE_UNSPECIFIED:
45
+ return 'CHUNK_STATE_UNSPECIFIED';
46
+ case ChunkState.CHUNK_STATE_IN_FLIGHT:
47
+ return 'CHUNK_STATE_IN_FLIGHT';
48
+ case ChunkState.CHUNK_STATE_RECEIVED:
49
+ return 'CHUNK_STATE_RECEIVED';
50
+ case ChunkState.CHUNK_STATE_PROCESSED:
51
+ return 'CHUNK_STATE_PROCESSED';
52
+ case ChunkState.UNRECOGNIZED:
53
+ default:
54
+ return 'UNRECOGNIZED';
55
+ }
56
+ }
8
57
  function createBaseCoreEvalProposal() {
9
58
  return {
10
59
  title: '',
@@ -168,6 +217,8 @@ function createBaseParams() {
168
217
  powerFlagFees: [],
169
218
  queueMax: [],
170
219
  vatCleanupBudget: [],
220
+ installationDeadlineBlocks: BigInt(0),
221
+ installationDeadlineSeconds: BigInt(0),
171
222
  };
172
223
  }
173
224
  export const Params = {
@@ -191,6 +242,12 @@ export const Params = {
191
242
  for (const v of message.vatCleanupBudget) {
192
243
  UintMapEntry.encode(v, writer.uint32(50).fork()).ldelim();
193
244
  }
245
+ if (message.installationDeadlineBlocks !== BigInt(0)) {
246
+ writer.uint32(56).int64(message.installationDeadlineBlocks);
247
+ }
248
+ if (message.installationDeadlineSeconds !== BigInt(0)) {
249
+ writer.uint32(64).int64(message.installationDeadlineSeconds);
250
+ }
194
251
  return writer;
195
252
  },
196
253
  decode(input, length) {
@@ -218,6 +275,12 @@ export const Params = {
218
275
  case 6:
219
276
  message.vatCleanupBudget.push(UintMapEntry.decode(reader, reader.uint32()));
220
277
  break;
278
+ case 7:
279
+ message.installationDeadlineBlocks = reader.int64();
280
+ break;
281
+ case 8:
282
+ message.installationDeadlineSeconds = reader.int64();
283
+ break;
221
284
  default:
222
285
  reader.skipType(tag & 7);
223
286
  break;
@@ -245,6 +308,12 @@ export const Params = {
245
308
  vatCleanupBudget: Array.isArray(object?.vatCleanupBudget)
246
309
  ? object.vatCleanupBudget.map((e) => UintMapEntry.fromJSON(e))
247
310
  : [],
311
+ installationDeadlineBlocks: isSet(object.installationDeadlineBlocks)
312
+ ? BigInt(object.installationDeadlineBlocks.toString())
313
+ : BigInt(0),
314
+ installationDeadlineSeconds: isSet(object.installationDeadlineSeconds)
315
+ ? BigInt(object.installationDeadlineSeconds.toString())
316
+ : BigInt(0),
248
317
  };
249
318
  },
250
319
  toJSON(message) {
@@ -281,6 +350,10 @@ export const Params = {
281
350
  else {
282
351
  obj.vatCleanupBudget = [];
283
352
  }
353
+ message.installationDeadlineBlocks !== undefined &&
354
+ (obj.installationDeadlineBlocks = (message.installationDeadlineBlocks || BigInt(0)).toString());
355
+ message.installationDeadlineSeconds !== undefined &&
356
+ (obj.installationDeadlineSeconds = (message.installationDeadlineSeconds || BigInt(0)).toString());
284
357
  return obj;
285
358
  },
286
359
  fromPartial(object) {
@@ -296,6 +369,16 @@ export const Params = {
296
369
  object.queueMax?.map(e => QueueSize.fromPartial(e)) || [];
297
370
  message.vatCleanupBudget =
298
371
  object.vatCleanupBudget?.map(e => UintMapEntry.fromPartial(e)) || [];
372
+ message.installationDeadlineBlocks =
373
+ object.installationDeadlineBlocks !== undefined &&
374
+ object.installationDeadlineBlocks !== null
375
+ ? BigInt(object.installationDeadlineBlocks.toString())
376
+ : BigInt(0);
377
+ message.installationDeadlineSeconds =
378
+ object.installationDeadlineSeconds !== undefined &&
379
+ object.installationDeadlineSeconds !== null
380
+ ? BigInt(object.installationDeadlineSeconds.toString())
381
+ : BigInt(0);
299
382
  return message;
300
383
  },
301
384
  fromProtoMsg(message) {
@@ -314,6 +397,8 @@ export const Params = {
314
397
  function createBaseState() {
315
398
  return {
316
399
  queueAllowed: [],
400
+ firstChunkedArtifactId: BigInt(0),
401
+ lastChunkedArtifactId: BigInt(0),
317
402
  };
318
403
  }
319
404
  export const State = {
@@ -322,6 +407,12 @@ export const State = {
322
407
  for (const v of message.queueAllowed) {
323
408
  QueueSize.encode(v, writer.uint32(10).fork()).ldelim();
324
409
  }
410
+ if (message.firstChunkedArtifactId !== BigInt(0)) {
411
+ writer.uint32(16).uint64(message.firstChunkedArtifactId);
412
+ }
413
+ if (message.lastChunkedArtifactId !== BigInt(0)) {
414
+ writer.uint32(24).uint64(message.lastChunkedArtifactId);
415
+ }
325
416
  return writer;
326
417
  },
327
418
  decode(input, length) {
@@ -334,6 +425,12 @@ export const State = {
334
425
  case 1:
335
426
  message.queueAllowed.push(QueueSize.decode(reader, reader.uint32()));
336
427
  break;
428
+ case 2:
429
+ message.firstChunkedArtifactId = reader.uint64();
430
+ break;
431
+ case 3:
432
+ message.lastChunkedArtifactId = reader.uint64();
433
+ break;
337
434
  default:
338
435
  reader.skipType(tag & 7);
339
436
  break;
@@ -346,6 +443,12 @@ export const State = {
346
443
  queueAllowed: Array.isArray(object?.queueAllowed)
347
444
  ? object.queueAllowed.map((e) => QueueSize.fromJSON(e))
348
445
  : [],
446
+ firstChunkedArtifactId: isSet(object.firstChunkedArtifactId)
447
+ ? BigInt(object.firstChunkedArtifactId.toString())
448
+ : BigInt(0),
449
+ lastChunkedArtifactId: isSet(object.lastChunkedArtifactId)
450
+ ? BigInt(object.lastChunkedArtifactId.toString())
451
+ : BigInt(0),
349
452
  };
350
453
  },
351
454
  toJSON(message) {
@@ -356,12 +459,26 @@ export const State = {
356
459
  else {
357
460
  obj.queueAllowed = [];
358
461
  }
462
+ message.firstChunkedArtifactId !== undefined &&
463
+ (obj.firstChunkedArtifactId = (message.firstChunkedArtifactId || BigInt(0)).toString());
464
+ message.lastChunkedArtifactId !== undefined &&
465
+ (obj.lastChunkedArtifactId = (message.lastChunkedArtifactId || BigInt(0)).toString());
359
466
  return obj;
360
467
  },
361
468
  fromPartial(object) {
362
469
  const message = createBaseState();
363
470
  message.queueAllowed =
364
471
  object.queueAllowed?.map(e => QueueSize.fromPartial(e)) || [];
472
+ message.firstChunkedArtifactId =
473
+ object.firstChunkedArtifactId !== undefined &&
474
+ object.firstChunkedArtifactId !== null
475
+ ? BigInt(object.firstChunkedArtifactId.toString())
476
+ : BigInt(0);
477
+ message.lastChunkedArtifactId =
478
+ object.lastChunkedArtifactId !== undefined &&
479
+ object.lastChunkedArtifactId !== null
480
+ ? BigInt(object.lastChunkedArtifactId.toString())
481
+ : BigInt(0);
365
482
  return message;
366
483
  },
367
484
  fromProtoMsg(message) {
@@ -815,4 +932,309 @@ export const SwingStoreArtifact = {
815
932
  };
816
933
  },
817
934
  };
935
+ function createBaseChunkedArtifact() {
936
+ return {
937
+ sha512: '',
938
+ sizeBytes: BigInt(0),
939
+ chunks: [],
940
+ };
941
+ }
942
+ export const ChunkedArtifact = {
943
+ typeUrl: '/agoric.swingset.ChunkedArtifact',
944
+ encode(message, writer = BinaryWriter.create()) {
945
+ if (message.sha512 !== '') {
946
+ writer.uint32(10).string(message.sha512);
947
+ }
948
+ if (message.sizeBytes !== BigInt(0)) {
949
+ writer.uint32(16).uint64(message.sizeBytes);
950
+ }
951
+ for (const v of message.chunks) {
952
+ ChunkInfo.encode(v, writer.uint32(26).fork()).ldelim();
953
+ }
954
+ return writer;
955
+ },
956
+ decode(input, length) {
957
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
958
+ let end = length === undefined ? reader.len : reader.pos + length;
959
+ const message = createBaseChunkedArtifact();
960
+ while (reader.pos < end) {
961
+ const tag = reader.uint32();
962
+ switch (tag >>> 3) {
963
+ case 1:
964
+ message.sha512 = reader.string();
965
+ break;
966
+ case 2:
967
+ message.sizeBytes = reader.uint64();
968
+ break;
969
+ case 3:
970
+ message.chunks.push(ChunkInfo.decode(reader, reader.uint32()));
971
+ break;
972
+ default:
973
+ reader.skipType(tag & 7);
974
+ break;
975
+ }
976
+ }
977
+ return message;
978
+ },
979
+ fromJSON(object) {
980
+ return {
981
+ sha512: isSet(object.sha512) ? String(object.sha512) : '',
982
+ sizeBytes: isSet(object.sizeBytes)
983
+ ? BigInt(object.sizeBytes.toString())
984
+ : BigInt(0),
985
+ chunks: Array.isArray(object?.chunks)
986
+ ? object.chunks.map((e) => ChunkInfo.fromJSON(e))
987
+ : [],
988
+ };
989
+ },
990
+ toJSON(message) {
991
+ const obj = {};
992
+ message.sha512 !== undefined && (obj.sha512 = message.sha512);
993
+ message.sizeBytes !== undefined &&
994
+ (obj.sizeBytes = (message.sizeBytes || BigInt(0)).toString());
995
+ if (message.chunks) {
996
+ obj.chunks = message.chunks.map(e => e ? ChunkInfo.toJSON(e) : undefined);
997
+ }
998
+ else {
999
+ obj.chunks = [];
1000
+ }
1001
+ return obj;
1002
+ },
1003
+ fromPartial(object) {
1004
+ const message = createBaseChunkedArtifact();
1005
+ message.sha512 = object.sha512 ?? '';
1006
+ message.sizeBytes =
1007
+ object.sizeBytes !== undefined && object.sizeBytes !== null
1008
+ ? BigInt(object.sizeBytes.toString())
1009
+ : BigInt(0);
1010
+ message.chunks = object.chunks?.map(e => ChunkInfo.fromPartial(e)) || [];
1011
+ return message;
1012
+ },
1013
+ fromProtoMsg(message) {
1014
+ return ChunkedArtifact.decode(message.value);
1015
+ },
1016
+ toProto(message) {
1017
+ return ChunkedArtifact.encode(message).finish();
1018
+ },
1019
+ toProtoMsg(message) {
1020
+ return {
1021
+ typeUrl: '/agoric.swingset.ChunkedArtifact',
1022
+ value: ChunkedArtifact.encode(message).finish(),
1023
+ };
1024
+ },
1025
+ };
1026
+ function createBaseChunkInfo() {
1027
+ return {
1028
+ sha512: '',
1029
+ sizeBytes: BigInt(0),
1030
+ state: 0,
1031
+ };
1032
+ }
1033
+ export const ChunkInfo = {
1034
+ typeUrl: '/agoric.swingset.ChunkInfo',
1035
+ encode(message, writer = BinaryWriter.create()) {
1036
+ if (message.sha512 !== '') {
1037
+ writer.uint32(10).string(message.sha512);
1038
+ }
1039
+ if (message.sizeBytes !== BigInt(0)) {
1040
+ writer.uint32(16).uint64(message.sizeBytes);
1041
+ }
1042
+ if (message.state !== 0) {
1043
+ writer.uint32(24).int32(message.state);
1044
+ }
1045
+ return writer;
1046
+ },
1047
+ decode(input, length) {
1048
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1049
+ let end = length === undefined ? reader.len : reader.pos + length;
1050
+ const message = createBaseChunkInfo();
1051
+ while (reader.pos < end) {
1052
+ const tag = reader.uint32();
1053
+ switch (tag >>> 3) {
1054
+ case 1:
1055
+ message.sha512 = reader.string();
1056
+ break;
1057
+ case 2:
1058
+ message.sizeBytes = reader.uint64();
1059
+ break;
1060
+ case 3:
1061
+ message.state = reader.int32();
1062
+ break;
1063
+ default:
1064
+ reader.skipType(tag & 7);
1065
+ break;
1066
+ }
1067
+ }
1068
+ return message;
1069
+ },
1070
+ fromJSON(object) {
1071
+ return {
1072
+ sha512: isSet(object.sha512) ? String(object.sha512) : '',
1073
+ sizeBytes: isSet(object.sizeBytes)
1074
+ ? BigInt(object.sizeBytes.toString())
1075
+ : BigInt(0),
1076
+ state: isSet(object.state) ? chunkStateFromJSON(object.state) : -1,
1077
+ };
1078
+ },
1079
+ toJSON(message) {
1080
+ const obj = {};
1081
+ message.sha512 !== undefined && (obj.sha512 = message.sha512);
1082
+ message.sizeBytes !== undefined &&
1083
+ (obj.sizeBytes = (message.sizeBytes || BigInt(0)).toString());
1084
+ message.state !== undefined &&
1085
+ (obj.state = chunkStateToJSON(message.state));
1086
+ return obj;
1087
+ },
1088
+ fromPartial(object) {
1089
+ const message = createBaseChunkInfo();
1090
+ message.sha512 = object.sha512 ?? '';
1091
+ message.sizeBytes =
1092
+ object.sizeBytes !== undefined && object.sizeBytes !== null
1093
+ ? BigInt(object.sizeBytes.toString())
1094
+ : BigInt(0);
1095
+ message.state = object.state ?? 0;
1096
+ return message;
1097
+ },
1098
+ fromProtoMsg(message) {
1099
+ return ChunkInfo.decode(message.value);
1100
+ },
1101
+ toProto(message) {
1102
+ return ChunkInfo.encode(message).finish();
1103
+ },
1104
+ toProtoMsg(message) {
1105
+ return {
1106
+ typeUrl: '/agoric.swingset.ChunkInfo',
1107
+ value: ChunkInfo.encode(message).finish(),
1108
+ };
1109
+ },
1110
+ };
1111
+ function createBaseChunkedArtifactNode() {
1112
+ return {
1113
+ chunkedArtifactId: BigInt(0),
1114
+ nextId: BigInt(0),
1115
+ prevId: BigInt(0),
1116
+ startTimeUnix: BigInt(0),
1117
+ startBlockHeight: BigInt(0),
1118
+ };
1119
+ }
1120
+ export const ChunkedArtifactNode = {
1121
+ typeUrl: '/agoric.swingset.ChunkedArtifactNode',
1122
+ encode(message, writer = BinaryWriter.create()) {
1123
+ if (message.chunkedArtifactId !== BigInt(0)) {
1124
+ writer.uint32(8).uint64(message.chunkedArtifactId);
1125
+ }
1126
+ if (message.nextId !== BigInt(0)) {
1127
+ writer.uint32(16).uint64(message.nextId);
1128
+ }
1129
+ if (message.prevId !== BigInt(0)) {
1130
+ writer.uint32(24).uint64(message.prevId);
1131
+ }
1132
+ if (message.startTimeUnix !== BigInt(0)) {
1133
+ writer.uint32(32).int64(message.startTimeUnix);
1134
+ }
1135
+ if (message.startBlockHeight !== BigInt(0)) {
1136
+ writer.uint32(40).int64(message.startBlockHeight);
1137
+ }
1138
+ return writer;
1139
+ },
1140
+ decode(input, length) {
1141
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1142
+ let end = length === undefined ? reader.len : reader.pos + length;
1143
+ const message = createBaseChunkedArtifactNode();
1144
+ while (reader.pos < end) {
1145
+ const tag = reader.uint32();
1146
+ switch (tag >>> 3) {
1147
+ case 1:
1148
+ message.chunkedArtifactId = reader.uint64();
1149
+ break;
1150
+ case 2:
1151
+ message.nextId = reader.uint64();
1152
+ break;
1153
+ case 3:
1154
+ message.prevId = reader.uint64();
1155
+ break;
1156
+ case 4:
1157
+ message.startTimeUnix = reader.int64();
1158
+ break;
1159
+ case 5:
1160
+ message.startBlockHeight = reader.int64();
1161
+ break;
1162
+ default:
1163
+ reader.skipType(tag & 7);
1164
+ break;
1165
+ }
1166
+ }
1167
+ return message;
1168
+ },
1169
+ fromJSON(object) {
1170
+ return {
1171
+ chunkedArtifactId: isSet(object.chunkedArtifactId)
1172
+ ? BigInt(object.chunkedArtifactId.toString())
1173
+ : BigInt(0),
1174
+ nextId: isSet(object.nextId)
1175
+ ? BigInt(object.nextId.toString())
1176
+ : BigInt(0),
1177
+ prevId: isSet(object.prevId)
1178
+ ? BigInt(object.prevId.toString())
1179
+ : BigInt(0),
1180
+ startTimeUnix: isSet(object.startTimeUnix)
1181
+ ? BigInt(object.startTimeUnix.toString())
1182
+ : BigInt(0),
1183
+ startBlockHeight: isSet(object.startBlockHeight)
1184
+ ? BigInt(object.startBlockHeight.toString())
1185
+ : BigInt(0),
1186
+ };
1187
+ },
1188
+ toJSON(message) {
1189
+ const obj = {};
1190
+ message.chunkedArtifactId !== undefined &&
1191
+ (obj.chunkedArtifactId = (message.chunkedArtifactId || BigInt(0)).toString());
1192
+ message.nextId !== undefined &&
1193
+ (obj.nextId = (message.nextId || BigInt(0)).toString());
1194
+ message.prevId !== undefined &&
1195
+ (obj.prevId = (message.prevId || BigInt(0)).toString());
1196
+ message.startTimeUnix !== undefined &&
1197
+ (obj.startTimeUnix = (message.startTimeUnix || BigInt(0)).toString());
1198
+ message.startBlockHeight !== undefined &&
1199
+ (obj.startBlockHeight = (message.startBlockHeight || BigInt(0)).toString());
1200
+ return obj;
1201
+ },
1202
+ fromPartial(object) {
1203
+ const message = createBaseChunkedArtifactNode();
1204
+ message.chunkedArtifactId =
1205
+ object.chunkedArtifactId !== undefined &&
1206
+ object.chunkedArtifactId !== null
1207
+ ? BigInt(object.chunkedArtifactId.toString())
1208
+ : BigInt(0);
1209
+ message.nextId =
1210
+ object.nextId !== undefined && object.nextId !== null
1211
+ ? BigInt(object.nextId.toString())
1212
+ : BigInt(0);
1213
+ message.prevId =
1214
+ object.prevId !== undefined && object.prevId !== null
1215
+ ? BigInt(object.prevId.toString())
1216
+ : BigInt(0);
1217
+ message.startTimeUnix =
1218
+ object.startTimeUnix !== undefined && object.startTimeUnix !== null
1219
+ ? BigInt(object.startTimeUnix.toString())
1220
+ : BigInt(0);
1221
+ message.startBlockHeight =
1222
+ object.startBlockHeight !== undefined && object.startBlockHeight !== null
1223
+ ? BigInt(object.startBlockHeight.toString())
1224
+ : BigInt(0);
1225
+ return message;
1226
+ },
1227
+ fromProtoMsg(message) {
1228
+ return ChunkedArtifactNode.decode(message.value);
1229
+ },
1230
+ toProto(message) {
1231
+ return ChunkedArtifactNode.encode(message).finish();
1232
+ },
1233
+ toProtoMsg(message) {
1234
+ return {
1235
+ typeUrl: '/agoric.swingset.ChunkedArtifactNode',
1236
+ value: ChunkedArtifactNode.encode(message).finish(),
1237
+ };
1238
+ },
1239
+ };
818
1240
  //# sourceMappingURL=swingset.js.map