blog/source/_posts/2020-02-11-subspace-1-3.md

1.6 KiB

title: Subspace 1.3 author: richard_ramos summary: "Subspace 1.3 release - new track methods trackBlock, trackBlockNumber, trackGasPrice, trackAverageBlocktime" categories:

  • announcements
  • releases
  • subspace layout: blog-post

Subspace 1.3

New to subspace? Check out the website at http://subspace.embarklabs.io/

New methods available to track blocks, gas price and blocktime

trackBlock()

Returns the block information for any new block as soon as they are mined. It's the reactive equivalent to web3.eth.getBlock("latest").

subspace.trackBlock().subscribe(block => console.log(block));

trackBlockNumber()

Returns the latest block number. It's the reactive equivalent to web3.eth.getBlockNumber.

subspace.trackBlockNumber().subscribe(blockNumber => console.log(blockNumber));

trackGasPrice()

Returns the current gas price oracle. It's the reactive equivalent to web3.eth.getGasPrice.

subspace.trackGasPrice().subscribe(gasPrice => console.log(gasPrice));

trackAverageBlocktime()

Returns the moving average block time taking in account the latest 10 blocks. The time is returned in milliseconds:

subspace.trackAverageBlocktime().subscribe(blocktimeMS => console.log(blocktimeMS));

Bug fixes

  • Web3 subscriptions are reused, which means that calling a track method with the same parameters more than once will not create a duplicate subscription.

Contributions

Subspace and the entire Embark labs organization are open source. As such we welcome contributions and input from the community using the product.