Class: TransactionHelper
Helper methods for Transactions.
Table of contents
Properties
Methods
- calculateBlockId
- outputIdFromTransactionData
- getTransactionEssenceHash
- getTransactionPayloadHash
- inputFromOutputId
- getInputsCommitment
- getStorageDeposit
- resolveIdFromOutputId
- constructTokenId
- networkIdFromNetworkName
Constructors
Properties
CONFIRMED_MILESTONE_INDEX_LENGTH
▪ Static
CONFIRMED_MILESTONE_INDEX_LENGTH: number
= 4
The confirmed milestone index length.
CONFIRMED_UINIX_TIMESTAMP_LENGTH
▪ Static
CONFIRMED_UINIX_TIMESTAMP_LENGTH: number
= 4
The confirmed unix timestamp length.
OUTPUT_ID_LENGTH
▪ Static
OUTPUT_ID_LENGTH: number
= 34
The output Id length.
Methods
calculateBlockId
▸ Static
calculateBlockId(block
): string
Calculate blockId from a block.
Parameters
Name | Type | Description |
---|---|---|
block | IBlock | The block. |
Returns
string
The blockId.
outputIdFromTransactionData
▸ Static
outputIdFromTransactionData(transactionId
, outputIndex
): string
Returns the outputId from transation id and output index.
Parameters
Name | Type | Description |
---|---|---|
transactionId | string | The id of the transaction. |
outputIndex | number | The index of the output. |
Returns
string
The output id.
getTransactionEssenceHash
▸ Static
getTransactionEssenceHash(essence
): Uint8Array
Calculate the Transaction Essence hash.
Parameters
Name | Type | Description |
---|---|---|
essence | ITransactionEssence | The transaction essence. |
Returns
Uint8Array
The transaction essence hash.
getTransactionPayloadHash
▸ Static
getTransactionPayloadHash(transactionPayload
): Uint8Array
Calculate the Transaction hash.
Parameters
Name | Type | Description |
---|---|---|
transactionPayload | ITransactionPayload | The payload of the transaction. |
Returns
Uint8Array
The transaction hash.
inputFromOutputId
▸ Static
inputFromOutputId(outputId
): IUTXOInput
Calculate the UTXO input from an output Id.
Parameters
Name | Type | Description |
---|---|---|
outputId | string | The id of the output. |
Returns
The UTXO Input.
getInputsCommitment
▸ Static
getInputsCommitment(inputs
): string
Calculate the inputCommitment from the output objects that are used as inputs to fund the transaction.
Parameters
Name | Type | Description |
---|---|---|
inputs | OutputTypes [] | The output objects used as inputs for the transaction. |
Returns
string
The inputs commitment.
getStorageDeposit
▸ Static
getStorageDeposit(output
, rentStructure
): number
Calculates the required storage deposit of an output.
Parameters
Name | Type | Description |
---|---|---|
output | OutputTypes | The output. |
rentStructure | IRent | Rent cost of objects which take node resources. |
Returns
number
The required storage deposit.
resolveIdFromOutputId
▸ Static
resolveIdFromOutputId(outputId
): string
Returns the nftId/aliasId from an outputId. NftId/aliasId is Blake2b-256 hash of the outputId that created it.
Parameters
Name | Type | Description |
---|---|---|
outputId | string | The id of the output. |
Returns
string
The resolved Nft id or Alias id.
constructTokenId
▸ Static
constructTokenId(aliasId
, serialNumber
, tokenSchemeType
): string
Constructs a tokenId from the aliasId, serial number and token scheme type.
Parameters
Name | Type | Description |
---|---|---|
aliasId | string | The alias Id of the alias that controls the foundry. |
serialNumber | number | The serial number of the foundry. |
tokenSchemeType | number | The tokenSchemeType of the foundry. |
Returns
string
The tokenId.
networkIdFromNetworkName
▸ Static
networkIdFromNetworkName(networkName
): string
Calculates the networkId value from the network name.
Parameters
Name | Type | Description |
---|---|---|
networkName | string | The name of the network. |
Returns
string
The networkId.
Constructors
constructor
• new TransactionHelper()