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

@ -39,7 +39,7 @@ class IndexedDB {
return
}
this.db = await openDB(this.dbName, 33, this.options) // version (optional): Schema version, or undefined to open the current version.
this.db = await openDB(this.dbName, 34, this.options) // version (optional): Schema version, or undefined to open the current version.
this.onEventHandler()
this.dbExists = true
@ -224,12 +224,10 @@ class IndexedDB {
export default async (ctx, inject) => {
const DEPOSIT_INDEXES = [
{ name: 'instance', unique: false },
{ name: 'transactionHash', unique: false },
{ name: 'commitment', unique: true }
]
const WITHDRAWAL_INDEXES = [
{ name: 'instance', unique: false },
{ name: 'nullifierHash', unique: true } // keys on which the index is created
]
const LAST_EVENT_INDEXES = [{ name: 'name', unique: false }]
@ -240,11 +238,6 @@ export default async (ctx, inject) => {
name: 'encrypted_events',
keyPath: 'transactionHash'
},
{
name: 'withdrawals',
keyPath: 'transactionHash',
indexes: WITHDRAWAL_INDEXES
},
{
name: 'lastEvents',
keyPath: 'name',
@ -289,6 +282,12 @@ export default async (ctx, inject) => {
indexes: DEPOSIT_INDEXES
})
stores.push({
name: `withdrawals_${token}_${amount}_${netId}`,
keyPath: 'transactionHash',
indexes: WITHDRAWAL_INDEXES
})
stores.push({
name: `stringify_tree_${token}_${amount}_${netId}`,
keyPath: 'hashTree'