From f6fab944551729301105e46db54ac3d01d9c7429 Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Wed, 25 Feb 2026 00:11:39 -0800 Subject: [PATCH] Fix byte array to hex string conversions --- index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index e3e1020..4b2ef2f 100644 --- a/index.html +++ b/index.html @@ -275,7 +275,7 @@ result.insertAdjacentText('beforeend', '❌ Failed to extract CBOR metadata from bytecode.'); return; } - logOutput(result, '✅ Successfully extracted CBOR metadata.', cbor.map(v => v.toString(16).padStart(2, '0')).join('')); + logOutput(result, '✅ Successfully extracted CBOR metadata.', cbor.toHex()); const metadata = decodeCBOR(cbor); // Minimal replacer to convert byte array values to CBOR diagnostic format. const replacer = (_, v) => ArrayBuffer.isView(v) ? `h'${v.toHex()}'` : v; @@ -284,11 +284,11 @@ // Fetch JSON metadata let json; if (metadata.bzzr0 !== undefined) { - const hex = [...metadata.bzzr0].map(b => b.toString(16).padStart(2, '0')).join(''); + const hex = metadata.bzzr0.toHex(); logOutput(result, '❌ Unable to fetch JSON metadata because the smart contract uses a Swarm hash.', `bzzr://${hex}`); } else if (metadata.bzzr1 !== undefined) { - const hex = [...metadata.bzzr1].map(b => b.toString(16).padStart(2, '0')).join(''); + const hex = metadata.bzzr1.toHex(); logOutput(result, '❌ Unable to fetch JSON metadata because the smart contract uses a Swarm hash.', `bzz-raw://${hex}`); } else { -- 2.47.3