Transaction
Class Transaction
Webassembly Representation of an Aleo transaction
This object is created when generating an on-chain function deployment or execution and is the object that should be submitted to the Aleo Network in order to deploy or execute a function.
Methods
fromString
Create a transaction from a string
fromString(transaction) ► Transaction
| Parameters | Type | Description |
|---|---|---|
| transaction | string | String representation of a transaction |
| return | Transaction | ** |
fromBytesLe
Create a transaction from a Uint8Array of left endian bytes.
fromBytesLe(Uint8Array) ► Transaction
| Parameters | Type | Description |
|---|---|---|
| Uint8Array | Uint8Array | of left endian bytes encoding a Transaction. |
| return | Transaction | ** |
toString
Get the transaction as a string. If you want to submit this transaction to the Aleo Network this function will create the string that should be submitted in the `POST` data.
toString() ► string
| Parameters | Type | Description |
|---|---|---|
| return | string | String representation of the transaction |
toBytesLe
Get the transaction as a Uint8Array of left endian bytes.
toBytesLe() ► Uint8Array
| Parameters | Type | Description |
|---|---|---|
| return | Uint8Array | Uint8Array representation of the transaction |
constainsSerialNumber
Returns true if the transaction contains the given serial number.
constainsSerialNumber(True) ► boolean
| Parameters | Type | Description |
|---|---|---|
| True | boolean | if the transaction contains the given serial number. |
| return | boolean | ** |
constainsCommitment
Returns true if the transaction contains the given commitment.
constainsCommitment(True) ► boolean
| Parameters | Type | Description |
|---|---|---|
| True | boolean | if the transaction contains the given commitment. |
| return | boolean | ** |
findRecord
Find a record in the transaction by the records commitment.
findRecord(commitment) ► RecordCiphertext
| Parameters | Type | Description |
|---|---|---|
| commitment | Field | ** |
| return | RecordCiphertext | ** |
baseFeeAmount
Returns the transaction's base fee.
baseFeeAmount() ► BigInt
| Parameters | Type | Description |
|---|---|---|
| return | BigInt | ** |
feeAmount
Returns the transaction's total fee.
feeAmount() ► BigInt
| Parameters | Type | Description |
|---|---|---|
| return | BigInt | ** |
priorityFeeAmount
Returns the transaction's priority fee.
returns The transaction's priority fee.
priorityFeeAmount() ► BigInt
| Parameters | Type | Description |
|---|---|---|
| return | BigInt | ** |
isDeploy
Returns true if the transaction is a deployment transaction.
isDeploy() ► boolean
| Parameters | Type | Description |
|---|---|---|
| return | boolean | True if the transaction is a deployment transaction |
isExecute
Returns true if the transaction is an execution transaction.
isExecute() ► boolean
| Parameters | Type | Description |
|---|---|---|
| return | boolean | True if the transaction is an execution transaction |
isFee
Returns true if the transaction is a fee transaction.
isFee() ► boolean
| Parameters | Type | Description |
|---|---|---|
| return | boolean | True if the transaction is a fee transaction |
deployedProgram
Returns the program deployed within the transaction if the transaction is a deployment transaction.
deployedProgram() ► Program
| Parameters | Type | Description |
|---|---|---|
| return | Program | The program deployed within the transaction. |
execution
Returns the execution within the transaction (if present).
execution() ► Execution
| Parameters | Type | Description |
|---|---|---|
| return | Execution | The execution within the transaction. |
ownedRecords
Get the record plaintext present in a transaction owned by a specific view key.
ownedRecords(view_key) ► Array.<RecordPlaintext>
| Parameters | Type | Description |
|---|---|---|
| view_key | ViewKey | View key used to decrypt the ciphertext |
| return | Array.<RecordPlaintext> | Array of record plaintext objects |
records
Get the records present in a transaction and their commitments.
records() ► Array.<{commitment: Field, record: RecordCiphertext}>
| Parameters | Type | Description |
|---|---|---|
| return | Array.<{commitment: Field, record: RecordCiphertext}> | Array of record ciphertext objects |
summary
Get a summary of the transaction within a javascript object.
If the transaction is an execution transaction, this function will return a list of the transitions and their inputs and outputs.
If the transaction is a deployment transaction, this function will return the program id and a list of the functions and their verifying keys, constraint, and variable counts.
summary(convert_to_js) ► Object
| Parameters | Type | Description |
|---|---|---|
| convert_to_js | boolean | *If true the inputs and outputs will be converted to JS objects, |
| if false the inputs and outputs will be in wasm format.* | ||
| return | Object | Transaction summary |
id
Get the id of the transaction. This is the merkle root of the transactions inclusion proof.
This value can be used to query the status of the transaction on the Aleo Network to see if it was successful. If successful, the transaction will be included in a block and this value can be used to lookup the transaction data on-chain.
id() ► string
| Parameters | Type | Description |
|---|---|---|
| return | string | TransactionId |
transactionType
Get the type of the transaction (will return "deploy" or "execute")
transactionType() ► string
| Parameters | Type | Description |
|---|---|---|
| return | string | Transaction type |
transitions
Get the transitions in a transaction.
transitions() ► Array.<Transition>
| Parameters | Type | Description |
|---|---|---|
| return | Array.<Transition> | Array of transition objects |
verifyingKeys
Get the verifying keys in a transaction.
verifyingKeys() ► Array.<Object>
| Parameters | Type | Description |
|---|---|---|
| return | Array.<Object> | Array of verifying keys. |