-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Description
The way the docs currently describe getting the inscription ID, it will not be deterministic due to explorers being case-insensitive and allowing leading 0s.
Line 162 in a1f0683
| let inscription_id = window.location.pathname.split("/").pop(); |
Oftentimes, the inscription ID is used as a seed for pseudorandom outputs for generative collections, and results in inconsistencies across various viewers. Would it make sense to add a canonicalization function to the docs, such as below?
// this code is not optimized
function normalizeInscriptionId(input) {
const m = String(input).trim().match(/^([0-9a-fA-F]{64})[iI]([0-9]+)$/);
if (!m) throw new Error("Invalid format: expected <64-hex><i><decimal index>");
const txid = m[1].toLowerCase();
const index = BigInt(m[2]).toString();
return `${txid}i${index}`;
}Metadata
Metadata
Assignees
Labels
No labels