MinedBlock
An Interface to indicate a Block has been included in the blockchain. This asserts a Type Guard that necessary properties are non-null.
Before a block is included, it is a pending block.
Extends
Properties
Property | Modifier | Type | Description | Inherited from |
---|---|---|---|---|
provider | readonly | Provider | The provider connected to the block used to fetch additional details if necessary. | Block .provider |
Accessors
date
The Date this block was included at.
Returns
null
| Date
The date this block was included at, or null if the timestamp is not available.
Source
length
The number of transactions in this block.
Returns
number
The number of transactions.
Source
outboundEtxs
Returns the list of extended transaction hashes, in the order they were executed within the block.
Returns
readonly string
[]
The list of extended transaction hashes.
Source
prefetchedExtTransactions
Returns the complete extended transactions, in the order they were executed within the block.
This is only available for blocks which prefetched transactions, by passing true
to prefetchTxs
into
getBlock.
Throws
If the transactions were not prefetched.
Returns
ExternalTransactionResponse
[]
The list of prefetched extended transactions.
Source
prefetchedTransactions
Returns the complete transactions, in the order they were executed within the block.
This is only available for blocks which prefetched transactions, by passing true
to prefetchTxs
into
getBlock.
Throws
If the transactions were not prefetched.
Returns
The list of prefetched transactions.
Source
transactions
Returns the list of transaction hashes, in the order they were executed within the block.
Returns
readonly string
[]
The list of transaction hashes.
Source
Methods
getExtTransaction()
Get the extended transaction at index
within this block.
Parameters
Parameter | Type | Description |
---|---|---|
indexOrHash | string | number | The index or hash of the extended transaction. |
Returns
Promise
<ExternalTransactionResponse
>
A promise resolving to the extended transaction.
Inherited from
Throws
If the extended transaction is not found.
Source
getPrefetchedTransaction()
If a Block was fetched with a request to include the transactions this will allow synchronous access to those transactions.
If the transactions were not prefetched, this will throw.
Parameters
Parameter | Type | Description |
---|---|---|
indexOrHash | string | number | The index or hash of the transaction. |
Returns
The transaction.
Inherited from
Block
.getPrefetchedTransaction
Throws
If the transaction is not found.
Source
getTransaction()
Get the transaction at index
within this block.
Parameters
Parameter | Type | Description |
---|---|---|
indexOrHash | string | number | The index or hash of the transaction. |
Returns
Promise
<TransactionResponse
| ExternalTransactionResponse
>
A promise resolving to the transaction.
Inherited from
Throws
If the transaction is not found.
Source
isMined()
Returns true if this block been mined. This provides a type guard for all properties on a MinedBlock.
Returns
this is MinedBlock
True if the block has been mined.
Inherited from
Source
toJSON()
Returns a JSON-friendly value.
Returns
The JSON-friendly value.