Blockchain

How to get a Block by Height

import {BlockHttp, NEMLibrary, NetworkTypes} from "nem-library";

// Initialize NEMLibrary for TEST_NET Network
NEMLibrary.bootstrap(NetworkTypes.TEST_NET);

const blockHttp = new BlockHttp();
blockHttp.getBlockByHeight(1033023).subscribe(block => {
    console.log(block);
});

Source code

How to get Last block of the blockchain

import {ChainHttp, NEMLibrary, NetworkTypes} from "nem-library";

// Initialize NEMLibrary for TEST_NET Network
NEMLibrary.bootstrap(NetworkTypes.TEST_NET);

const chainHttp = new ChainHttp();
chainHttp.getBlockchainLastBlock().subscribe(block => {
    console.log(block);
});

Source code