For events (or any queries) at a specific point in the chain -
// Get an API decorated at a specific point. This will -
// - connect
// - retrieve the metadata
// - decorate the API based on what is available
// - make any state queries at that point
const at = await api.at(blockHash);
// any queries now made will be at that point
const events = await at.query.system.events();
Previously (it is now deprecated, but still available, i.e. not removed), you could also do await api.query.syste.events.at(blockHash)
. Internally this form would also use the api.at(blockHash)
detailed above. The api.at
form is preferred since it re-decorates the API at that runtime point, while the older form would assume the state endpoints are the same.