fix: event service

This commit is contained in:
Danil Kovtonyuk 2022-07-05 18:29:31 +10:00
parent 56a6835d80
commit d36b1a9866
No known key found for this signature in database
GPG key ID: E72A919BF08C3746
3 changed files with 26 additions and 10 deletions

View file

@ -270,19 +270,15 @@ const actions = {
async updateSelectEvents({ dispatch, commit, state, rootGetters, getters }) {
const netId = rootGetters['metamask/netId']
const { currency, amount } = state.selectedStatistic
const { deployedBlock } = networkConfig[`netId${netId}`]
const eventService = getters.eventsInterface.getService({ netId, amount, currency })
const savedEvents = await eventService.getEvents(eventsType.DEPOSIT)
const fromBlock = savedEvents?.lastBlock || deployedBlock
const graphEvents = await eventService.getEventsFromGraph({ fromBlock, methodName: 'getStatistic' })
const graphEvents = await eventService.getEventsFromGraph({ methodName: 'getStatistic' })
let statistic = graphEvents?.events
if (!statistic || !statistic.length) {
const fresh = await eventService.getStatisticsRpc({ fromBlock, eventsCount: 10 })
const fresh = await eventService.getStatisticsRpc({ eventsCount: 10 })
statistic = fresh || []
}