@aztec/bb.js 0.0.1-commit.e6bd8901 → 0.0.1-commit.ee80a48

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.
@@ -1,3050 +0,0 @@
1
- // AUTOGENERATED FILE - DO NOT EDIT
2
-
3
- // Type aliases for primitive types
4
- export type Field2 = [Uint8Array, Uint8Array];
5
-
6
- // Public interfaces (exported)
7
- export interface CircuitComputeVkResponse {
8
- bytes: Uint8Array;
9
- fields: Uint8Array[];
10
- hash: Uint8Array;
11
- }
12
-
13
- export interface CircuitInput {
14
- name: string;
15
- bytecode: Uint8Array;
16
- verificationKey: Uint8Array;
17
- }
18
-
19
- export interface ProofSystemSettings {
20
- ipaAccumulation: boolean;
21
- oracleHashType: string;
22
- disableZk: boolean;
23
- optimizedSolidityVerifier: boolean;
24
- }
25
-
26
- export interface CircuitProve {
27
- circuit: CircuitInput;
28
- witness: Uint8Array;
29
- settings: ProofSystemSettings;
30
- }
31
-
32
- export interface CircuitInputNoVK {
33
- name: string;
34
- bytecode: Uint8Array;
35
- }
36
-
37
- export interface CircuitComputeVk {
38
- circuit: CircuitInputNoVK;
39
- settings: ProofSystemSettings;
40
- }
41
-
42
- export interface CircuitStats {
43
- circuit: CircuitInput;
44
- includeGatesPerOpcode: boolean;
45
- settings: ProofSystemSettings;
46
- }
47
-
48
- export interface CircuitVerify {
49
- verificationKey: Uint8Array;
50
- publicInputs: Uint8Array[];
51
- proof: Uint8Array[];
52
- settings: ProofSystemSettings;
53
- }
54
-
55
- export interface ChonkComputeVk {
56
- circuit: CircuitInputNoVK;
57
- }
58
-
59
- export interface ChonkStart {
60
- numCircuits: number;
61
- }
62
-
63
- export interface ChonkLoad {
64
- circuit: CircuitInput;
65
- }
66
-
67
- export interface ChonkAccumulate {
68
- witness: Uint8Array;
69
- }
70
-
71
- export interface ChonkProve {
72
-
73
- }
74
-
75
- export interface GoblinProof {
76
- mergeProof: Uint8Array[];
77
- eccvmProof: Uint8Array[];
78
- ipaProof: Uint8Array[];
79
- translatorProof: Uint8Array[];
80
- }
81
-
82
- export interface ChonkProof {
83
- megaProof: Uint8Array[];
84
- goblinProof: GoblinProof;
85
- }
86
-
87
- export interface ChonkVerify {
88
- proof: ChonkProof;
89
- vk: Uint8Array;
90
- }
91
-
92
- export interface VkAsFields {
93
- verificationKey: Uint8Array;
94
- }
95
-
96
- export interface MegaVkAsFields {
97
- verificationKey: Uint8Array;
98
- }
99
-
100
- export interface CircuitWriteSolidityVerifier {
101
- verificationKey: Uint8Array;
102
- settings: ProofSystemSettings;
103
- }
104
-
105
- export interface ChonkCheckPrecomputedVk {
106
- circuit: CircuitInput;
107
- }
108
-
109
- export interface ChonkStats {
110
- circuit: CircuitInputNoVK;
111
- includeGatesPerOpcode: boolean;
112
- }
113
-
114
- export interface Poseidon2Hash {
115
- inputs: Uint8Array[];
116
- }
117
-
118
- export interface Poseidon2Permutation {
119
- inputs: Uint8Array[];
120
- }
121
-
122
- export interface PedersenCommit {
123
- inputs: Uint8Array[];
124
- hashIndex: number;
125
- }
126
-
127
- export interface PedersenHash {
128
- inputs: Uint8Array[];
129
- hashIndex: number;
130
- }
131
-
132
- export interface PedersenHashBuffer {
133
- input: Uint8Array;
134
- hashIndex: number;
135
- }
136
-
137
- export interface Blake2s {
138
- data: Uint8Array;
139
- }
140
-
141
- export interface Blake2sToField {
142
- data: Uint8Array;
143
- }
144
-
145
- export interface AesEncrypt {
146
- plaintext: Uint8Array;
147
- iv: Uint8Array;
148
- key: Uint8Array;
149
- length: number;
150
- }
151
-
152
- export interface AesDecrypt {
153
- ciphertext: Uint8Array;
154
- iv: Uint8Array;
155
- key: Uint8Array;
156
- length: number;
157
- }
158
-
159
- export interface GrumpkinPoint {
160
- x: Uint8Array;
161
- y: Uint8Array;
162
- }
163
-
164
- export interface GrumpkinMul {
165
- point: GrumpkinPoint;
166
- scalar: Uint8Array;
167
- }
168
-
169
- export interface GrumpkinAdd {
170
- pointA: GrumpkinPoint;
171
- pointB: GrumpkinPoint;
172
- }
173
-
174
- export interface GrumpkinBatchMul {
175
- points: GrumpkinPoint[];
176
- scalar: Uint8Array;
177
- }
178
-
179
- export interface GrumpkinGetRandomFr {
180
- dummy: number;
181
- }
182
-
183
- export interface GrumpkinReduce512 {
184
- input: Uint8Array;
185
- }
186
-
187
- export interface Secp256k1Point {
188
- x: Uint8Array;
189
- y: Uint8Array;
190
- }
191
-
192
- export interface Secp256k1Mul {
193
- point: Secp256k1Point;
194
- scalar: Uint8Array;
195
- }
196
-
197
- export interface Secp256k1GetRandomFr {
198
- dummy: number;
199
- }
200
-
201
- export interface Secp256k1Reduce512 {
202
- input: Uint8Array;
203
- }
204
-
205
- export interface Bn254FrSqrt {
206
- input: Uint8Array;
207
- }
208
-
209
- export interface Bn254FqSqrt {
210
- input: Uint8Array;
211
- }
212
-
213
- export interface Bn254G1Point {
214
- x: Uint8Array;
215
- y: Uint8Array;
216
- }
217
-
218
- export interface Bn254G1Mul {
219
- point: Bn254G1Point;
220
- scalar: Uint8Array;
221
- }
222
-
223
- export interface Bn254G2Point {
224
- x: [Uint8Array, Uint8Array];
225
- y: [Uint8Array, Uint8Array];
226
- }
227
-
228
- export interface Bn254G2Mul {
229
- point: Bn254G2Point;
230
- scalar: Uint8Array;
231
- }
232
-
233
- export interface Bn254G1IsOnCurve {
234
- point: Bn254G1Point;
235
- }
236
-
237
- export interface Bn254G1FromCompressed {
238
- compressed: Uint8Array;
239
- }
240
-
241
- export interface SchnorrComputePublicKey {
242
- privateKey: Uint8Array;
243
- }
244
-
245
- export interface SchnorrConstructSignature {
246
- message: Uint8Array;
247
- privateKey: Uint8Array;
248
- }
249
-
250
- export interface SchnorrVerifySignature {
251
- message: Uint8Array;
252
- publicKey: GrumpkinPoint;
253
- s: Uint8Array;
254
- e: Uint8Array;
255
- }
256
-
257
- export interface EcdsaSecp256k1ComputePublicKey {
258
- privateKey: Uint8Array;
259
- }
260
-
261
- export interface EcdsaSecp256r1ComputePublicKey {
262
- privateKey: Uint8Array;
263
- }
264
-
265
- export interface EcdsaSecp256k1ConstructSignature {
266
- message: Uint8Array;
267
- privateKey: Uint8Array;
268
- }
269
-
270
- export interface EcdsaSecp256r1ConstructSignature {
271
- message: Uint8Array;
272
- privateKey: Uint8Array;
273
- }
274
-
275
- export interface EcdsaSecp256k1RecoverPublicKey {
276
- message: Uint8Array;
277
- r: Uint8Array;
278
- s: Uint8Array;
279
- v: number;
280
- }
281
-
282
- export interface EcdsaSecp256r1RecoverPublicKey {
283
- message: Uint8Array;
284
- r: Uint8Array;
285
- s: Uint8Array;
286
- v: number;
287
- }
288
-
289
- export interface EcdsaSecp256k1VerifySignature {
290
- message: Uint8Array;
291
- publicKey: Secp256k1Point;
292
- r: Uint8Array;
293
- s: Uint8Array;
294
- v: number;
295
- }
296
-
297
- export interface Secp256r1Point {
298
- x: Uint8Array;
299
- y: Uint8Array;
300
- }
301
-
302
- export interface EcdsaSecp256r1VerifySignature {
303
- message: Uint8Array;
304
- publicKey: Secp256r1Point;
305
- r: Uint8Array;
306
- s: Uint8Array;
307
- v: number;
308
- }
309
-
310
- export interface SrsInitSrs {
311
- pointsBuf: Uint8Array;
312
- numPoints: number;
313
- g2Point: Uint8Array;
314
- }
315
-
316
- export interface SrsInitGrumpkinSrs {
317
- pointsBuf: Uint8Array;
318
- numPoints: number;
319
- }
320
-
321
- export interface Shutdown {
322
-
323
- }
324
-
325
- export interface ErrorResponse {
326
- message: string;
327
- }
328
-
329
- export interface CircuitProveResponse {
330
- publicInputs: Uint8Array[];
331
- proof: Uint8Array[];
332
- vk: CircuitComputeVkResponse;
333
- }
334
-
335
- export interface CircuitInfoResponse {
336
- numGates: number;
337
- numGatesDyadic: number;
338
- numAcirOpcodes: number;
339
- gatesPerOpcode: number[];
340
- }
341
-
342
- export interface CircuitVerifyResponse {
343
- verified: boolean;
344
- }
345
-
346
- export interface ChonkComputeVkResponse {
347
- bytes: Uint8Array;
348
- fields: Uint8Array[];
349
- }
350
-
351
- export interface ChonkStartResponse {
352
-
353
- }
354
-
355
- export interface ChonkLoadResponse {
356
-
357
- }
358
-
359
- export interface ChonkAccumulateResponse {
360
-
361
- }
362
-
363
- export interface ChonkProveResponse {
364
- proof: ChonkProof;
365
- }
366
-
367
- export interface ChonkVerifyResponse {
368
- valid: boolean;
369
- }
370
-
371
- export interface VkAsFieldsResponse {
372
- fields: Uint8Array[];
373
- }
374
-
375
- export interface MegaVkAsFieldsResponse {
376
- fields: Uint8Array[];
377
- }
378
-
379
- export interface CircuitWriteSolidityVerifierResponse {
380
- solidityCode: string;
381
- }
382
-
383
- export interface ChonkCheckPrecomputedVkResponse {
384
- valid: boolean;
385
- actualVk: Uint8Array;
386
- }
387
-
388
- export interface ChonkStatsResponse {
389
- acirOpcodes: number;
390
- circuitSize: number;
391
- gatesPerOpcode: number[];
392
- }
393
-
394
- export interface Poseidon2HashResponse {
395
- hash: Uint8Array;
396
- }
397
-
398
- export interface Poseidon2PermutationResponse {
399
- outputs: Uint8Array[];
400
- }
401
-
402
- export interface PedersenCommitResponse {
403
- point: GrumpkinPoint;
404
- }
405
-
406
- export interface PedersenHashResponse {
407
- hash: Uint8Array;
408
- }
409
-
410
- export interface PedersenHashBufferResponse {
411
- hash: Uint8Array;
412
- }
413
-
414
- export interface Blake2sResponse {
415
- hash: Uint8Array;
416
- }
417
-
418
- export interface Blake2sToFieldResponse {
419
- field: Uint8Array;
420
- }
421
-
422
- export interface AesEncryptResponse {
423
- ciphertext: Uint8Array;
424
- }
425
-
426
- export interface AesDecryptResponse {
427
- plaintext: Uint8Array;
428
- }
429
-
430
- export interface GrumpkinMulResponse {
431
- point: GrumpkinPoint;
432
- }
433
-
434
- export interface GrumpkinAddResponse {
435
- point: GrumpkinPoint;
436
- }
437
-
438
- export interface GrumpkinBatchMulResponse {
439
- points: GrumpkinPoint[];
440
- }
441
-
442
- export interface GrumpkinGetRandomFrResponse {
443
- value: Uint8Array;
444
- }
445
-
446
- export interface GrumpkinReduce512Response {
447
- value: Uint8Array;
448
- }
449
-
450
- export interface Secp256k1MulResponse {
451
- point: Secp256k1Point;
452
- }
453
-
454
- export interface Secp256k1GetRandomFrResponse {
455
- value: Uint8Array;
456
- }
457
-
458
- export interface Secp256k1Reduce512Response {
459
- value: Uint8Array;
460
- }
461
-
462
- export interface Bn254FrSqrtResponse {
463
- isSquareRoot: boolean;
464
- value: Uint8Array;
465
- }
466
-
467
- export interface Bn254FqSqrtResponse {
468
- isSquareRoot: boolean;
469
- value: Uint8Array;
470
- }
471
-
472
- export interface Bn254G1MulResponse {
473
- point: Bn254G1Point;
474
- }
475
-
476
- export interface Bn254G2MulResponse {
477
- point: Bn254G2Point;
478
- }
479
-
480
- export interface Bn254G1IsOnCurveResponse {
481
- isOnCurve: boolean;
482
- }
483
-
484
- export interface Bn254G1FromCompressedResponse {
485
- point: Bn254G1Point;
486
- }
487
-
488
- export interface SchnorrComputePublicKeyResponse {
489
- publicKey: GrumpkinPoint;
490
- }
491
-
492
- export interface SchnorrConstructSignatureResponse {
493
- s: Uint8Array;
494
- e: Uint8Array;
495
- }
496
-
497
- export interface SchnorrVerifySignatureResponse {
498
- verified: boolean;
499
- }
500
-
501
- export interface EcdsaSecp256k1ComputePublicKeyResponse {
502
- publicKey: Secp256k1Point;
503
- }
504
-
505
- export interface EcdsaSecp256r1ComputePublicKeyResponse {
506
- publicKey: Secp256r1Point;
507
- }
508
-
509
- export interface EcdsaSecp256k1ConstructSignatureResponse {
510
- r: Uint8Array;
511
- s: Uint8Array;
512
- v: number;
513
- }
514
-
515
- export interface EcdsaSecp256r1ConstructSignatureResponse {
516
- r: Uint8Array;
517
- s: Uint8Array;
518
- v: number;
519
- }
520
-
521
- export interface EcdsaSecp256k1RecoverPublicKeyResponse {
522
- publicKey: Secp256k1Point;
523
- }
524
-
525
- export interface EcdsaSecp256r1RecoverPublicKeyResponse {
526
- publicKey: Secp256r1Point;
527
- }
528
-
529
- export interface EcdsaSecp256k1VerifySignatureResponse {
530
- verified: boolean;
531
- }
532
-
533
- export interface EcdsaSecp256r1VerifySignatureResponse {
534
- verified: boolean;
535
- }
536
-
537
- export interface SrsInitSrsResponse {
538
- dummy: number;
539
- }
540
-
541
- export interface SrsInitGrumpkinSrsResponse {
542
- dummy: number;
543
- }
544
-
545
- export interface ShutdownResponse {
546
-
547
- }
548
-
549
- // Private Msgpack interfaces (not exported)
550
- interface MsgpackCircuitComputeVkResponse {
551
- bytes: Uint8Array;
552
- fields: Uint8Array[];
553
- hash: Uint8Array;
554
- }
555
-
556
- interface MsgpackCircuitInput {
557
- name: string;
558
- bytecode: Uint8Array;
559
- verification_key: Uint8Array;
560
- }
561
-
562
- interface MsgpackProofSystemSettings {
563
- ipa_accumulation: boolean;
564
- oracle_hash_type: string;
565
- disable_zk: boolean;
566
- optimized_solidity_verifier: boolean;
567
- }
568
-
569
- interface MsgpackCircuitProve {
570
- circuit: MsgpackCircuitInput;
571
- witness: Uint8Array;
572
- settings: MsgpackProofSystemSettings;
573
- }
574
-
575
- interface MsgpackCircuitInputNoVK {
576
- name: string;
577
- bytecode: Uint8Array;
578
- }
579
-
580
- interface MsgpackCircuitComputeVk {
581
- circuit: MsgpackCircuitInputNoVK;
582
- settings: MsgpackProofSystemSettings;
583
- }
584
-
585
- interface MsgpackCircuitStats {
586
- circuit: MsgpackCircuitInput;
587
- include_gates_per_opcode: boolean;
588
- settings: MsgpackProofSystemSettings;
589
- }
590
-
591
- interface MsgpackCircuitVerify {
592
- verification_key: Uint8Array;
593
- public_inputs: Uint8Array[];
594
- proof: Uint8Array[];
595
- settings: MsgpackProofSystemSettings;
596
- }
597
-
598
- interface MsgpackChonkComputeVk {
599
- circuit: MsgpackCircuitInputNoVK;
600
- }
601
-
602
- interface MsgpackChonkStart {
603
- num_circuits: number;
604
- }
605
-
606
- interface MsgpackChonkLoad {
607
- circuit: MsgpackCircuitInput;
608
- }
609
-
610
- interface MsgpackChonkAccumulate {
611
- witness: Uint8Array;
612
- }
613
-
614
- interface MsgpackChonkProve {
615
-
616
- }
617
-
618
- interface MsgpackGoblinProof {
619
- merge_proof: Uint8Array[];
620
- eccvm_proof: Uint8Array[];
621
- ipa_proof: Uint8Array[];
622
- translator_proof: Uint8Array[];
623
- }
624
-
625
- interface MsgpackChonkProof {
626
- mega_proof: Uint8Array[];
627
- goblin_proof: MsgpackGoblinProof;
628
- }
629
-
630
- interface MsgpackChonkVerify {
631
- proof: MsgpackChonkProof;
632
- vk: Uint8Array;
633
- }
634
-
635
- interface MsgpackVkAsFields {
636
- verification_key: Uint8Array;
637
- }
638
-
639
- interface MsgpackMegaVkAsFields {
640
- verification_key: Uint8Array;
641
- }
642
-
643
- interface MsgpackCircuitWriteSolidityVerifier {
644
- verification_key: Uint8Array;
645
- settings: MsgpackProofSystemSettings;
646
- }
647
-
648
- interface MsgpackChonkCheckPrecomputedVk {
649
- circuit: MsgpackCircuitInput;
650
- }
651
-
652
- interface MsgpackChonkStats {
653
- circuit: MsgpackCircuitInputNoVK;
654
- include_gates_per_opcode: boolean;
655
- }
656
-
657
- interface MsgpackPoseidon2Hash {
658
- inputs: Uint8Array[];
659
- }
660
-
661
- interface MsgpackPoseidon2Permutation {
662
- inputs: Uint8Array[];
663
- }
664
-
665
- interface MsgpackPedersenCommit {
666
- inputs: Uint8Array[];
667
- hash_index: number;
668
- }
669
-
670
- interface MsgpackPedersenHash {
671
- inputs: Uint8Array[];
672
- hash_index: number;
673
- }
674
-
675
- interface MsgpackPedersenHashBuffer {
676
- input: Uint8Array;
677
- hash_index: number;
678
- }
679
-
680
- interface MsgpackBlake2s {
681
- data: Uint8Array;
682
- }
683
-
684
- interface MsgpackBlake2sToField {
685
- data: Uint8Array;
686
- }
687
-
688
- interface MsgpackAesEncrypt {
689
- plaintext: Uint8Array;
690
- iv: Uint8Array;
691
- key: Uint8Array;
692
- length: number;
693
- }
694
-
695
- interface MsgpackAesDecrypt {
696
- ciphertext: Uint8Array;
697
- iv: Uint8Array;
698
- key: Uint8Array;
699
- length: number;
700
- }
701
-
702
- interface MsgpackGrumpkinPoint {
703
- x: Uint8Array;
704
- y: Uint8Array;
705
- }
706
-
707
- interface MsgpackGrumpkinMul {
708
- point: MsgpackGrumpkinPoint;
709
- scalar: Uint8Array;
710
- }
711
-
712
- interface MsgpackGrumpkinAdd {
713
- point_a: MsgpackGrumpkinPoint;
714
- point_b: MsgpackGrumpkinPoint;
715
- }
716
-
717
- interface MsgpackGrumpkinBatchMul {
718
- points: MsgpackGrumpkinPoint[];
719
- scalar: Uint8Array;
720
- }
721
-
722
- interface MsgpackGrumpkinGetRandomFr {
723
- dummy: number;
724
- }
725
-
726
- interface MsgpackGrumpkinReduce512 {
727
- input: Uint8Array;
728
- }
729
-
730
- interface MsgpackSecp256k1Point {
731
- x: Uint8Array;
732
- y: Uint8Array;
733
- }
734
-
735
- interface MsgpackSecp256k1Mul {
736
- point: MsgpackSecp256k1Point;
737
- scalar: Uint8Array;
738
- }
739
-
740
- interface MsgpackSecp256k1GetRandomFr {
741
- dummy: number;
742
- }
743
-
744
- interface MsgpackSecp256k1Reduce512 {
745
- input: Uint8Array;
746
- }
747
-
748
- interface MsgpackBn254FrSqrt {
749
- input: Uint8Array;
750
- }
751
-
752
- interface MsgpackBn254FqSqrt {
753
- input: Uint8Array;
754
- }
755
-
756
- interface MsgpackBn254G1Point {
757
- x: Uint8Array;
758
- y: Uint8Array;
759
- }
760
-
761
- interface MsgpackBn254G1Mul {
762
- point: MsgpackBn254G1Point;
763
- scalar: Uint8Array;
764
- }
765
-
766
- interface MsgpackBn254G2Point {
767
- x: [Uint8Array, Uint8Array];
768
- y: [Uint8Array, Uint8Array];
769
- }
770
-
771
- interface MsgpackBn254G2Mul {
772
- point: MsgpackBn254G2Point;
773
- scalar: Uint8Array;
774
- }
775
-
776
- interface MsgpackBn254G1IsOnCurve {
777
- point: MsgpackBn254G1Point;
778
- }
779
-
780
- interface MsgpackBn254G1FromCompressed {
781
- compressed: Uint8Array;
782
- }
783
-
784
- interface MsgpackSchnorrComputePublicKey {
785
- private_key: Uint8Array;
786
- }
787
-
788
- interface MsgpackSchnorrConstructSignature {
789
- message: Uint8Array;
790
- private_key: Uint8Array;
791
- }
792
-
793
- interface MsgpackSchnorrVerifySignature {
794
- message: Uint8Array;
795
- public_key: MsgpackGrumpkinPoint;
796
- s: Uint8Array;
797
- e: Uint8Array;
798
- }
799
-
800
- interface MsgpackEcdsaSecp256k1ComputePublicKey {
801
- private_key: Uint8Array;
802
- }
803
-
804
- interface MsgpackEcdsaSecp256r1ComputePublicKey {
805
- private_key: Uint8Array;
806
- }
807
-
808
- interface MsgpackEcdsaSecp256k1ConstructSignature {
809
- message: Uint8Array;
810
- private_key: Uint8Array;
811
- }
812
-
813
- interface MsgpackEcdsaSecp256r1ConstructSignature {
814
- message: Uint8Array;
815
- private_key: Uint8Array;
816
- }
817
-
818
- interface MsgpackEcdsaSecp256k1RecoverPublicKey {
819
- message: Uint8Array;
820
- r: Uint8Array;
821
- s: Uint8Array;
822
- v: number;
823
- }
824
-
825
- interface MsgpackEcdsaSecp256r1RecoverPublicKey {
826
- message: Uint8Array;
827
- r: Uint8Array;
828
- s: Uint8Array;
829
- v: number;
830
- }
831
-
832
- interface MsgpackEcdsaSecp256k1VerifySignature {
833
- message: Uint8Array;
834
- public_key: MsgpackSecp256k1Point;
835
- r: Uint8Array;
836
- s: Uint8Array;
837
- v: number;
838
- }
839
-
840
- interface MsgpackSecp256r1Point {
841
- x: Uint8Array;
842
- y: Uint8Array;
843
- }
844
-
845
- interface MsgpackEcdsaSecp256r1VerifySignature {
846
- message: Uint8Array;
847
- public_key: MsgpackSecp256r1Point;
848
- r: Uint8Array;
849
- s: Uint8Array;
850
- v: number;
851
- }
852
-
853
- interface MsgpackSrsInitSrs {
854
- points_buf: Uint8Array;
855
- num_points: number;
856
- g2_point: Uint8Array;
857
- }
858
-
859
- interface MsgpackSrsInitGrumpkinSrs {
860
- points_buf: Uint8Array;
861
- num_points: number;
862
- }
863
-
864
- interface MsgpackShutdown {
865
-
866
- }
867
-
868
- interface MsgpackErrorResponse {
869
- message: string;
870
- }
871
-
872
- interface MsgpackCircuitProveResponse {
873
- public_inputs: Uint8Array[];
874
- proof: Uint8Array[];
875
- vk: MsgpackCircuitComputeVkResponse;
876
- }
877
-
878
- interface MsgpackCircuitInfoResponse {
879
- num_gates: number;
880
- num_gates_dyadic: number;
881
- num_acir_opcodes: number;
882
- gates_per_opcode: number[];
883
- }
884
-
885
- interface MsgpackCircuitVerifyResponse {
886
- verified: boolean;
887
- }
888
-
889
- interface MsgpackChonkComputeVkResponse {
890
- bytes: Uint8Array;
891
- fields: Uint8Array[];
892
- }
893
-
894
- interface MsgpackChonkStartResponse {
895
-
896
- }
897
-
898
- interface MsgpackChonkLoadResponse {
899
-
900
- }
901
-
902
- interface MsgpackChonkAccumulateResponse {
903
-
904
- }
905
-
906
- interface MsgpackChonkProveResponse {
907
- proof: MsgpackChonkProof;
908
- }
909
-
910
- interface MsgpackChonkVerifyResponse {
911
- valid: boolean;
912
- }
913
-
914
- interface MsgpackVkAsFieldsResponse {
915
- fields: Uint8Array[];
916
- }
917
-
918
- interface MsgpackMegaVkAsFieldsResponse {
919
- fields: Uint8Array[];
920
- }
921
-
922
- interface MsgpackCircuitWriteSolidityVerifierResponse {
923
- solidity_code: string;
924
- }
925
-
926
- interface MsgpackChonkCheckPrecomputedVkResponse {
927
- valid: boolean;
928
- actual_vk: Uint8Array;
929
- }
930
-
931
- interface MsgpackChonkStatsResponse {
932
- acir_opcodes: number;
933
- circuit_size: number;
934
- gates_per_opcode: number[];
935
- }
936
-
937
- interface MsgpackPoseidon2HashResponse {
938
- hash: Uint8Array;
939
- }
940
-
941
- interface MsgpackPoseidon2PermutationResponse {
942
- outputs: Uint8Array[];
943
- }
944
-
945
- interface MsgpackPedersenCommitResponse {
946
- point: MsgpackGrumpkinPoint;
947
- }
948
-
949
- interface MsgpackPedersenHashResponse {
950
- hash: Uint8Array;
951
- }
952
-
953
- interface MsgpackPedersenHashBufferResponse {
954
- hash: Uint8Array;
955
- }
956
-
957
- interface MsgpackBlake2sResponse {
958
- hash: Uint8Array;
959
- }
960
-
961
- interface MsgpackBlake2sToFieldResponse {
962
- field: Uint8Array;
963
- }
964
-
965
- interface MsgpackAesEncryptResponse {
966
- ciphertext: Uint8Array;
967
- }
968
-
969
- interface MsgpackAesDecryptResponse {
970
- plaintext: Uint8Array;
971
- }
972
-
973
- interface MsgpackGrumpkinMulResponse {
974
- point: MsgpackGrumpkinPoint;
975
- }
976
-
977
- interface MsgpackGrumpkinAddResponse {
978
- point: MsgpackGrumpkinPoint;
979
- }
980
-
981
- interface MsgpackGrumpkinBatchMulResponse {
982
- points: MsgpackGrumpkinPoint[];
983
- }
984
-
985
- interface MsgpackGrumpkinGetRandomFrResponse {
986
- value: Uint8Array;
987
- }
988
-
989
- interface MsgpackGrumpkinReduce512Response {
990
- value: Uint8Array;
991
- }
992
-
993
- interface MsgpackSecp256k1MulResponse {
994
- point: MsgpackSecp256k1Point;
995
- }
996
-
997
- interface MsgpackSecp256k1GetRandomFrResponse {
998
- value: Uint8Array;
999
- }
1000
-
1001
- interface MsgpackSecp256k1Reduce512Response {
1002
- value: Uint8Array;
1003
- }
1004
-
1005
- interface MsgpackBn254FrSqrtResponse {
1006
- is_square_root: boolean;
1007
- value: Uint8Array;
1008
- }
1009
-
1010
- interface MsgpackBn254FqSqrtResponse {
1011
- is_square_root: boolean;
1012
- value: Uint8Array;
1013
- }
1014
-
1015
- interface MsgpackBn254G1MulResponse {
1016
- point: MsgpackBn254G1Point;
1017
- }
1018
-
1019
- interface MsgpackBn254G2MulResponse {
1020
- point: MsgpackBn254G2Point;
1021
- }
1022
-
1023
- interface MsgpackBn254G1IsOnCurveResponse {
1024
- is_on_curve: boolean;
1025
- }
1026
-
1027
- interface MsgpackBn254G1FromCompressedResponse {
1028
- point: MsgpackBn254G1Point;
1029
- }
1030
-
1031
- interface MsgpackSchnorrComputePublicKeyResponse {
1032
- public_key: MsgpackGrumpkinPoint;
1033
- }
1034
-
1035
- interface MsgpackSchnorrConstructSignatureResponse {
1036
- s: Uint8Array;
1037
- e: Uint8Array;
1038
- }
1039
-
1040
- interface MsgpackSchnorrVerifySignatureResponse {
1041
- verified: boolean;
1042
- }
1043
-
1044
- interface MsgpackEcdsaSecp256k1ComputePublicKeyResponse {
1045
- public_key: MsgpackSecp256k1Point;
1046
- }
1047
-
1048
- interface MsgpackEcdsaSecp256r1ComputePublicKeyResponse {
1049
- public_key: MsgpackSecp256r1Point;
1050
- }
1051
-
1052
- interface MsgpackEcdsaSecp256k1ConstructSignatureResponse {
1053
- r: Uint8Array;
1054
- s: Uint8Array;
1055
- v: number;
1056
- }
1057
-
1058
- interface MsgpackEcdsaSecp256r1ConstructSignatureResponse {
1059
- r: Uint8Array;
1060
- s: Uint8Array;
1061
- v: number;
1062
- }
1063
-
1064
- interface MsgpackEcdsaSecp256k1RecoverPublicKeyResponse {
1065
- public_key: MsgpackSecp256k1Point;
1066
- }
1067
-
1068
- interface MsgpackEcdsaSecp256r1RecoverPublicKeyResponse {
1069
- public_key: MsgpackSecp256r1Point;
1070
- }
1071
-
1072
- interface MsgpackEcdsaSecp256k1VerifySignatureResponse {
1073
- verified: boolean;
1074
- }
1075
-
1076
- interface MsgpackEcdsaSecp256r1VerifySignatureResponse {
1077
- verified: boolean;
1078
- }
1079
-
1080
- interface MsgpackSrsInitSrsResponse {
1081
- dummy: number;
1082
- }
1083
-
1084
- interface MsgpackSrsInitGrumpkinSrsResponse {
1085
- dummy: number;
1086
- }
1087
-
1088
- interface MsgpackShutdownResponse {
1089
-
1090
- }
1091
-
1092
- // Conversion functions (exported)
1093
- export function toCircuitComputeVkResponse(o: MsgpackCircuitComputeVkResponse): CircuitComputeVkResponse {
1094
- if (o.bytes === undefined) { throw new Error("Expected bytes in CircuitComputeVkResponse deserialization"); }
1095
- if (o.fields === undefined) { throw new Error("Expected fields in CircuitComputeVkResponse deserialization"); }
1096
- if (o.hash === undefined) { throw new Error("Expected hash in CircuitComputeVkResponse deserialization"); };
1097
- return {
1098
- bytes: o.bytes,
1099
- fields: o.fields,
1100
- hash: o.hash,
1101
- };
1102
- }
1103
-
1104
- export function toCircuitInput(o: MsgpackCircuitInput): CircuitInput {
1105
- if (o.name === undefined) { throw new Error("Expected name in CircuitInput deserialization"); }
1106
- if (o.bytecode === undefined) { throw new Error("Expected bytecode in CircuitInput deserialization"); }
1107
- if (o.verification_key === undefined) { throw new Error("Expected verification_key in CircuitInput deserialization"); };
1108
- return {
1109
- name: o.name,
1110
- bytecode: o.bytecode,
1111
- verificationKey: o.verification_key,
1112
- };
1113
- }
1114
-
1115
- export function toProofSystemSettings(o: MsgpackProofSystemSettings): ProofSystemSettings {
1116
- if (o.ipa_accumulation === undefined) { throw new Error("Expected ipa_accumulation in ProofSystemSettings deserialization"); }
1117
- if (o.oracle_hash_type === undefined) { throw new Error("Expected oracle_hash_type in ProofSystemSettings deserialization"); }
1118
- if (o.disable_zk === undefined) { throw new Error("Expected disable_zk in ProofSystemSettings deserialization"); }
1119
- if (o.optimized_solidity_verifier === undefined) { throw new Error("Expected optimized_solidity_verifier in ProofSystemSettings deserialization"); };
1120
- return {
1121
- ipaAccumulation: o.ipa_accumulation,
1122
- oracleHashType: o.oracle_hash_type,
1123
- disableZk: o.disable_zk,
1124
- optimizedSolidityVerifier: o.optimized_solidity_verifier,
1125
- };
1126
- }
1127
-
1128
- export function toCircuitProve(o: MsgpackCircuitProve): CircuitProve {
1129
- if (o.circuit === undefined) { throw new Error("Expected circuit in CircuitProve deserialization"); }
1130
- if (o.witness === undefined) { throw new Error("Expected witness in CircuitProve deserialization"); }
1131
- if (o.settings === undefined) { throw new Error("Expected settings in CircuitProve deserialization"); };
1132
- return {
1133
- circuit: toCircuitInput(o.circuit),
1134
- witness: o.witness,
1135
- settings: toProofSystemSettings(o.settings),
1136
- };
1137
- }
1138
-
1139
- export function toCircuitInputNoVK(o: MsgpackCircuitInputNoVK): CircuitInputNoVK {
1140
- if (o.name === undefined) { throw new Error("Expected name in CircuitInputNoVK deserialization"); }
1141
- if (o.bytecode === undefined) { throw new Error("Expected bytecode in CircuitInputNoVK deserialization"); };
1142
- return {
1143
- name: o.name,
1144
- bytecode: o.bytecode,
1145
- };
1146
- }
1147
-
1148
- export function toCircuitComputeVk(o: MsgpackCircuitComputeVk): CircuitComputeVk {
1149
- if (o.circuit === undefined) { throw new Error("Expected circuit in CircuitComputeVk deserialization"); }
1150
- if (o.settings === undefined) { throw new Error("Expected settings in CircuitComputeVk deserialization"); };
1151
- return {
1152
- circuit: toCircuitInputNoVK(o.circuit),
1153
- settings: toProofSystemSettings(o.settings),
1154
- };
1155
- }
1156
-
1157
- export function toCircuitStats(o: MsgpackCircuitStats): CircuitStats {
1158
- if (o.circuit === undefined) { throw new Error("Expected circuit in CircuitStats deserialization"); }
1159
- if (o.include_gates_per_opcode === undefined) { throw new Error("Expected include_gates_per_opcode in CircuitStats deserialization"); }
1160
- if (o.settings === undefined) { throw new Error("Expected settings in CircuitStats deserialization"); };
1161
- return {
1162
- circuit: toCircuitInput(o.circuit),
1163
- includeGatesPerOpcode: o.include_gates_per_opcode,
1164
- settings: toProofSystemSettings(o.settings),
1165
- };
1166
- }
1167
-
1168
- export function toCircuitVerify(o: MsgpackCircuitVerify): CircuitVerify {
1169
- if (o.verification_key === undefined) { throw new Error("Expected verification_key in CircuitVerify deserialization"); }
1170
- if (o.public_inputs === undefined) { throw new Error("Expected public_inputs in CircuitVerify deserialization"); }
1171
- if (o.proof === undefined) { throw new Error("Expected proof in CircuitVerify deserialization"); }
1172
- if (o.settings === undefined) { throw new Error("Expected settings in CircuitVerify deserialization"); };
1173
- return {
1174
- verificationKey: o.verification_key,
1175
- publicInputs: o.public_inputs,
1176
- proof: o.proof,
1177
- settings: toProofSystemSettings(o.settings),
1178
- };
1179
- }
1180
-
1181
- export function toChonkComputeVk(o: MsgpackChonkComputeVk): ChonkComputeVk {
1182
- if (o.circuit === undefined) { throw new Error("Expected circuit in ChonkComputeVk deserialization"); };
1183
- return {
1184
- circuit: toCircuitInputNoVK(o.circuit),
1185
- };
1186
- }
1187
-
1188
- export function toChonkStart(o: MsgpackChonkStart): ChonkStart {
1189
- if (o.num_circuits === undefined) { throw new Error("Expected num_circuits in ChonkStart deserialization"); };
1190
- return {
1191
- numCircuits: o.num_circuits,
1192
- };
1193
- }
1194
-
1195
- export function toChonkLoad(o: MsgpackChonkLoad): ChonkLoad {
1196
- if (o.circuit === undefined) { throw new Error("Expected circuit in ChonkLoad deserialization"); };
1197
- return {
1198
- circuit: toCircuitInput(o.circuit),
1199
- };
1200
- }
1201
-
1202
- export function toChonkAccumulate(o: MsgpackChonkAccumulate): ChonkAccumulate {
1203
- if (o.witness === undefined) { throw new Error("Expected witness in ChonkAccumulate deserialization"); };
1204
- return {
1205
- witness: o.witness,
1206
- };
1207
- }
1208
-
1209
- export function toChonkProve(o: MsgpackChonkProve): ChonkProve {
1210
- return {};
1211
- }
1212
-
1213
- export function toGoblinProof(o: MsgpackGoblinProof): GoblinProof {
1214
- if (o.merge_proof === undefined) { throw new Error("Expected merge_proof in GoblinProof deserialization"); }
1215
- if (o.eccvm_proof === undefined) { throw new Error("Expected eccvm_proof in GoblinProof deserialization"); }
1216
- if (o.ipa_proof === undefined) { throw new Error("Expected ipa_proof in GoblinProof deserialization"); }
1217
- if (o.translator_proof === undefined) { throw new Error("Expected translator_proof in GoblinProof deserialization"); };
1218
- return {
1219
- mergeProof: o.merge_proof,
1220
- eccvmProof: o.eccvm_proof,
1221
- ipaProof: o.ipa_proof,
1222
- translatorProof: o.translator_proof,
1223
- };
1224
- }
1225
-
1226
- export function toChonkProof(o: MsgpackChonkProof): ChonkProof {
1227
- if (o.mega_proof === undefined) { throw new Error("Expected mega_proof in ChonkProof deserialization"); }
1228
- if (o.goblin_proof === undefined) { throw new Error("Expected goblin_proof in ChonkProof deserialization"); };
1229
- return {
1230
- megaProof: o.mega_proof,
1231
- goblinProof: toGoblinProof(o.goblin_proof),
1232
- };
1233
- }
1234
-
1235
- export function toChonkVerify(o: MsgpackChonkVerify): ChonkVerify {
1236
- if (o.proof === undefined) { throw new Error("Expected proof in ChonkVerify deserialization"); }
1237
- if (o.vk === undefined) { throw new Error("Expected vk in ChonkVerify deserialization"); };
1238
- return {
1239
- proof: toChonkProof(o.proof),
1240
- vk: o.vk,
1241
- };
1242
- }
1243
-
1244
- export function toVkAsFields(o: MsgpackVkAsFields): VkAsFields {
1245
- if (o.verification_key === undefined) { throw new Error("Expected verification_key in VkAsFields deserialization"); };
1246
- return {
1247
- verificationKey: o.verification_key,
1248
- };
1249
- }
1250
-
1251
- export function toMegaVkAsFields(o: MsgpackMegaVkAsFields): MegaVkAsFields {
1252
- if (o.verification_key === undefined) { throw new Error("Expected verification_key in MegaVkAsFields deserialization"); };
1253
- return {
1254
- verificationKey: o.verification_key,
1255
- };
1256
- }
1257
-
1258
- export function toCircuitWriteSolidityVerifier(o: MsgpackCircuitWriteSolidityVerifier): CircuitWriteSolidityVerifier {
1259
- if (o.verification_key === undefined) { throw new Error("Expected verification_key in CircuitWriteSolidityVerifier deserialization"); }
1260
- if (o.settings === undefined) { throw new Error("Expected settings in CircuitWriteSolidityVerifier deserialization"); };
1261
- return {
1262
- verificationKey: o.verification_key,
1263
- settings: toProofSystemSettings(o.settings),
1264
- };
1265
- }
1266
-
1267
- export function toChonkCheckPrecomputedVk(o: MsgpackChonkCheckPrecomputedVk): ChonkCheckPrecomputedVk {
1268
- if (o.circuit === undefined) { throw new Error("Expected circuit in ChonkCheckPrecomputedVk deserialization"); };
1269
- return {
1270
- circuit: toCircuitInput(o.circuit),
1271
- };
1272
- }
1273
-
1274
- export function toChonkStats(o: MsgpackChonkStats): ChonkStats {
1275
- if (o.circuit === undefined) { throw new Error("Expected circuit in ChonkStats deserialization"); }
1276
- if (o.include_gates_per_opcode === undefined) { throw new Error("Expected include_gates_per_opcode in ChonkStats deserialization"); };
1277
- return {
1278
- circuit: toCircuitInputNoVK(o.circuit),
1279
- includeGatesPerOpcode: o.include_gates_per_opcode,
1280
- };
1281
- }
1282
-
1283
- export function toPoseidon2Hash(o: MsgpackPoseidon2Hash): Poseidon2Hash {
1284
- if (o.inputs === undefined) { throw new Error("Expected inputs in Poseidon2Hash deserialization"); };
1285
- return {
1286
- inputs: o.inputs,
1287
- };
1288
- }
1289
-
1290
- export function toPoseidon2Permutation(o: MsgpackPoseidon2Permutation): Poseidon2Permutation {
1291
- if (o.inputs === undefined) { throw new Error("Expected inputs in Poseidon2Permutation deserialization"); };
1292
- return {
1293
- inputs: o.inputs,
1294
- };
1295
- }
1296
-
1297
- export function toPedersenCommit(o: MsgpackPedersenCommit): PedersenCommit {
1298
- if (o.inputs === undefined) { throw new Error("Expected inputs in PedersenCommit deserialization"); }
1299
- if (o.hash_index === undefined) { throw new Error("Expected hash_index in PedersenCommit deserialization"); };
1300
- return {
1301
- inputs: o.inputs,
1302
- hashIndex: o.hash_index,
1303
- };
1304
- }
1305
-
1306
- export function toPedersenHash(o: MsgpackPedersenHash): PedersenHash {
1307
- if (o.inputs === undefined) { throw new Error("Expected inputs in PedersenHash deserialization"); }
1308
- if (o.hash_index === undefined) { throw new Error("Expected hash_index in PedersenHash deserialization"); };
1309
- return {
1310
- inputs: o.inputs,
1311
- hashIndex: o.hash_index,
1312
- };
1313
- }
1314
-
1315
- export function toPedersenHashBuffer(o: MsgpackPedersenHashBuffer): PedersenHashBuffer {
1316
- if (o.input === undefined) { throw new Error("Expected input in PedersenHashBuffer deserialization"); }
1317
- if (o.hash_index === undefined) { throw new Error("Expected hash_index in PedersenHashBuffer deserialization"); };
1318
- return {
1319
- input: o.input,
1320
- hashIndex: o.hash_index,
1321
- };
1322
- }
1323
-
1324
- export function toBlake2s(o: MsgpackBlake2s): Blake2s {
1325
- if (o.data === undefined) { throw new Error("Expected data in Blake2s deserialization"); };
1326
- return {
1327
- data: o.data,
1328
- };
1329
- }
1330
-
1331
- export function toBlake2sToField(o: MsgpackBlake2sToField): Blake2sToField {
1332
- if (o.data === undefined) { throw new Error("Expected data in Blake2sToField deserialization"); };
1333
- return {
1334
- data: o.data,
1335
- };
1336
- }
1337
-
1338
- export function toAesEncrypt(o: MsgpackAesEncrypt): AesEncrypt {
1339
- if (o.plaintext === undefined) { throw new Error("Expected plaintext in AesEncrypt deserialization"); }
1340
- if (o.iv === undefined) { throw new Error("Expected iv in AesEncrypt deserialization"); }
1341
- if (o.key === undefined) { throw new Error("Expected key in AesEncrypt deserialization"); }
1342
- if (o.length === undefined) { throw new Error("Expected length in AesEncrypt deserialization"); };
1343
- return {
1344
- plaintext: o.plaintext,
1345
- iv: o.iv,
1346
- key: o.key,
1347
- length: o.length,
1348
- };
1349
- }
1350
-
1351
- export function toAesDecrypt(o: MsgpackAesDecrypt): AesDecrypt {
1352
- if (o.ciphertext === undefined) { throw new Error("Expected ciphertext in AesDecrypt deserialization"); }
1353
- if (o.iv === undefined) { throw new Error("Expected iv in AesDecrypt deserialization"); }
1354
- if (o.key === undefined) { throw new Error("Expected key in AesDecrypt deserialization"); }
1355
- if (o.length === undefined) { throw new Error("Expected length in AesDecrypt deserialization"); };
1356
- return {
1357
- ciphertext: o.ciphertext,
1358
- iv: o.iv,
1359
- key: o.key,
1360
- length: o.length,
1361
- };
1362
- }
1363
-
1364
- export function toGrumpkinPoint(o: MsgpackGrumpkinPoint): GrumpkinPoint {
1365
- if (o.x === undefined) { throw new Error("Expected x in GrumpkinPoint deserialization"); }
1366
- if (o.y === undefined) { throw new Error("Expected y in GrumpkinPoint deserialization"); };
1367
- return {
1368
- x: o.x,
1369
- y: o.y,
1370
- };
1371
- }
1372
-
1373
- export function toGrumpkinMul(o: MsgpackGrumpkinMul): GrumpkinMul {
1374
- if (o.point === undefined) { throw new Error("Expected point in GrumpkinMul deserialization"); }
1375
- if (o.scalar === undefined) { throw new Error("Expected scalar in GrumpkinMul deserialization"); };
1376
- return {
1377
- point: toGrumpkinPoint(o.point),
1378
- scalar: o.scalar,
1379
- };
1380
- }
1381
-
1382
- export function toGrumpkinAdd(o: MsgpackGrumpkinAdd): GrumpkinAdd {
1383
- if (o.point_a === undefined) { throw new Error("Expected point_a in GrumpkinAdd deserialization"); }
1384
- if (o.point_b === undefined) { throw new Error("Expected point_b in GrumpkinAdd deserialization"); };
1385
- return {
1386
- pointA: toGrumpkinPoint(o.point_a),
1387
- pointB: toGrumpkinPoint(o.point_b),
1388
- };
1389
- }
1390
-
1391
- export function toGrumpkinBatchMul(o: MsgpackGrumpkinBatchMul): GrumpkinBatchMul {
1392
- if (o.points === undefined) { throw new Error("Expected points in GrumpkinBatchMul deserialization"); }
1393
- if (o.scalar === undefined) { throw new Error("Expected scalar in GrumpkinBatchMul deserialization"); };
1394
- return {
1395
- points: o.points.map((v: any) => toGrumpkinPoint(v)),
1396
- scalar: o.scalar,
1397
- };
1398
- }
1399
-
1400
- export function toGrumpkinGetRandomFr(o: MsgpackGrumpkinGetRandomFr): GrumpkinGetRandomFr {
1401
- if (o.dummy === undefined) { throw new Error("Expected dummy in GrumpkinGetRandomFr deserialization"); };
1402
- return {
1403
- dummy: o.dummy,
1404
- };
1405
- }
1406
-
1407
- export function toGrumpkinReduce512(o: MsgpackGrumpkinReduce512): GrumpkinReduce512 {
1408
- if (o.input === undefined) { throw new Error("Expected input in GrumpkinReduce512 deserialization"); };
1409
- return {
1410
- input: o.input,
1411
- };
1412
- }
1413
-
1414
- export function toSecp256k1Point(o: MsgpackSecp256k1Point): Secp256k1Point {
1415
- if (o.x === undefined) { throw new Error("Expected x in Secp256k1Point deserialization"); }
1416
- if (o.y === undefined) { throw new Error("Expected y in Secp256k1Point deserialization"); };
1417
- return {
1418
- x: o.x,
1419
- y: o.y,
1420
- };
1421
- }
1422
-
1423
- export function toSecp256k1Mul(o: MsgpackSecp256k1Mul): Secp256k1Mul {
1424
- if (o.point === undefined) { throw new Error("Expected point in Secp256k1Mul deserialization"); }
1425
- if (o.scalar === undefined) { throw new Error("Expected scalar in Secp256k1Mul deserialization"); };
1426
- return {
1427
- point: toSecp256k1Point(o.point),
1428
- scalar: o.scalar,
1429
- };
1430
- }
1431
-
1432
- export function toSecp256k1GetRandomFr(o: MsgpackSecp256k1GetRandomFr): Secp256k1GetRandomFr {
1433
- if (o.dummy === undefined) { throw new Error("Expected dummy in Secp256k1GetRandomFr deserialization"); };
1434
- return {
1435
- dummy: o.dummy,
1436
- };
1437
- }
1438
-
1439
- export function toSecp256k1Reduce512(o: MsgpackSecp256k1Reduce512): Secp256k1Reduce512 {
1440
- if (o.input === undefined) { throw new Error("Expected input in Secp256k1Reduce512 deserialization"); };
1441
- return {
1442
- input: o.input,
1443
- };
1444
- }
1445
-
1446
- export function toBn254FrSqrt(o: MsgpackBn254FrSqrt): Bn254FrSqrt {
1447
- if (o.input === undefined) { throw new Error("Expected input in Bn254FrSqrt deserialization"); };
1448
- return {
1449
- input: o.input,
1450
- };
1451
- }
1452
-
1453
- export function toBn254FqSqrt(o: MsgpackBn254FqSqrt): Bn254FqSqrt {
1454
- if (o.input === undefined) { throw new Error("Expected input in Bn254FqSqrt deserialization"); };
1455
- return {
1456
- input: o.input,
1457
- };
1458
- }
1459
-
1460
- export function toBn254G1Point(o: MsgpackBn254G1Point): Bn254G1Point {
1461
- if (o.x === undefined) { throw new Error("Expected x in Bn254G1Point deserialization"); }
1462
- if (o.y === undefined) { throw new Error("Expected y in Bn254G1Point deserialization"); };
1463
- return {
1464
- x: o.x,
1465
- y: o.y,
1466
- };
1467
- }
1468
-
1469
- export function toBn254G1Mul(o: MsgpackBn254G1Mul): Bn254G1Mul {
1470
- if (o.point === undefined) { throw new Error("Expected point in Bn254G1Mul deserialization"); }
1471
- if (o.scalar === undefined) { throw new Error("Expected scalar in Bn254G1Mul deserialization"); };
1472
- return {
1473
- point: toBn254G1Point(o.point),
1474
- scalar: o.scalar,
1475
- };
1476
- }
1477
-
1478
- export function toBn254G2Point(o: MsgpackBn254G2Point): Bn254G2Point {
1479
- if (o.x === undefined) { throw new Error("Expected x in Bn254G2Point deserialization"); }
1480
- if (o.y === undefined) { throw new Error("Expected y in Bn254G2Point deserialization"); };
1481
- return {
1482
- x: o.x,
1483
- y: o.y,
1484
- };
1485
- }
1486
-
1487
- export function toBn254G2Mul(o: MsgpackBn254G2Mul): Bn254G2Mul {
1488
- if (o.point === undefined) { throw new Error("Expected point in Bn254G2Mul deserialization"); }
1489
- if (o.scalar === undefined) { throw new Error("Expected scalar in Bn254G2Mul deserialization"); };
1490
- return {
1491
- point: toBn254G2Point(o.point),
1492
- scalar: o.scalar,
1493
- };
1494
- }
1495
-
1496
- export function toBn254G1IsOnCurve(o: MsgpackBn254G1IsOnCurve): Bn254G1IsOnCurve {
1497
- if (o.point === undefined) { throw new Error("Expected point in Bn254G1IsOnCurve deserialization"); };
1498
- return {
1499
- point: toBn254G1Point(o.point),
1500
- };
1501
- }
1502
-
1503
- export function toBn254G1FromCompressed(o: MsgpackBn254G1FromCompressed): Bn254G1FromCompressed {
1504
- if (o.compressed === undefined) { throw new Error("Expected compressed in Bn254G1FromCompressed deserialization"); };
1505
- return {
1506
- compressed: o.compressed,
1507
- };
1508
- }
1509
-
1510
- export function toSchnorrComputePublicKey(o: MsgpackSchnorrComputePublicKey): SchnorrComputePublicKey {
1511
- if (o.private_key === undefined) { throw new Error("Expected private_key in SchnorrComputePublicKey deserialization"); };
1512
- return {
1513
- privateKey: o.private_key,
1514
- };
1515
- }
1516
-
1517
- export function toSchnorrConstructSignature(o: MsgpackSchnorrConstructSignature): SchnorrConstructSignature {
1518
- if (o.message === undefined) { throw new Error("Expected message in SchnorrConstructSignature deserialization"); }
1519
- if (o.private_key === undefined) { throw new Error("Expected private_key in SchnorrConstructSignature deserialization"); };
1520
- return {
1521
- message: o.message,
1522
- privateKey: o.private_key,
1523
- };
1524
- }
1525
-
1526
- export function toSchnorrVerifySignature(o: MsgpackSchnorrVerifySignature): SchnorrVerifySignature {
1527
- if (o.message === undefined) { throw new Error("Expected message in SchnorrVerifySignature deserialization"); }
1528
- if (o.public_key === undefined) { throw new Error("Expected public_key in SchnorrVerifySignature deserialization"); }
1529
- if (o.s === undefined) { throw new Error("Expected s in SchnorrVerifySignature deserialization"); }
1530
- if (o.e === undefined) { throw new Error("Expected e in SchnorrVerifySignature deserialization"); };
1531
- return {
1532
- message: o.message,
1533
- publicKey: toGrumpkinPoint(o.public_key),
1534
- s: o.s,
1535
- e: o.e,
1536
- };
1537
- }
1538
-
1539
- export function toEcdsaSecp256k1ComputePublicKey(o: MsgpackEcdsaSecp256k1ComputePublicKey): EcdsaSecp256k1ComputePublicKey {
1540
- if (o.private_key === undefined) { throw new Error("Expected private_key in EcdsaSecp256k1ComputePublicKey deserialization"); };
1541
- return {
1542
- privateKey: o.private_key,
1543
- };
1544
- }
1545
-
1546
- export function toEcdsaSecp256r1ComputePublicKey(o: MsgpackEcdsaSecp256r1ComputePublicKey): EcdsaSecp256r1ComputePublicKey {
1547
- if (o.private_key === undefined) { throw new Error("Expected private_key in EcdsaSecp256r1ComputePublicKey deserialization"); };
1548
- return {
1549
- privateKey: o.private_key,
1550
- };
1551
- }
1552
-
1553
- export function toEcdsaSecp256k1ConstructSignature(o: MsgpackEcdsaSecp256k1ConstructSignature): EcdsaSecp256k1ConstructSignature {
1554
- if (o.message === undefined) { throw new Error("Expected message in EcdsaSecp256k1ConstructSignature deserialization"); }
1555
- if (o.private_key === undefined) { throw new Error("Expected private_key in EcdsaSecp256k1ConstructSignature deserialization"); };
1556
- return {
1557
- message: o.message,
1558
- privateKey: o.private_key,
1559
- };
1560
- }
1561
-
1562
- export function toEcdsaSecp256r1ConstructSignature(o: MsgpackEcdsaSecp256r1ConstructSignature): EcdsaSecp256r1ConstructSignature {
1563
- if (o.message === undefined) { throw new Error("Expected message in EcdsaSecp256r1ConstructSignature deserialization"); }
1564
- if (o.private_key === undefined) { throw new Error("Expected private_key in EcdsaSecp256r1ConstructSignature deserialization"); };
1565
- return {
1566
- message: o.message,
1567
- privateKey: o.private_key,
1568
- };
1569
- }
1570
-
1571
- export function toEcdsaSecp256k1RecoverPublicKey(o: MsgpackEcdsaSecp256k1RecoverPublicKey): EcdsaSecp256k1RecoverPublicKey {
1572
- if (o.message === undefined) { throw new Error("Expected message in EcdsaSecp256k1RecoverPublicKey deserialization"); }
1573
- if (o.r === undefined) { throw new Error("Expected r in EcdsaSecp256k1RecoverPublicKey deserialization"); }
1574
- if (o.s === undefined) { throw new Error("Expected s in EcdsaSecp256k1RecoverPublicKey deserialization"); }
1575
- if (o.v === undefined) { throw new Error("Expected v in EcdsaSecp256k1RecoverPublicKey deserialization"); };
1576
- return {
1577
- message: o.message,
1578
- r: o.r,
1579
- s: o.s,
1580
- v: o.v,
1581
- };
1582
- }
1583
-
1584
- export function toEcdsaSecp256r1RecoverPublicKey(o: MsgpackEcdsaSecp256r1RecoverPublicKey): EcdsaSecp256r1RecoverPublicKey {
1585
- if (o.message === undefined) { throw new Error("Expected message in EcdsaSecp256r1RecoverPublicKey deserialization"); }
1586
- if (o.r === undefined) { throw new Error("Expected r in EcdsaSecp256r1RecoverPublicKey deserialization"); }
1587
- if (o.s === undefined) { throw new Error("Expected s in EcdsaSecp256r1RecoverPublicKey deserialization"); }
1588
- if (o.v === undefined) { throw new Error("Expected v in EcdsaSecp256r1RecoverPublicKey deserialization"); };
1589
- return {
1590
- message: o.message,
1591
- r: o.r,
1592
- s: o.s,
1593
- v: o.v,
1594
- };
1595
- }
1596
-
1597
- export function toEcdsaSecp256k1VerifySignature(o: MsgpackEcdsaSecp256k1VerifySignature): EcdsaSecp256k1VerifySignature {
1598
- if (o.message === undefined) { throw new Error("Expected message in EcdsaSecp256k1VerifySignature deserialization"); }
1599
- if (o.public_key === undefined) { throw new Error("Expected public_key in EcdsaSecp256k1VerifySignature deserialization"); }
1600
- if (o.r === undefined) { throw new Error("Expected r in EcdsaSecp256k1VerifySignature deserialization"); }
1601
- if (o.s === undefined) { throw new Error("Expected s in EcdsaSecp256k1VerifySignature deserialization"); }
1602
- if (o.v === undefined) { throw new Error("Expected v in EcdsaSecp256k1VerifySignature deserialization"); };
1603
- return {
1604
- message: o.message,
1605
- publicKey: toSecp256k1Point(o.public_key),
1606
- r: o.r,
1607
- s: o.s,
1608
- v: o.v,
1609
- };
1610
- }
1611
-
1612
- export function toSecp256r1Point(o: MsgpackSecp256r1Point): Secp256r1Point {
1613
- if (o.x === undefined) { throw new Error("Expected x in Secp256r1Point deserialization"); }
1614
- if (o.y === undefined) { throw new Error("Expected y in Secp256r1Point deserialization"); };
1615
- return {
1616
- x: o.x,
1617
- y: o.y,
1618
- };
1619
- }
1620
-
1621
- export function toEcdsaSecp256r1VerifySignature(o: MsgpackEcdsaSecp256r1VerifySignature): EcdsaSecp256r1VerifySignature {
1622
- if (o.message === undefined) { throw new Error("Expected message in EcdsaSecp256r1VerifySignature deserialization"); }
1623
- if (o.public_key === undefined) { throw new Error("Expected public_key in EcdsaSecp256r1VerifySignature deserialization"); }
1624
- if (o.r === undefined) { throw new Error("Expected r in EcdsaSecp256r1VerifySignature deserialization"); }
1625
- if (o.s === undefined) { throw new Error("Expected s in EcdsaSecp256r1VerifySignature deserialization"); }
1626
- if (o.v === undefined) { throw new Error("Expected v in EcdsaSecp256r1VerifySignature deserialization"); };
1627
- return {
1628
- message: o.message,
1629
- publicKey: toSecp256r1Point(o.public_key),
1630
- r: o.r,
1631
- s: o.s,
1632
- v: o.v,
1633
- };
1634
- }
1635
-
1636
- export function toSrsInitSrs(o: MsgpackSrsInitSrs): SrsInitSrs {
1637
- if (o.points_buf === undefined) { throw new Error("Expected points_buf in SrsInitSrs deserialization"); }
1638
- if (o.num_points === undefined) { throw new Error("Expected num_points in SrsInitSrs deserialization"); }
1639
- if (o.g2_point === undefined) { throw new Error("Expected g2_point in SrsInitSrs deserialization"); };
1640
- return {
1641
- pointsBuf: o.points_buf,
1642
- numPoints: o.num_points,
1643
- g2Point: o.g2_point,
1644
- };
1645
- }
1646
-
1647
- export function toSrsInitGrumpkinSrs(o: MsgpackSrsInitGrumpkinSrs): SrsInitGrumpkinSrs {
1648
- if (o.points_buf === undefined) { throw new Error("Expected points_buf in SrsInitGrumpkinSrs deserialization"); }
1649
- if (o.num_points === undefined) { throw new Error("Expected num_points in SrsInitGrumpkinSrs deserialization"); };
1650
- return {
1651
- pointsBuf: o.points_buf,
1652
- numPoints: o.num_points,
1653
- };
1654
- }
1655
-
1656
- export function toShutdown(o: MsgpackShutdown): Shutdown {
1657
- return {};
1658
- }
1659
-
1660
- export function toErrorResponse(o: MsgpackErrorResponse): ErrorResponse {
1661
- if (o.message === undefined) { throw new Error("Expected message in ErrorResponse deserialization"); };
1662
- return {
1663
- message: o.message,
1664
- };
1665
- }
1666
-
1667
- export function toCircuitProveResponse(o: MsgpackCircuitProveResponse): CircuitProveResponse {
1668
- if (o.public_inputs === undefined) { throw new Error("Expected public_inputs in CircuitProveResponse deserialization"); }
1669
- if (o.proof === undefined) { throw new Error("Expected proof in CircuitProveResponse deserialization"); }
1670
- if (o.vk === undefined) { throw new Error("Expected vk in CircuitProveResponse deserialization"); };
1671
- return {
1672
- publicInputs: o.public_inputs,
1673
- proof: o.proof,
1674
- vk: toCircuitComputeVkResponse(o.vk),
1675
- };
1676
- }
1677
-
1678
- export function toCircuitInfoResponse(o: MsgpackCircuitInfoResponse): CircuitInfoResponse {
1679
- if (o.num_gates === undefined) { throw new Error("Expected num_gates in CircuitInfoResponse deserialization"); }
1680
- if (o.num_gates_dyadic === undefined) { throw new Error("Expected num_gates_dyadic in CircuitInfoResponse deserialization"); }
1681
- if (o.num_acir_opcodes === undefined) { throw new Error("Expected num_acir_opcodes in CircuitInfoResponse deserialization"); }
1682
- if (o.gates_per_opcode === undefined) { throw new Error("Expected gates_per_opcode in CircuitInfoResponse deserialization"); };
1683
- return {
1684
- numGates: o.num_gates,
1685
- numGatesDyadic: o.num_gates_dyadic,
1686
- numAcirOpcodes: o.num_acir_opcodes,
1687
- gatesPerOpcode: o.gates_per_opcode,
1688
- };
1689
- }
1690
-
1691
- export function toCircuitVerifyResponse(o: MsgpackCircuitVerifyResponse): CircuitVerifyResponse {
1692
- if (o.verified === undefined) { throw new Error("Expected verified in CircuitVerifyResponse deserialization"); };
1693
- return {
1694
- verified: o.verified,
1695
- };
1696
- }
1697
-
1698
- export function toChonkComputeVkResponse(o: MsgpackChonkComputeVkResponse): ChonkComputeVkResponse {
1699
- if (o.bytes === undefined) { throw new Error("Expected bytes in ChonkComputeVkResponse deserialization"); }
1700
- if (o.fields === undefined) { throw new Error("Expected fields in ChonkComputeVkResponse deserialization"); };
1701
- return {
1702
- bytes: o.bytes,
1703
- fields: o.fields,
1704
- };
1705
- }
1706
-
1707
- export function toChonkStartResponse(o: MsgpackChonkStartResponse): ChonkStartResponse {
1708
- return {};
1709
- }
1710
-
1711
- export function toChonkLoadResponse(o: MsgpackChonkLoadResponse): ChonkLoadResponse {
1712
- return {};
1713
- }
1714
-
1715
- export function toChonkAccumulateResponse(o: MsgpackChonkAccumulateResponse): ChonkAccumulateResponse {
1716
- return {};
1717
- }
1718
-
1719
- export function toChonkProveResponse(o: MsgpackChonkProveResponse): ChonkProveResponse {
1720
- if (o.proof === undefined) { throw new Error("Expected proof in ChonkProveResponse deserialization"); };
1721
- return {
1722
- proof: toChonkProof(o.proof),
1723
- };
1724
- }
1725
-
1726
- export function toChonkVerifyResponse(o: MsgpackChonkVerifyResponse): ChonkVerifyResponse {
1727
- if (o.valid === undefined) { throw new Error("Expected valid in ChonkVerifyResponse deserialization"); };
1728
- return {
1729
- valid: o.valid,
1730
- };
1731
- }
1732
-
1733
- export function toVkAsFieldsResponse(o: MsgpackVkAsFieldsResponse): VkAsFieldsResponse {
1734
- if (o.fields === undefined) { throw new Error("Expected fields in VkAsFieldsResponse deserialization"); };
1735
- return {
1736
- fields: o.fields,
1737
- };
1738
- }
1739
-
1740
- export function toMegaVkAsFieldsResponse(o: MsgpackMegaVkAsFieldsResponse): MegaVkAsFieldsResponse {
1741
- if (o.fields === undefined) { throw new Error("Expected fields in MegaVkAsFieldsResponse deserialization"); };
1742
- return {
1743
- fields: o.fields,
1744
- };
1745
- }
1746
-
1747
- export function toCircuitWriteSolidityVerifierResponse(o: MsgpackCircuitWriteSolidityVerifierResponse): CircuitWriteSolidityVerifierResponse {
1748
- if (o.solidity_code === undefined) { throw new Error("Expected solidity_code in CircuitWriteSolidityVerifierResponse deserialization"); };
1749
- return {
1750
- solidityCode: o.solidity_code,
1751
- };
1752
- }
1753
-
1754
- export function toChonkCheckPrecomputedVkResponse(o: MsgpackChonkCheckPrecomputedVkResponse): ChonkCheckPrecomputedVkResponse {
1755
- if (o.valid === undefined) { throw new Error("Expected valid in ChonkCheckPrecomputedVkResponse deserialization"); }
1756
- if (o.actual_vk === undefined) { throw new Error("Expected actual_vk in ChonkCheckPrecomputedVkResponse deserialization"); };
1757
- return {
1758
- valid: o.valid,
1759
- actualVk: o.actual_vk,
1760
- };
1761
- }
1762
-
1763
- export function toChonkStatsResponse(o: MsgpackChonkStatsResponse): ChonkStatsResponse {
1764
- if (o.acir_opcodes === undefined) { throw new Error("Expected acir_opcodes in ChonkStatsResponse deserialization"); }
1765
- if (o.circuit_size === undefined) { throw new Error("Expected circuit_size in ChonkStatsResponse deserialization"); }
1766
- if (o.gates_per_opcode === undefined) { throw new Error("Expected gates_per_opcode in ChonkStatsResponse deserialization"); };
1767
- return {
1768
- acirOpcodes: o.acir_opcodes,
1769
- circuitSize: o.circuit_size,
1770
- gatesPerOpcode: o.gates_per_opcode,
1771
- };
1772
- }
1773
-
1774
- export function toPoseidon2HashResponse(o: MsgpackPoseidon2HashResponse): Poseidon2HashResponse {
1775
- if (o.hash === undefined) { throw new Error("Expected hash in Poseidon2HashResponse deserialization"); };
1776
- return {
1777
- hash: o.hash,
1778
- };
1779
- }
1780
-
1781
- export function toPoseidon2PermutationResponse(o: MsgpackPoseidon2PermutationResponse): Poseidon2PermutationResponse {
1782
- if (o.outputs === undefined) { throw new Error("Expected outputs in Poseidon2PermutationResponse deserialization"); };
1783
- return {
1784
- outputs: o.outputs,
1785
- };
1786
- }
1787
-
1788
- export function toPedersenCommitResponse(o: MsgpackPedersenCommitResponse): PedersenCommitResponse {
1789
- if (o.point === undefined) { throw new Error("Expected point in PedersenCommitResponse deserialization"); };
1790
- return {
1791
- point: toGrumpkinPoint(o.point),
1792
- };
1793
- }
1794
-
1795
- export function toPedersenHashResponse(o: MsgpackPedersenHashResponse): PedersenHashResponse {
1796
- if (o.hash === undefined) { throw new Error("Expected hash in PedersenHashResponse deserialization"); };
1797
- return {
1798
- hash: o.hash,
1799
- };
1800
- }
1801
-
1802
- export function toPedersenHashBufferResponse(o: MsgpackPedersenHashBufferResponse): PedersenHashBufferResponse {
1803
- if (o.hash === undefined) { throw new Error("Expected hash in PedersenHashBufferResponse deserialization"); };
1804
- return {
1805
- hash: o.hash,
1806
- };
1807
- }
1808
-
1809
- export function toBlake2sResponse(o: MsgpackBlake2sResponse): Blake2sResponse {
1810
- if (o.hash === undefined) { throw new Error("Expected hash in Blake2sResponse deserialization"); };
1811
- return {
1812
- hash: o.hash,
1813
- };
1814
- }
1815
-
1816
- export function toBlake2sToFieldResponse(o: MsgpackBlake2sToFieldResponse): Blake2sToFieldResponse {
1817
- if (o.field === undefined) { throw new Error("Expected field in Blake2sToFieldResponse deserialization"); };
1818
- return {
1819
- field: o.field,
1820
- };
1821
- }
1822
-
1823
- export function toAesEncryptResponse(o: MsgpackAesEncryptResponse): AesEncryptResponse {
1824
- if (o.ciphertext === undefined) { throw new Error("Expected ciphertext in AesEncryptResponse deserialization"); };
1825
- return {
1826
- ciphertext: o.ciphertext,
1827
- };
1828
- }
1829
-
1830
- export function toAesDecryptResponse(o: MsgpackAesDecryptResponse): AesDecryptResponse {
1831
- if (o.plaintext === undefined) { throw new Error("Expected plaintext in AesDecryptResponse deserialization"); };
1832
- return {
1833
- plaintext: o.plaintext,
1834
- };
1835
- }
1836
-
1837
- export function toGrumpkinMulResponse(o: MsgpackGrumpkinMulResponse): GrumpkinMulResponse {
1838
- if (o.point === undefined) { throw new Error("Expected point in GrumpkinMulResponse deserialization"); };
1839
- return {
1840
- point: toGrumpkinPoint(o.point),
1841
- };
1842
- }
1843
-
1844
- export function toGrumpkinAddResponse(o: MsgpackGrumpkinAddResponse): GrumpkinAddResponse {
1845
- if (o.point === undefined) { throw new Error("Expected point in GrumpkinAddResponse deserialization"); };
1846
- return {
1847
- point: toGrumpkinPoint(o.point),
1848
- };
1849
- }
1850
-
1851
- export function toGrumpkinBatchMulResponse(o: MsgpackGrumpkinBatchMulResponse): GrumpkinBatchMulResponse {
1852
- if (o.points === undefined) { throw new Error("Expected points in GrumpkinBatchMulResponse deserialization"); };
1853
- return {
1854
- points: o.points.map((v: any) => toGrumpkinPoint(v)),
1855
- };
1856
- }
1857
-
1858
- export function toGrumpkinGetRandomFrResponse(o: MsgpackGrumpkinGetRandomFrResponse): GrumpkinGetRandomFrResponse {
1859
- if (o.value === undefined) { throw new Error("Expected value in GrumpkinGetRandomFrResponse deserialization"); };
1860
- return {
1861
- value: o.value,
1862
- };
1863
- }
1864
-
1865
- export function toGrumpkinReduce512Response(o: MsgpackGrumpkinReduce512Response): GrumpkinReduce512Response {
1866
- if (o.value === undefined) { throw new Error("Expected value in GrumpkinReduce512Response deserialization"); };
1867
- return {
1868
- value: o.value,
1869
- };
1870
- }
1871
-
1872
- export function toSecp256k1MulResponse(o: MsgpackSecp256k1MulResponse): Secp256k1MulResponse {
1873
- if (o.point === undefined) { throw new Error("Expected point in Secp256k1MulResponse deserialization"); };
1874
- return {
1875
- point: toSecp256k1Point(o.point),
1876
- };
1877
- }
1878
-
1879
- export function toSecp256k1GetRandomFrResponse(o: MsgpackSecp256k1GetRandomFrResponse): Secp256k1GetRandomFrResponse {
1880
- if (o.value === undefined) { throw new Error("Expected value in Secp256k1GetRandomFrResponse deserialization"); };
1881
- return {
1882
- value: o.value,
1883
- };
1884
- }
1885
-
1886
- export function toSecp256k1Reduce512Response(o: MsgpackSecp256k1Reduce512Response): Secp256k1Reduce512Response {
1887
- if (o.value === undefined) { throw new Error("Expected value in Secp256k1Reduce512Response deserialization"); };
1888
- return {
1889
- value: o.value,
1890
- };
1891
- }
1892
-
1893
- export function toBn254FrSqrtResponse(o: MsgpackBn254FrSqrtResponse): Bn254FrSqrtResponse {
1894
- if (o.is_square_root === undefined) { throw new Error("Expected is_square_root in Bn254FrSqrtResponse deserialization"); }
1895
- if (o.value === undefined) { throw new Error("Expected value in Bn254FrSqrtResponse deserialization"); };
1896
- return {
1897
- isSquareRoot: o.is_square_root,
1898
- value: o.value,
1899
- };
1900
- }
1901
-
1902
- export function toBn254FqSqrtResponse(o: MsgpackBn254FqSqrtResponse): Bn254FqSqrtResponse {
1903
- if (o.is_square_root === undefined) { throw new Error("Expected is_square_root in Bn254FqSqrtResponse deserialization"); }
1904
- if (o.value === undefined) { throw new Error("Expected value in Bn254FqSqrtResponse deserialization"); };
1905
- return {
1906
- isSquareRoot: o.is_square_root,
1907
- value: o.value,
1908
- };
1909
- }
1910
-
1911
- export function toBn254G1MulResponse(o: MsgpackBn254G1MulResponse): Bn254G1MulResponse {
1912
- if (o.point === undefined) { throw new Error("Expected point in Bn254G1MulResponse deserialization"); };
1913
- return {
1914
- point: toBn254G1Point(o.point),
1915
- };
1916
- }
1917
-
1918
- export function toBn254G2MulResponse(o: MsgpackBn254G2MulResponse): Bn254G2MulResponse {
1919
- if (o.point === undefined) { throw new Error("Expected point in Bn254G2MulResponse deserialization"); };
1920
- return {
1921
- point: toBn254G2Point(o.point),
1922
- };
1923
- }
1924
-
1925
- export function toBn254G1IsOnCurveResponse(o: MsgpackBn254G1IsOnCurveResponse): Bn254G1IsOnCurveResponse {
1926
- if (o.is_on_curve === undefined) { throw new Error("Expected is_on_curve in Bn254G1IsOnCurveResponse deserialization"); };
1927
- return {
1928
- isOnCurve: o.is_on_curve,
1929
- };
1930
- }
1931
-
1932
- export function toBn254G1FromCompressedResponse(o: MsgpackBn254G1FromCompressedResponse): Bn254G1FromCompressedResponse {
1933
- if (o.point === undefined) { throw new Error("Expected point in Bn254G1FromCompressedResponse deserialization"); };
1934
- return {
1935
- point: toBn254G1Point(o.point),
1936
- };
1937
- }
1938
-
1939
- export function toSchnorrComputePublicKeyResponse(o: MsgpackSchnorrComputePublicKeyResponse): SchnorrComputePublicKeyResponse {
1940
- if (o.public_key === undefined) { throw new Error("Expected public_key in SchnorrComputePublicKeyResponse deserialization"); };
1941
- return {
1942
- publicKey: toGrumpkinPoint(o.public_key),
1943
- };
1944
- }
1945
-
1946
- export function toSchnorrConstructSignatureResponse(o: MsgpackSchnorrConstructSignatureResponse): SchnorrConstructSignatureResponse {
1947
- if (o.s === undefined) { throw new Error("Expected s in SchnorrConstructSignatureResponse deserialization"); }
1948
- if (o.e === undefined) { throw new Error("Expected e in SchnorrConstructSignatureResponse deserialization"); };
1949
- return {
1950
- s: o.s,
1951
- e: o.e,
1952
- };
1953
- }
1954
-
1955
- export function toSchnorrVerifySignatureResponse(o: MsgpackSchnorrVerifySignatureResponse): SchnorrVerifySignatureResponse {
1956
- if (o.verified === undefined) { throw new Error("Expected verified in SchnorrVerifySignatureResponse deserialization"); };
1957
- return {
1958
- verified: o.verified,
1959
- };
1960
- }
1961
-
1962
- export function toEcdsaSecp256k1ComputePublicKeyResponse(o: MsgpackEcdsaSecp256k1ComputePublicKeyResponse): EcdsaSecp256k1ComputePublicKeyResponse {
1963
- if (o.public_key === undefined) { throw new Error("Expected public_key in EcdsaSecp256k1ComputePublicKeyResponse deserialization"); };
1964
- return {
1965
- publicKey: toSecp256k1Point(o.public_key),
1966
- };
1967
- }
1968
-
1969
- export function toEcdsaSecp256r1ComputePublicKeyResponse(o: MsgpackEcdsaSecp256r1ComputePublicKeyResponse): EcdsaSecp256r1ComputePublicKeyResponse {
1970
- if (o.public_key === undefined) { throw new Error("Expected public_key in EcdsaSecp256r1ComputePublicKeyResponse deserialization"); };
1971
- return {
1972
- publicKey: toSecp256r1Point(o.public_key),
1973
- };
1974
- }
1975
-
1976
- export function toEcdsaSecp256k1ConstructSignatureResponse(o: MsgpackEcdsaSecp256k1ConstructSignatureResponse): EcdsaSecp256k1ConstructSignatureResponse {
1977
- if (o.r === undefined) { throw new Error("Expected r in EcdsaSecp256k1ConstructSignatureResponse deserialization"); }
1978
- if (o.s === undefined) { throw new Error("Expected s in EcdsaSecp256k1ConstructSignatureResponse deserialization"); }
1979
- if (o.v === undefined) { throw new Error("Expected v in EcdsaSecp256k1ConstructSignatureResponse deserialization"); };
1980
- return {
1981
- r: o.r,
1982
- s: o.s,
1983
- v: o.v,
1984
- };
1985
- }
1986
-
1987
- export function toEcdsaSecp256r1ConstructSignatureResponse(o: MsgpackEcdsaSecp256r1ConstructSignatureResponse): EcdsaSecp256r1ConstructSignatureResponse {
1988
- if (o.r === undefined) { throw new Error("Expected r in EcdsaSecp256r1ConstructSignatureResponse deserialization"); }
1989
- if (o.s === undefined) { throw new Error("Expected s in EcdsaSecp256r1ConstructSignatureResponse deserialization"); }
1990
- if (o.v === undefined) { throw new Error("Expected v in EcdsaSecp256r1ConstructSignatureResponse deserialization"); };
1991
- return {
1992
- r: o.r,
1993
- s: o.s,
1994
- v: o.v,
1995
- };
1996
- }
1997
-
1998
- export function toEcdsaSecp256k1RecoverPublicKeyResponse(o: MsgpackEcdsaSecp256k1RecoverPublicKeyResponse): EcdsaSecp256k1RecoverPublicKeyResponse {
1999
- if (o.public_key === undefined) { throw new Error("Expected public_key in EcdsaSecp256k1RecoverPublicKeyResponse deserialization"); };
2000
- return {
2001
- publicKey: toSecp256k1Point(o.public_key),
2002
- };
2003
- }
2004
-
2005
- export function toEcdsaSecp256r1RecoverPublicKeyResponse(o: MsgpackEcdsaSecp256r1RecoverPublicKeyResponse): EcdsaSecp256r1RecoverPublicKeyResponse {
2006
- if (o.public_key === undefined) { throw new Error("Expected public_key in EcdsaSecp256r1RecoverPublicKeyResponse deserialization"); };
2007
- return {
2008
- publicKey: toSecp256r1Point(o.public_key),
2009
- };
2010
- }
2011
-
2012
- export function toEcdsaSecp256k1VerifySignatureResponse(o: MsgpackEcdsaSecp256k1VerifySignatureResponse): EcdsaSecp256k1VerifySignatureResponse {
2013
- if (o.verified === undefined) { throw new Error("Expected verified in EcdsaSecp256k1VerifySignatureResponse deserialization"); };
2014
- return {
2015
- verified: o.verified,
2016
- };
2017
- }
2018
-
2019
- export function toEcdsaSecp256r1VerifySignatureResponse(o: MsgpackEcdsaSecp256r1VerifySignatureResponse): EcdsaSecp256r1VerifySignatureResponse {
2020
- if (o.verified === undefined) { throw new Error("Expected verified in EcdsaSecp256r1VerifySignatureResponse deserialization"); };
2021
- return {
2022
- verified: o.verified,
2023
- };
2024
- }
2025
-
2026
- export function toSrsInitSrsResponse(o: MsgpackSrsInitSrsResponse): SrsInitSrsResponse {
2027
- if (o.dummy === undefined) { throw new Error("Expected dummy in SrsInitSrsResponse deserialization"); };
2028
- return {
2029
- dummy: o.dummy,
2030
- };
2031
- }
2032
-
2033
- export function toSrsInitGrumpkinSrsResponse(o: MsgpackSrsInitGrumpkinSrsResponse): SrsInitGrumpkinSrsResponse {
2034
- if (o.dummy === undefined) { throw new Error("Expected dummy in SrsInitGrumpkinSrsResponse deserialization"); };
2035
- return {
2036
- dummy: o.dummy,
2037
- };
2038
- }
2039
-
2040
- export function toShutdownResponse(o: MsgpackShutdownResponse): ShutdownResponse {
2041
- return {};
2042
- }
2043
-
2044
- export function fromCircuitComputeVkResponse(o: CircuitComputeVkResponse): MsgpackCircuitComputeVkResponse {
2045
- if (o.bytes === undefined) { throw new Error("Expected bytes in CircuitComputeVkResponse serialization"); }
2046
- if (o.fields === undefined) { throw new Error("Expected fields in CircuitComputeVkResponse serialization"); }
2047
- if (o.hash === undefined) { throw new Error("Expected hash in CircuitComputeVkResponse serialization"); };
2048
- return {
2049
- bytes: o.bytes,
2050
- fields: o.fields,
2051
- hash: o.hash,
2052
- };
2053
- }
2054
-
2055
- export function fromCircuitInput(o: CircuitInput): MsgpackCircuitInput {
2056
- if (o.name === undefined) { throw new Error("Expected name in CircuitInput serialization"); }
2057
- if (o.bytecode === undefined) { throw new Error("Expected bytecode in CircuitInput serialization"); }
2058
- if (o.verificationKey === undefined) { throw new Error("Expected verificationKey in CircuitInput serialization"); };
2059
- return {
2060
- name: o.name,
2061
- bytecode: o.bytecode,
2062
- verification_key: o.verificationKey,
2063
- };
2064
- }
2065
-
2066
- export function fromProofSystemSettings(o: ProofSystemSettings): MsgpackProofSystemSettings {
2067
- if (o.ipaAccumulation === undefined) { throw new Error("Expected ipaAccumulation in ProofSystemSettings serialization"); }
2068
- if (o.oracleHashType === undefined) { throw new Error("Expected oracleHashType in ProofSystemSettings serialization"); }
2069
- if (o.disableZk === undefined) { throw new Error("Expected disableZk in ProofSystemSettings serialization"); }
2070
- if (o.optimizedSolidityVerifier === undefined) { throw new Error("Expected optimizedSolidityVerifier in ProofSystemSettings serialization"); };
2071
- return {
2072
- ipa_accumulation: o.ipaAccumulation,
2073
- oracle_hash_type: o.oracleHashType,
2074
- disable_zk: o.disableZk,
2075
- optimized_solidity_verifier: o.optimizedSolidityVerifier,
2076
- };
2077
- }
2078
-
2079
- export function fromCircuitProve(o: CircuitProve): MsgpackCircuitProve {
2080
- if (o.circuit === undefined) { throw new Error("Expected circuit in CircuitProve serialization"); }
2081
- if (o.witness === undefined) { throw new Error("Expected witness in CircuitProve serialization"); }
2082
- if (o.settings === undefined) { throw new Error("Expected settings in CircuitProve serialization"); };
2083
- return {
2084
- circuit: fromCircuitInput(o.circuit),
2085
- witness: o.witness,
2086
- settings: fromProofSystemSettings(o.settings),
2087
- };
2088
- }
2089
-
2090
- export function fromCircuitInputNoVK(o: CircuitInputNoVK): MsgpackCircuitInputNoVK {
2091
- if (o.name === undefined) { throw new Error("Expected name in CircuitInputNoVK serialization"); }
2092
- if (o.bytecode === undefined) { throw new Error("Expected bytecode in CircuitInputNoVK serialization"); };
2093
- return {
2094
- name: o.name,
2095
- bytecode: o.bytecode,
2096
- };
2097
- }
2098
-
2099
- export function fromCircuitComputeVk(o: CircuitComputeVk): MsgpackCircuitComputeVk {
2100
- if (o.circuit === undefined) { throw new Error("Expected circuit in CircuitComputeVk serialization"); }
2101
- if (o.settings === undefined) { throw new Error("Expected settings in CircuitComputeVk serialization"); };
2102
- return {
2103
- circuit: fromCircuitInputNoVK(o.circuit),
2104
- settings: fromProofSystemSettings(o.settings),
2105
- };
2106
- }
2107
-
2108
- export function fromCircuitStats(o: CircuitStats): MsgpackCircuitStats {
2109
- if (o.circuit === undefined) { throw new Error("Expected circuit in CircuitStats serialization"); }
2110
- if (o.includeGatesPerOpcode === undefined) { throw new Error("Expected includeGatesPerOpcode in CircuitStats serialization"); }
2111
- if (o.settings === undefined) { throw new Error("Expected settings in CircuitStats serialization"); };
2112
- return {
2113
- circuit: fromCircuitInput(o.circuit),
2114
- include_gates_per_opcode: o.includeGatesPerOpcode,
2115
- settings: fromProofSystemSettings(o.settings),
2116
- };
2117
- }
2118
-
2119
- export function fromCircuitVerify(o: CircuitVerify): MsgpackCircuitVerify {
2120
- if (o.verificationKey === undefined) { throw new Error("Expected verificationKey in CircuitVerify serialization"); }
2121
- if (o.publicInputs === undefined) { throw new Error("Expected publicInputs in CircuitVerify serialization"); }
2122
- if (o.proof === undefined) { throw new Error("Expected proof in CircuitVerify serialization"); }
2123
- if (o.settings === undefined) { throw new Error("Expected settings in CircuitVerify serialization"); };
2124
- return {
2125
- verification_key: o.verificationKey,
2126
- public_inputs: o.publicInputs,
2127
- proof: o.proof,
2128
- settings: fromProofSystemSettings(o.settings),
2129
- };
2130
- }
2131
-
2132
- export function fromChonkComputeVk(o: ChonkComputeVk): MsgpackChonkComputeVk {
2133
- if (o.circuit === undefined) { throw new Error("Expected circuit in ChonkComputeVk serialization"); };
2134
- return {
2135
- circuit: fromCircuitInputNoVK(o.circuit),
2136
- };
2137
- }
2138
-
2139
- export function fromChonkStart(o: ChonkStart): MsgpackChonkStart {
2140
- if (o.numCircuits === undefined) { throw new Error("Expected numCircuits in ChonkStart serialization"); };
2141
- return {
2142
- num_circuits: o.numCircuits,
2143
- };
2144
- }
2145
-
2146
- export function fromChonkLoad(o: ChonkLoad): MsgpackChonkLoad {
2147
- if (o.circuit === undefined) { throw new Error("Expected circuit in ChonkLoad serialization"); };
2148
- return {
2149
- circuit: fromCircuitInput(o.circuit),
2150
- };
2151
- }
2152
-
2153
- export function fromChonkAccumulate(o: ChonkAccumulate): MsgpackChonkAccumulate {
2154
- if (o.witness === undefined) { throw new Error("Expected witness in ChonkAccumulate serialization"); };
2155
- return {
2156
- witness: o.witness,
2157
- };
2158
- }
2159
-
2160
- export function fromChonkProve(o: ChonkProve): MsgpackChonkProve {
2161
- return {};
2162
- }
2163
-
2164
- export function fromGoblinProof(o: GoblinProof): MsgpackGoblinProof {
2165
- if (o.mergeProof === undefined) { throw new Error("Expected mergeProof in GoblinProof serialization"); }
2166
- if (o.eccvmProof === undefined) { throw new Error("Expected eccvmProof in GoblinProof serialization"); }
2167
- if (o.ipaProof === undefined) { throw new Error("Expected ipaProof in GoblinProof serialization"); }
2168
- if (o.translatorProof === undefined) { throw new Error("Expected translatorProof in GoblinProof serialization"); };
2169
- return {
2170
- merge_proof: o.mergeProof,
2171
- eccvm_proof: o.eccvmProof,
2172
- ipa_proof: o.ipaProof,
2173
- translator_proof: o.translatorProof,
2174
- };
2175
- }
2176
-
2177
- export function fromChonkProof(o: ChonkProof): MsgpackChonkProof {
2178
- if (o.megaProof === undefined) { throw new Error("Expected megaProof in ChonkProof serialization"); }
2179
- if (o.goblinProof === undefined) { throw new Error("Expected goblinProof in ChonkProof serialization"); };
2180
- return {
2181
- mega_proof: o.megaProof,
2182
- goblin_proof: fromGoblinProof(o.goblinProof),
2183
- };
2184
- }
2185
-
2186
- export function fromChonkVerify(o: ChonkVerify): MsgpackChonkVerify {
2187
- if (o.proof === undefined) { throw new Error("Expected proof in ChonkVerify serialization"); }
2188
- if (o.vk === undefined) { throw new Error("Expected vk in ChonkVerify serialization"); };
2189
- return {
2190
- proof: fromChonkProof(o.proof),
2191
- vk: o.vk,
2192
- };
2193
- }
2194
-
2195
- export function fromVkAsFields(o: VkAsFields): MsgpackVkAsFields {
2196
- if (o.verificationKey === undefined) { throw new Error("Expected verificationKey in VkAsFields serialization"); };
2197
- return {
2198
- verification_key: o.verificationKey,
2199
- };
2200
- }
2201
-
2202
- export function fromMegaVkAsFields(o: MegaVkAsFields): MsgpackMegaVkAsFields {
2203
- if (o.verificationKey === undefined) { throw new Error("Expected verificationKey in MegaVkAsFields serialization"); };
2204
- return {
2205
- verification_key: o.verificationKey,
2206
- };
2207
- }
2208
-
2209
- export function fromCircuitWriteSolidityVerifier(o: CircuitWriteSolidityVerifier): MsgpackCircuitWriteSolidityVerifier {
2210
- if (o.verificationKey === undefined) { throw new Error("Expected verificationKey in CircuitWriteSolidityVerifier serialization"); }
2211
- if (o.settings === undefined) { throw new Error("Expected settings in CircuitWriteSolidityVerifier serialization"); };
2212
- return {
2213
- verification_key: o.verificationKey,
2214
- settings: fromProofSystemSettings(o.settings),
2215
- };
2216
- }
2217
-
2218
- export function fromChonkCheckPrecomputedVk(o: ChonkCheckPrecomputedVk): MsgpackChonkCheckPrecomputedVk {
2219
- if (o.circuit === undefined) { throw new Error("Expected circuit in ChonkCheckPrecomputedVk serialization"); };
2220
- return {
2221
- circuit: fromCircuitInput(o.circuit),
2222
- };
2223
- }
2224
-
2225
- export function fromChonkStats(o: ChonkStats): MsgpackChonkStats {
2226
- if (o.circuit === undefined) { throw new Error("Expected circuit in ChonkStats serialization"); }
2227
- if (o.includeGatesPerOpcode === undefined) { throw new Error("Expected includeGatesPerOpcode in ChonkStats serialization"); };
2228
- return {
2229
- circuit: fromCircuitInputNoVK(o.circuit),
2230
- include_gates_per_opcode: o.includeGatesPerOpcode,
2231
- };
2232
- }
2233
-
2234
- export function fromPoseidon2Hash(o: Poseidon2Hash): MsgpackPoseidon2Hash {
2235
- if (o.inputs === undefined) { throw new Error("Expected inputs in Poseidon2Hash serialization"); };
2236
- return {
2237
- inputs: o.inputs,
2238
- };
2239
- }
2240
-
2241
- export function fromPoseidon2Permutation(o: Poseidon2Permutation): MsgpackPoseidon2Permutation {
2242
- if (o.inputs === undefined) { throw new Error("Expected inputs in Poseidon2Permutation serialization"); };
2243
- return {
2244
- inputs: o.inputs,
2245
- };
2246
- }
2247
-
2248
- export function fromPedersenCommit(o: PedersenCommit): MsgpackPedersenCommit {
2249
- if (o.inputs === undefined) { throw new Error("Expected inputs in PedersenCommit serialization"); }
2250
- if (o.hashIndex === undefined) { throw new Error("Expected hashIndex in PedersenCommit serialization"); };
2251
- return {
2252
- inputs: o.inputs,
2253
- hash_index: o.hashIndex,
2254
- };
2255
- }
2256
-
2257
- export function fromPedersenHash(o: PedersenHash): MsgpackPedersenHash {
2258
- if (o.inputs === undefined) { throw new Error("Expected inputs in PedersenHash serialization"); }
2259
- if (o.hashIndex === undefined) { throw new Error("Expected hashIndex in PedersenHash serialization"); };
2260
- return {
2261
- inputs: o.inputs,
2262
- hash_index: o.hashIndex,
2263
- };
2264
- }
2265
-
2266
- export function fromPedersenHashBuffer(o: PedersenHashBuffer): MsgpackPedersenHashBuffer {
2267
- if (o.input === undefined) { throw new Error("Expected input in PedersenHashBuffer serialization"); }
2268
- if (o.hashIndex === undefined) { throw new Error("Expected hashIndex in PedersenHashBuffer serialization"); };
2269
- return {
2270
- input: o.input,
2271
- hash_index: o.hashIndex,
2272
- };
2273
- }
2274
-
2275
- export function fromBlake2s(o: Blake2s): MsgpackBlake2s {
2276
- if (o.data === undefined) { throw new Error("Expected data in Blake2s serialization"); };
2277
- return {
2278
- data: o.data,
2279
- };
2280
- }
2281
-
2282
- export function fromBlake2sToField(o: Blake2sToField): MsgpackBlake2sToField {
2283
- if (o.data === undefined) { throw new Error("Expected data in Blake2sToField serialization"); };
2284
- return {
2285
- data: o.data,
2286
- };
2287
- }
2288
-
2289
- export function fromAesEncrypt(o: AesEncrypt): MsgpackAesEncrypt {
2290
- if (o.plaintext === undefined) { throw new Error("Expected plaintext in AesEncrypt serialization"); }
2291
- if (o.iv === undefined) { throw new Error("Expected iv in AesEncrypt serialization"); }
2292
- if (o.key === undefined) { throw new Error("Expected key in AesEncrypt serialization"); }
2293
- if (o.length === undefined) { throw new Error("Expected length in AesEncrypt serialization"); };
2294
- return {
2295
- plaintext: o.plaintext,
2296
- iv: o.iv,
2297
- key: o.key,
2298
- length: o.length,
2299
- };
2300
- }
2301
-
2302
- export function fromAesDecrypt(o: AesDecrypt): MsgpackAesDecrypt {
2303
- if (o.ciphertext === undefined) { throw new Error("Expected ciphertext in AesDecrypt serialization"); }
2304
- if (o.iv === undefined) { throw new Error("Expected iv in AesDecrypt serialization"); }
2305
- if (o.key === undefined) { throw new Error("Expected key in AesDecrypt serialization"); }
2306
- if (o.length === undefined) { throw new Error("Expected length in AesDecrypt serialization"); };
2307
- return {
2308
- ciphertext: o.ciphertext,
2309
- iv: o.iv,
2310
- key: o.key,
2311
- length: o.length,
2312
- };
2313
- }
2314
-
2315
- export function fromGrumpkinPoint(o: GrumpkinPoint): MsgpackGrumpkinPoint {
2316
- if (o.x === undefined) { throw new Error("Expected x in GrumpkinPoint serialization"); }
2317
- if (o.y === undefined) { throw new Error("Expected y in GrumpkinPoint serialization"); };
2318
- return {
2319
- x: o.x,
2320
- y: o.y,
2321
- };
2322
- }
2323
-
2324
- export function fromGrumpkinMul(o: GrumpkinMul): MsgpackGrumpkinMul {
2325
- if (o.point === undefined) { throw new Error("Expected point in GrumpkinMul serialization"); }
2326
- if (o.scalar === undefined) { throw new Error("Expected scalar in GrumpkinMul serialization"); };
2327
- return {
2328
- point: fromGrumpkinPoint(o.point),
2329
- scalar: o.scalar,
2330
- };
2331
- }
2332
-
2333
- export function fromGrumpkinAdd(o: GrumpkinAdd): MsgpackGrumpkinAdd {
2334
- if (o.pointA === undefined) { throw new Error("Expected pointA in GrumpkinAdd serialization"); }
2335
- if (o.pointB === undefined) { throw new Error("Expected pointB in GrumpkinAdd serialization"); };
2336
- return {
2337
- point_a: fromGrumpkinPoint(o.pointA),
2338
- point_b: fromGrumpkinPoint(o.pointB),
2339
- };
2340
- }
2341
-
2342
- export function fromGrumpkinBatchMul(o: GrumpkinBatchMul): MsgpackGrumpkinBatchMul {
2343
- if (o.points === undefined) { throw new Error("Expected points in GrumpkinBatchMul serialization"); }
2344
- if (o.scalar === undefined) { throw new Error("Expected scalar in GrumpkinBatchMul serialization"); };
2345
- return {
2346
- points: o.points.map((v: any) => fromGrumpkinPoint(v)),
2347
- scalar: o.scalar,
2348
- };
2349
- }
2350
-
2351
- export function fromGrumpkinGetRandomFr(o: GrumpkinGetRandomFr): MsgpackGrumpkinGetRandomFr {
2352
- if (o.dummy === undefined) { throw new Error("Expected dummy in GrumpkinGetRandomFr serialization"); };
2353
- return {
2354
- dummy: o.dummy,
2355
- };
2356
- }
2357
-
2358
- export function fromGrumpkinReduce512(o: GrumpkinReduce512): MsgpackGrumpkinReduce512 {
2359
- if (o.input === undefined) { throw new Error("Expected input in GrumpkinReduce512 serialization"); };
2360
- return {
2361
- input: o.input,
2362
- };
2363
- }
2364
-
2365
- export function fromSecp256k1Point(o: Secp256k1Point): MsgpackSecp256k1Point {
2366
- if (o.x === undefined) { throw new Error("Expected x in Secp256k1Point serialization"); }
2367
- if (o.y === undefined) { throw new Error("Expected y in Secp256k1Point serialization"); };
2368
- return {
2369
- x: o.x,
2370
- y: o.y,
2371
- };
2372
- }
2373
-
2374
- export function fromSecp256k1Mul(o: Secp256k1Mul): MsgpackSecp256k1Mul {
2375
- if (o.point === undefined) { throw new Error("Expected point in Secp256k1Mul serialization"); }
2376
- if (o.scalar === undefined) { throw new Error("Expected scalar in Secp256k1Mul serialization"); };
2377
- return {
2378
- point: fromSecp256k1Point(o.point),
2379
- scalar: o.scalar,
2380
- };
2381
- }
2382
-
2383
- export function fromSecp256k1GetRandomFr(o: Secp256k1GetRandomFr): MsgpackSecp256k1GetRandomFr {
2384
- if (o.dummy === undefined) { throw new Error("Expected dummy in Secp256k1GetRandomFr serialization"); };
2385
- return {
2386
- dummy: o.dummy,
2387
- };
2388
- }
2389
-
2390
- export function fromSecp256k1Reduce512(o: Secp256k1Reduce512): MsgpackSecp256k1Reduce512 {
2391
- if (o.input === undefined) { throw new Error("Expected input in Secp256k1Reduce512 serialization"); };
2392
- return {
2393
- input: o.input,
2394
- };
2395
- }
2396
-
2397
- export function fromBn254FrSqrt(o: Bn254FrSqrt): MsgpackBn254FrSqrt {
2398
- if (o.input === undefined) { throw new Error("Expected input in Bn254FrSqrt serialization"); };
2399
- return {
2400
- input: o.input,
2401
- };
2402
- }
2403
-
2404
- export function fromBn254FqSqrt(o: Bn254FqSqrt): MsgpackBn254FqSqrt {
2405
- if (o.input === undefined) { throw new Error("Expected input in Bn254FqSqrt serialization"); };
2406
- return {
2407
- input: o.input,
2408
- };
2409
- }
2410
-
2411
- export function fromBn254G1Point(o: Bn254G1Point): MsgpackBn254G1Point {
2412
- if (o.x === undefined) { throw new Error("Expected x in Bn254G1Point serialization"); }
2413
- if (o.y === undefined) { throw new Error("Expected y in Bn254G1Point serialization"); };
2414
- return {
2415
- x: o.x,
2416
- y: o.y,
2417
- };
2418
- }
2419
-
2420
- export function fromBn254G1Mul(o: Bn254G1Mul): MsgpackBn254G1Mul {
2421
- if (o.point === undefined) { throw new Error("Expected point in Bn254G1Mul serialization"); }
2422
- if (o.scalar === undefined) { throw new Error("Expected scalar in Bn254G1Mul serialization"); };
2423
- return {
2424
- point: fromBn254G1Point(o.point),
2425
- scalar: o.scalar,
2426
- };
2427
- }
2428
-
2429
- export function fromBn254G2Point(o: Bn254G2Point): MsgpackBn254G2Point {
2430
- if (o.x === undefined) { throw new Error("Expected x in Bn254G2Point serialization"); }
2431
- if (o.y === undefined) { throw new Error("Expected y in Bn254G2Point serialization"); };
2432
- return {
2433
- x: o.x,
2434
- y: o.y,
2435
- };
2436
- }
2437
-
2438
- export function fromBn254G2Mul(o: Bn254G2Mul): MsgpackBn254G2Mul {
2439
- if (o.point === undefined) { throw new Error("Expected point in Bn254G2Mul serialization"); }
2440
- if (o.scalar === undefined) { throw new Error("Expected scalar in Bn254G2Mul serialization"); };
2441
- return {
2442
- point: fromBn254G2Point(o.point),
2443
- scalar: o.scalar,
2444
- };
2445
- }
2446
-
2447
- export function fromBn254G1IsOnCurve(o: Bn254G1IsOnCurve): MsgpackBn254G1IsOnCurve {
2448
- if (o.point === undefined) { throw new Error("Expected point in Bn254G1IsOnCurve serialization"); };
2449
- return {
2450
- point: fromBn254G1Point(o.point),
2451
- };
2452
- }
2453
-
2454
- export function fromBn254G1FromCompressed(o: Bn254G1FromCompressed): MsgpackBn254G1FromCompressed {
2455
- if (o.compressed === undefined) { throw new Error("Expected compressed in Bn254G1FromCompressed serialization"); };
2456
- return {
2457
- compressed: o.compressed,
2458
- };
2459
- }
2460
-
2461
- export function fromSchnorrComputePublicKey(o: SchnorrComputePublicKey): MsgpackSchnorrComputePublicKey {
2462
- if (o.privateKey === undefined) { throw new Error("Expected privateKey in SchnorrComputePublicKey serialization"); };
2463
- return {
2464
- private_key: o.privateKey,
2465
- };
2466
- }
2467
-
2468
- export function fromSchnorrConstructSignature(o: SchnorrConstructSignature): MsgpackSchnorrConstructSignature {
2469
- if (o.message === undefined) { throw new Error("Expected message in SchnorrConstructSignature serialization"); }
2470
- if (o.privateKey === undefined) { throw new Error("Expected privateKey in SchnorrConstructSignature serialization"); };
2471
- return {
2472
- message: o.message,
2473
- private_key: o.privateKey,
2474
- };
2475
- }
2476
-
2477
- export function fromSchnorrVerifySignature(o: SchnorrVerifySignature): MsgpackSchnorrVerifySignature {
2478
- if (o.message === undefined) { throw new Error("Expected message in SchnorrVerifySignature serialization"); }
2479
- if (o.publicKey === undefined) { throw new Error("Expected publicKey in SchnorrVerifySignature serialization"); }
2480
- if (o.s === undefined) { throw new Error("Expected s in SchnorrVerifySignature serialization"); }
2481
- if (o.e === undefined) { throw new Error("Expected e in SchnorrVerifySignature serialization"); };
2482
- return {
2483
- message: o.message,
2484
- public_key: fromGrumpkinPoint(o.publicKey),
2485
- s: o.s,
2486
- e: o.e,
2487
- };
2488
- }
2489
-
2490
- export function fromEcdsaSecp256k1ComputePublicKey(o: EcdsaSecp256k1ComputePublicKey): MsgpackEcdsaSecp256k1ComputePublicKey {
2491
- if (o.privateKey === undefined) { throw new Error("Expected privateKey in EcdsaSecp256k1ComputePublicKey serialization"); };
2492
- return {
2493
- private_key: o.privateKey,
2494
- };
2495
- }
2496
-
2497
- export function fromEcdsaSecp256r1ComputePublicKey(o: EcdsaSecp256r1ComputePublicKey): MsgpackEcdsaSecp256r1ComputePublicKey {
2498
- if (o.privateKey === undefined) { throw new Error("Expected privateKey in EcdsaSecp256r1ComputePublicKey serialization"); };
2499
- return {
2500
- private_key: o.privateKey,
2501
- };
2502
- }
2503
-
2504
- export function fromEcdsaSecp256k1ConstructSignature(o: EcdsaSecp256k1ConstructSignature): MsgpackEcdsaSecp256k1ConstructSignature {
2505
- if (o.message === undefined) { throw new Error("Expected message in EcdsaSecp256k1ConstructSignature serialization"); }
2506
- if (o.privateKey === undefined) { throw new Error("Expected privateKey in EcdsaSecp256k1ConstructSignature serialization"); };
2507
- return {
2508
- message: o.message,
2509
- private_key: o.privateKey,
2510
- };
2511
- }
2512
-
2513
- export function fromEcdsaSecp256r1ConstructSignature(o: EcdsaSecp256r1ConstructSignature): MsgpackEcdsaSecp256r1ConstructSignature {
2514
- if (o.message === undefined) { throw new Error("Expected message in EcdsaSecp256r1ConstructSignature serialization"); }
2515
- if (o.privateKey === undefined) { throw new Error("Expected privateKey in EcdsaSecp256r1ConstructSignature serialization"); };
2516
- return {
2517
- message: o.message,
2518
- private_key: o.privateKey,
2519
- };
2520
- }
2521
-
2522
- export function fromEcdsaSecp256k1RecoverPublicKey(o: EcdsaSecp256k1RecoverPublicKey): MsgpackEcdsaSecp256k1RecoverPublicKey {
2523
- if (o.message === undefined) { throw new Error("Expected message in EcdsaSecp256k1RecoverPublicKey serialization"); }
2524
- if (o.r === undefined) { throw new Error("Expected r in EcdsaSecp256k1RecoverPublicKey serialization"); }
2525
- if (o.s === undefined) { throw new Error("Expected s in EcdsaSecp256k1RecoverPublicKey serialization"); }
2526
- if (o.v === undefined) { throw new Error("Expected v in EcdsaSecp256k1RecoverPublicKey serialization"); };
2527
- return {
2528
- message: o.message,
2529
- r: o.r,
2530
- s: o.s,
2531
- v: o.v,
2532
- };
2533
- }
2534
-
2535
- export function fromEcdsaSecp256r1RecoverPublicKey(o: EcdsaSecp256r1RecoverPublicKey): MsgpackEcdsaSecp256r1RecoverPublicKey {
2536
- if (o.message === undefined) { throw new Error("Expected message in EcdsaSecp256r1RecoverPublicKey serialization"); }
2537
- if (o.r === undefined) { throw new Error("Expected r in EcdsaSecp256r1RecoverPublicKey serialization"); }
2538
- if (o.s === undefined) { throw new Error("Expected s in EcdsaSecp256r1RecoverPublicKey serialization"); }
2539
- if (o.v === undefined) { throw new Error("Expected v in EcdsaSecp256r1RecoverPublicKey serialization"); };
2540
- return {
2541
- message: o.message,
2542
- r: o.r,
2543
- s: o.s,
2544
- v: o.v,
2545
- };
2546
- }
2547
-
2548
- export function fromEcdsaSecp256k1VerifySignature(o: EcdsaSecp256k1VerifySignature): MsgpackEcdsaSecp256k1VerifySignature {
2549
- if (o.message === undefined) { throw new Error("Expected message in EcdsaSecp256k1VerifySignature serialization"); }
2550
- if (o.publicKey === undefined) { throw new Error("Expected publicKey in EcdsaSecp256k1VerifySignature serialization"); }
2551
- if (o.r === undefined) { throw new Error("Expected r in EcdsaSecp256k1VerifySignature serialization"); }
2552
- if (o.s === undefined) { throw new Error("Expected s in EcdsaSecp256k1VerifySignature serialization"); }
2553
- if (o.v === undefined) { throw new Error("Expected v in EcdsaSecp256k1VerifySignature serialization"); };
2554
- return {
2555
- message: o.message,
2556
- public_key: fromSecp256k1Point(o.publicKey),
2557
- r: o.r,
2558
- s: o.s,
2559
- v: o.v,
2560
- };
2561
- }
2562
-
2563
- export function fromSecp256r1Point(o: Secp256r1Point): MsgpackSecp256r1Point {
2564
- if (o.x === undefined) { throw new Error("Expected x in Secp256r1Point serialization"); }
2565
- if (o.y === undefined) { throw new Error("Expected y in Secp256r1Point serialization"); };
2566
- return {
2567
- x: o.x,
2568
- y: o.y,
2569
- };
2570
- }
2571
-
2572
- export function fromEcdsaSecp256r1VerifySignature(o: EcdsaSecp256r1VerifySignature): MsgpackEcdsaSecp256r1VerifySignature {
2573
- if (o.message === undefined) { throw new Error("Expected message in EcdsaSecp256r1VerifySignature serialization"); }
2574
- if (o.publicKey === undefined) { throw new Error("Expected publicKey in EcdsaSecp256r1VerifySignature serialization"); }
2575
- if (o.r === undefined) { throw new Error("Expected r in EcdsaSecp256r1VerifySignature serialization"); }
2576
- if (o.s === undefined) { throw new Error("Expected s in EcdsaSecp256r1VerifySignature serialization"); }
2577
- if (o.v === undefined) { throw new Error("Expected v in EcdsaSecp256r1VerifySignature serialization"); };
2578
- return {
2579
- message: o.message,
2580
- public_key: fromSecp256r1Point(o.publicKey),
2581
- r: o.r,
2582
- s: o.s,
2583
- v: o.v,
2584
- };
2585
- }
2586
-
2587
- export function fromSrsInitSrs(o: SrsInitSrs): MsgpackSrsInitSrs {
2588
- if (o.pointsBuf === undefined) { throw new Error("Expected pointsBuf in SrsInitSrs serialization"); }
2589
- if (o.numPoints === undefined) { throw new Error("Expected numPoints in SrsInitSrs serialization"); }
2590
- if (o.g2Point === undefined) { throw new Error("Expected g2Point in SrsInitSrs serialization"); };
2591
- return {
2592
- points_buf: o.pointsBuf,
2593
- num_points: o.numPoints,
2594
- g2_point: o.g2Point,
2595
- };
2596
- }
2597
-
2598
- export function fromSrsInitGrumpkinSrs(o: SrsInitGrumpkinSrs): MsgpackSrsInitGrumpkinSrs {
2599
- if (o.pointsBuf === undefined) { throw new Error("Expected pointsBuf in SrsInitGrumpkinSrs serialization"); }
2600
- if (o.numPoints === undefined) { throw new Error("Expected numPoints in SrsInitGrumpkinSrs serialization"); };
2601
- return {
2602
- points_buf: o.pointsBuf,
2603
- num_points: o.numPoints,
2604
- };
2605
- }
2606
-
2607
- export function fromShutdown(o: Shutdown): MsgpackShutdown {
2608
- return {};
2609
- }
2610
-
2611
- export function fromErrorResponse(o: ErrorResponse): MsgpackErrorResponse {
2612
- if (o.message === undefined) { throw new Error("Expected message in ErrorResponse serialization"); };
2613
- return {
2614
- message: o.message,
2615
- };
2616
- }
2617
-
2618
- export function fromCircuitProveResponse(o: CircuitProveResponse): MsgpackCircuitProveResponse {
2619
- if (o.publicInputs === undefined) { throw new Error("Expected publicInputs in CircuitProveResponse serialization"); }
2620
- if (o.proof === undefined) { throw new Error("Expected proof in CircuitProveResponse serialization"); }
2621
- if (o.vk === undefined) { throw new Error("Expected vk in CircuitProveResponse serialization"); };
2622
- return {
2623
- public_inputs: o.publicInputs,
2624
- proof: o.proof,
2625
- vk: fromCircuitComputeVkResponse(o.vk),
2626
- };
2627
- }
2628
-
2629
- export function fromCircuitInfoResponse(o: CircuitInfoResponse): MsgpackCircuitInfoResponse {
2630
- if (o.numGates === undefined) { throw new Error("Expected numGates in CircuitInfoResponse serialization"); }
2631
- if (o.numGatesDyadic === undefined) { throw new Error("Expected numGatesDyadic in CircuitInfoResponse serialization"); }
2632
- if (o.numAcirOpcodes === undefined) { throw new Error("Expected numAcirOpcodes in CircuitInfoResponse serialization"); }
2633
- if (o.gatesPerOpcode === undefined) { throw new Error("Expected gatesPerOpcode in CircuitInfoResponse serialization"); };
2634
- return {
2635
- num_gates: o.numGates,
2636
- num_gates_dyadic: o.numGatesDyadic,
2637
- num_acir_opcodes: o.numAcirOpcodes,
2638
- gates_per_opcode: o.gatesPerOpcode,
2639
- };
2640
- }
2641
-
2642
- export function fromCircuitVerifyResponse(o: CircuitVerifyResponse): MsgpackCircuitVerifyResponse {
2643
- if (o.verified === undefined) { throw new Error("Expected verified in CircuitVerifyResponse serialization"); };
2644
- return {
2645
- verified: o.verified,
2646
- };
2647
- }
2648
-
2649
- export function fromChonkComputeVkResponse(o: ChonkComputeVkResponse): MsgpackChonkComputeVkResponse {
2650
- if (o.bytes === undefined) { throw new Error("Expected bytes in ChonkComputeVkResponse serialization"); }
2651
- if (o.fields === undefined) { throw new Error("Expected fields in ChonkComputeVkResponse serialization"); };
2652
- return {
2653
- bytes: o.bytes,
2654
- fields: o.fields,
2655
- };
2656
- }
2657
-
2658
- export function fromChonkStartResponse(o: ChonkStartResponse): MsgpackChonkStartResponse {
2659
- return {};
2660
- }
2661
-
2662
- export function fromChonkLoadResponse(o: ChonkLoadResponse): MsgpackChonkLoadResponse {
2663
- return {};
2664
- }
2665
-
2666
- export function fromChonkAccumulateResponse(o: ChonkAccumulateResponse): MsgpackChonkAccumulateResponse {
2667
- return {};
2668
- }
2669
-
2670
- export function fromChonkProveResponse(o: ChonkProveResponse): MsgpackChonkProveResponse {
2671
- if (o.proof === undefined) { throw new Error("Expected proof in ChonkProveResponse serialization"); };
2672
- return {
2673
- proof: fromChonkProof(o.proof),
2674
- };
2675
- }
2676
-
2677
- export function fromChonkVerifyResponse(o: ChonkVerifyResponse): MsgpackChonkVerifyResponse {
2678
- if (o.valid === undefined) { throw new Error("Expected valid in ChonkVerifyResponse serialization"); };
2679
- return {
2680
- valid: o.valid,
2681
- };
2682
- }
2683
-
2684
- export function fromVkAsFieldsResponse(o: VkAsFieldsResponse): MsgpackVkAsFieldsResponse {
2685
- if (o.fields === undefined) { throw new Error("Expected fields in VkAsFieldsResponse serialization"); };
2686
- return {
2687
- fields: o.fields,
2688
- };
2689
- }
2690
-
2691
- export function fromMegaVkAsFieldsResponse(o: MegaVkAsFieldsResponse): MsgpackMegaVkAsFieldsResponse {
2692
- if (o.fields === undefined) { throw new Error("Expected fields in MegaVkAsFieldsResponse serialization"); };
2693
- return {
2694
- fields: o.fields,
2695
- };
2696
- }
2697
-
2698
- export function fromCircuitWriteSolidityVerifierResponse(o: CircuitWriteSolidityVerifierResponse): MsgpackCircuitWriteSolidityVerifierResponse {
2699
- if (o.solidityCode === undefined) { throw new Error("Expected solidityCode in CircuitWriteSolidityVerifierResponse serialization"); };
2700
- return {
2701
- solidity_code: o.solidityCode,
2702
- };
2703
- }
2704
-
2705
- export function fromChonkCheckPrecomputedVkResponse(o: ChonkCheckPrecomputedVkResponse): MsgpackChonkCheckPrecomputedVkResponse {
2706
- if (o.valid === undefined) { throw new Error("Expected valid in ChonkCheckPrecomputedVkResponse serialization"); }
2707
- if (o.actualVk === undefined) { throw new Error("Expected actualVk in ChonkCheckPrecomputedVkResponse serialization"); };
2708
- return {
2709
- valid: o.valid,
2710
- actual_vk: o.actualVk,
2711
- };
2712
- }
2713
-
2714
- export function fromChonkStatsResponse(o: ChonkStatsResponse): MsgpackChonkStatsResponse {
2715
- if (o.acirOpcodes === undefined) { throw new Error("Expected acirOpcodes in ChonkStatsResponse serialization"); }
2716
- if (o.circuitSize === undefined) { throw new Error("Expected circuitSize in ChonkStatsResponse serialization"); }
2717
- if (o.gatesPerOpcode === undefined) { throw new Error("Expected gatesPerOpcode in ChonkStatsResponse serialization"); };
2718
- return {
2719
- acir_opcodes: o.acirOpcodes,
2720
- circuit_size: o.circuitSize,
2721
- gates_per_opcode: o.gatesPerOpcode,
2722
- };
2723
- }
2724
-
2725
- export function fromPoseidon2HashResponse(o: Poseidon2HashResponse): MsgpackPoseidon2HashResponse {
2726
- if (o.hash === undefined) { throw new Error("Expected hash in Poseidon2HashResponse serialization"); };
2727
- return {
2728
- hash: o.hash,
2729
- };
2730
- }
2731
-
2732
- export function fromPoseidon2PermutationResponse(o: Poseidon2PermutationResponse): MsgpackPoseidon2PermutationResponse {
2733
- if (o.outputs === undefined) { throw new Error("Expected outputs in Poseidon2PermutationResponse serialization"); };
2734
- return {
2735
- outputs: o.outputs,
2736
- };
2737
- }
2738
-
2739
- export function fromPedersenCommitResponse(o: PedersenCommitResponse): MsgpackPedersenCommitResponse {
2740
- if (o.point === undefined) { throw new Error("Expected point in PedersenCommitResponse serialization"); };
2741
- return {
2742
- point: fromGrumpkinPoint(o.point),
2743
- };
2744
- }
2745
-
2746
- export function fromPedersenHashResponse(o: PedersenHashResponse): MsgpackPedersenHashResponse {
2747
- if (o.hash === undefined) { throw new Error("Expected hash in PedersenHashResponse serialization"); };
2748
- return {
2749
- hash: o.hash,
2750
- };
2751
- }
2752
-
2753
- export function fromPedersenHashBufferResponse(o: PedersenHashBufferResponse): MsgpackPedersenHashBufferResponse {
2754
- if (o.hash === undefined) { throw new Error("Expected hash in PedersenHashBufferResponse serialization"); };
2755
- return {
2756
- hash: o.hash,
2757
- };
2758
- }
2759
-
2760
- export function fromBlake2sResponse(o: Blake2sResponse): MsgpackBlake2sResponse {
2761
- if (o.hash === undefined) { throw new Error("Expected hash in Blake2sResponse serialization"); };
2762
- return {
2763
- hash: o.hash,
2764
- };
2765
- }
2766
-
2767
- export function fromBlake2sToFieldResponse(o: Blake2sToFieldResponse): MsgpackBlake2sToFieldResponse {
2768
- if (o.field === undefined) { throw new Error("Expected field in Blake2sToFieldResponse serialization"); };
2769
- return {
2770
- field: o.field,
2771
- };
2772
- }
2773
-
2774
- export function fromAesEncryptResponse(o: AesEncryptResponse): MsgpackAesEncryptResponse {
2775
- if (o.ciphertext === undefined) { throw new Error("Expected ciphertext in AesEncryptResponse serialization"); };
2776
- return {
2777
- ciphertext: o.ciphertext,
2778
- };
2779
- }
2780
-
2781
- export function fromAesDecryptResponse(o: AesDecryptResponse): MsgpackAesDecryptResponse {
2782
- if (o.plaintext === undefined) { throw new Error("Expected plaintext in AesDecryptResponse serialization"); };
2783
- return {
2784
- plaintext: o.plaintext,
2785
- };
2786
- }
2787
-
2788
- export function fromGrumpkinMulResponse(o: GrumpkinMulResponse): MsgpackGrumpkinMulResponse {
2789
- if (o.point === undefined) { throw new Error("Expected point in GrumpkinMulResponse serialization"); };
2790
- return {
2791
- point: fromGrumpkinPoint(o.point),
2792
- };
2793
- }
2794
-
2795
- export function fromGrumpkinAddResponse(o: GrumpkinAddResponse): MsgpackGrumpkinAddResponse {
2796
- if (o.point === undefined) { throw new Error("Expected point in GrumpkinAddResponse serialization"); };
2797
- return {
2798
- point: fromGrumpkinPoint(o.point),
2799
- };
2800
- }
2801
-
2802
- export function fromGrumpkinBatchMulResponse(o: GrumpkinBatchMulResponse): MsgpackGrumpkinBatchMulResponse {
2803
- if (o.points === undefined) { throw new Error("Expected points in GrumpkinBatchMulResponse serialization"); };
2804
- return {
2805
- points: o.points.map((v: any) => fromGrumpkinPoint(v)),
2806
- };
2807
- }
2808
-
2809
- export function fromGrumpkinGetRandomFrResponse(o: GrumpkinGetRandomFrResponse): MsgpackGrumpkinGetRandomFrResponse {
2810
- if (o.value === undefined) { throw new Error("Expected value in GrumpkinGetRandomFrResponse serialization"); };
2811
- return {
2812
- value: o.value,
2813
- };
2814
- }
2815
-
2816
- export function fromGrumpkinReduce512Response(o: GrumpkinReduce512Response): MsgpackGrumpkinReduce512Response {
2817
- if (o.value === undefined) { throw new Error("Expected value in GrumpkinReduce512Response serialization"); };
2818
- return {
2819
- value: o.value,
2820
- };
2821
- }
2822
-
2823
- export function fromSecp256k1MulResponse(o: Secp256k1MulResponse): MsgpackSecp256k1MulResponse {
2824
- if (o.point === undefined) { throw new Error("Expected point in Secp256k1MulResponse serialization"); };
2825
- return {
2826
- point: fromSecp256k1Point(o.point),
2827
- };
2828
- }
2829
-
2830
- export function fromSecp256k1GetRandomFrResponse(o: Secp256k1GetRandomFrResponse): MsgpackSecp256k1GetRandomFrResponse {
2831
- if (o.value === undefined) { throw new Error("Expected value in Secp256k1GetRandomFrResponse serialization"); };
2832
- return {
2833
- value: o.value,
2834
- };
2835
- }
2836
-
2837
- export function fromSecp256k1Reduce512Response(o: Secp256k1Reduce512Response): MsgpackSecp256k1Reduce512Response {
2838
- if (o.value === undefined) { throw new Error("Expected value in Secp256k1Reduce512Response serialization"); };
2839
- return {
2840
- value: o.value,
2841
- };
2842
- }
2843
-
2844
- export function fromBn254FrSqrtResponse(o: Bn254FrSqrtResponse): MsgpackBn254FrSqrtResponse {
2845
- if (o.isSquareRoot === undefined) { throw new Error("Expected isSquareRoot in Bn254FrSqrtResponse serialization"); }
2846
- if (o.value === undefined) { throw new Error("Expected value in Bn254FrSqrtResponse serialization"); };
2847
- return {
2848
- is_square_root: o.isSquareRoot,
2849
- value: o.value,
2850
- };
2851
- }
2852
-
2853
- export function fromBn254FqSqrtResponse(o: Bn254FqSqrtResponse): MsgpackBn254FqSqrtResponse {
2854
- if (o.isSquareRoot === undefined) { throw new Error("Expected isSquareRoot in Bn254FqSqrtResponse serialization"); }
2855
- if (o.value === undefined) { throw new Error("Expected value in Bn254FqSqrtResponse serialization"); };
2856
- return {
2857
- is_square_root: o.isSquareRoot,
2858
- value: o.value,
2859
- };
2860
- }
2861
-
2862
- export function fromBn254G1MulResponse(o: Bn254G1MulResponse): MsgpackBn254G1MulResponse {
2863
- if (o.point === undefined) { throw new Error("Expected point in Bn254G1MulResponse serialization"); };
2864
- return {
2865
- point: fromBn254G1Point(o.point),
2866
- };
2867
- }
2868
-
2869
- export function fromBn254G2MulResponse(o: Bn254G2MulResponse): MsgpackBn254G2MulResponse {
2870
- if (o.point === undefined) { throw new Error("Expected point in Bn254G2MulResponse serialization"); };
2871
- return {
2872
- point: fromBn254G2Point(o.point),
2873
- };
2874
- }
2875
-
2876
- export function fromBn254G1IsOnCurveResponse(o: Bn254G1IsOnCurveResponse): MsgpackBn254G1IsOnCurveResponse {
2877
- if (o.isOnCurve === undefined) { throw new Error("Expected isOnCurve in Bn254G1IsOnCurveResponse serialization"); };
2878
- return {
2879
- is_on_curve: o.isOnCurve,
2880
- };
2881
- }
2882
-
2883
- export function fromBn254G1FromCompressedResponse(o: Bn254G1FromCompressedResponse): MsgpackBn254G1FromCompressedResponse {
2884
- if (o.point === undefined) { throw new Error("Expected point in Bn254G1FromCompressedResponse serialization"); };
2885
- return {
2886
- point: fromBn254G1Point(o.point),
2887
- };
2888
- }
2889
-
2890
- export function fromSchnorrComputePublicKeyResponse(o: SchnorrComputePublicKeyResponse): MsgpackSchnorrComputePublicKeyResponse {
2891
- if (o.publicKey === undefined) { throw new Error("Expected publicKey in SchnorrComputePublicKeyResponse serialization"); };
2892
- return {
2893
- public_key: fromGrumpkinPoint(o.publicKey),
2894
- };
2895
- }
2896
-
2897
- export function fromSchnorrConstructSignatureResponse(o: SchnorrConstructSignatureResponse): MsgpackSchnorrConstructSignatureResponse {
2898
- if (o.s === undefined) { throw new Error("Expected s in SchnorrConstructSignatureResponse serialization"); }
2899
- if (o.e === undefined) { throw new Error("Expected e in SchnorrConstructSignatureResponse serialization"); };
2900
- return {
2901
- s: o.s,
2902
- e: o.e,
2903
- };
2904
- }
2905
-
2906
- export function fromSchnorrVerifySignatureResponse(o: SchnorrVerifySignatureResponse): MsgpackSchnorrVerifySignatureResponse {
2907
- if (o.verified === undefined) { throw new Error("Expected verified in SchnorrVerifySignatureResponse serialization"); };
2908
- return {
2909
- verified: o.verified,
2910
- };
2911
- }
2912
-
2913
- export function fromEcdsaSecp256k1ComputePublicKeyResponse(o: EcdsaSecp256k1ComputePublicKeyResponse): MsgpackEcdsaSecp256k1ComputePublicKeyResponse {
2914
- if (o.publicKey === undefined) { throw new Error("Expected publicKey in EcdsaSecp256k1ComputePublicKeyResponse serialization"); };
2915
- return {
2916
- public_key: fromSecp256k1Point(o.publicKey),
2917
- };
2918
- }
2919
-
2920
- export function fromEcdsaSecp256r1ComputePublicKeyResponse(o: EcdsaSecp256r1ComputePublicKeyResponse): MsgpackEcdsaSecp256r1ComputePublicKeyResponse {
2921
- if (o.publicKey === undefined) { throw new Error("Expected publicKey in EcdsaSecp256r1ComputePublicKeyResponse serialization"); };
2922
- return {
2923
- public_key: fromSecp256r1Point(o.publicKey),
2924
- };
2925
- }
2926
-
2927
- export function fromEcdsaSecp256k1ConstructSignatureResponse(o: EcdsaSecp256k1ConstructSignatureResponse): MsgpackEcdsaSecp256k1ConstructSignatureResponse {
2928
- if (o.r === undefined) { throw new Error("Expected r in EcdsaSecp256k1ConstructSignatureResponse serialization"); }
2929
- if (o.s === undefined) { throw new Error("Expected s in EcdsaSecp256k1ConstructSignatureResponse serialization"); }
2930
- if (o.v === undefined) { throw new Error("Expected v in EcdsaSecp256k1ConstructSignatureResponse serialization"); };
2931
- return {
2932
- r: o.r,
2933
- s: o.s,
2934
- v: o.v,
2935
- };
2936
- }
2937
-
2938
- export function fromEcdsaSecp256r1ConstructSignatureResponse(o: EcdsaSecp256r1ConstructSignatureResponse): MsgpackEcdsaSecp256r1ConstructSignatureResponse {
2939
- if (o.r === undefined) { throw new Error("Expected r in EcdsaSecp256r1ConstructSignatureResponse serialization"); }
2940
- if (o.s === undefined) { throw new Error("Expected s in EcdsaSecp256r1ConstructSignatureResponse serialization"); }
2941
- if (o.v === undefined) { throw new Error("Expected v in EcdsaSecp256r1ConstructSignatureResponse serialization"); };
2942
- return {
2943
- r: o.r,
2944
- s: o.s,
2945
- v: o.v,
2946
- };
2947
- }
2948
-
2949
- export function fromEcdsaSecp256k1RecoverPublicKeyResponse(o: EcdsaSecp256k1RecoverPublicKeyResponse): MsgpackEcdsaSecp256k1RecoverPublicKeyResponse {
2950
- if (o.publicKey === undefined) { throw new Error("Expected publicKey in EcdsaSecp256k1RecoverPublicKeyResponse serialization"); };
2951
- return {
2952
- public_key: fromSecp256k1Point(o.publicKey),
2953
- };
2954
- }
2955
-
2956
- export function fromEcdsaSecp256r1RecoverPublicKeyResponse(o: EcdsaSecp256r1RecoverPublicKeyResponse): MsgpackEcdsaSecp256r1RecoverPublicKeyResponse {
2957
- if (o.publicKey === undefined) { throw new Error("Expected publicKey in EcdsaSecp256r1RecoverPublicKeyResponse serialization"); };
2958
- return {
2959
- public_key: fromSecp256r1Point(o.publicKey),
2960
- };
2961
- }
2962
-
2963
- export function fromEcdsaSecp256k1VerifySignatureResponse(o: EcdsaSecp256k1VerifySignatureResponse): MsgpackEcdsaSecp256k1VerifySignatureResponse {
2964
- if (o.verified === undefined) { throw new Error("Expected verified in EcdsaSecp256k1VerifySignatureResponse serialization"); };
2965
- return {
2966
- verified: o.verified,
2967
- };
2968
- }
2969
-
2970
- export function fromEcdsaSecp256r1VerifySignatureResponse(o: EcdsaSecp256r1VerifySignatureResponse): MsgpackEcdsaSecp256r1VerifySignatureResponse {
2971
- if (o.verified === undefined) { throw new Error("Expected verified in EcdsaSecp256r1VerifySignatureResponse serialization"); };
2972
- return {
2973
- verified: o.verified,
2974
- };
2975
- }
2976
-
2977
- export function fromSrsInitSrsResponse(o: SrsInitSrsResponse): MsgpackSrsInitSrsResponse {
2978
- if (o.dummy === undefined) { throw new Error("Expected dummy in SrsInitSrsResponse serialization"); };
2979
- return {
2980
- dummy: o.dummy,
2981
- };
2982
- }
2983
-
2984
- export function fromSrsInitGrumpkinSrsResponse(o: SrsInitGrumpkinSrsResponse): MsgpackSrsInitGrumpkinSrsResponse {
2985
- if (o.dummy === undefined) { throw new Error("Expected dummy in SrsInitGrumpkinSrsResponse serialization"); };
2986
- return {
2987
- dummy: o.dummy,
2988
- };
2989
- }
2990
-
2991
- export function fromShutdownResponse(o: ShutdownResponse): MsgpackShutdownResponse {
2992
- return {};
2993
- }
2994
-
2995
- // Base API interface
2996
- export interface BbApiBase {
2997
- circuitProve(command: CircuitProve): Promise<CircuitProveResponse>;
2998
- circuitComputeVk(command: CircuitComputeVk): Promise<CircuitComputeVkResponse>;
2999
- circuitStats(command: CircuitStats): Promise<CircuitInfoResponse>;
3000
- circuitVerify(command: CircuitVerify): Promise<CircuitVerifyResponse>;
3001
- chonkComputeVk(command: ChonkComputeVk): Promise<ChonkComputeVkResponse>;
3002
- chonkStart(command: ChonkStart): Promise<ChonkStartResponse>;
3003
- chonkLoad(command: ChonkLoad): Promise<ChonkLoadResponse>;
3004
- chonkAccumulate(command: ChonkAccumulate): Promise<ChonkAccumulateResponse>;
3005
- chonkProve(command: ChonkProve): Promise<ChonkProveResponse>;
3006
- chonkVerify(command: ChonkVerify): Promise<ChonkVerifyResponse>;
3007
- vkAsFields(command: VkAsFields): Promise<VkAsFieldsResponse>;
3008
- megaVkAsFields(command: MegaVkAsFields): Promise<MegaVkAsFieldsResponse>;
3009
- circuitWriteSolidityVerifier(command: CircuitWriteSolidityVerifier): Promise<CircuitWriteSolidityVerifierResponse>;
3010
- chonkCheckPrecomputedVk(command: ChonkCheckPrecomputedVk): Promise<ChonkCheckPrecomputedVkResponse>;
3011
- chonkStats(command: ChonkStats): Promise<ChonkStatsResponse>;
3012
- poseidon2Hash(command: Poseidon2Hash): Promise<Poseidon2HashResponse>;
3013
- poseidon2Permutation(command: Poseidon2Permutation): Promise<Poseidon2PermutationResponse>;
3014
- pedersenCommit(command: PedersenCommit): Promise<PedersenCommitResponse>;
3015
- pedersenHash(command: PedersenHash): Promise<PedersenHashResponse>;
3016
- pedersenHashBuffer(command: PedersenHashBuffer): Promise<PedersenHashBufferResponse>;
3017
- blake2s(command: Blake2s): Promise<Blake2sResponse>;
3018
- blake2sToField(command: Blake2sToField): Promise<Blake2sToFieldResponse>;
3019
- aesEncrypt(command: AesEncrypt): Promise<AesEncryptResponse>;
3020
- aesDecrypt(command: AesDecrypt): Promise<AesDecryptResponse>;
3021
- grumpkinMul(command: GrumpkinMul): Promise<GrumpkinMulResponse>;
3022
- grumpkinAdd(command: GrumpkinAdd): Promise<GrumpkinAddResponse>;
3023
- grumpkinBatchMul(command: GrumpkinBatchMul): Promise<GrumpkinBatchMulResponse>;
3024
- grumpkinGetRandomFr(command: GrumpkinGetRandomFr): Promise<GrumpkinGetRandomFrResponse>;
3025
- grumpkinReduce512(command: GrumpkinReduce512): Promise<GrumpkinReduce512Response>;
3026
- secp256k1Mul(command: Secp256k1Mul): Promise<Secp256k1MulResponse>;
3027
- secp256k1GetRandomFr(command: Secp256k1GetRandomFr): Promise<Secp256k1GetRandomFrResponse>;
3028
- secp256k1Reduce512(command: Secp256k1Reduce512): Promise<Secp256k1Reduce512Response>;
3029
- bn254FrSqrt(command: Bn254FrSqrt): Promise<Bn254FrSqrtResponse>;
3030
- bn254FqSqrt(command: Bn254FqSqrt): Promise<Bn254FqSqrtResponse>;
3031
- bn254G1Mul(command: Bn254G1Mul): Promise<Bn254G1MulResponse>;
3032
- bn254G2Mul(command: Bn254G2Mul): Promise<Bn254G2MulResponse>;
3033
- bn254G1IsOnCurve(command: Bn254G1IsOnCurve): Promise<Bn254G1IsOnCurveResponse>;
3034
- bn254G1FromCompressed(command: Bn254G1FromCompressed): Promise<Bn254G1FromCompressedResponse>;
3035
- schnorrComputePublicKey(command: SchnorrComputePublicKey): Promise<SchnorrComputePublicKeyResponse>;
3036
- schnorrConstructSignature(command: SchnorrConstructSignature): Promise<SchnorrConstructSignatureResponse>;
3037
- schnorrVerifySignature(command: SchnorrVerifySignature): Promise<SchnorrVerifySignatureResponse>;
3038
- ecdsaSecp256k1ComputePublicKey(command: EcdsaSecp256k1ComputePublicKey): Promise<EcdsaSecp256k1ComputePublicKeyResponse>;
3039
- ecdsaSecp256r1ComputePublicKey(command: EcdsaSecp256r1ComputePublicKey): Promise<EcdsaSecp256r1ComputePublicKeyResponse>;
3040
- ecdsaSecp256k1ConstructSignature(command: EcdsaSecp256k1ConstructSignature): Promise<EcdsaSecp256k1ConstructSignatureResponse>;
3041
- ecdsaSecp256r1ConstructSignature(command: EcdsaSecp256r1ConstructSignature): Promise<EcdsaSecp256r1ConstructSignatureResponse>;
3042
- ecdsaSecp256k1RecoverPublicKey(command: EcdsaSecp256k1RecoverPublicKey): Promise<EcdsaSecp256k1RecoverPublicKeyResponse>;
3043
- ecdsaSecp256r1RecoverPublicKey(command: EcdsaSecp256r1RecoverPublicKey): Promise<EcdsaSecp256r1RecoverPublicKeyResponse>;
3044
- ecdsaSecp256k1VerifySignature(command: EcdsaSecp256k1VerifySignature): Promise<EcdsaSecp256k1VerifySignatureResponse>;
3045
- ecdsaSecp256r1VerifySignature(command: EcdsaSecp256r1VerifySignature): Promise<EcdsaSecp256r1VerifySignatureResponse>;
3046
- srsInitSrs(command: SrsInitSrs): Promise<SrsInitSrsResponse>;
3047
- srsInitGrumpkinSrs(command: SrsInitGrumpkinSrs): Promise<SrsInitGrumpkinSrsResponse>;
3048
- shutdown(command: Shutdown): Promise<ShutdownResponse>;
3049
- destroy(): Promise<void>;
3050
- }