Transition
Overview
Represents a state transition in the Aleo blockchain. The Transition class provides methods for creating, inspecting, and decrypting transitions. Transitions encapsulate the execution of a single function call within a transaction.
Methods
id
Get the transition ID
id() ► string
| Param | Type |
|---|---|
| return | string |
fromString
Create a transition from a string
fromString(transition) ► Transition
| Param | Type | Description |
|---|---|---|
| transition | string | String representation of a transition |
| return | Transition | Transition object |
fromBytesLe
Create a transition from a Uint8Array of left endian bytes
fromBytesLe(bytes) ► Transition
| Param | Type | Description |
|---|---|---|
| bytes | Uint8Array | Uint8Array of left endian bytes encoding a Transition |
| return | Transition | Transition object |
toString
Get the transition as a string. If you want to submit this transition to the Aleo Network this function will create the string that should be submitted in the POST data.
toString() ► string
| Param | Type |
|---|---|
| return | string |
toBytesLe
Get the transition as a Uint8Array of left endian bytes
toBytesLe() ► Uint8Array
| Param | Type |
|---|---|
| return | Uint8Array |
programId
Get the program ID of the transition
programId() ► string
| Param | Type |
|---|---|
| return | string |
functionName
Get the function name of the transition
functionName() ► string
| Param | Type |
|---|---|
| return | string |
containsCommitment
Returns true if the transition contains the given commitment
containsCommitment(commitment) ► boolean
| Param | Type | Description |
|---|---|---|
| commitment | Field | The commitment to check for |
| return | boolean | True if the transition contains the given commitment |
containsSerialNumber
Check if the transition contains a serial number
containsSerialNumber(serial_number) ► boolean
| Param | Type | Description |
|---|---|---|
| serial_number | Field | The serial number to check for |
| return | boolean | True if the transition contains a serial number, false otherwise |
findRecord
Find a record in the transition by the record's commitment
findRecord(commitment) ► RecordCiphertext | undefined
| Param | Type | Description |
|---|---|---|
| commitment | Field | The commitment to find the record for |
| return | RecordCiphertext | The record ciphertext if found, undefined otherwise |
ownedRecords
Get the record plaintext present in a transition owned by a specific view key
ownedRecords(view_key) ► Array
| Param | Type | Description |
|---|---|---|
| view_key | ViewKey | The view key of the record owner |
| return | Array | Array of record plaintext objects |
records
Get the records present in a transition and their commitments
records() ► Array
| Param | Type | Description |
|---|---|---|
| return | Array | Array of objects with commitment and record properties |
inputs
Get the inputs of the transition
inputs(convert_to_js) ► Array
| Param | Type | Description |
|---|---|---|
| convert_to_js | boolean | If true the inputs will be converted to JS objects, if false the inputs will be in wasm format |
| return | Array | Array of inputs |
outputs
Get the outputs of the transition
outputs(convert_to_js) ► Array
| Param | Type | Description |
|---|---|---|
| convert_to_js | boolean | If true the outputs will be converted to JS objects, if false the outputs will be in wasm format |
| return | Array | Array of outputs |
tpk
Get the transition public key of the transition
tpk() ► Group
| Param | Type |
|---|---|
| return | Group |
tvk
Get the transition view key of the transition
tvk(view_key) ► Field
| Param | Type | Description |
|---|---|---|
| view_key | ViewKey | The view key of the transition signer |
| return | Field | Transition view key |
tcm
Get the transition commitment of the transition
tcm() ► Field
| Param | Type |
|---|---|
| return | Field |
scm
Get the transition signer commitment of the transition
scm() ► Field
| Param | Type |
|---|---|
| return | Field |
decryptTransition
Decrypt the transition using the transition view key
decryptTransition(tvk) ► Transition
| Param | Type | Description |
|---|---|---|
| tvk | Field | The transition view key |
| return | Transition | The transition with public values for inputs and outputs |