Skip to content

Provider class

Provider connects Koilib to a Koinos JSON-RPC endpoint. Read calls such as getHeadInfo() do not require an account or mana.

export async function readHead(provider = new Provider(MAINNET_RPC)) {
  const head = await provider.getHeadInfo();
  return head.head_topology;
}

View complete file · Run example

The complete example reads the current mainnet height.