|
@@ -27,6 +27,7 @@ import axios from 'axios'
|
|
|
import moment from 'moment'
|
|
|
|
|
|
import { VoteKind } from '@joystream/types/proposals'
|
|
|
+import { EventRecord } from '@polkadot/types/interfaces'
|
|
|
import {
|
|
|
Api,
|
|
|
Handles,
|
|
@@ -107,21 +108,17 @@ const addBlock = async (
|
|
|
const getBlockHash = (api: Api, blockId: number) =>
|
|
|
api.rpc.chain.getBlockHash(blockId)
|
|
|
|
|
|
-interface BlockEvent {
|
|
|
- section: string
|
|
|
- method: string
|
|
|
- data: string
|
|
|
-}
|
|
|
-
|
|
|
const processEvents = async (api: Api, blockId: number) => {
|
|
|
const blockHash = await getBlockHash(api, blockId)
|
|
|
const blockEvents = await api.query.system.events.at(blockHash)
|
|
|
- blockEvents.forEach(({ section, method, data }: BlockEvent) => {
|
|
|
- console.log(`event`, section, method, data)
|
|
|
+ blockEvents.forEach(({ event }: EventRecord) => {
|
|
|
+ let { section, method, data } = event
|
|
|
Event.create({ blockId, section, method, data: JSON.stringify(data) })
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+const updateAccount = async (api: Api, account: string) => {}
|
|
|
+
|
|
|
const updateEra = async (api: Api, io: any, status: any, era: number) => {
|
|
|
const now: number = moment().valueOf()
|
|
|
if (lastUpdate + 60000 > now) return status
|