Constructor
new BlocksProvider(configuration)
Parameters:
Name |
Type |
Description |
configuration |
object
|
Properties
Name |
Type |
Attributes |
Default |
Description |
api |
ApiPromise
|
<optional>
|
|
|
cacheCapacity |
boolean
|
<optional>
|
100
|
|
finalized |
boolean
|
<optional>
|
false
|
|
|
- Source:
Classes
- BlocksProvider
Methods
(async) blockByHash(hash) → {Promise.<SignedBlockExtended>}
Retrieves blocks by hash from either the local cache or by querying the node.
Parameters:
Name |
Type |
Description |
hash |
BlockHash
|
string
|
|
- Source:
Returns:
-
Type
-
Promise.<SignedBlockExtended>
(async) blockByNumber(numberOrBlockNumber, configurationopt) → {Promise.<SignedBlockExtended>}
Retrieves blocks by number from either the local cache or by querying the node.
This function will check that the provided block number is less than the latest known
(best or finalized depending on the `finalized` flag).
Parameters:
Name |
Type |
Attributes |
Default |
Description |
numberOrBlockNumber |
BlockNumber
|
number
|
|
|
|
configuration |
object
|
<optional>
|
{}
|
Properties
Name |
Type |
Attributes |
Default |
Description |
skipCheck |
boolean
|
<optional>
|
false
|
forces number check to be skipped. |
|
- Source:
Returns:
-
Type
-
Promise.<SignedBlockExtended>
(async) lastHash() → {Promise.<BlockHash>}
Returns the latest available hash for the block (finalized if `finalized=true`).
- Source:
Returns:
-
Type
-
Promise.<BlockHash>
(async) lastNumber() → {Promise.<BlockNumber>}
Returns the latest available number for the block (finalized if `finalized=true`).
- Source:
Returns:
-
Type
-
Promise.<BlockNumber>