Skip to content

Commit

Permalink
tool nonFungible modal wip
Browse files Browse the repository at this point in the history
  • Loading branch information
bokkypoobah committed Aug 14, 2024
1 parent 3f3b204 commit 48d19fe
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1581,15 +1581,17 @@ <h5 class="mt-3">Troubleshooting</h5>
let include = true;
if (regex) {
if (event.name == "Transfer") {
if (!(regex.test(event.from) || regex.test(event.to) || regex.test(event.txHash) || regex.test(event.blockNumber.toString()))) {
if (!(regex.test(event.from) || regex.test(event.to) || regex.test(event.tokenId.toString())|| regex.test(event.txHash) || regex.test(event.blockNumber.toString()))) {
include = false;
}
} else if (event.name == "Approval") {
if (!(regex.test(event.owner) || regex.test(event.spender) || regex.test(event.txHash) || regex.test(event.blockNumber))) {
if (!(regex.test(event.owner) || regex.test(event.spender) || regex.test(event.tokenId.toString())|| regex.test(event.txHash) || regex.test(event.blockNumber))) {
include = false;
}
} else if (event.name == "ApprovalForAll") {
if (!(regex.test(event.owner) || regex.test(event.operator) || regex.test(event.txHash) || regex.test(event.blockNumber))) {
include = false;
}
} else {
console.log(JSON.stringify(event));
}
}
if (include) {
Expand Down Expand Up @@ -2162,6 +2164,7 @@ <h5 class="mt-3">Troubleshooting</h5>
return this.nonFungibleViewer.replace(/\${contract}/, contract).replace(/\${tokenId}/, tokenId);
},
async viewNonFungible(type, contract, tokenId) {
console.log(now() + " retrieveERC20 viewNonFungible - type: " + type + ", contract: " + contract + ", tokenId: " + tokenId);
Vue.set(this.nonFungibleModal, 'show', true);
Vue.set(this.nonFungibleModal, 'type', type);
Vue.set(this.nonFungibleModal, 'contract', contract);
Expand Down Expand Up @@ -2202,6 +2205,15 @@ <h5 class="mt-3">Troubleshooting</h5>
this.nonFungibleModal.logs.push({ log:now() + " Updated URI to " + uriResults });
}
}
try {
this.nonFungibleModal.logs.push({ log:now() + " Fetching " + uriResults });
const fileContent = await fetch(uriResults, { mode: 'cors', signal: AbortSignal.timeout(10000) }).then(response => response.json());
this.nonFungibleModal.logs.push({ log:now() + " Fetched " + JSON.stringify(fileContent, null, 2) });
console.log(now() + " retrieveERC20 viewNonFungible - fileContent: " + JSON.stringify(fileContent, null, 2));
} catch (e) {
console.log(now() + " viewNonFungible - ERROR: " + e.message);
}


},

Expand Down

0 comments on commit 48d19fe

Please sign in to comment.