Fetch information on the active era
On-chain name of method: staking_activeEra
Parameters
- None
Returns
index
: The index of the active erastart
: The timestamp when the active era started
Minimal example (Fetch the active era)
- 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();
- Run the code using:
deno run --allow-net your-file-name.ts
Sample Response:
{
index: "174",
start: "1,726,523,440,000"
}