craft-nft

A standalone NFT implementation for real-world arts and crafts assets
Log | Files | Refs | README

commit 99b8085cec819c64828246cf88844ed279e54c4b
parent 1c0b460267919bd18c4e575ea11143878d17c959
Author: lash <dev@holbrook.no>
Date:   Tue, 21 Feb 2023 00:18:58 +0000

add confirmation feedback in qr scan

Diffstat:
Mjs/qrread.js | 3+--
Mjs/qrread_ui.js | 12++++++++++++
2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/js/qrread.js b/js/qrread.js @@ -8,8 +8,6 @@ const STATE = { SCAN_RESULT: 32, SCAN_STOP: 64, SCAN_DONE: 128, - TX_FLIGHT: 256, - TX_RESULT: 512, }; var settings = { @@ -22,6 +20,7 @@ var settings = { chainId: undefined, dataPost: undefined, mintAmount: 1, + minedAmount: 0, recipient: undefined, }; diff --git a/js/qrread_ui.js b/js/qrread_ui.js @@ -86,8 +86,20 @@ window.addEventListener('tx', (e) => { li.appendChild(l); li.appendChild(r); ls.appendChild(li); + watchTx(e.detail.tx); }); +async function watchTx(tx) { + const rcpt = await settings.provider.waitForTransaction(tx.hash); + const txRow = document.getElementById('status.' + tx.hash); + console.debug('rcpt', rcpt); + if (rcpt.status == 1) { + txRow.innerHTML = 'status: confirmed'; + } else { + txRow.innerHTML = 'status: failed'; + } +} + function updateSettingsView(k, v) { const dl = document.getElementById("settingsView"); const dt = document.createElement("dt");