mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-09 18:18:14 -07:00
global: private xpub support part 2
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { addressScripts } from "../../derive/script.js";
|
||||
|
||||
/**
|
||||
* @typedef {import("../../derive/address.js").AddressScript} 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);
|
||||
}
|
||||
Reference in New Issue
Block a user