global: private xpub support part 1

This commit is contained in:
nym21
2026-06-16 23:37:03 +02:00
parent 6f430bdb8c
commit 0c7861071d
70 changed files with 5874 additions and 12510 deletions
+38
View File
@@ -0,0 +1,38 @@
export const addressScripts = /** @type {const} */ ([
{ id: "v0_p2wpkh", label: "P2WPKH" },
{ id: "v1_p2tr", label: "P2TR" },
{ id: "p2sh_p2wpkh", label: "Nested P2WPKH" },
{ id: "p2pkh", label: "P2PKH" },
]);
/**
* @typedef {typeof addressScripts[number]["id"]} AddressScript
*/
/**
* @param {AddressScript} [value]
*/
export function createAddressScriptSelect(value) {
const select = document.createElement("select");
select.name = "script";
for (const { id, label } of addressScripts) {
const option = document.createElement("option");
option.value = id;
option.selected = id === value;
option.append(label);
select.append(option);
}
return select;
}
/**
* @param {HTMLSelectElement} select
* @returns {AddressScript}
*/
export function readAddressScript(select) {
return /** @type {AddressScript} */ (select.value);
}