Struct snarkvm_console_program::Record
source · pub struct Record<N: Network, Private: Visibility> { /* private fields */ }
Expand description
A value stored in program record.
Implementations§
source§impl<N: Network> Record<N, Ciphertext<N>>
impl<N: Network> Record<N, Ciphertext<N>>
source§impl<N: Network> Record<N, Plaintext<N>>
impl<N: Network> Record<N, Plaintext<N>>
sourcepub fn encrypt(&self, randomizer: Scalar<N>) -> Result<Record<N, Ciphertext<N>>>
pub fn encrypt(&self, randomizer: Scalar<N>) -> Result<Record<N, Ciphertext<N>>>
Encrypts self
for the record owner under the given randomizer.
sourcepub fn encrypt_symmetric(
&self,
record_view_key: &Field<N>
) -> Result<Record<N, Ciphertext<N>>>
pub fn encrypt_symmetric(
&self,
record_view_key: &Field<N>
) -> Result<Record<N, Ciphertext<N>>>
Encrypts self
under the given record view key.
source§impl<N: Network> Record<N, Ciphertext<N>>
impl<N: Network> Record<N, Ciphertext<N>>
sourcepub 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.
sourcepub 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.
source§impl<N: Network, Private: Visibility> Record<N, Private>
impl<N: Network, Private: Visibility> Record<N, Private>
sourcepub fn serial_number(
private_key: PrivateKey<N>,
commitment: Field<N>
) -> Result<Field<N>>
pub fn serial_number(
private_key: PrivateKey<N>,
commitment: Field<N>
) -> Result<Field<N>>
A helper method to derive the serial number from the private key and commitment.
source§impl<N: Network, Private: Visibility> Record<N, Private>
impl<N: Network, Private: Visibility> Record<N, Private>
source§impl<N: Network> Record<N, Plaintext<N>>
impl<N: Network> Record<N, Plaintext<N>>
sourcepub fn to_commitment(
&self,
program_id: &ProgramID<N>,
record_name: &Identifier<N>
) -> Result<Field<N>>
pub fn to_commitment(
&self,
program_id: &ProgramID<N>,
record_name: &Identifier<N>
) -> Result<Field<N>>
Returns the record commitment.
source§impl<N: Network> Record<N, Ciphertext<N>>
impl<N: Network> Record<N, Ciphertext<N>>
sourcepub fn to_commitment(
&self,
_program_id: &ProgramID<N>,
_record_name: &Identifier<N>
) -> Result<Field<N>>
pub fn to_commitment(
&self,
_program_id: &ProgramID<N>,
_record_name: &Identifier<N>
) -> Result<Field<N>>
Returns the record commitment.
source§impl<N: Network, Private: Visibility> Record<N, Private>
impl<N: Network, Private: Visibility> Record<N, Private>
sourcepub fn from_plaintext(
owner: Owner<N, Plaintext<N>>,
gates: Balance<N, Plaintext<N>>,
data: IndexMap<Identifier<N>, Entry<N, Plaintext<N>>>,
nonce: Group<N>
) -> Result<Record<N, Plaintext<N>>>
pub fn from_plaintext(
owner: Owner<N, Plaintext<N>>,
gates: Balance<N, Plaintext<N>>,
data: IndexMap<Identifier<N>, Entry<N, Plaintext<N>>>,
nonce: Group<N>
) -> Result<Record<N, Plaintext<N>>>
Initializes a new record plaintext.
sourcepub fn from_ciphertext(
owner: Owner<N, Ciphertext<N>>,
gates: Balance<N, Ciphertext<N>>,
data: IndexMap<Identifier<N>, Entry<N, Ciphertext<N>>>,
nonce: Group<N>
) -> Result<Record<N, Ciphertext<N>>>
pub fn from_ciphertext(
owner: Owner<N, Ciphertext<N>>,
gates: Balance<N, Ciphertext<N>>,
data: IndexMap<Identifier<N>, Entry<N, Ciphertext<N>>>,
nonce: Group<N>
) -> Result<Record<N, Ciphertext<N>>>
Initializes a new record ciphertext.
source§impl<N: Network, Private: Visibility> Record<N, Private>
impl<N: Network, Private: Visibility> Record<N, Private>
sourcepub const fn data(&self) -> &IndexMap<Identifier<N>, Entry<N, Private>>
pub const fn data(&self) -> &IndexMap<Identifier<N>, Entry<N, Private>>
Returns the program data.
source§impl<N: Network, Private: Visibility> Record<N, Private>
impl<N: Network, Private: Visibility> Record<N, Private>
sourcepub fn into_owner(self) -> Owner<N, Private>
pub fn into_owner(self) -> Owner<N, Private>
Returns the owner of the program record, and consumes self
.
sourcepub fn into_gates(self) -> Balance<N, Private>
pub fn into_gates(self) -> Balance<N, Private>
Returns the gates of the program record, and consumes self
.
sourcepub fn into_data(self) -> IndexMap<Identifier<N>, Entry<N, Private>>
pub fn into_data(self) -> IndexMap<Identifier<N>, Entry<N, Private>>
Returns the program data, and consumes self
.
sourcepub fn into_nonce(self) -> Group<N>
pub fn into_nonce(self) -> Group<N>
Returns the nonce of the program record, and consumes self
.
Trait Implementations§
source§impl<'de, N: Network> Deserialize<'de> for Record<N, Ciphertext<N>>
impl<'de, N: Network> Deserialize<'de> for Record<N, Ciphertext<N>>
source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserializes the record ciphertext from a string or bytes.
source§impl<'de, N: Network> Deserialize<'de> for Record<N, Plaintext<N>>
impl<'de, N: Network> Deserialize<'de> for Record<N, Plaintext<N>>
source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserializes the record plaintext from a string or bytes.
source§impl<N: Network, Private: Visibility<Boolean = Boolean<N>>> Equal<Record<N, Private>> for Record<N, Private>
impl<N: Network, Private: Visibility<Boolean = Boolean<N>>> Equal<Record<N, Private>> for Record<N, Private>
source§fn is_equal(&self, other: &Self) -> Self::Output
fn is_equal(&self, other: &Self) -> Self::Output
Returns true
if self
and other
are equal.
Note: This method does not check the nonce
equality.
source§fn is_not_equal(&self, other: &Self) -> Self::Output
fn is_not_equal(&self, other: &Self) -> Self::Output
Returns true
if self
and other
are not equal.
Note: This method does not check the nonce
equality.
type Output = Boolean<N>
source§impl<N: Network> Parser for Record<N, Ciphertext<N>>
impl<N: Network> Parser for Record<N, Ciphertext<N>>
source§fn parse(string: &str) -> ParserResult<'_, Self>
fn parse(string: &str) -> ParserResult<'_, Self>
Parses a string into an ciphertext.
source§impl<N: Network> Parser for Record<N, Plaintext<N>>
impl<N: Network> Parser for Record<N, Plaintext<N>>
source§fn parse(string: &str) -> ParserResult<'_, Self>
fn parse(string: &str) -> ParserResult<'_, Self>
Parses a string as a record: { owner: address, gates: u64, identifier_0: entry_0, ..., identifier_n: entry_n, _nonce: field }
.
source§impl<N: Network, Private: Visibility<Boolean = Boolean<N>>> PartialEq<Record<N, Private>> for Record<N, Private>
impl<N: Network, Private: Visibility<Boolean = Boolean<N>>> PartialEq<Record<N, Private>> for Record<N, Private>
impl<N: Network, Private: Visibility<Boolean = Boolean<N>>> Eq for Record<N, Private>
Auto Trait Implementations§
impl<N, Private> RefUnwindSafe for Record<N, Private>where
N: RefUnwindSafe,
Private: RefUnwindSafe,
<N as Environment>::Field: RefUnwindSafe,
<N as Environment>::Projective: RefUnwindSafe,
<N as Environment>::Scalar: RefUnwindSafe,
impl<N, Private> Send for Record<N, Private>where
Private: Send,
impl<N, Private> Sync for Record<N, Private>where
Private: Sync,
impl<N, Private> Unpin for Record<N, Private>where
N: Unpin,
Private: Unpin,
<N as Environment>::Field: Unpin,
<N as Environment>::Projective: Unpin,
<N as Environment>::Scalar: Unpin,
impl<N, Private> UnwindSafe for Record<N, Private>where
N: UnwindSafe,
Private: UnwindSafe,
<N as Environment>::Field: UnwindSafe,
<N as Environment>::Projective: UnwindSafe,
<N as Environment>::Scalar: UnwindSafe,
Blanket Implementations§
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.