Skip to content

Commit 4f80d3c

Browse files
committed
napi: annotate js_name for gate vector
1 parent 214a69c commit 4f80d3c

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

plonk-napi/src/gate_vector.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ fn gate_vector_error(context: &str, err: impl std::fmt::Display) -> Error {
206206
Error::new(Status::GenericFailure, format!("{}: {}", context, err))
207207
}
208208

209-
#[napi(object)]
209+
#[napi(object, js_name = "WasmGateWires")]
210210
#[derive(Clone, Copy, Debug, Default)]
211211
pub struct NapiGateWires {
212212
pub w0: NapiWire,
@@ -300,7 +300,7 @@ fn gate_type_to_i32(value: GateType) -> i32 {
300300
macro_rules! impl_gate_support {
301301
($field_name:ident, $F:ty, $WasmF:ty) => {
302302
paste! {
303-
#[napi(object)]
303+
#[napi(object, js_name = [<"Wasm" $field_name:camel "Gate">])]
304304
#[derive(Clone, Debug, Default)]
305305
pub struct [<Napi $field_name:camel Gate>] {
306306
pub typ: i32, // for convenience, we use i32 instead of GateType
@@ -349,7 +349,7 @@ macro_rules! impl_gate_support {
349349
}
350350
}
351351

352-
#[napi]
352+
#[napi(js_name = [<"Wasm" $field_name:camel "GateVector">])]
353353
#[derive(Clone, Debug, Default)]
354354
pub struct [<Napi $field_name:camel GateVector>](
355355
#[napi(skip)] pub CoreGateVector<$F>,
@@ -413,12 +413,12 @@ macro_rules! impl_gate_support {
413413
}
414414
}
415415

416-
#[napi]
416+
#[napi(js_name = [<"caml_pasta_" $field_name:snake "_plonk_gate_vector_create">])]
417417
pub fn [<caml_pasta_ $field_name:snake _plonk_gate_vector_create>]() -> [<Napi $field_name:camel GateVector>] {
418418
[<Napi $field_name:camel GateVector>]::new()
419419
}
420420

421-
#[napi]
421+
#[napi(js_name = [<"caml_pasta_" $field_name:snake "_plonk_gate_vector_add">])]
422422
pub fn [<caml_pasta_ $field_name:snake _plonk_gate_vector_add>](
423423
vector: &mut [<Napi $field_name:camel GateVector>],
424424
gate: [<Napi $field_name:camel Gate>],
@@ -428,7 +428,7 @@ macro_rules! impl_gate_support {
428428
Ok(())
429429
}
430430

431-
#[napi]
431+
#[napi(js_name = [<"caml_pasta_" $field_name:snake "_plonk_gate_vector_get">])]
432432
pub fn [<caml_pasta_ $field_name:snake _plonk_gate_vector_get>](
433433
vector: &[<Napi $field_name:camel GateVector>],
434434
index: i32,
@@ -440,14 +440,14 @@ macro_rules! impl_gate_support {
440440
[<Napi $field_name:camel Gate>]::from_inner(gate)
441441
}
442442

443-
#[napi]
443+
#[napi(js_name = [<"caml_pasta_" $field_name:snake "_plonk_gate_vector_len">])]
444444
pub fn [<caml_pasta_ $field_name:snake _plonk_gate_vector_len>](
445445
vector: &[<Napi $field_name:camel GateVector>],
446446
) -> i32 {
447447
vector.as_slice().len() as i32
448448
}
449449

450-
#[napi]
450+
#[napi(js_name = [<"caml_pasta_" $field_name:snake "_plonk_gate_vector_wrap">])]
451451
pub fn [<caml_pasta_ $field_name:snake _plonk_gate_vector_wrap>](
452452
vector: &mut [<Napi $field_name:camel GateVector>],
453453
target: NapiWire,
@@ -458,7 +458,7 @@ macro_rules! impl_gate_support {
458458
vector.inner_mut().wrap_wire(target, head);
459459
}
460460

461-
#[napi]
461+
#[napi(js_name = [<"caml_pasta_" $field_name:snake "_plonk_gate_vector_digest">])]
462462
pub fn [<caml_pasta_ $field_name:snake _plonk_gate_vector_digest>](
463463
public_input_size: i32,
464464
vector: &[<Napi $field_name:camel GateVector>],
@@ -467,7 +467,7 @@ macro_rules! impl_gate_support {
467467
Uint8Array::from(bytes)
468468
}
469469

470-
#[napi]
470+
#[napi(js_name = [<"caml_pasta_" $field_name:snake "_plonk_circuit_serialize">])]
471471
pub fn [<caml_pasta_ $field_name:snake _plonk_circuit_serialize>](
472472
public_input_size: i32,
473473
vector: &[<Napi $field_name:camel GateVector>],
@@ -483,14 +483,14 @@ macro_rules! impl_gate_support {
483483
})
484484
}
485485

486-
#[napi]
486+
#[napi(js_name = [<"caml_pasta_" $field_name:snake "_plonk_gate_vector_to_bytes">])]
487487
pub fn [<caml_pasta_ $field_name:snake _plonk_gate_vector_to_bytes>](
488488
vector: &[<Napi $field_name:camel GateVector>],
489489
) -> Result<Uint8Array> {
490490
vector.serialize()
491491
}
492492

493-
#[napi]
493+
#[napi(js_name = [<"caml_pasta_" $field_name:snake "_plonk_gate_vector_from_bytes">])]
494494
pub fn [<caml_pasta_ $field_name:snake _plonk_gate_vector_from_bytes>](
495495
bytes: Uint8Array,
496496
) -> Result<[<Napi $field_name:camel GateVector>]> {

0 commit comments

Comments
 (0)