Skip to content

Commit

Permalink
persisting data to indexeddb
Browse files Browse the repository at this point in the history
  • Loading branch information
bokkypoobah committed Aug 17, 2024
1 parent 1f69ce9 commit 8d09a15
Showing 1 changed file with 26 additions and 12 deletions.
38 changes: 26 additions & 12 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ <h6 class="mt-4">Troubleshooting</h6>
name: null,
decimals: null,
totalSupply: null,
description: null,
// description: null,
events: [],
tokens: [],
approvalForAlls: [],
Expand Down Expand Up @@ -1668,16 +1668,30 @@ <h6 class="mt-4">Troubleshooting</h6>
}
}
}
if (this.type == 20) {
this.description = "ERC-20 " + this.symbol + " " + this.name + " " + this.decimals + " " + this.formatDecimals(this.totalSupply, this.decimals);
} else if (this.type == 721) {
this.description = "ERC-721 " + this.symbol;
} else if (this.type == 1155) {
this.description = "ERC-1155";
} else {
this.description = "Not a token contract";
}
console.log(now() + " retrieveEvents - this.description: " + this.description);
// if (this.type == 20) {
// this.description = "ERC-20 " + this.symbol + " " + this.name + " " + this.decimals + " " + this.formatDecimals(this.totalSupply, this.decimals);
// } else if (this.type == 721) {
// this.description = "ERC-721 " + this.symbol;
// } else if (this.type == 1155) {
// this.description = "ERC-1155";
// } else {
// this.description = "Not a token contract";
// }
// console.log(now() + " retrieveEvents - this.description: " + this.description);
const record = {
chainId: this.chainId,
contract: this.settings.contract,
type: this.type,
symbol: this.symbol,
name: this.name,
decimals: this.decimals,
totalSupply: this.totalSupply,
};
// console.log(now() + " retrieveEvents - record: " + JSON.stringify(record));
await db.contracts.put(record).then(function() {
}).catch(function(e) {
console.log(now() + " ERROR retrieveMetadata - put: " + e.message);
});

// Retrieve Event Logs
const events = [];
Expand Down Expand Up @@ -2025,7 +2039,7 @@ <h6 class="mt-4">Troubleshooting</h6>
}
for (let record of data.tokens) {
const token = parseReservoirTokenData(record);
console.log(JSON.stringify(token));
// console.log(JSON.stringify(token));
if (!(this.settings.contract in metadata)) {
metadata[this.settings.contract] = {
type: parseInt(token.type.substring(3)),
Expand Down

0 comments on commit 8d09a15

Please sign in to comment.