Subscribe to new Blocks
Just like subscribing to balance changes, this will trigger an event every time a new block is mined, and publish a state with the block number.
Setup
This action doesn't have any fields, just run it after the api was initialised.
Action - Unsubscribe from new Block event
After subscribing you can of course unsubscribe by running this action and receiving events about new blocks.
Event - New Block
This is the event that will be triggered every time a new block is mined.
State - Last Block Nr
In this state you will find the number of the latest block.
Demo
Find a demo on the polkadot api page. See the workflow folder Subscribe blocks
Last updated
Was this helpful?