RecordPlaintext
Overview
Represents a plaintext Aleo record. The RecordPlaintext class provides methods for creating, inspecting, and extracting data from decrypted records including computing serial numbers and commitments.
Methods
fromString
Return a record plaintext from a string
fromString(record) ► RecordPlaintext
| Param | Type | Description |
|---|---|---|
| record | string | String representation of a plaintext representation of an Aleo record |
| return | RecordPlaintext | Record plaintext |
toString
Returns the record plaintext string
toString() ► string
| Param | Type |
|---|---|
| return | string |
commitment
Get the commitment of the record
commitment(program_id, record_name, record_view_key) ► Field
| Param | Type | Description |
|---|---|---|
| program_id | string | Program ID of the program that the record is associated with |
| record_name | string | Name of the record |
| record_view_key | string | The string representation of the record view key |
| return | Field | Commitment of the record |
getMember
Get the record entry matching a key
getMember(input) ► Plaintext
| Param | Type | Description |
|---|---|---|
| input | string | The key to retrieve the value in the record data field |
| return | Plaintext | The plaintext value corresponding to the key |
owner
Get the owner of the record
owner() ► Address
| Param | Type |
|---|---|
| return | Address |
toJsObject
Get a representation of a record as a javascript object for usage in client side computations. Note that this is not a reversible operation and exists for the convenience of discovering and using properties of the record.
The conversion guide is as follows:
- u8, u16, u32, i8, i16, i32 → Number
- u64, u128, i64, i128 → BigInt
- Address, Field, Group, Scalar → String (bech32 representation)
toJsObject() ► Object
| Param | Type |
|---|---|
| return | Object |
fromBytesLe
Get a record plaintext object from a series of bytes
fromBytesLe(bytes) ► RecordPlaintext
| Param | Type | Description |
|---|---|---|
| bytes | Uint8Array | A left endian byte array representing the record plaintext |
| return | RecordPlaintext | The record plaintext |
toBytesLe
Returns the left endian byte array representation of the record plaintext
toBytesLe() ► Uint8Array
| Param | Type |
|---|---|
| return | Uint8Array |
toBitsLe
Returns the left endian boolean array representation of the record plaintext bits
toBitsLe() ► Array
| Param | Type |
|---|---|
| return | Array |
toFields
Get the field array representation of the record plaintext
toFields() ► Array
| Param | Type |
|---|---|
| return | Array |
microcredits
Returns the amount of microcredits in the record
microcredits() ► bigint
| Param | Type |
|---|---|
| return | bigint |
nonce
Returns the nonce of the record. This can be used to uniquely identify a record.
nonce() ► string
| Param | Type |
|---|---|
| return | string |
serialNumberString
Attempt to get the serial number of a record to determine whether or not it has been spent
serialNumberString(private_key, program_id, record_name, record_view_key) ► string
| Param | Type | Description |
|---|---|---|
| private_key | PrivateKey | Private key of the account that owns the record |
| program_id | string | Program ID of the program that the record is associated with |
| record_name | string | Name of the record |
| record_view_key | string | The string representation of the record view key |
| return | string | Serial number of the record |
tag
Get the tag of the record using the graph key
tag(graph_key, commitment) ► Field
| Param | Type | Description |
|---|---|---|
| graph_key | GraphKey | Graph key of the account |
| commitment | Field | Commitment of the record |
| return | Field | Tag of the record |
recordViewKey
Generate the record view key. The record view key can only decrypt the record if the supplied view key belongs to the record owner.
recordViewKey(view_key) ► Field
| Param | Type | Description |
|---|---|---|
| view_key | ViewKey | View key used to generate the record view key |
| return | Field | Record view key |
decryptSender
Decrypt the sender ciphertext associated with the record
decryptSender(view_key, sender_ciphertext) ► Address
| Param | Type | Description |
|---|---|---|
| view_key | ViewKey | View key associated with the record |
| sender_ciphertext | Field | Sender ciphertext associated with the record |
| return | Address | Address of the sender |
clone
Clone the RecordPlaintext WASM object
clone() ► RecordPlaintext
| Param | Type |
|---|---|
| return | RecordPlaintext |