File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed
Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -146,11 +146,11 @@ macro_rules! impl_integer {
146146 Self ( self . 0 . rem_wrapped( & other. 0 ) )
147147 }
148148
149- // // / Convert to Scalar.
150- // #[wasm_bindgen(js_name = "toScalar")]
151- // pub fn to_scalar(&self) -> crate::Scalar {
152- // crate::Scalar(self.0.to_scalar())
153- // }
149+ /// Convert to Scalar.
150+ #[ wasm_bindgen( js_name = "toScalar" ) ]
151+ pub fn to_scalar( & self ) -> crate :: Scalar {
152+ crate :: Scalar :: from_native ( self . 0 . to_scalar( ) )
153+ }
154154
155155 // /// Convert from Field.
156156 // #[wasm_bindgen(js_name = "fromField")]
Original file line number Diff line number Diff line change @@ -47,6 +47,11 @@ impl Scalar {
4747 self . 0 . to_string ( )
4848 }
4949
50+ /// Constructs a Scalar from its native representation that can be exposed to JavaScript.
51+ pub ( crate ) fn from_native ( native : ScalarNative ) -> Self {
52+ Scalar ( native)
53+ }
54+
5055 /// Create a scalar element from a Uint8Array of left endian bytes.
5156 #[ wasm_bindgen( js_name = "fromBytesLe" ) ]
5257 pub fn from_bytes_le ( bytes : & Uint8Array ) -> Result < Scalar , String > {
You can’t perform that action at this time.
0 commit comments