Breaking-Change: Extremely rough update to work with Kioks wallet
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user