Struct aleo_wasm::record::record_plaintext::RecordPlaintext
source · pub struct RecordPlaintext(/* private fields */);
Expand description
Plaintext representation of an Aleo record
Implementations§
source§impl RecordPlaintext
impl RecordPlaintext
pub fn commitment( &self, program_id: &str, record_name: &str ) -> Result<Field, String>
sourcepub fn from_string(record: &str) -> Result<RecordPlaintext, String>
pub fn from_string(record: &str) -> Result<RecordPlaintext, String>
Return a record plaintext from a string.
@param {string} record String representation of a plaintext representation of an Aleo record @returns {RecordPlaintext | Error} Record plaintext
sourcepub fn to_string(&self) -> String
pub fn to_string(&self) -> String
Returns the record plaintext string
@returns {string} String representation of the record plaintext
sourcepub fn microcredits(&self) -> u64
pub fn microcredits(&self) -> u64
Returns the amount of microcredits in the record
@returns {u64} Amount of microcredits in the record
sourcepub fn nonce(&self) -> String
pub fn nonce(&self) -> String
Returns the nonce of the record. This can be used to uniquely identify a record.
@returns {string} Nonce of the record
sourcepub fn serial_number_string(
&self,
private_key: &PrivateKey,
program_id: &str,
record_name: &str
) -> Result<String, String>
pub fn serial_number_string( &self, private_key: &PrivateKey, program_id: &str, record_name: &str ) -> Result<String, String>
Attempt to get the serial number of a record to determine whether or not is has been spent
@param {PrivateKey} private_key Private key of the account that owns the record @param {string} program_id Program ID of the program that the record is associated with @param {string} record_name Name of the record @returns {string | Error} Serial number of the record
Methods from Deref<Target = Record<Testnet3, Plaintext<Testnet3>>>§
pub fn decrypt(
&self,
view_key: &ViewKey<N>
) -> Result<Record<N, Plaintext<N>>, Error>
pub fn decrypt( &self, view_key: &ViewKey<N> ) -> Result<Record<N, Plaintext<N>>, Error>
Decrypts self
into plaintext using the given view key and checks that the owner matches the view key.
pub fn decrypt_symmetric_unchecked(
&self,
record_view_key: &Field<N>
) -> Result<Record<N, Plaintext<N>>, Error>
pub fn decrypt_symmetric_unchecked( &self, record_view_key: &Field<N> ) -> Result<Record<N, Plaintext<N>>, Error>
Decrypts self
into plaintext using the given record view key.
Note: This method does not check that the record view key corresponds to the record owner.
Use Self::decrypt
for the checked variant.
pub fn encrypt(
&self,
randomizer: Scalar<N>
) -> Result<Record<N, Ciphertext<N>>, Error>
pub fn encrypt( &self, randomizer: Scalar<N> ) -> Result<Record<N, Ciphertext<N>>, Error>
Encrypts self
for the record owner under the given randomizer.
pub fn encrypt_symmetric_unchecked(
&self,
record_view_key: &Field<N>
) -> Result<Record<N, Ciphertext<N>>, Error>
pub fn encrypt_symmetric_unchecked( &self, record_view_key: &Field<N> ) -> Result<Record<N, Ciphertext<N>>, Error>
Encrypts self
under the given record view key.
Note: This method does not check that the record view key corresponds to the record owner.
Use Self::encrypt
for the checked variant.
pub fn find<A>(&self, path: &[A]) -> Result<Entry<N, Plaintext<N>>, Error>where
A: Into<Access<N>> + Copy + Debug,
pub fn find<A>(&self, path: &[A]) -> Result<Entry<N, Plaintext<N>>, Error>where A: Into<Access<N>> + Copy + Debug,
Returns the entry from the given path.
pub fn is_owner(&self, view_key: &ViewKey<N>) -> bool
pub fn is_owner(&self, view_key: &ViewKey<N>) -> bool
Decrypts self
into plaintext using the given view key.
pub fn is_owner_with_address_x_coordinate(
&self,
view_key: &ViewKey<N>,
address_x_coordinate: &Field<N>
) -> bool
pub fn is_owner_with_address_x_coordinate( &self, view_key: &ViewKey<N>, address_x_coordinate: &Field<N> ) -> bool
Decrypts self
into plaintext using the x-coordinate of the address corresponding to the given view key.
pub fn to_commitment(
&self,
program_id: &ProgramID<N>,
record_name: &Identifier<N>
) -> Result<Field<N>, Error>
pub fn to_commitment( &self, program_id: &ProgramID<N>, record_name: &Identifier<N> ) -> Result<Field<N>, Error>
Returns the record commitment.
pub fn to_commitment(
&self,
_program_id: &ProgramID<N>,
_record_name: &Identifier<N>
) -> Result<Field<N>, Error>
pub fn to_commitment( &self, _program_id: &ProgramID<N>, _record_name: &Identifier<N> ) -> Result<Field<N>, Error>
Returns the record commitment.
pub fn owner(&self) -> &Owner<N, Private>
pub fn owner(&self) -> &Owner<N, Private>
Returns the owner of the program record.
pub fn nonce(&self) -> &Group<N>
pub fn nonce(&self) -> &Group<N>
Returns the nonce of the program record.
Trait Implementations§
source§impl Clone for RecordPlaintext
impl Clone for RecordPlaintext
source§fn clone(&self) -> RecordPlaintext
fn clone(&self) -> RecordPlaintext
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Deref for RecordPlaintext
impl Deref for RecordPlaintext
source§impl From<Record<Testnet3, Plaintext<Testnet3>>> for RecordPlaintext
impl From<Record<Testnet3, Plaintext<Testnet3>>> for RecordPlaintext
source§impl From<RecordPlaintext> for JsValue
impl From<RecordPlaintext> for JsValue
source§fn from(value: RecordPlaintext) -> Self
fn from(value: RecordPlaintext) -> Self
source§impl FromStr for RecordPlaintext
impl FromStr for RecordPlaintext
source§impl FromWasmAbi for RecordPlaintext
impl FromWasmAbi for RecordPlaintext
source§impl IntoWasmAbi for RecordPlaintext
impl IntoWasmAbi for RecordPlaintext
source§impl LongRefFromWasmAbi for RecordPlaintext
impl LongRefFromWasmAbi for RecordPlaintext
source§impl OptionFromWasmAbi for RecordPlaintext
impl OptionFromWasmAbi for RecordPlaintext
source§impl OptionIntoWasmAbi for RecordPlaintext
impl OptionIntoWasmAbi for RecordPlaintext
source§impl RefFromWasmAbi for RecordPlaintext
impl RefFromWasmAbi for RecordPlaintext
§type Anchor = Ref<'static, RecordPlaintext>
type Anchor = Ref<'static, RecordPlaintext>
Self
for the duration of the
invocation of the function that has an &Self
parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.source§impl RefMutFromWasmAbi for RecordPlaintext
impl RefMutFromWasmAbi for RecordPlaintext
source§impl TryFromJsValue for RecordPlaintext
impl TryFromJsValue for RecordPlaintext
source§impl VectorFromWasmAbi for RecordPlaintext
impl VectorFromWasmAbi for RecordPlaintext
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[RecordPlaintext]>
source§impl VectorIntoWasmAbi for RecordPlaintext
impl VectorIntoWasmAbi for RecordPlaintext
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[RecordPlaintext]>) -> Self::Abi
source§impl WasmDescribeVector for RecordPlaintext
impl WasmDescribeVector for RecordPlaintext
Auto Trait Implementations§
impl RefUnwindSafe for RecordPlaintext
impl Send for RecordPlaintext
impl Sync for RecordPlaintext
impl Unpin for RecordPlaintext
impl UnwindSafe for RecordPlaintext
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere T: IntoWasmAbi,
§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::Abi
source§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi
, except that it may throw and never
return in the case of Err
.