Breaking-Change: Extremely rough update to work with Kioks wallet

This commit is contained in:
2026-05-22 14:11:07 +02:00
parent 3d6518e465
commit def261b568
17 changed files with 422 additions and 107 deletions

View File

@@ -24,6 +24,7 @@ import {
formatActionListItem,
getTemplateRoles,
} from '../../utils/template-utils.js';
import { buildScriptHashDataMap } from '../../utils/utxo-metadata.js';
/**
* Template item with metadata.
@@ -83,12 +84,21 @@ export function TemplateListScreen(): React.ReactElement {
const templateList = await appService.engine.listImportedTemplates();
const allUtxos = await appService.engine.listUnspentOutputsData();
const scriptHashDataByScriptHash =
await buildScriptHashDataMap(appService.engine);
const ownedOutputsByTemplate = new Map<string, Set<string>>();
for (const utxo of allUtxos) {
const existing = ownedOutputsByTemplate.get(utxo.templateIdentifier) ?? new Set<string>();
existing.add(utxo.outputIdentifier);
ownedOutputsByTemplate.set(utxo.templateIdentifier, existing);
const scriptRow = scriptHashDataByScriptHash.get(utxo.scriptHash);
if (scriptRow === undefined) {
continue;
}
const existing =
ownedOutputsByTemplate.get(scriptRow.templateIdentifier) ??
new Set<string>();
existing.add(scriptRow.outputIdentifier);
ownedOutputsByTemplate.set(scriptRow.templateIdentifier, existing);
}
const loadedTemplates = await Promise.all(