44// Requires: plonk_wasm
55function caml_pasta_fp_plonk_index_max_degree ( prover_index ) {
66 var bytes = prover_index . serialize ( )
7- var index = plonk_wasm . prover_index_fp_from_bytes ( bytes ) ;
7+ var index = plonk_wasm . prover_index_fp_deserialize ( bytes ) ;
88 // TODO: ^ remove the round trip when napi has direct access to the object
99
1010 return plonk_wasm . caml_pasta_fp_plonk_index_max_degree ( index ) ;
@@ -14,7 +14,7 @@ function caml_pasta_fp_plonk_index_max_degree(prover_index) {
1414// Requires: plonk_wasm
1515function caml_pasta_fp_plonk_index_public_inputs ( prover_index ) {
1616 var bytes = prover_index . serialize ( )
17- var index = plonk_wasm . prover_index_fp_from_bytes ( bytes ) ;
17+ var index = plonk_wasm . prover_index_fp_deserialize ( bytes ) ;
1818 // TODO: ^ remove the round trip when napi has direct access to the object
1919
2020 return plonk_wasm . caml_pasta_fp_plonk_index_public_inputs ( index ) ;
@@ -24,7 +24,7 @@ function caml_pasta_fp_plonk_index_public_inputs(prover_index) {
2424// Requires: plonk_wasm
2525function caml_pasta_fp_plonk_index_domain_d1_size ( prover_index ) {
2626 var bytes = prover_index . serialize ( )
27- var index = plonk_wasm . prover_index_fp_from_bytes ( bytes ) ;
27+ var index = plonk_wasm . prover_index_fp_deserialize ( bytes ) ;
2828 // TODO: ^ remove the round trip when napi has direct access to the object
2929
3030 return plonk_wasm . caml_pasta_fp_plonk_index_domain_d1_size ( index ) ;
@@ -34,7 +34,7 @@ function caml_pasta_fp_plonk_index_domain_d1_size(prover_index) {
3434// Requires: plonk_wasm
3535function caml_pasta_fp_plonk_index_domain_d4_size ( prover_index ) {
3636 var bytes = prover_index . serialize ( )
37- var index = plonk_wasm . prover_index_fp_from_bytes ( bytes ) ;
37+ var index = plonk_wasm . prover_index_fp_deserialize ( bytes ) ;
3838 // TODO: ^ remove the round trip when napi has direct access to the object
3939
4040 return plonk_wasm . caml_pasta_fp_plonk_index_domain_d4_size ( index ) ;
@@ -44,7 +44,7 @@ function caml_pasta_fp_plonk_index_domain_d4_size(prover_index) {
4444// Requires: plonk_wasm
4545function caml_pasta_fp_plonk_index_domain_d8_size ( prover_index ) {
4646 var bytes = prover_index . serialize ( )
47- var index = plonk_wasm . prover_index_fp_from_bytes ( bytes ) ;
47+ var index = plonk_wasm . prover_index_fp_deserialize ( bytes ) ;
4848 // TODO: ^ remove the round trip when napi has direct access to the object
4949
5050 return plonk_wasm . caml_pasta_fp_plonk_index_domain_d8_size ( index ) ;
@@ -58,7 +58,7 @@ function caml_pasta_fp_plonk_index_domain_d8_size(prover_index) {
5858// Requires: plonk_wasm
5959function caml_pasta_fq_plonk_index_max_degree ( prover_index ) {
6060 var bytes = prover_index . serialize ( )
61- var index = plonk_wasm . prover_index_fq_from_bytes ( bytes ) ;
61+ var index = plonk_wasm . prover_index_fq_deserialize ( bytes ) ;
6262 // TODO: ^ remove the round trip when napi has direct access to the object
6363
6464 return plonk_wasm . caml_pasta_fq_plonk_index_max_degree ( index ) ;
@@ -68,7 +68,7 @@ function caml_pasta_fq_plonk_index_max_degree(prover_index) {
6868// Requires: plonk_wasm
6969function caml_pasta_fq_plonk_index_public_inputs ( prover_index ) {
7070 var bytes = prover_index . serialize ( )
71- var index = plonk_wasm . prover_index_fq_from_bytes ( bytes ) ;
71+ var index = plonk_wasm . prover_index_fq_deserialize ( bytes ) ;
7272 // TODO: ^ remove the round trip when napi has direct access to the object
7373
7474 return plonk_wasm . caml_pasta_fq_plonk_index_public_inputs ( index ) ;
@@ -78,7 +78,7 @@ function caml_pasta_fq_plonk_index_public_inputs(prover_index) {
7878// Requires: plonk_wasm
7979function caml_pasta_fq_plonk_index_domain_d1_size ( prover_index ) {
8080 var bytes = prover_index . serialize ( )
81- var index = plonk_wasm . prover_index_fq_from_bytes ( bytes ) ;
81+ var index = plonk_wasm . prover_index_fq_deserialize ( bytes ) ;
8282 // TODO: ^ remove the round trip when napi has direct access to the object
8383
8484 return plonk_wasm . caml_pasta_fq_plonk_index_domain_d1_size ( index ) ;
@@ -88,7 +88,7 @@ function caml_pasta_fq_plonk_index_domain_d1_size(prover_index) {
8888// Requires: plonk_wasm
8989function caml_pasta_fq_plonk_index_domain_d4_size ( prover_index ) {
9090 var bytes = prover_index . serialize ( )
91- var index = plonk_wasm . prover_index_fq_from_bytes ( bytes ) ;
91+ var index = plonk_wasm . prover_index_fq_deserialize ( bytes ) ;
9292 // TODO: ^ remove the round trip when napi has direct access to the object
9393
9494 return plonk_wasm . caml_pasta_fq_plonk_index_domain_d4_size ( index ) ;
@@ -98,13 +98,33 @@ function caml_pasta_fq_plonk_index_domain_d4_size(prover_index) {
9898// Requires: plonk_wasm
9999function caml_pasta_fq_plonk_index_domain_d8_size ( prover_index ) {
100100 var bytes = prover_index . serialize ( )
101- var index = plonk_wasm . prover_index_fq_from_bytes ( bytes ) ;
101+ var index = plonk_wasm . prover_index_fq_deserialize ( bytes ) ;
102102 // TODO: ^ remove the round trip when napi has direct access to the object
103103
104104 return plonk_wasm . caml_pasta_fq_plonk_index_domain_d8_size ( index ) ;
105105}
106106
107107
108+ // Provides: caml_pasta_fp_plonk_index_serialize
109+ // Requires: plonk_wasm
110+ var caml_pasta_fp_plonk_index_serialize = function ( index ) {
111+ // Workaround for napi issue where methods on External objects are not accessible
112+ if ( typeof index . serialize === 'function' ) {
113+ return index . serialize ( ) ;
114+ }
115+ return plonk_wasm . prover_index_fp_serialize ( index ) ;
116+ } ;
117+
118+ // Provides: caml_pasta_fp_plonk_index_deserialize
119+ // Requires: plonk_wasm
120+ var caml_pasta_fp_plonk_index_deserialize = function ( index ) {
121+ // Workaround for napi issue where methods on External objects are not accessible
122+ if ( typeof index . deserialize === 'function' ) {
123+ return index . deserialize ( ) ;
124+ }
125+ return plonk_wasm . prover_index_fp_deserialize ( index ) ;
126+ } ;
127+
108128// Provides: caml_pasta_fp_plonk_index_create
109129// Requires: plonk_wasm, tsRustConversionNative
110130var caml_pasta_fp_plonk_index_create = function (
@@ -138,7 +158,7 @@ var caml_pasta_fp_plonk_index_create = function (
138158 ) ;
139159 console . timeEnd ( "index_create" ) ;
140160
141- return plonk_wasm . prover_index_fp_to_bytes ( t ) ;
161+ return t ;
142162} ;
143163
144164// Provides: caml_pasta_fp_plonk_index_create_bytecode
@@ -193,6 +213,26 @@ var caml_pasta_fp_plonk_index_write = function (append, t, path) {
193213 ) ;
194214} ;
195215
216+ // Provides: caml_pasta_fq_plonk_index_serialize
217+ // Requires: plonk_wasm
218+ var caml_pasta_fq_plonk_index_serialize = function ( index ) {
219+ // Workaround for napi issue where methods on External objects are not accessible
220+ if ( typeof index . serialize === 'function' ) {
221+ return index . serialize ( ) ;
222+ }
223+ return plonk_wasm . prover_index_fq_serialize ( index ) ;
224+ } ;
225+
226+ // Provides: caml_pasta_fq_plonk_index_deserialize
227+ // Requires: plonk_wasm
228+ var caml_pasta_fq_plonk_index_deserialize = function ( index ) {
229+ // Workaround for napi issue where methods on External objects are not accessible
230+ if ( typeof index . deserialize === 'function' ) {
231+ return index . deserialize ( ) ;
232+ }
233+ return plonk_wasm . prover_index_fq_deserialize ( index ) ;
234+ } ;
235+
196236// Provides: caml_pasta_fq_plonk_index_create
197237// Requires: plonk_wasm, tsRustConversionNative
198238var caml_pasta_fq_plonk_index_create = function (
@@ -214,7 +254,7 @@ var caml_pasta_fq_plonk_index_create = function (
214254 console . log ( "anais: 3" ) ;
215255
216256 console . time ( "conversion" )
217- var gate_vec = plonk_wasm . caml_pasta_fq_plonk_gate_vector_from_bytes ( gates . serialize ( ) ) ;
257+ var gate_vec = plonk_wasm . caml_pasta_fq_plonk_gate_vector_deserialize ( gates . serialize ( ) ) ;
218258 var urs_ser = plonk_wasm . caml_fq_srs_from_bytes_external ( urs . serialize ( ) )
219259 console . timeEnd ( "conversion" )
220260 console . log ( "anais: 4" ) ;
@@ -231,7 +271,7 @@ var caml_pasta_fq_plonk_index_create = function (
231271 ) ;
232272 console . timeEnd ( "index_create" ) ;
233273
234- return plonk_wasm . prover_index_fq_to_bytes ( t ) ;
274+ return t ;
235275} ;
236276
237277// Provides: caml_pasta_fq_plonk_index_create_bytecode
0 commit comments