Skip to main content

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
ParamType
returnstring

fromString

Create a transition from a string

fromString(transition)Transition
ParamTypeDescription
transitionstringString representation of a transition
returnTransitionTransition object

fromBytesLe

Create a transition from a Uint8Array of left endian bytes

fromBytesLe(bytes)Transition
ParamTypeDescription
bytesUint8ArrayUint8Array of left endian bytes encoding a Transition
returnTransitionTransition 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
ParamType
returnstring

toBytesLe

Get the transition as a Uint8Array of left endian bytes

toBytesLe()Uint8Array
ParamType
returnUint8Array

programId

Get the program ID of the transition

programId() ► string
ParamType
returnstring

functionName

Get the function name of the transition

functionName() ► string
ParamType
returnstring

containsCommitment

Returns true if the transition contains the given commitment

containsCommitment(commitment) ► boolean
ParamTypeDescription
commitmentFieldThe commitment to check for
returnbooleanTrue if the transition contains the given commitment

containsSerialNumber

Check if the transition contains a serial number

containsSerialNumber(serial_number) ► boolean
ParamTypeDescription
serial_numberFieldThe serial number to check for
returnbooleanTrue 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
ParamTypeDescription
commitmentFieldThe commitment to find the record for
returnRecordCiphertextThe 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
ParamTypeDescription
view_keyViewKeyThe view key of the record owner
returnArrayArray of record plaintext objects

records

Get the records present in a transition and their commitments

records()Array
ParamTypeDescription
returnArrayArray of objects with commitment and record properties

inputs

Get the inputs of the transition

inputs(convert_to_js)Array
ParamTypeDescription
convert_to_jsbooleanIf true the inputs will be converted to JS objects, if false the inputs will be in wasm format
returnArrayArray of inputs

outputs

Get the outputs of the transition

outputs(convert_to_js)Array
ParamTypeDescription
convert_to_jsbooleanIf true the outputs will be converted to JS objects, if false the outputs will be in wasm format
returnArrayArray of outputs

tpk

Get the transition public key of the transition

tpk()Group
ParamType
returnGroup

tvk

Get the transition view key of the transition

tvk(view_key)Field
ParamTypeDescription
view_keyViewKeyThe view key of the transition signer
returnFieldTransition view key

tcm

Get the transition commitment of the transition

tcm()Field
ParamType
returnField

scm

Get the transition signer commitment of the transition

scm()Field
ParamType
returnField

decryptTransition

Decrypt the transition using the transition view key

decryptTransition(tvk)Transition
ParamTypeDescription
tvkFieldThe transition view key
returnTransitionThe transition with public values for inputs and outputs