From 0bc52aed2ce9596245e922312e0727934de42e9e Mon Sep 17 00:00:00 2001 From: BokkyPooBah Date: Fri, 2 Aug 2024 14:28:13 +1000 Subject: [PATCH] tidy --- docs/data.js | 44 ++++++++++++++++++++--------------------- docs/syncOptions.js | 16 +++++++-------- docs/viewNonFungible.js | 2 +- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/docs/data.js b/docs/data.js index 94fd30b..bc85c72 100644 --- a/docs/data.js +++ b/docs/data.js @@ -947,12 +947,6 @@ const dataModule = { if ((options.tokens || options.selectedContract) && !options.devThing) { await context.dispatch('syncTokenEvents', parameter); } - if (options.timestamps && !options.devThing) { - await context.dispatch('syncTokenEventTimestamps', parameter); - } - if (options.txData && !options.devThing) { - await context.dispatch('syncTokenEventTxData', parameter); - } if ((options.tokens || options.fungiblesMetadata || options.nonFungiblesMetadata || options.selectedContract) && !options.devThing) { await context.dispatch('computeBalances', parameter); await context.dispatch('computeApprovals', parameter); @@ -962,8 +956,8 @@ const dataModule = { await context.dispatch('computeApprovals', parameter); } - if (options.ensExpiries && chainId == 1 && !options.devThing) { - await context.dispatch('syncENSExpiries', parameter); + if (options.ensEvents && chainId == 1 && !options.devThing) { + await context.dispatch('syncENSEvents', parameter); } if (options.fungiblesMetadata && !options.devThing) { @@ -974,7 +968,13 @@ const dataModule = { // await context.dispatch('syncNonFungiblesMetadata', parameter); } if (options.ens && chainId == 1 && !options.devThing) { - await context.dispatch('syncENS', parameter); + await context.dispatch('syncReverseENS', parameter); + } + if (options.timestamps && !options.devThing) { + await context.dispatch('syncTokenEventTimestamps', parameter); + } + if (options.txData && !options.devThing) { + await context.dispatch('syncTokenEventTxData', parameter); } await context.dispatch('collateNames', parameter); @@ -1914,8 +1914,8 @@ const dataModule = { console.log(now() + " INFO dataModule:actions.computeApprovals END"); }, - async syncENSExpiries(context, parameter) { - console.log(now() + " INFO dataModule:actions.syncENSExpiries: " + JSON.stringify(parameter)); + async syncENSEvents(context, parameter) { + console.log(now() + " INFO dataModule:actions.syncENSEvents: " + JSON.stringify(parameter)); const db = new Dexie(context.state.db.name); db.version(context.state.db.version).stores(context.state.db.schemaDefinition); const provider = new ethers.providers.Web3Provider(window.ethereum); @@ -1929,7 +1929,7 @@ const dataModule = { async function processLogs(logs) { total = parseInt(total) + logs.length; context.commit('setSyncCompleted', total); - console.log(now() + " INFO dataModule:actions.syncENSExpiries.processLogs - logs.length: " + logs.length + ", total: " + total); + console.log(now() + " INFO dataModule:actions.syncENSEvents.processLogs - logs.length: " + logs.length + ", total: " + total); const records = []; for (const log of logs) { if (!log.removed) { @@ -1976,14 +1976,14 @@ const dataModule = { mapERC721ToERC1155[labelhashDecimals] = namehashDecimals; } } else { - console.log(now() + " INFO dataModule:actions.syncENSExpiries.processLogs - NOT HANDLED: " + JSON.stringify(log)); + console.log(now() + " INFO dataModule:actions.syncENSEvents.processLogs - NOT HANDLED: " + JSON.stringify(log)); } if (eventRecord) { let remapToERC1155 = null; if (eventRecord.type == "NameRegistered" || eventRecord.type == "NameRenewed") { if (eventRecord.tokenId in mapERC721ToERC1155) { remapToERC1155 = mapERC721ToERC1155[eventRecord.tokenId]; - console.log(now() + " INFO dataModule:actions.syncENSExpiries.processLogs - Remapping ERC-721 to ERC-1155: " + eventRecord.tokenId + " to " + remapToERC1155); + console.log(now() + " INFO dataModule:actions.syncENSEvents.processLogs - Remapping ERC-721 to ERC-1155: " + eventRecord.tokenId + " to " + remapToERC1155); } } if (remapToERC1155) { @@ -2003,7 +2003,7 @@ const dataModule = { } } - console.log(now() + " INFO dataModule:actions.syncENSExpiries BEGIN"); + console.log(now() + " INFO dataModule:actions.syncENSEvents BEGIN"); const ens721TokenIds = []; const ens1155TokenIds = []; for (const [contract, contractData] of Object.entries(context.state.balances[parameter.chainId] || {})) { @@ -2026,7 +2026,7 @@ const dataModule = { // console.log("ens1155TokenIds: " + JSON.stringify(ens1155TokenIds)); // return; const BATCHSIZE = 100; - context.commit('setSyncSection', { section: 'ENS Expiries', total: null }); + context.commit('setSyncSection', { section: 'ENS Events', total: null }); context.commit('setSyncCompleted', 0); // ERC-1155 portraits.eth 27727362303445643037535452095569739813950020376856883309402147522300287323280 @@ -2046,7 +2046,7 @@ const dataModule = { const logs = await provider.getLogs({ address: null, fromBlock: 0, toBlock: parameter.blockNumber, topics }); await processLogs(logs); } catch (e) { - console.log(now() + " INFO dataModule:actions.syncENSExpiries - getLogs ERROR: " + e.message); + console.log(now() + " INFO dataModule:actions.syncENSEvents - getLogs ERROR: " + e.message); } } @@ -2069,12 +2069,12 @@ const dataModule = { const logs = await provider.getLogs({ address: null, fromBlock: 0, toBlock: parameter.blockNumber, topics }); await processLogs(logs); } catch (e) { - console.log(now() + " INFO dataModule:actions.syncENSExpiries - getLogs ERROR: " + e.message); + console.log(now() + " INFO dataModule:actions.syncENSEvents - getLogs ERROR: " + e.message); } } await context.dispatch('saveData', ['expiries']); - console.log(now() + " INFO dataModule:actions.syncENSExpiries END"); + console.log(now() + " INFO dataModule:actions.syncENSEvents END"); }, async syncFungiblesMetadata(context, parameter) { @@ -2467,8 +2467,8 @@ const dataModule = { console.log(now() + " INFO dataModule:actions.syncNonFungiblesMetadataFromReservoir END"); }, - async syncENS(context, parameter) { - console.log(now() + " INFO dataModule:actions.syncENS BEGIN: " + JSON.stringify(parameter)); + async syncReverseENS(context, parameter) { + console.log(now() + " INFO dataModule:actions.syncReverseENS BEGIN: " + JSON.stringify(parameter)); const db = new Dexie(context.state.db.name); db.version(context.state.db.version).stores(context.state.db.schemaDefinition); const provider = new ethers.providers.Web3Provider(window.ethereum); @@ -2478,7 +2478,7 @@ const dataModule = { owners[address] = true; } } - console.log(now() + " INFO dataModule:actions.syncENS - owners: " + JSON.stringify(owners)); + console.log(now() + " INFO dataModule:actions.syncReverseENS - owners: " + JSON.stringify(owners)); context.commit('setSyncSection', { section: "ENS", total: Object.keys(owners).length }); let completed = 0; const ensReverseRecordsContract = new ethers.Contract(ENSREVERSERECORDSADDRESS, ENSREVERSERECORDSABI, provider); diff --git a/docs/syncOptions.js b/docs/syncOptions.js index dc6488d..ac647eb 100644 --- a/docs/syncOptions.js +++ b/docs/syncOptions.js @@ -15,17 +15,17 @@ const SyncOptions = { Token Transfers + + ENS Events (Mainnet) + Fungibles Metadata Non-Fungibles Metadata - - ENS Expiries - - - ENS Names on ETH Mainnet + + Reverse ENS Names (Mainnet) TODO: Exchange Rates @@ -55,16 +55,16 @@ const SyncOptions = { stealthMetaAddressRegistry: true, ethers: true, tokens: true, + ensEvents: true, fungiblesMetadata: true, nonFungiblesMetadata: true, - ensExpiries: true, ens: true, exchangeRates: true, // incrementalSync: true, timestamps: true, txData: true, devThing: false, - version: 2, + version: 3, }, } }, @@ -104,9 +104,9 @@ const SyncOptions = { stealthMetaAddressRegistry: this.settings.stealthMetaAddressRegistry, ethers: this.settings.ethers, tokens: this.settings.tokens, + ensEvents: this.settings.ensEvents, fungiblesMetadata: this.settings.fungiblesMetadata, nonFungiblesMetadata: this.settings.nonFungiblesMetadata, - ensExpiries: this.settings.ensExpiries, ens: this.settings.ens, exchangeRates: this.settings.exchangeRates, // incrementalSync: this.settings.incrementalSync, diff --git a/docs/viewNonFungible.js b/docs/viewNonFungible.js index ff6cc22..c1b3c16 100644 --- a/docs/viewNonFungible.js +++ b/docs/viewNonFungible.js @@ -649,7 +649,7 @@ const viewNonFungibleModule = { const logs = await provider.getLogs({ address: null, fromBlock, toBlock, topics }); // console.log(now() + " INFO viewNonFungibleModule:actions.loadENSEvents - logs: " + JSON.stringify(logs, null, 2)); const events = parseEventLogs(logs, chainId, toBlock); - console.log(now() + " INFO viewNonFungibleModule:actions.loadENSEvents - events: " + JSON.stringify(events, null, 2)); + // console.log(now() + " INFO viewNonFungibleModule:actions.loadENSEvents - events: " + JSON.stringify(events, null, 2)); await context.commit('addEvents', events); } catch (e) { console.log(now() + " INFO viewNonFungibleModule:actions.loadENSEvents.getLogs - ERROR fromBlock: " + fromBlock + ", toBlock: " + toBlock + " " + e.message);