forked from tornadocash/classic-ui
hopefully fix rest of issues with netId addition
Signed-off-by: AlienTornadosaurusHex <>
This commit is contained in:
parent
2cc751f9d2
commit
62f079608e
@ -25,7 +25,7 @@ export async function _encryptFormatTx({ dispatch, getters, rootGetters }, { eve
|
|||||||
if (!instance) {
|
if (!instance) {
|
||||||
return acc
|
return acc
|
||||||
}
|
}
|
||||||
const name = `${instance.amount}${instance.currency}`
|
const name = `${netId}${instance.amount}${instance.currency}`
|
||||||
if (!acc[name]) {
|
if (!acc[name]) {
|
||||||
const service = eventsInterface.getService({ netId, ...instance })
|
const service = eventsInterface.getService({ netId, ...instance })
|
||||||
acc[name] = { ...instance, service }
|
acc[name] = { ...instance, service }
|
||||||
@ -49,7 +49,7 @@ export async function _encryptFormatTx({ dispatch, getters, rootGetters }, { eve
|
|||||||
if (!instance) {
|
if (!instance) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const { service } = instances[`${instance.amount}${instance.currency}`]
|
const { service } = instances[`${netId}${instance.amount}${instance.currency}`]
|
||||||
return getDeposit({ event, netId, service, instance })
|
return getDeposit({ event, netId, service, instance })
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ async function saveEncryptedNote(netId) {
|
|||||||
let encryptedEvents = []
|
let encryptedEvents = []
|
||||||
const name = `encrypted_notes_${netId}.json`
|
const name = `encrypted_notes_${netId}.json`
|
||||||
|
|
||||||
const cachedEvents = await loadCachedEvents({
|
const cachedEvents = loadCachedEvents({
|
||||||
name,
|
name,
|
||||||
directory: EVENTS_PATH,
|
directory: EVENTS_PATH,
|
||||||
deployedBlock: constants.ENCRYPTED_NOTES_BLOCK
|
deployedBlock: constants.ENCRYPTED_NOTES_BLOCK
|
||||||
|
@ -78,7 +78,7 @@ async function createTree(netId) {
|
|||||||
|
|
||||||
console.log('createTree', { type, instance })
|
console.log('createTree', { type, instance })
|
||||||
|
|
||||||
const { events } = await loadCachedEvents({
|
const { events } = loadCachedEvents({
|
||||||
name: `${type}s_${netId}_${nativeCurrency}_${instance}.json`,
|
name: `${type}s_${netId}_${nativeCurrency}_${instance}.json`,
|
||||||
directory: EVENTS_PATH,
|
directory: EVENTS_PATH,
|
||||||
deployedBlock
|
deployedBlock
|
||||||
|
@ -464,7 +464,7 @@ class EventsFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getService = (payload) => {
|
getService = (payload) => {
|
||||||
const instanceName = `${payload.currency}_${payload.amount}`
|
const instanceName = `${payload.netId}_${payload.currency}_${payload.amount}`
|
||||||
|
|
||||||
if (this.instances.has(instanceName)) {
|
if (this.instances.has(instanceName)) {
|
||||||
return this.instances.get(instanceName)
|
return this.instances.get(instanceName)
|
||||||
|
@ -186,7 +186,7 @@ class TreesFactory {
|
|||||||
instances = new Map()
|
instances = new Map()
|
||||||
|
|
||||||
getService = (payload) => {
|
getService = (payload) => {
|
||||||
const instanceName = `${payload.currency}_${payload.amount}`
|
const instanceName = `${payload.netId}_${payload.currency}_${payload.amount}`
|
||||||
if (this.instances.has(instanceName)) {
|
if (this.instances.has(instanceName)) {
|
||||||
return this.instances.get(instanceName)
|
return this.instances.get(instanceName)
|
||||||
}
|
}
|
||||||
|
@ -324,7 +324,7 @@ const actions = {
|
|||||||
lastBlock = await this.$indexedDB(netId).getFromIndex({
|
lastBlock = await this.$indexedDB(netId).getFromIndex({
|
||||||
indexName: 'name',
|
indexName: 'name',
|
||||||
storeName: 'lastEvents',
|
storeName: 'lastEvents',
|
||||||
key: `${type}s_${currency}_${amount}`
|
key: `${type}s_${netId}_${currency}_${amount}`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -661,7 +661,7 @@ const actions = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async buildTree({ dispatch }, { currency, amount, netId, commitmentHex }) {
|
async buildTree({ dispatch }, { currency, amount, netId, commitmentHex }) {
|
||||||
const treeInstanceName = `${currency}_${amount}`
|
const treeInstanceName = `${netId}_${currency}_${amount}`
|
||||||
const params = { netId, amount, currency }
|
const params = { netId, amount, currency }
|
||||||
|
|
||||||
const treeService = treesInterface.getService({
|
const treeService = treesInterface.getService({
|
||||||
|
@ -129,7 +129,7 @@ export const actions = {
|
|||||||
const instances = txs.reduce((acc, curr) => {
|
const instances = txs.reduce((acc, curr) => {
|
||||||
const [, currency, amount, netId] = curr.prefix.split('-')
|
const [, currency, amount, netId] = curr.prefix.split('-')
|
||||||
|
|
||||||
const name = `${amount}${currency}`
|
const name = `${netId}${amount}${currency}`
|
||||||
if (!acc[name]) {
|
if (!acc[name]) {
|
||||||
const service = eventsInterface.getService({ netId, amount, currency })
|
const service = eventsInterface.getService({ netId, amount, currency })
|
||||||
acc[name] = { currency, amount, netId, service }
|
acc[name] = { currency, amount, netId, service }
|
||||||
@ -161,7 +161,7 @@ export const actions = {
|
|||||||
txHash: tx.txHash,
|
txHash: tx.txHash,
|
||||||
type: eventsType.DEPOSIT,
|
type: eventsType.DEPOSIT,
|
||||||
commitment: tx.commitmentHex,
|
commitment: tx.commitmentHex,
|
||||||
service: instances[`${amount}${currency}`]
|
service: instances[`${netId}${amount}${currency}`]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -213,7 +213,7 @@ export const actions = {
|
|||||||
if (!tx.isSpent) {
|
if (!tx.isSpent) {
|
||||||
const { currency, amount, netId, nullifierHex } = parseNote(`${tx.prefix}-${tx.note}`)
|
const { currency, amount, netId, nullifierHex } = parseNote(`${tx.prefix}-${tx.note}`)
|
||||||
|
|
||||||
const isSpent = await instances[`${amount}${currency}`].service.findEvent({
|
const isSpent = await instances[`${netId}${amount}${currency}`].service.findEvent({
|
||||||
eventName: 'nullifierHash',
|
eventName: 'nullifierHash',
|
||||||
eventToFind: nullifierHex,
|
eventToFind: nullifierHex,
|
||||||
type: eventsType.WITHDRAWAL
|
type: eventsType.WITHDRAWAL
|
||||||
@ -364,7 +364,7 @@ export const actions = {
|
|||||||
if (tx && !tx.isSpent) {
|
if (tx && !tx.isSpent) {
|
||||||
const { currency, amount, netId, nullifierHex } = parseNote(`${tx.prefix}-${tx.note}`)
|
const { currency, amount, netId, nullifierHex } = parseNote(`${tx.prefix}-${tx.note}`)
|
||||||
|
|
||||||
const isSpent = await instances[`${amount}${currency}`].service.findEvent({
|
const isSpent = await instances[`${netId}${amount}${currency}`].service.findEvent({
|
||||||
eventName: 'nullifierHash',
|
eventName: 'nullifierHash',
|
||||||
eventToFind: nullifierHex,
|
eventToFind: nullifierHex,
|
||||||
type: eventsType.WITHDRAWAL
|
type: eventsType.WITHDRAWAL
|
||||||
|
Loading…
Reference in New Issue
Block a user