Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
bokkypoobah committed Aug 2, 2024
1 parent cdc62d3 commit 0bc52ae
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 31 deletions.
44 changes: 22 additions & 22 deletions docs/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) {
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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] || {})) {
Expand All @@ -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
Expand All @@ -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);
}
}

Expand All @@ -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) {
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
16 changes: 8 additions & 8 deletions docs/syncOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ const SyncOptions = {
<b-form-checkbox size="sm" switch :disabled="settings.devThing" v-model="settings.tokens" @input="saveSettings" v-b-popover.hover.ds500="'ERC-20, ERC-721 and ERC-1155 token transfer events'" class="ml-2 mt-1">
Token Transfers
</b-form-checkbox>
<b-form-checkbox size="sm" switch :disabled="settings.devThing || chainId != 1" v-model="settings.ensEvents" @input="saveSettings" v-b-popover.hover.ds500="'ENS events, on ETH Mainnet only'" class="ml-2 mt-1">
ENS Events (Mainnet)
</b-form-checkbox>
<b-form-checkbox size="sm" switch :disabled="settings.devThing" v-model="settings.fungiblesMetadata" @input="saveSettings" v-b-popover.hover.ds500="'ERC-20 fungible token metadata'" class="ml-2 mt-1">
Fungibles Metadata
</b-form-checkbox>
<b-form-checkbox size="sm" switch :disabled="settings.devThing" v-model="settings.nonFungiblesMetadata" @input="saveSettings" v-b-popover.hover.ds500="'ERC-721 non-fungible token metadata'" class="ml-2 mt-1">
Non-Fungibles Metadata
</b-form-checkbox>
<b-form-checkbox size="sm" switch :disabled="settings.devThing || chainId != 1" v-model="settings.ensExpiries" @input="saveSettings" v-b-popover.hover.ds500="'ENS expiries'" class="ml-2 mt-1">
ENS Expiries
</b-form-checkbox>
<b-form-checkbox size="sm" switch :disabled="settings.devThing || chainId != 1" v-model="settings.ens" @input="saveSettings" class="ml-2 mt-1">
ENS Names on ETH Mainnet
<b-form-checkbox size="sm" switch :disabled="settings.devThing || chainId != 1" v-model="settings.ens" @input="saveSettings" v-b-popover.hover.ds500="'Reverse ENS names, on ETH Mainnet only'" class="ml-2 mt-1">
Reverse ENS Names (Mainnet)
</b-form-checkbox>
<b-form-checkbox v-if="false" size="sm" switch :disabled="true" v-model="settings.exchangeRates" @input="saveSettings" class="ml-2 mt-1">
TODO: Exchange Rates
Expand Down Expand Up @@ -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,
},
}
},
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion docs/viewNonFungible.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0bc52ae

Please sign in to comment.