📅  最后修改于: 2022-03-11 15:02:27.355000             🧑  作者: Mango
import { ApiRx } from '@polkadot/api';
// initialise via static create
const api = await ApiRx.create().toPromise();
// make a call to retrieve the current network head
api.rpc.chain.subscribeNewHeads().subscribe((header) => {
console.log(`Chain is at #${header.number}`);
});