@aztec/bb.js 2.0.3-rc.9 → 2.0.3-zkpassport

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.
@@ -0,0 +1,1326 @@
1
+ // AUTOGENERATED FILE - DO NOT EDIT
2
+
3
+
4
+ // Type aliases
5
+ export type Fr = Uint8Array;
6
+ export type Uint256T = Uint8Array;
7
+
8
+ // Public interfaces (exported)
9
+ export interface CircuitComputeVk {
10
+ circuit: CircuitInputNoVK;
11
+ settings: ProofSystemSettings;
12
+ }
13
+
14
+ interface MsgpackCircuitComputeVk {
15
+ circuit: MsgpackCircuitInputNoVK;
16
+ settings: MsgpackProofSystemSettings;
17
+ }
18
+
19
+ export interface CircuitComputeVkResponse {
20
+ bytes: Uint8Array;
21
+ fields: Uint256T[];
22
+ hash: Uint8Array;
23
+ }
24
+
25
+ interface MsgpackCircuitComputeVkResponse {
26
+ bytes: Uint8Array;
27
+ fields: Uint8Array[];
28
+ hash: Uint8Array;
29
+ }
30
+
31
+ export interface CircuitInfoResponse {
32
+ numGates: number;
33
+ numGatesDyadic: number;
34
+ numAcirOpcodes: number;
35
+ gatesPerOpcode: number[];
36
+ }
37
+
38
+ interface MsgpackCircuitInfoResponse {
39
+ num_gates: number;
40
+ num_gates_dyadic: number;
41
+ num_acir_opcodes: number;
42
+ gates_per_opcode: number[];
43
+ }
44
+
45
+ export interface CircuitInput {
46
+ name: string;
47
+ bytecode: Uint8Array;
48
+ verificationKey: Uint8Array;
49
+ }
50
+
51
+ interface MsgpackCircuitInput {
52
+ name: string;
53
+ bytecode: Uint8Array;
54
+ verification_key: Uint8Array;
55
+ }
56
+
57
+ export interface CircuitInputNoVK {
58
+ name: string;
59
+ bytecode: Uint8Array;
60
+ }
61
+
62
+ interface MsgpackCircuitInputNoVK {
63
+ name: string;
64
+ bytecode: Uint8Array;
65
+ }
66
+
67
+ export interface CircuitProve {
68
+ circuit: CircuitInput;
69
+ witness: Uint8Array;
70
+ settings: ProofSystemSettings;
71
+ }
72
+
73
+ interface MsgpackCircuitProve {
74
+ circuit: MsgpackCircuitInput;
75
+ witness: Uint8Array;
76
+ settings: MsgpackProofSystemSettings;
77
+ }
78
+
79
+ export interface CircuitProveResponse {
80
+ publicInputs: Uint256T[];
81
+ proof: Uint256T[];
82
+ vk: CircuitComputeVkResponse;
83
+ }
84
+
85
+ interface MsgpackCircuitProveResponse {
86
+ public_inputs: Uint8Array[];
87
+ proof: Uint8Array[];
88
+ vk: MsgpackCircuitComputeVkResponse;
89
+ }
90
+
91
+ export interface CircuitStats {
92
+ circuit: CircuitInput;
93
+ includeGatesPerOpcode: boolean;
94
+ settings: ProofSystemSettings;
95
+ }
96
+
97
+ interface MsgpackCircuitStats {
98
+ circuit: MsgpackCircuitInput;
99
+ include_gates_per_opcode: boolean;
100
+ settings: MsgpackProofSystemSettings;
101
+ }
102
+
103
+ export interface CircuitVerify {
104
+ verificationKey: Uint8Array;
105
+ publicInputs: Uint256T[];
106
+ proof: Uint256T[];
107
+ settings: ProofSystemSettings;
108
+ }
109
+
110
+ interface MsgpackCircuitVerify {
111
+ verification_key: Uint8Array;
112
+ public_inputs: Uint8Array[];
113
+ proof: Uint8Array[];
114
+ settings: MsgpackProofSystemSettings;
115
+ }
116
+
117
+ export interface CircuitVerifyResponse {
118
+ verified: boolean;
119
+ }
120
+
121
+ interface MsgpackCircuitVerifyResponse {
122
+ verified: boolean;
123
+ }
124
+
125
+ export interface CircuitWriteSolidityVerifier {
126
+ verificationKey: Uint8Array;
127
+ settings: ProofSystemSettings;
128
+ }
129
+
130
+ interface MsgpackCircuitWriteSolidityVerifier {
131
+ verification_key: Uint8Array;
132
+ settings: MsgpackProofSystemSettings;
133
+ }
134
+
135
+ export interface CircuitWriteSolidityVerifierResponse {
136
+ solidityCode: string;
137
+ }
138
+
139
+ interface MsgpackCircuitWriteSolidityVerifierResponse {
140
+ solidity_code: string;
141
+ }
142
+
143
+ export interface ClientIvcAccumulate {
144
+ witness: Uint8Array;
145
+ }
146
+
147
+ interface MsgpackClientIvcAccumulate {
148
+ witness: Uint8Array;
149
+ }
150
+
151
+ export interface ClientIvcAccumulateResponse {
152
+ }
153
+
154
+ interface MsgpackClientIvcAccumulateResponse {
155
+ }
156
+
157
+ export interface ClientIvcCheckPrecomputedVk {
158
+ circuit: CircuitInput;
159
+ }
160
+
161
+ interface MsgpackClientIvcCheckPrecomputedVk {
162
+ circuit: MsgpackCircuitInput;
163
+ }
164
+
165
+ export interface ClientIvcCheckPrecomputedVkResponse {
166
+ valid: boolean;
167
+ actualVk: Uint8Array;
168
+ }
169
+
170
+ interface MsgpackClientIvcCheckPrecomputedVkResponse {
171
+ valid: boolean;
172
+ actual_vk: Uint8Array;
173
+ }
174
+
175
+ export interface ClientIvcComputeIvcVk {
176
+ circuit: CircuitInputNoVK;
177
+ }
178
+
179
+ interface MsgpackClientIvcComputeIvcVk {
180
+ circuit: MsgpackCircuitInputNoVK;
181
+ }
182
+
183
+ export interface ClientIvcComputeIvcVkResponse {
184
+ bytes: Uint8Array;
185
+ }
186
+
187
+ interface MsgpackClientIvcComputeIvcVkResponse {
188
+ bytes: Uint8Array;
189
+ }
190
+
191
+ export interface ClientIvcComputeStandaloneVk {
192
+ circuit: CircuitInputNoVK;
193
+ }
194
+
195
+ interface MsgpackClientIvcComputeStandaloneVk {
196
+ circuit: MsgpackCircuitInputNoVK;
197
+ }
198
+
199
+ export interface ClientIvcComputeStandaloneVkResponse {
200
+ bytes: Uint8Array;
201
+ fields: Fr[];
202
+ }
203
+
204
+ interface MsgpackClientIvcComputeStandaloneVkResponse {
205
+ bytes: Uint8Array;
206
+ fields: Uint8Array[];
207
+ }
208
+
209
+ export interface ClientIvcLoad {
210
+ circuit: CircuitInput;
211
+ }
212
+
213
+ interface MsgpackClientIvcLoad {
214
+ circuit: MsgpackCircuitInput;
215
+ }
216
+
217
+ export interface ClientIvcLoadResponse {
218
+ }
219
+
220
+ interface MsgpackClientIvcLoadResponse {
221
+ }
222
+
223
+ export interface ClientIVCProof {
224
+ megaProof: Fr[];
225
+ goblinProof: GoblinProof;
226
+ }
227
+
228
+ interface MsgpackClientIVCProof {
229
+ mega_proof: Uint8Array[];
230
+ goblin_proof: MsgpackGoblinProof;
231
+ }
232
+
233
+ export interface ClientIvcProve {
234
+ }
235
+
236
+ interface MsgpackClientIvcProve {
237
+ }
238
+
239
+ export interface ClientIvcProveResponse {
240
+ proof: ClientIVCProof;
241
+ }
242
+
243
+ interface MsgpackClientIvcProveResponse {
244
+ proof: MsgpackClientIVCProof;
245
+ }
246
+
247
+ export interface ClientIvcStart {
248
+ numCircuits: number;
249
+ }
250
+
251
+ interface MsgpackClientIvcStart {
252
+ num_circuits: number;
253
+ }
254
+
255
+ export interface ClientIvcStartResponse {
256
+ }
257
+
258
+ interface MsgpackClientIvcStartResponse {
259
+ }
260
+
261
+ export interface ClientIvcStats {
262
+ circuit: CircuitInputNoVK;
263
+ includeGatesPerOpcode: boolean;
264
+ }
265
+
266
+ interface MsgpackClientIvcStats {
267
+ circuit: MsgpackCircuitInputNoVK;
268
+ include_gates_per_opcode: boolean;
269
+ }
270
+
271
+ export interface ClientIvcStatsResponse {
272
+ acirOpcodes: number;
273
+ circuitSize: number;
274
+ gatesPerOpcode: number[];
275
+ }
276
+
277
+ interface MsgpackClientIvcStatsResponse {
278
+ acir_opcodes: number;
279
+ circuit_size: number;
280
+ gates_per_opcode: number[];
281
+ }
282
+
283
+ export interface ClientIvcVerify {
284
+ proof: ClientIVCProof;
285
+ vk: Uint8Array;
286
+ }
287
+
288
+ interface MsgpackClientIvcVerify {
289
+ proof: MsgpackClientIVCProof;
290
+ vk: Uint8Array;
291
+ }
292
+
293
+ export interface ClientIvcVerifyResponse {
294
+ valid: boolean;
295
+ }
296
+
297
+ interface MsgpackClientIvcVerifyResponse {
298
+ valid: boolean;
299
+ }
300
+
301
+ export interface ECCVMProof {
302
+ preIpaProof: Fr[];
303
+ ipaProof: Fr[];
304
+ }
305
+
306
+ interface MsgpackECCVMProof {
307
+ pre_ipa_proof: Uint8Array[];
308
+ ipa_proof: Uint8Array[];
309
+ }
310
+
311
+ export interface GoblinProof {
312
+ mergeProof: Fr[];
313
+ eccvmProof: ECCVMProof;
314
+ translatorProof: Fr[];
315
+ }
316
+
317
+ interface MsgpackGoblinProof {
318
+ merge_proof: Uint8Array[];
319
+ eccvm_proof: MsgpackECCVMProof;
320
+ translator_proof: Uint8Array[];
321
+ }
322
+
323
+ export interface ProofSystemSettings {
324
+ ipaAccumulation: boolean;
325
+ oracleHashType: string;
326
+ disableZk: boolean;
327
+ optimizedSolidityVerifier: boolean;
328
+ }
329
+
330
+ interface MsgpackProofSystemSettings {
331
+ ipa_accumulation: boolean;
332
+ oracle_hash_type: string;
333
+ disable_zk: boolean;
334
+ optimized_solidity_verifier: boolean;
335
+ }
336
+
337
+ export interface VkAsFields {
338
+ verificationKey: Uint8Array;
339
+ }
340
+
341
+ interface MsgpackVkAsFields {
342
+ verification_key: Uint8Array;
343
+ }
344
+
345
+ export interface VkAsFieldsResponse {
346
+ fields: Fr[];
347
+ }
348
+
349
+ interface MsgpackVkAsFieldsResponse {
350
+ fields: Uint8Array[];
351
+ }
352
+
353
+ // Private Msgpack interfaces (not exported)
354
+ export interface CircuitComputeVk {
355
+ circuit: CircuitInputNoVK;
356
+ settings: ProofSystemSettings;
357
+ }
358
+
359
+ interface MsgpackCircuitComputeVk {
360
+ circuit: MsgpackCircuitInputNoVK;
361
+ settings: MsgpackProofSystemSettings;
362
+ }
363
+
364
+ export interface CircuitComputeVkResponse {
365
+ bytes: Uint8Array;
366
+ fields: Uint256T[];
367
+ hash: Uint8Array;
368
+ }
369
+
370
+ interface MsgpackCircuitComputeVkResponse {
371
+ bytes: Uint8Array;
372
+ fields: Uint8Array[];
373
+ hash: Uint8Array;
374
+ }
375
+
376
+ export interface CircuitInfoResponse {
377
+ numGates: number;
378
+ numGatesDyadic: number;
379
+ numAcirOpcodes: number;
380
+ gatesPerOpcode: number[];
381
+ }
382
+
383
+ interface MsgpackCircuitInfoResponse {
384
+ num_gates: number;
385
+ num_gates_dyadic: number;
386
+ num_acir_opcodes: number;
387
+ gates_per_opcode: number[];
388
+ }
389
+
390
+ export interface CircuitInput {
391
+ name: string;
392
+ bytecode: Uint8Array;
393
+ verificationKey: Uint8Array;
394
+ }
395
+
396
+ interface MsgpackCircuitInput {
397
+ name: string;
398
+ bytecode: Uint8Array;
399
+ verification_key: Uint8Array;
400
+ }
401
+
402
+ export interface CircuitInputNoVK {
403
+ name: string;
404
+ bytecode: Uint8Array;
405
+ }
406
+
407
+ interface MsgpackCircuitInputNoVK {
408
+ name: string;
409
+ bytecode: Uint8Array;
410
+ }
411
+
412
+ export interface CircuitProve {
413
+ circuit: CircuitInput;
414
+ witness: Uint8Array;
415
+ settings: ProofSystemSettings;
416
+ }
417
+
418
+ interface MsgpackCircuitProve {
419
+ circuit: MsgpackCircuitInput;
420
+ witness: Uint8Array;
421
+ settings: MsgpackProofSystemSettings;
422
+ }
423
+
424
+ export interface CircuitProveResponse {
425
+ publicInputs: Uint256T[];
426
+ proof: Uint256T[];
427
+ vk: CircuitComputeVkResponse;
428
+ }
429
+
430
+ interface MsgpackCircuitProveResponse {
431
+ public_inputs: Uint8Array[];
432
+ proof: Uint8Array[];
433
+ vk: MsgpackCircuitComputeVkResponse;
434
+ }
435
+
436
+ export interface CircuitStats {
437
+ circuit: CircuitInput;
438
+ includeGatesPerOpcode: boolean;
439
+ settings: ProofSystemSettings;
440
+ }
441
+
442
+ interface MsgpackCircuitStats {
443
+ circuit: MsgpackCircuitInput;
444
+ include_gates_per_opcode: boolean;
445
+ settings: MsgpackProofSystemSettings;
446
+ }
447
+
448
+ export interface CircuitVerify {
449
+ verificationKey: Uint8Array;
450
+ publicInputs: Uint256T[];
451
+ proof: Uint256T[];
452
+ settings: ProofSystemSettings;
453
+ }
454
+
455
+ interface MsgpackCircuitVerify {
456
+ verification_key: Uint8Array;
457
+ public_inputs: Uint8Array[];
458
+ proof: Uint8Array[];
459
+ settings: MsgpackProofSystemSettings;
460
+ }
461
+
462
+ export interface CircuitVerifyResponse {
463
+ verified: boolean;
464
+ }
465
+
466
+ interface MsgpackCircuitVerifyResponse {
467
+ verified: boolean;
468
+ }
469
+
470
+ export interface CircuitWriteSolidityVerifier {
471
+ verificationKey: Uint8Array;
472
+ settings: ProofSystemSettings;
473
+ }
474
+
475
+ interface MsgpackCircuitWriteSolidityVerifier {
476
+ verification_key: Uint8Array;
477
+ settings: MsgpackProofSystemSettings;
478
+ }
479
+
480
+ export interface CircuitWriteSolidityVerifierResponse {
481
+ solidityCode: string;
482
+ }
483
+
484
+ interface MsgpackCircuitWriteSolidityVerifierResponse {
485
+ solidity_code: string;
486
+ }
487
+
488
+ export interface ClientIvcAccumulate {
489
+ witness: Uint8Array;
490
+ }
491
+
492
+ interface MsgpackClientIvcAccumulate {
493
+ witness: Uint8Array;
494
+ }
495
+
496
+ export interface ClientIvcAccumulateResponse {
497
+ }
498
+
499
+ interface MsgpackClientIvcAccumulateResponse {
500
+ }
501
+
502
+ export interface ClientIvcCheckPrecomputedVk {
503
+ circuit: CircuitInput;
504
+ }
505
+
506
+ interface MsgpackClientIvcCheckPrecomputedVk {
507
+ circuit: MsgpackCircuitInput;
508
+ }
509
+
510
+ export interface ClientIvcCheckPrecomputedVkResponse {
511
+ valid: boolean;
512
+ actualVk: Uint8Array;
513
+ }
514
+
515
+ interface MsgpackClientIvcCheckPrecomputedVkResponse {
516
+ valid: boolean;
517
+ actual_vk: Uint8Array;
518
+ }
519
+
520
+ export interface ClientIvcComputeIvcVk {
521
+ circuit: CircuitInputNoVK;
522
+ }
523
+
524
+ interface MsgpackClientIvcComputeIvcVk {
525
+ circuit: MsgpackCircuitInputNoVK;
526
+ }
527
+
528
+ export interface ClientIvcComputeIvcVkResponse {
529
+ bytes: Uint8Array;
530
+ }
531
+
532
+ interface MsgpackClientIvcComputeIvcVkResponse {
533
+ bytes: Uint8Array;
534
+ }
535
+
536
+ export interface ClientIvcComputeStandaloneVk {
537
+ circuit: CircuitInputNoVK;
538
+ }
539
+
540
+ interface MsgpackClientIvcComputeStandaloneVk {
541
+ circuit: MsgpackCircuitInputNoVK;
542
+ }
543
+
544
+ export interface ClientIvcComputeStandaloneVkResponse {
545
+ bytes: Uint8Array;
546
+ fields: Fr[];
547
+ }
548
+
549
+ interface MsgpackClientIvcComputeStandaloneVkResponse {
550
+ bytes: Uint8Array;
551
+ fields: Uint8Array[];
552
+ }
553
+
554
+ export interface ClientIvcLoad {
555
+ circuit: CircuitInput;
556
+ }
557
+
558
+ interface MsgpackClientIvcLoad {
559
+ circuit: MsgpackCircuitInput;
560
+ }
561
+
562
+ export interface ClientIvcLoadResponse {
563
+ }
564
+
565
+ interface MsgpackClientIvcLoadResponse {
566
+ }
567
+
568
+ export interface ClientIVCProof {
569
+ megaProof: Fr[];
570
+ goblinProof: GoblinProof;
571
+ }
572
+
573
+ interface MsgpackClientIVCProof {
574
+ mega_proof: Uint8Array[];
575
+ goblin_proof: MsgpackGoblinProof;
576
+ }
577
+
578
+ export interface ClientIvcProve {
579
+ }
580
+
581
+ interface MsgpackClientIvcProve {
582
+ }
583
+
584
+ export interface ClientIvcProveResponse {
585
+ proof: ClientIVCProof;
586
+ }
587
+
588
+ interface MsgpackClientIvcProveResponse {
589
+ proof: MsgpackClientIVCProof;
590
+ }
591
+
592
+ export interface ClientIvcStart {
593
+ numCircuits: number;
594
+ }
595
+
596
+ interface MsgpackClientIvcStart {
597
+ num_circuits: number;
598
+ }
599
+
600
+ export interface ClientIvcStartResponse {
601
+ }
602
+
603
+ interface MsgpackClientIvcStartResponse {
604
+ }
605
+
606
+ export interface ClientIvcStats {
607
+ circuit: CircuitInputNoVK;
608
+ includeGatesPerOpcode: boolean;
609
+ }
610
+
611
+ interface MsgpackClientIvcStats {
612
+ circuit: MsgpackCircuitInputNoVK;
613
+ include_gates_per_opcode: boolean;
614
+ }
615
+
616
+ export interface ClientIvcStatsResponse {
617
+ acirOpcodes: number;
618
+ circuitSize: number;
619
+ gatesPerOpcode: number[];
620
+ }
621
+
622
+ interface MsgpackClientIvcStatsResponse {
623
+ acir_opcodes: number;
624
+ circuit_size: number;
625
+ gates_per_opcode: number[];
626
+ }
627
+
628
+ export interface ClientIvcVerify {
629
+ proof: ClientIVCProof;
630
+ vk: Uint8Array;
631
+ }
632
+
633
+ interface MsgpackClientIvcVerify {
634
+ proof: MsgpackClientIVCProof;
635
+ vk: Uint8Array;
636
+ }
637
+
638
+ export interface ClientIvcVerifyResponse {
639
+ valid: boolean;
640
+ }
641
+
642
+ interface MsgpackClientIvcVerifyResponse {
643
+ valid: boolean;
644
+ }
645
+
646
+ export interface ECCVMProof {
647
+ preIpaProof: Fr[];
648
+ ipaProof: Fr[];
649
+ }
650
+
651
+ interface MsgpackECCVMProof {
652
+ pre_ipa_proof: Uint8Array[];
653
+ ipa_proof: Uint8Array[];
654
+ }
655
+
656
+ export interface GoblinProof {
657
+ mergeProof: Fr[];
658
+ eccvmProof: ECCVMProof;
659
+ translatorProof: Fr[];
660
+ }
661
+
662
+ interface MsgpackGoblinProof {
663
+ merge_proof: Uint8Array[];
664
+ eccvm_proof: MsgpackECCVMProof;
665
+ translator_proof: Uint8Array[];
666
+ }
667
+
668
+ export interface ProofSystemSettings {
669
+ ipaAccumulation: boolean;
670
+ oracleHashType: string;
671
+ disableZk: boolean;
672
+ optimizedSolidityVerifier: boolean;
673
+ }
674
+
675
+ interface MsgpackProofSystemSettings {
676
+ ipa_accumulation: boolean;
677
+ oracle_hash_type: string;
678
+ disable_zk: boolean;
679
+ optimized_solidity_verifier: boolean;
680
+ }
681
+
682
+ export interface VkAsFields {
683
+ verificationKey: Uint8Array;
684
+ }
685
+
686
+ interface MsgpackVkAsFields {
687
+ verification_key: Uint8Array;
688
+ }
689
+
690
+ export interface VkAsFieldsResponse {
691
+ fields: Fr[];
692
+ }
693
+
694
+ interface MsgpackVkAsFieldsResponse {
695
+ fields: Uint8Array[];
696
+ }
697
+
698
+ // Conversion functions (exported)
699
+ export function toCircuitComputeVk(o: MsgpackCircuitComputeVk): CircuitComputeVk {
700
+ if (o.circuit === undefined) { throw new Error("Expected circuit in CircuitComputeVk deserialization"); }
701
+ if (o.settings === undefined) { throw new Error("Expected settings in CircuitComputeVk deserialization"); };
702
+ return {
703
+ circuit: toCircuitInputNoVK(o.circuit),
704
+ settings: toProofSystemSettings(o.settings),
705
+ };
706
+ }
707
+
708
+ export function fromCircuitComputeVk(o: CircuitComputeVk): MsgpackCircuitComputeVk {
709
+ if (o.circuit === undefined) { throw new Error("Expected circuit in CircuitComputeVk serialization"); }
710
+ if (o.settings === undefined) { throw new Error("Expected settings in CircuitComputeVk serialization"); };
711
+ return {
712
+ circuit: fromCircuitInputNoVK(o.circuit),
713
+ settings: fromProofSystemSettings(o.settings),
714
+ };
715
+ }
716
+
717
+ export function toCircuitComputeVkResponse(o: MsgpackCircuitComputeVkResponse): CircuitComputeVkResponse {
718
+ if (o.bytes === undefined) { throw new Error("Expected bytes in CircuitComputeVkResponse deserialization"); }
719
+ if (o.fields === undefined) { throw new Error("Expected fields in CircuitComputeVkResponse deserialization"); }
720
+ if (o.hash === undefined) { throw new Error("Expected hash in CircuitComputeVkResponse deserialization"); };
721
+ return {
722
+ bytes: o.bytes,
723
+ fields: o.fields.map((v: any) => v),
724
+ hash: o.hash,
725
+ };
726
+ }
727
+
728
+ export function fromCircuitComputeVkResponse(o: CircuitComputeVkResponse): MsgpackCircuitComputeVkResponse {
729
+ if (o.bytes === undefined) { throw new Error("Expected bytes in CircuitComputeVkResponse serialization"); }
730
+ if (o.fields === undefined) { throw new Error("Expected fields in CircuitComputeVkResponse serialization"); }
731
+ if (o.hash === undefined) { throw new Error("Expected hash in CircuitComputeVkResponse serialization"); };
732
+ return {
733
+ bytes: o.bytes,
734
+ fields: o.fields.map((v: any) => v),
735
+ hash: o.hash,
736
+ };
737
+ }
738
+
739
+ export function toCircuitInfoResponse(o: MsgpackCircuitInfoResponse): CircuitInfoResponse {
740
+ if (o.num_gates === undefined) { throw new Error("Expected num_gates in CircuitInfoResponse deserialization"); }
741
+ if (o.num_gates_dyadic === undefined) { throw new Error("Expected num_gates_dyadic in CircuitInfoResponse deserialization"); }
742
+ if (o.num_acir_opcodes === undefined) { throw new Error("Expected num_acir_opcodes in CircuitInfoResponse deserialization"); }
743
+ if (o.gates_per_opcode === undefined) { throw new Error("Expected gates_per_opcode in CircuitInfoResponse deserialization"); };
744
+ return {
745
+ numGates: o.num_gates,
746
+ numGatesDyadic: o.num_gates_dyadic,
747
+ numAcirOpcodes: o.num_acir_opcodes,
748
+ gatesPerOpcode: o.gates_per_opcode.map((v: any) => v),
749
+ };
750
+ }
751
+
752
+ export function fromCircuitInfoResponse(o: CircuitInfoResponse): MsgpackCircuitInfoResponse {
753
+ if (o.numGates === undefined) { throw new Error("Expected numGates in CircuitInfoResponse serialization"); }
754
+ if (o.numGatesDyadic === undefined) { throw new Error("Expected numGatesDyadic in CircuitInfoResponse serialization"); }
755
+ if (o.numAcirOpcodes === undefined) { throw new Error("Expected numAcirOpcodes in CircuitInfoResponse serialization"); }
756
+ if (o.gatesPerOpcode === undefined) { throw new Error("Expected gatesPerOpcode in CircuitInfoResponse serialization"); };
757
+ return {
758
+ num_gates: o.numGates,
759
+ num_gates_dyadic: o.numGatesDyadic,
760
+ num_acir_opcodes: o.numAcirOpcodes,
761
+ gates_per_opcode: o.gatesPerOpcode.map((v: any) => v),
762
+ };
763
+ }
764
+
765
+ export function toCircuitInput(o: MsgpackCircuitInput): CircuitInput {
766
+ if (o.name === undefined) { throw new Error("Expected name in CircuitInput deserialization"); }
767
+ if (o.bytecode === undefined) { throw new Error("Expected bytecode in CircuitInput deserialization"); }
768
+ if (o.verification_key === undefined) { throw new Error("Expected verification_key in CircuitInput deserialization"); };
769
+ return {
770
+ name: o.name,
771
+ bytecode: o.bytecode,
772
+ verificationKey: o.verification_key,
773
+ };
774
+ }
775
+
776
+ export function fromCircuitInput(o: CircuitInput): MsgpackCircuitInput {
777
+ if (o.name === undefined) { throw new Error("Expected name in CircuitInput serialization"); }
778
+ if (o.bytecode === undefined) { throw new Error("Expected bytecode in CircuitInput serialization"); }
779
+ if (o.verificationKey === undefined) { throw new Error("Expected verificationKey in CircuitInput serialization"); };
780
+ return {
781
+ name: o.name,
782
+ bytecode: o.bytecode,
783
+ verification_key: o.verificationKey,
784
+ };
785
+ }
786
+
787
+ export function toCircuitInputNoVK(o: MsgpackCircuitInputNoVK): CircuitInputNoVK {
788
+ if (o.name === undefined) { throw new Error("Expected name in CircuitInputNoVK deserialization"); }
789
+ if (o.bytecode === undefined) { throw new Error("Expected bytecode in CircuitInputNoVK deserialization"); };
790
+ return {
791
+ name: o.name,
792
+ bytecode: o.bytecode,
793
+ };
794
+ }
795
+
796
+ export function fromCircuitInputNoVK(o: CircuitInputNoVK): MsgpackCircuitInputNoVK {
797
+ if (o.name === undefined) { throw new Error("Expected name in CircuitInputNoVK serialization"); }
798
+ if (o.bytecode === undefined) { throw new Error("Expected bytecode in CircuitInputNoVK serialization"); };
799
+ return {
800
+ name: o.name,
801
+ bytecode: o.bytecode,
802
+ };
803
+ }
804
+
805
+ export function toCircuitProve(o: MsgpackCircuitProve): CircuitProve {
806
+ if (o.circuit === undefined) { throw new Error("Expected circuit in CircuitProve deserialization"); }
807
+ if (o.witness === undefined) { throw new Error("Expected witness in CircuitProve deserialization"); }
808
+ if (o.settings === undefined) { throw new Error("Expected settings in CircuitProve deserialization"); };
809
+ return {
810
+ circuit: toCircuitInput(o.circuit),
811
+ witness: o.witness,
812
+ settings: toProofSystemSettings(o.settings),
813
+ };
814
+ }
815
+
816
+ export function fromCircuitProve(o: CircuitProve): MsgpackCircuitProve {
817
+ if (o.circuit === undefined) { throw new Error("Expected circuit in CircuitProve serialization"); }
818
+ if (o.witness === undefined) { throw new Error("Expected witness in CircuitProve serialization"); }
819
+ if (o.settings === undefined) { throw new Error("Expected settings in CircuitProve serialization"); };
820
+ return {
821
+ circuit: fromCircuitInput(o.circuit),
822
+ witness: o.witness,
823
+ settings: fromProofSystemSettings(o.settings),
824
+ };
825
+ }
826
+
827
+ export function toCircuitProveResponse(o: MsgpackCircuitProveResponse): CircuitProveResponse {
828
+ if (o.public_inputs === undefined) { throw new Error("Expected public_inputs in CircuitProveResponse deserialization"); }
829
+ if (o.proof === undefined) { throw new Error("Expected proof in CircuitProveResponse deserialization"); }
830
+ if (o.vk === undefined) { throw new Error("Expected vk in CircuitProveResponse deserialization"); };
831
+ return {
832
+ publicInputs: o.public_inputs.map((v: any) => v),
833
+ proof: o.proof.map((v: any) => v),
834
+ vk: toCircuitComputeVkResponse(o.vk),
835
+ };
836
+ }
837
+
838
+ export function fromCircuitProveResponse(o: CircuitProveResponse): MsgpackCircuitProveResponse {
839
+ if (o.publicInputs === undefined) { throw new Error("Expected publicInputs in CircuitProveResponse serialization"); }
840
+ if (o.proof === undefined) { throw new Error("Expected proof in CircuitProveResponse serialization"); }
841
+ if (o.vk === undefined) { throw new Error("Expected vk in CircuitProveResponse serialization"); };
842
+ return {
843
+ public_inputs: o.publicInputs.map((v: any) => v),
844
+ proof: o.proof.map((v: any) => v),
845
+ vk: fromCircuitComputeVkResponse(o.vk),
846
+ };
847
+ }
848
+
849
+ export function toCircuitStats(o: MsgpackCircuitStats): CircuitStats {
850
+ if (o.circuit === undefined) { throw new Error("Expected circuit in CircuitStats deserialization"); }
851
+ if (o.include_gates_per_opcode === undefined) { throw new Error("Expected include_gates_per_opcode in CircuitStats deserialization"); }
852
+ if (o.settings === undefined) { throw new Error("Expected settings in CircuitStats deserialization"); };
853
+ return {
854
+ circuit: toCircuitInput(o.circuit),
855
+ includeGatesPerOpcode: o.include_gates_per_opcode,
856
+ settings: toProofSystemSettings(o.settings),
857
+ };
858
+ }
859
+
860
+ export function fromCircuitStats(o: CircuitStats): MsgpackCircuitStats {
861
+ if (o.circuit === undefined) { throw new Error("Expected circuit in CircuitStats serialization"); }
862
+ if (o.includeGatesPerOpcode === undefined) { throw new Error("Expected includeGatesPerOpcode in CircuitStats serialization"); }
863
+ if (o.settings === undefined) { throw new Error("Expected settings in CircuitStats serialization"); };
864
+ return {
865
+ circuit: fromCircuitInput(o.circuit),
866
+ include_gates_per_opcode: o.includeGatesPerOpcode,
867
+ settings: fromProofSystemSettings(o.settings),
868
+ };
869
+ }
870
+
871
+ export function toCircuitVerify(o: MsgpackCircuitVerify): CircuitVerify {
872
+ if (o.verification_key === undefined) { throw new Error("Expected verification_key in CircuitVerify deserialization"); }
873
+ if (o.public_inputs === undefined) { throw new Error("Expected public_inputs in CircuitVerify deserialization"); }
874
+ if (o.proof === undefined) { throw new Error("Expected proof in CircuitVerify deserialization"); }
875
+ if (o.settings === undefined) { throw new Error("Expected settings in CircuitVerify deserialization"); };
876
+ return {
877
+ verificationKey: o.verification_key,
878
+ publicInputs: o.public_inputs.map((v: any) => v),
879
+ proof: o.proof.map((v: any) => v),
880
+ settings: toProofSystemSettings(o.settings),
881
+ };
882
+ }
883
+
884
+ export function fromCircuitVerify(o: CircuitVerify): MsgpackCircuitVerify {
885
+ if (o.verificationKey === undefined) { throw new Error("Expected verificationKey in CircuitVerify serialization"); }
886
+ if (o.publicInputs === undefined) { throw new Error("Expected publicInputs in CircuitVerify serialization"); }
887
+ if (o.proof === undefined) { throw new Error("Expected proof in CircuitVerify serialization"); }
888
+ if (o.settings === undefined) { throw new Error("Expected settings in CircuitVerify serialization"); };
889
+ return {
890
+ verification_key: o.verificationKey,
891
+ public_inputs: o.publicInputs.map((v: any) => v),
892
+ proof: o.proof.map((v: any) => v),
893
+ settings: fromProofSystemSettings(o.settings),
894
+ };
895
+ }
896
+
897
+ export function toCircuitVerifyResponse(o: MsgpackCircuitVerifyResponse): CircuitVerifyResponse {
898
+ if (o.verified === undefined) { throw new Error("Expected verified in CircuitVerifyResponse deserialization"); };
899
+ return {
900
+ verified: o.verified,
901
+ };
902
+ }
903
+
904
+ export function fromCircuitVerifyResponse(o: CircuitVerifyResponse): MsgpackCircuitVerifyResponse {
905
+ if (o.verified === undefined) { throw new Error("Expected verified in CircuitVerifyResponse serialization"); };
906
+ return {
907
+ verified: o.verified,
908
+ };
909
+ }
910
+
911
+ export function toCircuitWriteSolidityVerifier(o: MsgpackCircuitWriteSolidityVerifier): CircuitWriteSolidityVerifier {
912
+ if (o.verification_key === undefined) { throw new Error("Expected verification_key in CircuitWriteSolidityVerifier deserialization"); }
913
+ if (o.settings === undefined) { throw new Error("Expected settings in CircuitWriteSolidityVerifier deserialization"); };
914
+ return {
915
+ verificationKey: o.verification_key,
916
+ settings: toProofSystemSettings(o.settings),
917
+ };
918
+ }
919
+
920
+ export function fromCircuitWriteSolidityVerifier(o: CircuitWriteSolidityVerifier): MsgpackCircuitWriteSolidityVerifier {
921
+ if (o.verificationKey === undefined) { throw new Error("Expected verificationKey in CircuitWriteSolidityVerifier serialization"); }
922
+ if (o.settings === undefined) { throw new Error("Expected settings in CircuitWriteSolidityVerifier serialization"); };
923
+ return {
924
+ verification_key: o.verificationKey,
925
+ settings: fromProofSystemSettings(o.settings),
926
+ };
927
+ }
928
+
929
+ export function toCircuitWriteSolidityVerifierResponse(o: MsgpackCircuitWriteSolidityVerifierResponse): CircuitWriteSolidityVerifierResponse {
930
+ if (o.solidity_code === undefined) { throw new Error("Expected solidity_code in CircuitWriteSolidityVerifierResponse deserialization"); };
931
+ return {
932
+ solidityCode: o.solidity_code,
933
+ };
934
+ }
935
+
936
+ export function fromCircuitWriteSolidityVerifierResponse(o: CircuitWriteSolidityVerifierResponse): MsgpackCircuitWriteSolidityVerifierResponse {
937
+ if (o.solidityCode === undefined) { throw new Error("Expected solidityCode in CircuitWriteSolidityVerifierResponse serialization"); };
938
+ return {
939
+ solidity_code: o.solidityCode,
940
+ };
941
+ }
942
+
943
+ export function toClientIvcAccumulate(o: MsgpackClientIvcAccumulate): ClientIvcAccumulate {
944
+ if (o.witness === undefined) { throw new Error("Expected witness in ClientIvcAccumulate deserialization"); };
945
+ return {
946
+ witness: o.witness,
947
+ };
948
+ }
949
+
950
+ export function fromClientIvcAccumulate(o: ClientIvcAccumulate): MsgpackClientIvcAccumulate {
951
+ if (o.witness === undefined) { throw new Error("Expected witness in ClientIvcAccumulate serialization"); };
952
+ return {
953
+ witness: o.witness,
954
+ };
955
+ }
956
+
957
+ export function toClientIvcAccumulateResponse(o: MsgpackClientIvcAccumulateResponse): ClientIvcAccumulateResponse {
958
+ return {};
959
+ }
960
+
961
+ export function fromClientIvcAccumulateResponse(o: ClientIvcAccumulateResponse): MsgpackClientIvcAccumulateResponse {
962
+ return {};
963
+ }
964
+
965
+ export function toClientIvcCheckPrecomputedVk(o: MsgpackClientIvcCheckPrecomputedVk): ClientIvcCheckPrecomputedVk {
966
+ if (o.circuit === undefined) { throw new Error("Expected circuit in ClientIvcCheckPrecomputedVk deserialization"); };
967
+ return {
968
+ circuit: toCircuitInput(o.circuit),
969
+ };
970
+ }
971
+
972
+ export function fromClientIvcCheckPrecomputedVk(o: ClientIvcCheckPrecomputedVk): MsgpackClientIvcCheckPrecomputedVk {
973
+ if (o.circuit === undefined) { throw new Error("Expected circuit in ClientIvcCheckPrecomputedVk serialization"); };
974
+ return {
975
+ circuit: fromCircuitInput(o.circuit),
976
+ };
977
+ }
978
+
979
+ export function toClientIvcCheckPrecomputedVkResponse(o: MsgpackClientIvcCheckPrecomputedVkResponse): ClientIvcCheckPrecomputedVkResponse {
980
+ if (o.valid === undefined) { throw new Error("Expected valid in ClientIvcCheckPrecomputedVkResponse deserialization"); }
981
+ if (o.actual_vk === undefined) { throw new Error("Expected actual_vk in ClientIvcCheckPrecomputedVkResponse deserialization"); };
982
+ return {
983
+ valid: o.valid,
984
+ actualVk: o.actual_vk,
985
+ };
986
+ }
987
+
988
+ export function fromClientIvcCheckPrecomputedVkResponse(o: ClientIvcCheckPrecomputedVkResponse): MsgpackClientIvcCheckPrecomputedVkResponse {
989
+ if (o.valid === undefined) { throw new Error("Expected valid in ClientIvcCheckPrecomputedVkResponse serialization"); }
990
+ if (o.actualVk === undefined) { throw new Error("Expected actualVk in ClientIvcCheckPrecomputedVkResponse serialization"); };
991
+ return {
992
+ valid: o.valid,
993
+ actual_vk: o.actualVk,
994
+ };
995
+ }
996
+
997
+ export function toClientIvcComputeIvcVk(o: MsgpackClientIvcComputeIvcVk): ClientIvcComputeIvcVk {
998
+ if (o.circuit === undefined) { throw new Error("Expected circuit in ClientIvcComputeIvcVk deserialization"); };
999
+ return {
1000
+ circuit: toCircuitInputNoVK(o.circuit),
1001
+ };
1002
+ }
1003
+
1004
+ export function fromClientIvcComputeIvcVk(o: ClientIvcComputeIvcVk): MsgpackClientIvcComputeIvcVk {
1005
+ if (o.circuit === undefined) { throw new Error("Expected circuit in ClientIvcComputeIvcVk serialization"); };
1006
+ return {
1007
+ circuit: fromCircuitInputNoVK(o.circuit),
1008
+ };
1009
+ }
1010
+
1011
+ export function toClientIvcComputeIvcVkResponse(o: MsgpackClientIvcComputeIvcVkResponse): ClientIvcComputeIvcVkResponse {
1012
+ if (o.bytes === undefined) { throw new Error("Expected bytes in ClientIvcComputeIvcVkResponse deserialization"); };
1013
+ return {
1014
+ bytes: o.bytes,
1015
+ };
1016
+ }
1017
+
1018
+ export function fromClientIvcComputeIvcVkResponse(o: ClientIvcComputeIvcVkResponse): MsgpackClientIvcComputeIvcVkResponse {
1019
+ if (o.bytes === undefined) { throw new Error("Expected bytes in ClientIvcComputeIvcVkResponse serialization"); };
1020
+ return {
1021
+ bytes: o.bytes,
1022
+ };
1023
+ }
1024
+
1025
+ export function toClientIvcComputeStandaloneVk(o: MsgpackClientIvcComputeStandaloneVk): ClientIvcComputeStandaloneVk {
1026
+ if (o.circuit === undefined) { throw new Error("Expected circuit in ClientIvcComputeStandaloneVk deserialization"); };
1027
+ return {
1028
+ circuit: toCircuitInputNoVK(o.circuit),
1029
+ };
1030
+ }
1031
+
1032
+ export function fromClientIvcComputeStandaloneVk(o: ClientIvcComputeStandaloneVk): MsgpackClientIvcComputeStandaloneVk {
1033
+ if (o.circuit === undefined) { throw new Error("Expected circuit in ClientIvcComputeStandaloneVk serialization"); };
1034
+ return {
1035
+ circuit: fromCircuitInputNoVK(o.circuit),
1036
+ };
1037
+ }
1038
+
1039
+ export function toClientIvcComputeStandaloneVkResponse(o: MsgpackClientIvcComputeStandaloneVkResponse): ClientIvcComputeStandaloneVkResponse {
1040
+ if (o.bytes === undefined) { throw new Error("Expected bytes in ClientIvcComputeStandaloneVkResponse deserialization"); }
1041
+ if (o.fields === undefined) { throw new Error("Expected fields in ClientIvcComputeStandaloneVkResponse deserialization"); };
1042
+ return {
1043
+ bytes: o.bytes,
1044
+ fields: o.fields.map((v: any) => v),
1045
+ };
1046
+ }
1047
+
1048
+ export function fromClientIvcComputeStandaloneVkResponse(o: ClientIvcComputeStandaloneVkResponse): MsgpackClientIvcComputeStandaloneVkResponse {
1049
+ if (o.bytes === undefined) { throw new Error("Expected bytes in ClientIvcComputeStandaloneVkResponse serialization"); }
1050
+ if (o.fields === undefined) { throw new Error("Expected fields in ClientIvcComputeStandaloneVkResponse serialization"); };
1051
+ return {
1052
+ bytes: o.bytes,
1053
+ fields: o.fields.map((v: any) => v),
1054
+ };
1055
+ }
1056
+
1057
+ export function toClientIvcLoad(o: MsgpackClientIvcLoad): ClientIvcLoad {
1058
+ if (o.circuit === undefined) { throw new Error("Expected circuit in ClientIvcLoad deserialization"); };
1059
+ return {
1060
+ circuit: toCircuitInput(o.circuit),
1061
+ };
1062
+ }
1063
+
1064
+ export function fromClientIvcLoad(o: ClientIvcLoad): MsgpackClientIvcLoad {
1065
+ if (o.circuit === undefined) { throw new Error("Expected circuit in ClientIvcLoad serialization"); };
1066
+ return {
1067
+ circuit: fromCircuitInput(o.circuit),
1068
+ };
1069
+ }
1070
+
1071
+ export function toClientIvcLoadResponse(o: MsgpackClientIvcLoadResponse): ClientIvcLoadResponse {
1072
+ return {};
1073
+ }
1074
+
1075
+ export function fromClientIvcLoadResponse(o: ClientIvcLoadResponse): MsgpackClientIvcLoadResponse {
1076
+ return {};
1077
+ }
1078
+
1079
+ export function toClientIVCProof(o: MsgpackClientIVCProof): ClientIVCProof {
1080
+ if (o.mega_proof === undefined) { throw new Error("Expected mega_proof in ClientIVCProof deserialization"); }
1081
+ if (o.goblin_proof === undefined) { throw new Error("Expected goblin_proof in ClientIVCProof deserialization"); };
1082
+ return {
1083
+ megaProof: o.mega_proof.map((v: any) => v),
1084
+ goblinProof: toGoblinProof(o.goblin_proof),
1085
+ };
1086
+ }
1087
+
1088
+ export function fromClientIVCProof(o: ClientIVCProof): MsgpackClientIVCProof {
1089
+ if (o.megaProof === undefined) { throw new Error("Expected megaProof in ClientIVCProof serialization"); }
1090
+ if (o.goblinProof === undefined) { throw new Error("Expected goblinProof in ClientIVCProof serialization"); };
1091
+ return {
1092
+ mega_proof: o.megaProof.map((v: any) => v),
1093
+ goblin_proof: fromGoblinProof(o.goblinProof),
1094
+ };
1095
+ }
1096
+
1097
+ export function toClientIvcProve(o: MsgpackClientIvcProve): ClientIvcProve {
1098
+ return {};
1099
+ }
1100
+
1101
+ export function fromClientIvcProve(o: ClientIvcProve): MsgpackClientIvcProve {
1102
+ return {};
1103
+ }
1104
+
1105
+ export function toClientIvcProveResponse(o: MsgpackClientIvcProveResponse): ClientIvcProveResponse {
1106
+ if (o.proof === undefined) { throw new Error("Expected proof in ClientIvcProveResponse deserialization"); };
1107
+ return {
1108
+ proof: toClientIVCProof(o.proof),
1109
+ };
1110
+ }
1111
+
1112
+ export function fromClientIvcProveResponse(o: ClientIvcProveResponse): MsgpackClientIvcProveResponse {
1113
+ if (o.proof === undefined) { throw new Error("Expected proof in ClientIvcProveResponse serialization"); };
1114
+ return {
1115
+ proof: fromClientIVCProof(o.proof),
1116
+ };
1117
+ }
1118
+
1119
+ export function toClientIvcStart(o: MsgpackClientIvcStart): ClientIvcStart {
1120
+ if (o.num_circuits === undefined) { throw new Error("Expected num_circuits in ClientIvcStart deserialization"); };
1121
+ return {
1122
+ numCircuits: o.num_circuits,
1123
+ };
1124
+ }
1125
+
1126
+ export function fromClientIvcStart(o: ClientIvcStart): MsgpackClientIvcStart {
1127
+ if (o.numCircuits === undefined) { throw new Error("Expected numCircuits in ClientIvcStart serialization"); };
1128
+ return {
1129
+ num_circuits: o.numCircuits,
1130
+ };
1131
+ }
1132
+
1133
+ export function toClientIvcStartResponse(o: MsgpackClientIvcStartResponse): ClientIvcStartResponse {
1134
+ return {};
1135
+ }
1136
+
1137
+ export function fromClientIvcStartResponse(o: ClientIvcStartResponse): MsgpackClientIvcStartResponse {
1138
+ return {};
1139
+ }
1140
+
1141
+ export function toClientIvcStats(o: MsgpackClientIvcStats): ClientIvcStats {
1142
+ if (o.circuit === undefined) { throw new Error("Expected circuit in ClientIvcStats deserialization"); }
1143
+ if (o.include_gates_per_opcode === undefined) { throw new Error("Expected include_gates_per_opcode in ClientIvcStats deserialization"); };
1144
+ return {
1145
+ circuit: toCircuitInputNoVK(o.circuit),
1146
+ includeGatesPerOpcode: o.include_gates_per_opcode,
1147
+ };
1148
+ }
1149
+
1150
+ export function fromClientIvcStats(o: ClientIvcStats): MsgpackClientIvcStats {
1151
+ if (o.circuit === undefined) { throw new Error("Expected circuit in ClientIvcStats serialization"); }
1152
+ if (o.includeGatesPerOpcode === undefined) { throw new Error("Expected includeGatesPerOpcode in ClientIvcStats serialization"); };
1153
+ return {
1154
+ circuit: fromCircuitInputNoVK(o.circuit),
1155
+ include_gates_per_opcode: o.includeGatesPerOpcode,
1156
+ };
1157
+ }
1158
+
1159
+ export function toClientIvcStatsResponse(o: MsgpackClientIvcStatsResponse): ClientIvcStatsResponse {
1160
+ if (o.acir_opcodes === undefined) { throw new Error("Expected acir_opcodes in ClientIvcStatsResponse deserialization"); }
1161
+ if (o.circuit_size === undefined) { throw new Error("Expected circuit_size in ClientIvcStatsResponse deserialization"); }
1162
+ if (o.gates_per_opcode === undefined) { throw new Error("Expected gates_per_opcode in ClientIvcStatsResponse deserialization"); };
1163
+ return {
1164
+ acirOpcodes: o.acir_opcodes,
1165
+ circuitSize: o.circuit_size,
1166
+ gatesPerOpcode: o.gates_per_opcode.map((v: any) => v),
1167
+ };
1168
+ }
1169
+
1170
+ export function fromClientIvcStatsResponse(o: ClientIvcStatsResponse): MsgpackClientIvcStatsResponse {
1171
+ if (o.acirOpcodes === undefined) { throw new Error("Expected acirOpcodes in ClientIvcStatsResponse serialization"); }
1172
+ if (o.circuitSize === undefined) { throw new Error("Expected circuitSize in ClientIvcStatsResponse serialization"); }
1173
+ if (o.gatesPerOpcode === undefined) { throw new Error("Expected gatesPerOpcode in ClientIvcStatsResponse serialization"); };
1174
+ return {
1175
+ acir_opcodes: o.acirOpcodes,
1176
+ circuit_size: o.circuitSize,
1177
+ gates_per_opcode: o.gatesPerOpcode.map((v: any) => v),
1178
+ };
1179
+ }
1180
+
1181
+ export function toClientIvcVerify(o: MsgpackClientIvcVerify): ClientIvcVerify {
1182
+ if (o.proof === undefined) { throw new Error("Expected proof in ClientIvcVerify deserialization"); }
1183
+ if (o.vk === undefined) { throw new Error("Expected vk in ClientIvcVerify deserialization"); };
1184
+ return {
1185
+ proof: toClientIVCProof(o.proof),
1186
+ vk: o.vk,
1187
+ };
1188
+ }
1189
+
1190
+ export function fromClientIvcVerify(o: ClientIvcVerify): MsgpackClientIvcVerify {
1191
+ if (o.proof === undefined) { throw new Error("Expected proof in ClientIvcVerify serialization"); }
1192
+ if (o.vk === undefined) { throw new Error("Expected vk in ClientIvcVerify serialization"); };
1193
+ return {
1194
+ proof: fromClientIVCProof(o.proof),
1195
+ vk: o.vk,
1196
+ };
1197
+ }
1198
+
1199
+ export function toClientIvcVerifyResponse(o: MsgpackClientIvcVerifyResponse): ClientIvcVerifyResponse {
1200
+ if (o.valid === undefined) { throw new Error("Expected valid in ClientIvcVerifyResponse deserialization"); };
1201
+ return {
1202
+ valid: o.valid,
1203
+ };
1204
+ }
1205
+
1206
+ export function fromClientIvcVerifyResponse(o: ClientIvcVerifyResponse): MsgpackClientIvcVerifyResponse {
1207
+ if (o.valid === undefined) { throw new Error("Expected valid in ClientIvcVerifyResponse serialization"); };
1208
+ return {
1209
+ valid: o.valid,
1210
+ };
1211
+ }
1212
+
1213
+ export function toECCVMProof(o: MsgpackECCVMProof): ECCVMProof {
1214
+ if (o.pre_ipa_proof === undefined) { throw new Error("Expected pre_ipa_proof in ECCVMProof deserialization"); }
1215
+ if (o.ipa_proof === undefined) { throw new Error("Expected ipa_proof in ECCVMProof deserialization"); };
1216
+ return {
1217
+ preIpaProof: o.pre_ipa_proof.map((v: any) => v),
1218
+ ipaProof: o.ipa_proof.map((v: any) => v),
1219
+ };
1220
+ }
1221
+
1222
+ export function fromECCVMProof(o: ECCVMProof): MsgpackECCVMProof {
1223
+ if (o.preIpaProof === undefined) { throw new Error("Expected preIpaProof in ECCVMProof serialization"); }
1224
+ if (o.ipaProof === undefined) { throw new Error("Expected ipaProof in ECCVMProof serialization"); };
1225
+ return {
1226
+ pre_ipa_proof: o.preIpaProof.map((v: any) => v),
1227
+ ipa_proof: o.ipaProof.map((v: any) => v),
1228
+ };
1229
+ }
1230
+
1231
+ export function toGoblinProof(o: MsgpackGoblinProof): GoblinProof {
1232
+ if (o.merge_proof === undefined) { throw new Error("Expected merge_proof in GoblinProof deserialization"); }
1233
+ if (o.eccvm_proof === undefined) { throw new Error("Expected eccvm_proof in GoblinProof deserialization"); }
1234
+ if (o.translator_proof === undefined) { throw new Error("Expected translator_proof in GoblinProof deserialization"); };
1235
+ return {
1236
+ mergeProof: o.merge_proof.map((v: any) => v),
1237
+ eccvmProof: toECCVMProof(o.eccvm_proof),
1238
+ translatorProof: o.translator_proof.map((v: any) => v),
1239
+ };
1240
+ }
1241
+
1242
+ export function fromGoblinProof(o: GoblinProof): MsgpackGoblinProof {
1243
+ if (o.mergeProof === undefined) { throw new Error("Expected mergeProof in GoblinProof serialization"); }
1244
+ if (o.eccvmProof === undefined) { throw new Error("Expected eccvmProof in GoblinProof serialization"); }
1245
+ if (o.translatorProof === undefined) { throw new Error("Expected translatorProof in GoblinProof serialization"); };
1246
+ return {
1247
+ merge_proof: o.mergeProof.map((v: any) => v),
1248
+ eccvm_proof: fromECCVMProof(o.eccvmProof),
1249
+ translator_proof: o.translatorProof.map((v: any) => v),
1250
+ };
1251
+ }
1252
+
1253
+ export function toProofSystemSettings(o: MsgpackProofSystemSettings): ProofSystemSettings {
1254
+ if (o.ipa_accumulation === undefined) { throw new Error("Expected ipa_accumulation in ProofSystemSettings deserialization"); }
1255
+ if (o.oracle_hash_type === undefined) { throw new Error("Expected oracle_hash_type in ProofSystemSettings deserialization"); }
1256
+ if (o.disable_zk === undefined) { throw new Error("Expected disable_zk in ProofSystemSettings deserialization"); }
1257
+ if (o.optimized_solidity_verifier === undefined) { throw new Error("Expected optimized_solidity_verifier in ProofSystemSettings deserialization"); };
1258
+ return {
1259
+ ipaAccumulation: o.ipa_accumulation,
1260
+ oracleHashType: o.oracle_hash_type,
1261
+ disableZk: o.disable_zk,
1262
+ optimizedSolidityVerifier: o.optimized_solidity_verifier,
1263
+ };
1264
+ }
1265
+
1266
+ export function fromProofSystemSettings(o: ProofSystemSettings): MsgpackProofSystemSettings {
1267
+ if (o.ipaAccumulation === undefined) { throw new Error("Expected ipaAccumulation in ProofSystemSettings serialization"); }
1268
+ if (o.oracleHashType === undefined) { throw new Error("Expected oracleHashType in ProofSystemSettings serialization"); }
1269
+ if (o.disableZk === undefined) { throw new Error("Expected disableZk in ProofSystemSettings serialization"); }
1270
+ if (o.optimizedSolidityVerifier === undefined) { throw new Error("Expected optimizedSolidityVerifier in ProofSystemSettings serialization"); };
1271
+ return {
1272
+ ipa_accumulation: o.ipaAccumulation,
1273
+ oracle_hash_type: o.oracleHashType,
1274
+ disable_zk: o.disableZk,
1275
+ optimized_solidity_verifier: o.optimizedSolidityVerifier,
1276
+ };
1277
+ }
1278
+
1279
+ export function toVkAsFields(o: MsgpackVkAsFields): VkAsFields {
1280
+ if (o.verification_key === undefined) { throw new Error("Expected verification_key in VkAsFields deserialization"); };
1281
+ return {
1282
+ verificationKey: o.verification_key,
1283
+ };
1284
+ }
1285
+
1286
+ export function fromVkAsFields(o: VkAsFields): MsgpackVkAsFields {
1287
+ if (o.verificationKey === undefined) { throw new Error("Expected verificationKey in VkAsFields serialization"); };
1288
+ return {
1289
+ verification_key: o.verificationKey,
1290
+ };
1291
+ }
1292
+
1293
+ export function toVkAsFieldsResponse(o: MsgpackVkAsFieldsResponse): VkAsFieldsResponse {
1294
+ if (o.fields === undefined) { throw new Error("Expected fields in VkAsFieldsResponse deserialization"); };
1295
+ return {
1296
+ fields: o.fields.map((v: any) => v),
1297
+ };
1298
+ }
1299
+
1300
+ export function fromVkAsFieldsResponse(o: VkAsFieldsResponse): MsgpackVkAsFieldsResponse {
1301
+ if (o.fields === undefined) { throw new Error("Expected fields in VkAsFieldsResponse serialization"); };
1302
+ return {
1303
+ fields: o.fields.map((v: any) => v),
1304
+ };
1305
+ }
1306
+
1307
+
1308
+ // Base API interface
1309
+ export interface BbApiBase {
1310
+ circuitProve(command: CircuitProve): Promise<CircuitProveResponse>;
1311
+ circuitComputeVk(command: CircuitComputeVk): Promise<CircuitComputeVkResponse>;
1312
+ circuitStats(command: CircuitStats): Promise<CircuitInfoResponse>;
1313
+ circuitVerify(command: CircuitVerify): Promise<CircuitVerifyResponse>;
1314
+ clientIvcComputeStandaloneVk(command: ClientIvcComputeStandaloneVk): Promise<ClientIvcComputeStandaloneVkResponse>;
1315
+ clientIvcComputeIvcVk(command: ClientIvcComputeIvcVk): Promise<ClientIvcComputeIvcVkResponse>;
1316
+ clientIvcStart(command: ClientIvcStart): Promise<ClientIvcStartResponse>;
1317
+ clientIvcLoad(command: ClientIvcLoad): Promise<ClientIvcLoadResponse>;
1318
+ clientIvcAccumulate(command: ClientIvcAccumulate): Promise<ClientIvcAccumulateResponse>;
1319
+ clientIvcProve(command: ClientIvcProve): Promise<ClientIvcProveResponse>;
1320
+ clientIvcVerify(command: ClientIvcVerify): Promise<ClientIvcVerifyResponse>;
1321
+ vkAsFields(command: VkAsFields): Promise<VkAsFieldsResponse>;
1322
+ circuitWriteSolidityVerifier(command: CircuitWriteSolidityVerifier): Promise<CircuitWriteSolidityVerifierResponse>;
1323
+ clientIvcCheckPrecomputedVk(command: ClientIvcCheckPrecomputedVk): Promise<ClientIvcCheckPrecomputedVkResponse>;
1324
+ clientIvcStats(command: ClientIvcStats): Promise<ClientIvcStatsResponse>;
1325
+ destroy(): Promise<void>;
1326
+ }