fix: withdrawal idb store

This commit is contained in:
Danil Kovtonyuk 2022-06-14 18:56:36 +10:00
parent dce468cace
commit c7d1a5cb8e
4 changed files with 17 additions and 20 deletions

View file

@ -26,7 +26,7 @@ class EventService {
getStoreNames(type) {
const instanceName = `${type}s_${this.currency}_${this.amount}`
const storeName = type === eventsType.DEPOSIT ? `${instanceName}_${this.netId}` : `${type}s_${this.netId}`
const storeName = `${instanceName}_${this.netId}`
return { instanceName, storeName }
}
@ -338,9 +338,6 @@ class EventService {
await this.idb.createMultipleTransactions({
data: events,
index: {
instance: instanceName
},
storeName
})

View file

@ -147,9 +147,11 @@ async function getAllDeposits({ currency, amount, fromBlock, netId }) {
const lastSyncBlock = await getMeta({ netId })
const data = deposits.map((e) => ({
...e,
timestamp: e.timestamp,
commitment: e.commitment,
leafIndex: Number(e.index),
blockNumber: Number(e.blockNumber)
blockNumber: Number(e.blockNumber),
transactionHash: e.transactionHash
}))
const [lastEvent] = data.slice(-1)
@ -270,10 +272,12 @@ async function getAllWithdrawals({ currency, amount, fromBlock, netId }) {
const lastSyncBlock = await getMeta({ netId })
const data = withdrawals.map((e) => ({
...e,
to: e.to,
fee: e.fee,
timestamp: e.timestamp,
nullifierHash: e.nullifier,
leafIndex: Number(e.index),
blockNumber: Number(e.blockNumber)
blockNumber: Number(e.blockNumber),
transactionHash: e.transactionHash
}))
const [lastEvent] = data.slice(-1)

View file

@ -16,10 +16,8 @@ export const GET_WITHDRAWALS = `
amount: $amount,
blockNumber_gte: $fromBlock
}) {
id
to
fee
index
nullifier
timestamp
blockNumber
@ -48,7 +46,6 @@ export const GET_DEPOSITS = `
currency: $currency,
blockNumber_gte: $fromBlock
}) {
id
index
timestamp
commitment