All phases of Avail's unification drop have now ended, 👉👉 check out this page 👈👈 for more information.

API reference
Fetch information on the active era

Fetch information on the active era

On-chain name of method: staking_activeEra

Parameters

  • None

Returns

  • index: The index of the active era
  • start: The timestamp when the active era started

Minimal example (Fetch the active era)

  1. Inside your-file-name.ts, add the following code:
avail-deno
import { SDK } from "https://raw.githubusercontent.com/availproject/avail/main/avail-deno/src/sdk.ts";
 
const providerEndpoint = "wss://turing-rpc.avail.so/ws";
const sdk = await SDK.New(providerEndpoint);
 
const value = await sdk.api.query.staking.activeEra();
console.log(value.toHuman());
 
Deno.exit();
  1. Run the code using:
deno run --allow-net your-file-name.ts

Sample Response:
{ 
    index: "174", 
    start: "1,726,523,440,000" 
}