@onflow/sdk-latest-block

Flow JS SDK -- Fetch the Latest Block from the Configured Access Node

Usage no npm install needed!

<script type="module">
  import onflowSdkLatestBlock from 'https://cdn.skypack.dev/@onflow/sdk-latest-block';
</script>

README

sdk-latest-block

Fetch the Latest Block from the configured Access Node

import {config} from "@onflow/config"
import {latestBlock} from "@onflow/sdk-latest-block"

config()
  .put("accessNode.api", "https://access-testnet.onflow.org") // point the sdk to the desired access node

var block = await latestBlock()

console.log("id", block.id)              // The blocks ID
console.log("height", block.height)      // The blocks Height
console.log("parent id", block.parentId) // ID of the blocks parent