From: Ardis Lu Date: Sun, 21 Aug 2022 06:37:31 +0000 (-0700) Subject: Match response to name by ID instead of index X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=4cad1f9d8a0e58029d5f66fd09e9d65c5e87c981;p=ens2hex Match response to name by ID instead of index --- diff --git a/index.html b/index.html index 1764db0..d2df67e 100644 --- a/index.html +++ b/index.html @@ -148,12 +148,13 @@ table.querySelector('tbody')?.remove(); // Clear previous rows, if any const body = table.createTBody(); - for (const [index, response] of batchResponse.entries()) { + for (const [index, name] of cleaned.entries()) { const row = body.insertRow(); const ens = row.insertCell(); const address = row.insertCell(); - ens.textContent = cleaned[index]; // Assumes batchResponse is in the same order as cleaned + ens.textContent = name; + const response = batchResponse.find(r => r.id === index); address.textContent = `0x${response.result.slice(26)}`; }