gitiumiota
Version:
IOTA Client Reference Implementation
101 lines (60 loc) • 2.41 kB
Markdown
Utilities and validators for transactions.
Install using [npm](https://www.npmjs.org/):
```
npm install @iota/transaction
```
or using [yarn](https://yarnpkg.com/):
```
yarn add @iota/transaction
```
* [transaction](
* [~transactionHash(trits)](
* [~isTransaction(tx)](
* [~isTailTransaction(transaction)](
* [~isTransactionHash(hash, mwm)](
* [~isTransactionTrytes(trytes, minWeightMagnitude)](
* [~isAttachedTrytes(trytes)](
<a name="module_transaction..transactionHash"></a>
| Param | Type | Description |
| --- | --- | --- |
| trits | <code>Int8Array</code> | Int8Array of 8019 transaction trits |
Calculates the transaction hash out of 8019 transaction trits.
**Returns**: <code>Hash</code> - Transaction hash
<a name="module_transaction..isTransaction"></a>
| Param | Type |
| --- | --- |
| tx | <code>object</code> |
Checks if input is valid transaction object.
<a name="module_transaction..isTailTransaction"></a>
| Param | Type |
| --- | --- |
| transaction | <code>object</code> |
Checks if given transaction object is tail transaction.
A tail transaction is one with `currentIndex=0`.
<a name="module_transaction..isTransactionHash"></a>
| Param | Type |
| --- | --- |
| hash | <code>string</code> |
| mwm | <code>number</code> |
Checks if input is correct transaction hash (81 trytes)
<a name="module_transaction..isTransactionTrytes"></a>
| Param | Type |
| --- | --- |
| trytes | <code>string</code> |
| minWeightMagnitude | <code>number</code> |
Checks if input is correct transaction trytes (2673 trytes)
<a name="module_transaction..isAttachedTrytes"></a>
| Param | Type |
| --- | --- |
| trytes | <code>string</code> |
Checks if input is valid attached transaction trytes.
For attached transactions last 241 trytes are non-zero.