mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-10 02:28:13 -07:00
26 lines
778 B
JavaScript
26 lines
778 B
JavaScript
import { createQrDataUrl } from "../../../qr/index.js";
|
|
import { formatDisplayUrl } from "./data.js";
|
|
|
|
/** @typedef {import("../../../modules/brk-client/index.js").BlockInfoV1} Block */
|
|
|
|
/**
|
|
* @param {Block} block
|
|
* @param {string} url
|
|
*/
|
|
export function createReceiptQr(block, url) {
|
|
const section = document.createElement("section");
|
|
const label = document.createElement("span");
|
|
const image = document.createElement("img");
|
|
const link = document.createElement("a");
|
|
|
|
section.dataset.receiptQr = "";
|
|
label.textContent = "Scan to verify";
|
|
image.alt = `QR code for block ${block.height}`;
|
|
image.src = createQrDataUrl(url, { scale: 8 });
|
|
link.href = url;
|
|
link.textContent = formatDisplayUrl(url);
|
|
section.append(label, image, link);
|
|
|
|
return section;
|
|
}
|