File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 1717use crate :: { from_js_typed_array, to_bits_array_le, types:: native:: * } ;
1818// use crate::types::{U8, U16, U32};
1919use js_sys:: { Array , Uint8Array } ;
20+ use once_cell:: sync:: OnceCell ;
2021use snarkvm_console:: prelude:: {
2122 AbsChecked ,
2223 AbsWrapped ,
@@ -34,6 +35,7 @@ use snarkvm_console::prelude::{
3435 ToBits ,
3536 ToBytes ,
3637} ;
38+ use crate :: Plaintext ;
3739use std:: { ops:: Deref , str:: FromStr } ;
3840use wasm_bindgen:: prelude:: * ;
3941
@@ -158,6 +160,12 @@ macro_rules! impl_integer {
158160 self . 0 . to_scalar( ) . into( )
159161 }
160162
163+ /// Convert to plaintext.
164+ #[ wasm_bindgen( js_name = "toPlaintext" ) ]
165+ pub fn to_plaintext( & self ) -> Plaintext {
166+ Plaintext :: from( PlaintextNative :: Literal ( LiteralNative :: Integer ( self . 0 ) , OnceCell :: new( ) ) )
167+ }
168+
161169 /// Convert from Field.
162170 #[ wasm_bindgen( js_name = "fromField" ) ]
163171 pub fn from_field( field: & crate :: Field ) -> Result <$name, String > {
You can’t perform that action at this time.
0 commit comments