@world-engines/protocol-ts 0.1.0-alpha.0

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.
Files changed (74) hide show
  1. package/LICENSE +46 -0
  2. package/dist/entity-prop-envelope.d.ts +36 -0
  3. package/dist/entity-prop-envelope.js +50 -0
  4. package/dist/gen/v1/auth.d.ts +46 -0
  5. package/dist/gen/v1/auth.js +278 -0
  6. package/dist/gen/v1/billing.d.ts +71 -0
  7. package/dist/gen/v1/billing.js +521 -0
  8. package/dist/gen/v1/common.d.ts +65 -0
  9. package/dist/gen/v1/common.js +387 -0
  10. package/dist/gen/v1/llm.d.ts +317 -0
  11. package/dist/gen/v1/llm.js +3557 -0
  12. package/dist/gen/v1/mcp.d.ts +373 -0
  13. package/dist/gen/v1/mcp.js +3190 -0
  14. package/dist/gen/v1/moderation.d.ts +51 -0
  15. package/dist/gen/v1/moderation.js +368 -0
  16. package/dist/gen/v1/neutral_scenario_source.d.ts +80 -0
  17. package/dist/gen/v1/neutral_scenario_source.js +569 -0
  18. package/dist/gen/v1/relation_kind.d.ts +105 -0
  19. package/dist/gen/v1/relation_kind.js +562 -0
  20. package/dist/gen/v1/rest/admin.d.ts +432 -0
  21. package/dist/gen/v1/rest/admin.js +4957 -0
  22. package/dist/gen/v1/rest/asset.d.ts +205 -0
  23. package/dist/gen/v1/rest/asset.js +2200 -0
  24. package/dist/gen/v1/rest/auth.d.ts +275 -0
  25. package/dist/gen/v1/rest/auth.js +2896 -0
  26. package/dist/gen/v1/rest/billing.d.ts +101 -0
  27. package/dist/gen/v1/rest/billing.js +866 -0
  28. package/dist/gen/v1/rest/common.d.ts +179 -0
  29. package/dist/gen/v1/rest/common.js +1358 -0
  30. package/dist/gen/v1/rest/creator.d.ts +354 -0
  31. package/dist/gen/v1/rest/creator.js +4169 -0
  32. package/dist/gen/v1/rest/messaging.d.ts +190 -0
  33. package/dist/gen/v1/rest/messaging.js +2017 -0
  34. package/dist/gen/v1/rest/moderation.d.ts +61 -0
  35. package/dist/gen/v1/rest/moderation.js +569 -0
  36. package/dist/gen/v1/rest/pet.d.ts +98 -0
  37. package/dist/gen/v1/rest/pet.js +698 -0
  38. package/dist/gen/v1/rest/project_transfer.d.ts +470 -0
  39. package/dist/gen/v1/rest/project_transfer.js +5266 -0
  40. package/dist/gen/v1/rest/scenario.d.ts +756 -0
  41. package/dist/gen/v1/rest/scenario.js +8768 -0
  42. package/dist/gen/v1/rest/stock_bounty.d.ts +154 -0
  43. package/dist/gen/v1/rest/stock_bounty.js +1547 -0
  44. package/dist/gen/v1/rest/stocks.d.ts +465 -0
  45. package/dist/gen/v1/rest/stocks.js +5200 -0
  46. package/dist/gen/v1/rest/support_ticket.d.ts +61 -0
  47. package/dist/gen/v1/rest/support_ticket.js +511 -0
  48. package/dist/gen/v1/rest/users.d.ts +292 -0
  49. package/dist/gen/v1/rest/users.js +2879 -0
  50. package/dist/gen/v1/rest/violations.d.ts +52 -0
  51. package/dist/gen/v1/rest/violations.js +338 -0
  52. package/dist/gen/v1/sav.d.ts +987 -0
  53. package/dist/gen/v1/sav.js +12327 -0
  54. package/dist/gen/v1/save.d.ts +68 -0
  55. package/dist/gen/v1/save.js +595 -0
  56. package/dist/gen/v1/scenario_part_source.d.ts +94 -0
  57. package/dist/gen/v1/scenario_part_source.js +913 -0
  58. package/dist/gen/v1/session.d.ts +49 -0
  59. package/dist/gen/v1/session.js +311 -0
  60. package/dist/gen/v1/view_state.d.ts +267 -0
  61. package/dist/gen/v1/view_state.js +3239 -0
  62. package/dist/gen/v1/world.d.ts +82 -0
  63. package/dist/gen/v1/world.js +707 -0
  64. package/dist/gen/v1/world_memory.d.ts +545 -0
  65. package/dist/gen/v1/world_memory.js +5816 -0
  66. package/dist/gen/v1/world_memory_privacy.d.ts +96 -0
  67. package/dist/gen/v1/world_memory_privacy.js +994 -0
  68. package/dist/gen/v1/ws_frame.d.ts +1626 -0
  69. package/dist/gen/v1/ws_frame.js +18253 -0
  70. package/dist/index.d.ts +2 -0
  71. package/dist/index.js +5 -0
  72. package/dist/ladybug-extraction.d.ts +36 -0
  73. package/dist/ladybug-extraction.js +1 -0
  74. package/package.json +65 -0
@@ -0,0 +1,994 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.12.0
4
+ // protoc unknown
5
+ // source: v1/world_memory_privacy.proto
6
+ /* eslint-disable */
7
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
8
+ export var WorldMemoryPrivacyAuthorizationIssueStatus;
9
+ (function (WorldMemoryPrivacyAuthorizationIssueStatus) {
10
+ WorldMemoryPrivacyAuthorizationIssueStatus[WorldMemoryPrivacyAuthorizationIssueStatus["WORLD_MEMORY_PRIVACY_AUTHORIZATION_ISSUE_STATUS_UNSPECIFIED"] = 0] = "WORLD_MEMORY_PRIVACY_AUTHORIZATION_ISSUE_STATUS_UNSPECIFIED";
11
+ WorldMemoryPrivacyAuthorizationIssueStatus[WorldMemoryPrivacyAuthorizationIssueStatus["WORLD_MEMORY_PRIVACY_AUTHORIZATION_ISSUE_STATUS_ISSUED"] = 1] = "WORLD_MEMORY_PRIVACY_AUTHORIZATION_ISSUE_STATUS_ISSUED";
12
+ WorldMemoryPrivacyAuthorizationIssueStatus[WorldMemoryPrivacyAuthorizationIssueStatus["WORLD_MEMORY_PRIVACY_AUTHORIZATION_ISSUE_STATUS_EXACT_REPLAY_NO_NEW_BEARER"] = 2] = "WORLD_MEMORY_PRIVACY_AUTHORIZATION_ISSUE_STATUS_EXACT_REPLAY_NO_NEW_BEARER";
13
+ WorldMemoryPrivacyAuthorizationIssueStatus[WorldMemoryPrivacyAuthorizationIssueStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
14
+ })(WorldMemoryPrivacyAuthorizationIssueStatus || (WorldMemoryPrivacyAuthorizationIssueStatus = {}));
15
+ export function worldMemoryPrivacyAuthorizationIssueStatusFromJSON(object) {
16
+ switch (object) {
17
+ case 0:
18
+ case "WORLD_MEMORY_PRIVACY_AUTHORIZATION_ISSUE_STATUS_UNSPECIFIED":
19
+ return WorldMemoryPrivacyAuthorizationIssueStatus.WORLD_MEMORY_PRIVACY_AUTHORIZATION_ISSUE_STATUS_UNSPECIFIED;
20
+ case 1:
21
+ case "WORLD_MEMORY_PRIVACY_AUTHORIZATION_ISSUE_STATUS_ISSUED":
22
+ return WorldMemoryPrivacyAuthorizationIssueStatus.WORLD_MEMORY_PRIVACY_AUTHORIZATION_ISSUE_STATUS_ISSUED;
23
+ case 2:
24
+ case "WORLD_MEMORY_PRIVACY_AUTHORIZATION_ISSUE_STATUS_EXACT_REPLAY_NO_NEW_BEARER":
25
+ return WorldMemoryPrivacyAuthorizationIssueStatus
26
+ .WORLD_MEMORY_PRIVACY_AUTHORIZATION_ISSUE_STATUS_EXACT_REPLAY_NO_NEW_BEARER;
27
+ case -1:
28
+ case "UNRECOGNIZED":
29
+ default:
30
+ return WorldMemoryPrivacyAuthorizationIssueStatus.UNRECOGNIZED;
31
+ }
32
+ }
33
+ export function worldMemoryPrivacyAuthorizationIssueStatusToJSON(object) {
34
+ switch (object) {
35
+ case WorldMemoryPrivacyAuthorizationIssueStatus.WORLD_MEMORY_PRIVACY_AUTHORIZATION_ISSUE_STATUS_UNSPECIFIED:
36
+ return "WORLD_MEMORY_PRIVACY_AUTHORIZATION_ISSUE_STATUS_UNSPECIFIED";
37
+ case WorldMemoryPrivacyAuthorizationIssueStatus.WORLD_MEMORY_PRIVACY_AUTHORIZATION_ISSUE_STATUS_ISSUED:
38
+ return "WORLD_MEMORY_PRIVACY_AUTHORIZATION_ISSUE_STATUS_ISSUED";
39
+ case WorldMemoryPrivacyAuthorizationIssueStatus
40
+ .WORLD_MEMORY_PRIVACY_AUTHORIZATION_ISSUE_STATUS_EXACT_REPLAY_NO_NEW_BEARER:
41
+ return "WORLD_MEMORY_PRIVACY_AUTHORIZATION_ISSUE_STATUS_EXACT_REPLAY_NO_NEW_BEARER";
42
+ case WorldMemoryPrivacyAuthorizationIssueStatus.UNRECOGNIZED:
43
+ default:
44
+ return "UNRECOGNIZED";
45
+ }
46
+ }
47
+ function createBaseWorldMemoryPrivacyGenerationIdentity() {
48
+ return { sav_generation: "0", seg_seq_head: "0", sha256: new Uint8Array(0), _unknownFields: {} };
49
+ }
50
+ export const WorldMemoryPrivacyGenerationIdentity = {
51
+ encode(message, writer = new BinaryWriter()) {
52
+ if (message.sav_generation !== "0") {
53
+ writer.uint32(8).uint64(message.sav_generation);
54
+ }
55
+ if (message.seg_seq_head !== "0") {
56
+ writer.uint32(16).uint64(message.seg_seq_head);
57
+ }
58
+ if (message.sha256.length !== 0) {
59
+ writer.uint32(26).bytes(message.sha256);
60
+ }
61
+ if (message._unknownFields !== undefined) {
62
+ for (const [key, values] of globalThis.Object.entries(message._unknownFields)) {
63
+ const tag = parseInt(key, 10);
64
+ for (const value of values) {
65
+ writer.uint32(tag).raw(value);
66
+ }
67
+ }
68
+ }
69
+ return writer;
70
+ },
71
+ decode(input, length) {
72
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
73
+ const end = length === undefined ? reader.len : reader.pos + length;
74
+ const message = createBaseWorldMemoryPrivacyGenerationIdentity();
75
+ while (reader.pos < end) {
76
+ const tag = reader.uint32();
77
+ switch (tag >>> 3) {
78
+ case 1: {
79
+ if (tag !== 8) {
80
+ break;
81
+ }
82
+ message.sav_generation = reader.uint64().toString();
83
+ continue;
84
+ }
85
+ case 2: {
86
+ if (tag !== 16) {
87
+ break;
88
+ }
89
+ message.seg_seq_head = reader.uint64().toString();
90
+ continue;
91
+ }
92
+ case 3: {
93
+ if (tag !== 26) {
94
+ break;
95
+ }
96
+ message.sha256 = reader.bytes();
97
+ continue;
98
+ }
99
+ }
100
+ if ((tag & 7) === 4 || tag === 0) {
101
+ break;
102
+ }
103
+ const buf = reader.skip(tag & 7);
104
+ const list = message._unknownFields[tag];
105
+ if (list === undefined) {
106
+ message._unknownFields[tag] = [buf];
107
+ }
108
+ else {
109
+ list.push(buf);
110
+ }
111
+ }
112
+ return message;
113
+ },
114
+ fromJSON(object) {
115
+ return {
116
+ sav_generation: isSet(object.savGeneration)
117
+ ? globalThis.String(object.savGeneration)
118
+ : isSet(object.sav_generation)
119
+ ? globalThis.String(object.sav_generation)
120
+ : "0",
121
+ seg_seq_head: isSet(object.segSeqHead)
122
+ ? globalThis.String(object.segSeqHead)
123
+ : isSet(object.seg_seq_head)
124
+ ? globalThis.String(object.seg_seq_head)
125
+ : "0",
126
+ sha256: isSet(object.sha256) ? bytesFromBase64(object.sha256) : new Uint8Array(0),
127
+ };
128
+ },
129
+ toJSON(message) {
130
+ const obj = {};
131
+ if (message.sav_generation !== "0") {
132
+ obj.savGeneration = message.sav_generation;
133
+ }
134
+ if (message.seg_seq_head !== "0") {
135
+ obj.segSeqHead = message.seg_seq_head;
136
+ }
137
+ if (message.sha256.length !== 0) {
138
+ obj.sha256 = base64FromBytes(message.sha256);
139
+ }
140
+ return obj;
141
+ },
142
+ create(base) {
143
+ return WorldMemoryPrivacyGenerationIdentity.fromPartial(base ?? {});
144
+ },
145
+ fromPartial(object) {
146
+ const message = createBaseWorldMemoryPrivacyGenerationIdentity();
147
+ message.sav_generation = object.sav_generation ?? "0";
148
+ message.seg_seq_head = object.seg_seq_head ?? "0";
149
+ message.sha256 = object.sha256 ?? new Uint8Array(0);
150
+ return message;
151
+ },
152
+ };
153
+ function createBaseWorldMemoryPrivacyAuthorizationIssueRequest() {
154
+ return {
155
+ contract_version: 0,
156
+ account_epoch: "0",
157
+ save_id: "",
158
+ operation_id: "",
159
+ idempotency_key: "",
160
+ canonical_payload_sha256: new Uint8Array(0),
161
+ browser_commit_receipt_sha256: new Uint8Array(0),
162
+ expected_canonical_head: undefined,
163
+ replacement_generation: undefined,
164
+ host_seal_sha256: new Uint8Array(0),
165
+ _unknownFields: {},
166
+ };
167
+ }
168
+ export const WorldMemoryPrivacyAuthorizationIssueRequest = {
169
+ encode(message, writer = new BinaryWriter()) {
170
+ if (message.contract_version !== 0) {
171
+ writer.uint32(8).uint32(message.contract_version);
172
+ }
173
+ if (message.account_epoch !== "0") {
174
+ writer.uint32(16).uint64(message.account_epoch);
175
+ }
176
+ if (message.save_id !== "") {
177
+ writer.uint32(26).string(message.save_id);
178
+ }
179
+ if (message.operation_id !== "") {
180
+ writer.uint32(34).string(message.operation_id);
181
+ }
182
+ if (message.idempotency_key !== "") {
183
+ writer.uint32(42).string(message.idempotency_key);
184
+ }
185
+ if (message.canonical_payload_sha256.length !== 0) {
186
+ writer.uint32(50).bytes(message.canonical_payload_sha256);
187
+ }
188
+ if (message.browser_commit_receipt_sha256.length !== 0) {
189
+ writer.uint32(58).bytes(message.browser_commit_receipt_sha256);
190
+ }
191
+ if (message.expected_canonical_head !== undefined) {
192
+ WorldMemoryPrivacyGenerationIdentity.encode(message.expected_canonical_head, writer.uint32(66).fork()).join();
193
+ }
194
+ if (message.replacement_generation !== undefined) {
195
+ WorldMemoryPrivacyGenerationIdentity.encode(message.replacement_generation, writer.uint32(74).fork()).join();
196
+ }
197
+ if (message.host_seal_sha256.length !== 0) {
198
+ writer.uint32(82).bytes(message.host_seal_sha256);
199
+ }
200
+ if (message._unknownFields !== undefined) {
201
+ for (const [key, values] of globalThis.Object.entries(message._unknownFields)) {
202
+ const tag = parseInt(key, 10);
203
+ for (const value of values) {
204
+ writer.uint32(tag).raw(value);
205
+ }
206
+ }
207
+ }
208
+ return writer;
209
+ },
210
+ decode(input, length) {
211
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
212
+ const end = length === undefined ? reader.len : reader.pos + length;
213
+ const message = createBaseWorldMemoryPrivacyAuthorizationIssueRequest();
214
+ while (reader.pos < end) {
215
+ const tag = reader.uint32();
216
+ switch (tag >>> 3) {
217
+ case 1: {
218
+ if (tag !== 8) {
219
+ break;
220
+ }
221
+ message.contract_version = reader.uint32();
222
+ continue;
223
+ }
224
+ case 2: {
225
+ if (tag !== 16) {
226
+ break;
227
+ }
228
+ message.account_epoch = reader.uint64().toString();
229
+ continue;
230
+ }
231
+ case 3: {
232
+ if (tag !== 26) {
233
+ break;
234
+ }
235
+ message.save_id = reader.string();
236
+ continue;
237
+ }
238
+ case 4: {
239
+ if (tag !== 34) {
240
+ break;
241
+ }
242
+ message.operation_id = reader.string();
243
+ continue;
244
+ }
245
+ case 5: {
246
+ if (tag !== 42) {
247
+ break;
248
+ }
249
+ message.idempotency_key = reader.string();
250
+ continue;
251
+ }
252
+ case 6: {
253
+ if (tag !== 50) {
254
+ break;
255
+ }
256
+ message.canonical_payload_sha256 = reader.bytes();
257
+ continue;
258
+ }
259
+ case 7: {
260
+ if (tag !== 58) {
261
+ break;
262
+ }
263
+ message.browser_commit_receipt_sha256 = reader.bytes();
264
+ continue;
265
+ }
266
+ case 8: {
267
+ if (tag !== 66) {
268
+ break;
269
+ }
270
+ message.expected_canonical_head = WorldMemoryPrivacyGenerationIdentity.decode(reader, reader.uint32());
271
+ continue;
272
+ }
273
+ case 9: {
274
+ if (tag !== 74) {
275
+ break;
276
+ }
277
+ message.replacement_generation = WorldMemoryPrivacyGenerationIdentity.decode(reader, reader.uint32());
278
+ continue;
279
+ }
280
+ case 10: {
281
+ if (tag !== 82) {
282
+ break;
283
+ }
284
+ message.host_seal_sha256 = reader.bytes();
285
+ continue;
286
+ }
287
+ }
288
+ if ((tag & 7) === 4 || tag === 0) {
289
+ break;
290
+ }
291
+ const buf = reader.skip(tag & 7);
292
+ const list = message._unknownFields[tag];
293
+ if (list === undefined) {
294
+ message._unknownFields[tag] = [buf];
295
+ }
296
+ else {
297
+ list.push(buf);
298
+ }
299
+ }
300
+ return message;
301
+ },
302
+ fromJSON(object) {
303
+ return {
304
+ contract_version: isSet(object.contractVersion)
305
+ ? globalThis.Number(object.contractVersion)
306
+ : isSet(object.contract_version)
307
+ ? globalThis.Number(object.contract_version)
308
+ : 0,
309
+ account_epoch: isSet(object.accountEpoch)
310
+ ? globalThis.String(object.accountEpoch)
311
+ : isSet(object.account_epoch)
312
+ ? globalThis.String(object.account_epoch)
313
+ : "0",
314
+ save_id: isSet(object.saveId)
315
+ ? globalThis.String(object.saveId)
316
+ : isSet(object.save_id)
317
+ ? globalThis.String(object.save_id)
318
+ : "",
319
+ operation_id: isSet(object.operationId)
320
+ ? globalThis.String(object.operationId)
321
+ : isSet(object.operation_id)
322
+ ? globalThis.String(object.operation_id)
323
+ : "",
324
+ idempotency_key: isSet(object.idempotencyKey)
325
+ ? globalThis.String(object.idempotencyKey)
326
+ : isSet(object.idempotency_key)
327
+ ? globalThis.String(object.idempotency_key)
328
+ : "",
329
+ canonical_payload_sha256: isSet(object.canonicalPayloadSha256)
330
+ ? bytesFromBase64(object.canonicalPayloadSha256)
331
+ : isSet(object.canonical_payload_sha256)
332
+ ? bytesFromBase64(object.canonical_payload_sha256)
333
+ : new Uint8Array(0),
334
+ browser_commit_receipt_sha256: isSet(object.browserCommitReceiptSha256)
335
+ ? bytesFromBase64(object.browserCommitReceiptSha256)
336
+ : isSet(object.browser_commit_receipt_sha256)
337
+ ? bytesFromBase64(object.browser_commit_receipt_sha256)
338
+ : new Uint8Array(0),
339
+ expected_canonical_head: isSet(object.expectedCanonicalHead)
340
+ ? WorldMemoryPrivacyGenerationIdentity.fromJSON(object.expectedCanonicalHead)
341
+ : isSet(object.expected_canonical_head)
342
+ ? WorldMemoryPrivacyGenerationIdentity.fromJSON(object.expected_canonical_head)
343
+ : undefined,
344
+ replacement_generation: isSet(object.replacementGeneration)
345
+ ? WorldMemoryPrivacyGenerationIdentity.fromJSON(object.replacementGeneration)
346
+ : isSet(object.replacement_generation)
347
+ ? WorldMemoryPrivacyGenerationIdentity.fromJSON(object.replacement_generation)
348
+ : undefined,
349
+ host_seal_sha256: isSet(object.hostSealSha256)
350
+ ? bytesFromBase64(object.hostSealSha256)
351
+ : isSet(object.host_seal_sha256)
352
+ ? bytesFromBase64(object.host_seal_sha256)
353
+ : new Uint8Array(0),
354
+ };
355
+ },
356
+ toJSON(message) {
357
+ const obj = {};
358
+ if (message.contract_version !== 0) {
359
+ obj.contractVersion = Math.round(message.contract_version);
360
+ }
361
+ if (message.account_epoch !== "0") {
362
+ obj.accountEpoch = message.account_epoch;
363
+ }
364
+ if (message.save_id !== "") {
365
+ obj.saveId = message.save_id;
366
+ }
367
+ if (message.operation_id !== "") {
368
+ obj.operationId = message.operation_id;
369
+ }
370
+ if (message.idempotency_key !== "") {
371
+ obj.idempotencyKey = message.idempotency_key;
372
+ }
373
+ if (message.canonical_payload_sha256.length !== 0) {
374
+ obj.canonicalPayloadSha256 = base64FromBytes(message.canonical_payload_sha256);
375
+ }
376
+ if (message.browser_commit_receipt_sha256.length !== 0) {
377
+ obj.browserCommitReceiptSha256 = base64FromBytes(message.browser_commit_receipt_sha256);
378
+ }
379
+ if (message.expected_canonical_head !== undefined) {
380
+ obj.expectedCanonicalHead = WorldMemoryPrivacyGenerationIdentity.toJSON(message.expected_canonical_head);
381
+ }
382
+ if (message.replacement_generation !== undefined) {
383
+ obj.replacementGeneration = WorldMemoryPrivacyGenerationIdentity.toJSON(message.replacement_generation);
384
+ }
385
+ if (message.host_seal_sha256.length !== 0) {
386
+ obj.hostSealSha256 = base64FromBytes(message.host_seal_sha256);
387
+ }
388
+ return obj;
389
+ },
390
+ create(base) {
391
+ return WorldMemoryPrivacyAuthorizationIssueRequest.fromPartial(base ?? {});
392
+ },
393
+ fromPartial(object) {
394
+ const message = createBaseWorldMemoryPrivacyAuthorizationIssueRequest();
395
+ message.contract_version = object.contract_version ?? 0;
396
+ message.account_epoch = object.account_epoch ?? "0";
397
+ message.save_id = object.save_id ?? "";
398
+ message.operation_id = object.operation_id ?? "";
399
+ message.idempotency_key = object.idempotency_key ?? "";
400
+ message.canonical_payload_sha256 = object.canonical_payload_sha256 ?? new Uint8Array(0);
401
+ message.browser_commit_receipt_sha256 = object.browser_commit_receipt_sha256 ?? new Uint8Array(0);
402
+ message.expected_canonical_head =
403
+ (object.expected_canonical_head !== undefined && object.expected_canonical_head !== null)
404
+ ? WorldMemoryPrivacyGenerationIdentity.fromPartial(object.expected_canonical_head)
405
+ : undefined;
406
+ message.replacement_generation =
407
+ (object.replacement_generation !== undefined && object.replacement_generation !== null)
408
+ ? WorldMemoryPrivacyGenerationIdentity.fromPartial(object.replacement_generation)
409
+ : undefined;
410
+ message.host_seal_sha256 = object.host_seal_sha256 ?? new Uint8Array(0);
411
+ return message;
412
+ },
413
+ };
414
+ function createBaseWorldMemoryPrivacyAuthorizationReceipt() {
415
+ return {
416
+ schema_version: 0,
417
+ authorization_id: "",
418
+ authorization_sha256: new Uint8Array(0),
419
+ expires_at_ms: "0",
420
+ account_scope_sha256: new Uint8Array(0),
421
+ issue_request_sha256: new Uint8Array(0),
422
+ issued_at_ms: "0",
423
+ receipt_sha256: new Uint8Array(0),
424
+ _unknownFields: {},
425
+ };
426
+ }
427
+ export const WorldMemoryPrivacyAuthorizationReceipt = {
428
+ encode(message, writer = new BinaryWriter()) {
429
+ if (message.schema_version !== 0) {
430
+ writer.uint32(8).uint32(message.schema_version);
431
+ }
432
+ if (message.authorization_id !== "") {
433
+ writer.uint32(18).string(message.authorization_id);
434
+ }
435
+ if (message.authorization_sha256.length !== 0) {
436
+ writer.uint32(26).bytes(message.authorization_sha256);
437
+ }
438
+ if (message.expires_at_ms !== "0") {
439
+ writer.uint32(32).uint64(message.expires_at_ms);
440
+ }
441
+ if (message.account_scope_sha256.length !== 0) {
442
+ writer.uint32(42).bytes(message.account_scope_sha256);
443
+ }
444
+ if (message.issue_request_sha256.length !== 0) {
445
+ writer.uint32(50).bytes(message.issue_request_sha256);
446
+ }
447
+ if (message.issued_at_ms !== "0") {
448
+ writer.uint32(56).uint64(message.issued_at_ms);
449
+ }
450
+ if (message.receipt_sha256.length !== 0) {
451
+ writer.uint32(66).bytes(message.receipt_sha256);
452
+ }
453
+ if (message._unknownFields !== undefined) {
454
+ for (const [key, values] of globalThis.Object.entries(message._unknownFields)) {
455
+ const tag = parseInt(key, 10);
456
+ for (const value of values) {
457
+ writer.uint32(tag).raw(value);
458
+ }
459
+ }
460
+ }
461
+ return writer;
462
+ },
463
+ decode(input, length) {
464
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
465
+ const end = length === undefined ? reader.len : reader.pos + length;
466
+ const message = createBaseWorldMemoryPrivacyAuthorizationReceipt();
467
+ while (reader.pos < end) {
468
+ const tag = reader.uint32();
469
+ switch (tag >>> 3) {
470
+ case 1: {
471
+ if (tag !== 8) {
472
+ break;
473
+ }
474
+ message.schema_version = reader.uint32();
475
+ continue;
476
+ }
477
+ case 2: {
478
+ if (tag !== 18) {
479
+ break;
480
+ }
481
+ message.authorization_id = reader.string();
482
+ continue;
483
+ }
484
+ case 3: {
485
+ if (tag !== 26) {
486
+ break;
487
+ }
488
+ message.authorization_sha256 = reader.bytes();
489
+ continue;
490
+ }
491
+ case 4: {
492
+ if (tag !== 32) {
493
+ break;
494
+ }
495
+ message.expires_at_ms = reader.uint64().toString();
496
+ continue;
497
+ }
498
+ case 5: {
499
+ if (tag !== 42) {
500
+ break;
501
+ }
502
+ message.account_scope_sha256 = reader.bytes();
503
+ continue;
504
+ }
505
+ case 6: {
506
+ if (tag !== 50) {
507
+ break;
508
+ }
509
+ message.issue_request_sha256 = reader.bytes();
510
+ continue;
511
+ }
512
+ case 7: {
513
+ if (tag !== 56) {
514
+ break;
515
+ }
516
+ message.issued_at_ms = reader.uint64().toString();
517
+ continue;
518
+ }
519
+ case 8: {
520
+ if (tag !== 66) {
521
+ break;
522
+ }
523
+ message.receipt_sha256 = reader.bytes();
524
+ continue;
525
+ }
526
+ }
527
+ if ((tag & 7) === 4 || tag === 0) {
528
+ break;
529
+ }
530
+ const buf = reader.skip(tag & 7);
531
+ const list = message._unknownFields[tag];
532
+ if (list === undefined) {
533
+ message._unknownFields[tag] = [buf];
534
+ }
535
+ else {
536
+ list.push(buf);
537
+ }
538
+ }
539
+ return message;
540
+ },
541
+ fromJSON(object) {
542
+ return {
543
+ schema_version: isSet(object.schemaVersion)
544
+ ? globalThis.Number(object.schemaVersion)
545
+ : isSet(object.schema_version)
546
+ ? globalThis.Number(object.schema_version)
547
+ : 0,
548
+ authorization_id: isSet(object.authorizationId)
549
+ ? globalThis.String(object.authorizationId)
550
+ : isSet(object.authorization_id)
551
+ ? globalThis.String(object.authorization_id)
552
+ : "",
553
+ authorization_sha256: isSet(object.authorizationSha256)
554
+ ? bytesFromBase64(object.authorizationSha256)
555
+ : isSet(object.authorization_sha256)
556
+ ? bytesFromBase64(object.authorization_sha256)
557
+ : new Uint8Array(0),
558
+ expires_at_ms: isSet(object.expiresAtMs)
559
+ ? globalThis.String(object.expiresAtMs)
560
+ : isSet(object.expires_at_ms)
561
+ ? globalThis.String(object.expires_at_ms)
562
+ : "0",
563
+ account_scope_sha256: isSet(object.accountScopeSha256)
564
+ ? bytesFromBase64(object.accountScopeSha256)
565
+ : isSet(object.account_scope_sha256)
566
+ ? bytesFromBase64(object.account_scope_sha256)
567
+ : new Uint8Array(0),
568
+ issue_request_sha256: isSet(object.issueRequestSha256)
569
+ ? bytesFromBase64(object.issueRequestSha256)
570
+ : isSet(object.issue_request_sha256)
571
+ ? bytesFromBase64(object.issue_request_sha256)
572
+ : new Uint8Array(0),
573
+ issued_at_ms: isSet(object.issuedAtMs)
574
+ ? globalThis.String(object.issuedAtMs)
575
+ : isSet(object.issued_at_ms)
576
+ ? globalThis.String(object.issued_at_ms)
577
+ : "0",
578
+ receipt_sha256: isSet(object.receiptSha256)
579
+ ? bytesFromBase64(object.receiptSha256)
580
+ : isSet(object.receipt_sha256)
581
+ ? bytesFromBase64(object.receipt_sha256)
582
+ : new Uint8Array(0),
583
+ };
584
+ },
585
+ toJSON(message) {
586
+ const obj = {};
587
+ if (message.schema_version !== 0) {
588
+ obj.schemaVersion = Math.round(message.schema_version);
589
+ }
590
+ if (message.authorization_id !== "") {
591
+ obj.authorizationId = message.authorization_id;
592
+ }
593
+ if (message.authorization_sha256.length !== 0) {
594
+ obj.authorizationSha256 = base64FromBytes(message.authorization_sha256);
595
+ }
596
+ if (message.expires_at_ms !== "0") {
597
+ obj.expiresAtMs = message.expires_at_ms;
598
+ }
599
+ if (message.account_scope_sha256.length !== 0) {
600
+ obj.accountScopeSha256 = base64FromBytes(message.account_scope_sha256);
601
+ }
602
+ if (message.issue_request_sha256.length !== 0) {
603
+ obj.issueRequestSha256 = base64FromBytes(message.issue_request_sha256);
604
+ }
605
+ if (message.issued_at_ms !== "0") {
606
+ obj.issuedAtMs = message.issued_at_ms;
607
+ }
608
+ if (message.receipt_sha256.length !== 0) {
609
+ obj.receiptSha256 = base64FromBytes(message.receipt_sha256);
610
+ }
611
+ return obj;
612
+ },
613
+ create(base) {
614
+ return WorldMemoryPrivacyAuthorizationReceipt.fromPartial(base ?? {});
615
+ },
616
+ fromPartial(object) {
617
+ const message = createBaseWorldMemoryPrivacyAuthorizationReceipt();
618
+ message.schema_version = object.schema_version ?? 0;
619
+ message.authorization_id = object.authorization_id ?? "";
620
+ message.authorization_sha256 = object.authorization_sha256 ?? new Uint8Array(0);
621
+ message.expires_at_ms = object.expires_at_ms ?? "0";
622
+ message.account_scope_sha256 = object.account_scope_sha256 ?? new Uint8Array(0);
623
+ message.issue_request_sha256 = object.issue_request_sha256 ?? new Uint8Array(0);
624
+ message.issued_at_ms = object.issued_at_ms ?? "0";
625
+ message.receipt_sha256 = object.receipt_sha256 ?? new Uint8Array(0);
626
+ return message;
627
+ },
628
+ };
629
+ function createBaseWorldMemoryPrivacyAuthorizationIssueResponse() {
630
+ return { contract_version: 0, authorization_token: "", receipt: undefined, status: 0, _unknownFields: {} };
631
+ }
632
+ export const WorldMemoryPrivacyAuthorizationIssueResponse = {
633
+ encode(message, writer = new BinaryWriter()) {
634
+ if (message.contract_version !== 0) {
635
+ writer.uint32(8).uint32(message.contract_version);
636
+ }
637
+ if (message.authorization_token !== "") {
638
+ writer.uint32(18).string(message.authorization_token);
639
+ }
640
+ if (message.receipt !== undefined) {
641
+ WorldMemoryPrivacyAuthorizationReceipt.encode(message.receipt, writer.uint32(26).fork()).join();
642
+ }
643
+ if (message.status !== 0) {
644
+ writer.uint32(32).int32(message.status);
645
+ }
646
+ if (message._unknownFields !== undefined) {
647
+ for (const [key, values] of globalThis.Object.entries(message._unknownFields)) {
648
+ const tag = parseInt(key, 10);
649
+ for (const value of values) {
650
+ writer.uint32(tag).raw(value);
651
+ }
652
+ }
653
+ }
654
+ return writer;
655
+ },
656
+ decode(input, length) {
657
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
658
+ const end = length === undefined ? reader.len : reader.pos + length;
659
+ const message = createBaseWorldMemoryPrivacyAuthorizationIssueResponse();
660
+ while (reader.pos < end) {
661
+ const tag = reader.uint32();
662
+ switch (tag >>> 3) {
663
+ case 1: {
664
+ if (tag !== 8) {
665
+ break;
666
+ }
667
+ message.contract_version = reader.uint32();
668
+ continue;
669
+ }
670
+ case 2: {
671
+ if (tag !== 18) {
672
+ break;
673
+ }
674
+ message.authorization_token = reader.string();
675
+ continue;
676
+ }
677
+ case 3: {
678
+ if (tag !== 26) {
679
+ break;
680
+ }
681
+ message.receipt = WorldMemoryPrivacyAuthorizationReceipt.decode(reader, reader.uint32());
682
+ continue;
683
+ }
684
+ case 4: {
685
+ if (tag !== 32) {
686
+ break;
687
+ }
688
+ message.status = reader.int32();
689
+ continue;
690
+ }
691
+ }
692
+ if ((tag & 7) === 4 || tag === 0) {
693
+ break;
694
+ }
695
+ const buf = reader.skip(tag & 7);
696
+ const list = message._unknownFields[tag];
697
+ if (list === undefined) {
698
+ message._unknownFields[tag] = [buf];
699
+ }
700
+ else {
701
+ list.push(buf);
702
+ }
703
+ }
704
+ return message;
705
+ },
706
+ fromJSON(object) {
707
+ return {
708
+ contract_version: isSet(object.contractVersion)
709
+ ? globalThis.Number(object.contractVersion)
710
+ : isSet(object.contract_version)
711
+ ? globalThis.Number(object.contract_version)
712
+ : 0,
713
+ authorization_token: isSet(object.authorizationToken)
714
+ ? globalThis.String(object.authorizationToken)
715
+ : isSet(object.authorization_token)
716
+ ? globalThis.String(object.authorization_token)
717
+ : "",
718
+ receipt: isSet(object.receipt) ? WorldMemoryPrivacyAuthorizationReceipt.fromJSON(object.receipt) : undefined,
719
+ status: isSet(object.status) ? worldMemoryPrivacyAuthorizationIssueStatusFromJSON(object.status) : 0,
720
+ };
721
+ },
722
+ toJSON(message) {
723
+ const obj = {};
724
+ if (message.contract_version !== 0) {
725
+ obj.contractVersion = Math.round(message.contract_version);
726
+ }
727
+ if (message.authorization_token !== "") {
728
+ obj.authorizationToken = message.authorization_token;
729
+ }
730
+ if (message.receipt !== undefined) {
731
+ obj.receipt = WorldMemoryPrivacyAuthorizationReceipt.toJSON(message.receipt);
732
+ }
733
+ if (message.status !== 0) {
734
+ obj.status = worldMemoryPrivacyAuthorizationIssueStatusToJSON(message.status);
735
+ }
736
+ return obj;
737
+ },
738
+ create(base) {
739
+ return WorldMemoryPrivacyAuthorizationIssueResponse.fromPartial(base ?? {});
740
+ },
741
+ fromPartial(object) {
742
+ const message = createBaseWorldMemoryPrivacyAuthorizationIssueResponse();
743
+ message.contract_version = object.contract_version ?? 0;
744
+ message.authorization_token = object.authorization_token ?? "";
745
+ message.receipt = (object.receipt !== undefined && object.receipt !== null)
746
+ ? WorldMemoryPrivacyAuthorizationReceipt.fromPartial(object.receipt)
747
+ : undefined;
748
+ message.status = object.status ?? 0;
749
+ return message;
750
+ },
751
+ };
752
+ function createBaseWorldMemoryPrivacyAuthorizationConsumeReceipt() {
753
+ return {
754
+ schema_version: 0,
755
+ authorization_id: "",
756
+ authorization_sha256: new Uint8Array(0),
757
+ expires_at_ms: "0",
758
+ account_scope_sha256: new Uint8Array(0),
759
+ consume_request_sha256: new Uint8Array(0),
760
+ consumed_at_ms: "0",
761
+ receipt_sha256: new Uint8Array(0),
762
+ _unknownFields: {},
763
+ };
764
+ }
765
+ export const WorldMemoryPrivacyAuthorizationConsumeReceipt = {
766
+ encode(message, writer = new BinaryWriter()) {
767
+ if (message.schema_version !== 0) {
768
+ writer.uint32(8).uint32(message.schema_version);
769
+ }
770
+ if (message.authorization_id !== "") {
771
+ writer.uint32(18).string(message.authorization_id);
772
+ }
773
+ if (message.authorization_sha256.length !== 0) {
774
+ writer.uint32(26).bytes(message.authorization_sha256);
775
+ }
776
+ if (message.expires_at_ms !== "0") {
777
+ writer.uint32(32).uint64(message.expires_at_ms);
778
+ }
779
+ if (message.account_scope_sha256.length !== 0) {
780
+ writer.uint32(42).bytes(message.account_scope_sha256);
781
+ }
782
+ if (message.consume_request_sha256.length !== 0) {
783
+ writer.uint32(50).bytes(message.consume_request_sha256);
784
+ }
785
+ if (message.consumed_at_ms !== "0") {
786
+ writer.uint32(56).uint64(message.consumed_at_ms);
787
+ }
788
+ if (message.receipt_sha256.length !== 0) {
789
+ writer.uint32(66).bytes(message.receipt_sha256);
790
+ }
791
+ if (message._unknownFields !== undefined) {
792
+ for (const [key, values] of globalThis.Object.entries(message._unknownFields)) {
793
+ const tag = parseInt(key, 10);
794
+ for (const value of values) {
795
+ writer.uint32(tag).raw(value);
796
+ }
797
+ }
798
+ }
799
+ return writer;
800
+ },
801
+ decode(input, length) {
802
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
803
+ const end = length === undefined ? reader.len : reader.pos + length;
804
+ const message = createBaseWorldMemoryPrivacyAuthorizationConsumeReceipt();
805
+ while (reader.pos < end) {
806
+ const tag = reader.uint32();
807
+ switch (tag >>> 3) {
808
+ case 1: {
809
+ if (tag !== 8) {
810
+ break;
811
+ }
812
+ message.schema_version = reader.uint32();
813
+ continue;
814
+ }
815
+ case 2: {
816
+ if (tag !== 18) {
817
+ break;
818
+ }
819
+ message.authorization_id = reader.string();
820
+ continue;
821
+ }
822
+ case 3: {
823
+ if (tag !== 26) {
824
+ break;
825
+ }
826
+ message.authorization_sha256 = reader.bytes();
827
+ continue;
828
+ }
829
+ case 4: {
830
+ if (tag !== 32) {
831
+ break;
832
+ }
833
+ message.expires_at_ms = reader.uint64().toString();
834
+ continue;
835
+ }
836
+ case 5: {
837
+ if (tag !== 42) {
838
+ break;
839
+ }
840
+ message.account_scope_sha256 = reader.bytes();
841
+ continue;
842
+ }
843
+ case 6: {
844
+ if (tag !== 50) {
845
+ break;
846
+ }
847
+ message.consume_request_sha256 = reader.bytes();
848
+ continue;
849
+ }
850
+ case 7: {
851
+ if (tag !== 56) {
852
+ break;
853
+ }
854
+ message.consumed_at_ms = reader.uint64().toString();
855
+ continue;
856
+ }
857
+ case 8: {
858
+ if (tag !== 66) {
859
+ break;
860
+ }
861
+ message.receipt_sha256 = reader.bytes();
862
+ continue;
863
+ }
864
+ }
865
+ if ((tag & 7) === 4 || tag === 0) {
866
+ break;
867
+ }
868
+ const buf = reader.skip(tag & 7);
869
+ const list = message._unknownFields[tag];
870
+ if (list === undefined) {
871
+ message._unknownFields[tag] = [buf];
872
+ }
873
+ else {
874
+ list.push(buf);
875
+ }
876
+ }
877
+ return message;
878
+ },
879
+ fromJSON(object) {
880
+ return {
881
+ schema_version: isSet(object.schemaVersion)
882
+ ? globalThis.Number(object.schemaVersion)
883
+ : isSet(object.schema_version)
884
+ ? globalThis.Number(object.schema_version)
885
+ : 0,
886
+ authorization_id: isSet(object.authorizationId)
887
+ ? globalThis.String(object.authorizationId)
888
+ : isSet(object.authorization_id)
889
+ ? globalThis.String(object.authorization_id)
890
+ : "",
891
+ authorization_sha256: isSet(object.authorizationSha256)
892
+ ? bytesFromBase64(object.authorizationSha256)
893
+ : isSet(object.authorization_sha256)
894
+ ? bytesFromBase64(object.authorization_sha256)
895
+ : new Uint8Array(0),
896
+ expires_at_ms: isSet(object.expiresAtMs)
897
+ ? globalThis.String(object.expiresAtMs)
898
+ : isSet(object.expires_at_ms)
899
+ ? globalThis.String(object.expires_at_ms)
900
+ : "0",
901
+ account_scope_sha256: isSet(object.accountScopeSha256)
902
+ ? bytesFromBase64(object.accountScopeSha256)
903
+ : isSet(object.account_scope_sha256)
904
+ ? bytesFromBase64(object.account_scope_sha256)
905
+ : new Uint8Array(0),
906
+ consume_request_sha256: isSet(object.consumeRequestSha256)
907
+ ? bytesFromBase64(object.consumeRequestSha256)
908
+ : isSet(object.consume_request_sha256)
909
+ ? bytesFromBase64(object.consume_request_sha256)
910
+ : new Uint8Array(0),
911
+ consumed_at_ms: isSet(object.consumedAtMs)
912
+ ? globalThis.String(object.consumedAtMs)
913
+ : isSet(object.consumed_at_ms)
914
+ ? globalThis.String(object.consumed_at_ms)
915
+ : "0",
916
+ receipt_sha256: isSet(object.receiptSha256)
917
+ ? bytesFromBase64(object.receiptSha256)
918
+ : isSet(object.receipt_sha256)
919
+ ? bytesFromBase64(object.receipt_sha256)
920
+ : new Uint8Array(0),
921
+ };
922
+ },
923
+ toJSON(message) {
924
+ const obj = {};
925
+ if (message.schema_version !== 0) {
926
+ obj.schemaVersion = Math.round(message.schema_version);
927
+ }
928
+ if (message.authorization_id !== "") {
929
+ obj.authorizationId = message.authorization_id;
930
+ }
931
+ if (message.authorization_sha256.length !== 0) {
932
+ obj.authorizationSha256 = base64FromBytes(message.authorization_sha256);
933
+ }
934
+ if (message.expires_at_ms !== "0") {
935
+ obj.expiresAtMs = message.expires_at_ms;
936
+ }
937
+ if (message.account_scope_sha256.length !== 0) {
938
+ obj.accountScopeSha256 = base64FromBytes(message.account_scope_sha256);
939
+ }
940
+ if (message.consume_request_sha256.length !== 0) {
941
+ obj.consumeRequestSha256 = base64FromBytes(message.consume_request_sha256);
942
+ }
943
+ if (message.consumed_at_ms !== "0") {
944
+ obj.consumedAtMs = message.consumed_at_ms;
945
+ }
946
+ if (message.receipt_sha256.length !== 0) {
947
+ obj.receiptSha256 = base64FromBytes(message.receipt_sha256);
948
+ }
949
+ return obj;
950
+ },
951
+ create(base) {
952
+ return WorldMemoryPrivacyAuthorizationConsumeReceipt.fromPartial(base ?? {});
953
+ },
954
+ fromPartial(object) {
955
+ const message = createBaseWorldMemoryPrivacyAuthorizationConsumeReceipt();
956
+ message.schema_version = object.schema_version ?? 0;
957
+ message.authorization_id = object.authorization_id ?? "";
958
+ message.authorization_sha256 = object.authorization_sha256 ?? new Uint8Array(0);
959
+ message.expires_at_ms = object.expires_at_ms ?? "0";
960
+ message.account_scope_sha256 = object.account_scope_sha256 ?? new Uint8Array(0);
961
+ message.consume_request_sha256 = object.consume_request_sha256 ?? new Uint8Array(0);
962
+ message.consumed_at_ms = object.consumed_at_ms ?? "0";
963
+ message.receipt_sha256 = object.receipt_sha256 ?? new Uint8Array(0);
964
+ return message;
965
+ },
966
+ };
967
+ function bytesFromBase64(b64) {
968
+ if (globalThis.Buffer) {
969
+ return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
970
+ }
971
+ else {
972
+ const bin = globalThis.atob(b64);
973
+ const arr = new Uint8Array(bin.length);
974
+ for (let i = 0; i < bin.length; ++i) {
975
+ arr[i] = bin.charCodeAt(i);
976
+ }
977
+ return arr;
978
+ }
979
+ }
980
+ function base64FromBytes(arr) {
981
+ if (globalThis.Buffer) {
982
+ return globalThis.Buffer.from(arr).toString("base64");
983
+ }
984
+ else {
985
+ const bin = [];
986
+ arr.forEach((byte) => {
987
+ bin.push(globalThis.String.fromCharCode(byte));
988
+ });
989
+ return globalThis.btoa(bin.join(""));
990
+ }
991
+ }
992
+ function isSet(value) {
993
+ return value !== null && value !== undefined;
994
+ }