<html>
<head>
<title>Lotus: Chain Head</title>
</head>
<body>
<h3>ChainHead</h3>
Height: <span id='height'></span>
<script type="module" src="./script.js"></script>
</body>
</html>
import { LotusRPC } from 'https://unpkg.com/@filecoin-shipyard/lotus-client-rpc?module'
import { BrowserProvider } from 'https://unpkg.com/@filecoin-shipyard/lotus-client-provider-browser?module'
import { testnet } from 'https://unpkg.com/@filecoin-shipyard/lotus-client-schema?module'
const wsUrl = 'wss://lotus.testground.ipfs.team/api/0/node/rpc/v0'
const provider = new BrowserProvider(wsUrl)
const client = new LotusRPC(provider, { schema: testnet.fullNode })
setInterval(async () => {
const result = await client.chainHead()
document.querySelector('#height').textContent = result.Height
}, 1000)