Format with prettier. Use screen mode for invitation import - dialog mode is broken.

This commit is contained in:
2026-03-23 10:15:48 +00:00
parent 7fd89c5663
commit b475b23beb
47 changed files with 1718 additions and 1098 deletions

View File

@@ -2,19 +2,19 @@ import type { XOTemplate } from "@xo-cash/types";
/**
* List of helper functions to make templates easy to develop with.
*
*
* Most of these are centered around the fact that the templates are very disjointed and sporadic in where the information lies.
*
*
* I.e. required variables ** names ** are stored in actions.roles.requirements.variables, but the variable definitions are stored in the template.variables object.
* so to make a UI out of that, you first need to iterate over the actions.roles.requirements.variables and then lookup the variable definition in the template.variables object.
* this is a pain, so these functions are here to help.
*
*
* Simiarly for inputs, outputs, locking scripts, etc. The get referenced in the actions, but then the actual lookup of what is actually is becomes a pain.
*/
/**
* Deepens a templates object by append the actual definitions for the objects as they are referenced in the template.
* NOTE: Whether this is better as part of the template or not can be debated endlessly.
* NOTE: Whether this is better as part of the template or not can be debated endlessly.
* The decision for separating the defintions from where they are used is likely to reduce template size...
* This could be fruitless though, as its easily compressible (gzip, msgpack, etc) will yield similar results to the separated approach.
*/
@@ -222,7 +222,14 @@ export function resolveTemplateReferences(
const resolved = structuredClone(template);
for (const rule of RESOLUTION_RULES) {
applyRule(resolved, resolved, rule.path.split("."), 0, rule.from, rule.mode);
applyRule(
resolved,
resolved,
rule.path.split("."),
0,
rule.from,
rule.mode,
);
}
return resolved as unknown as ResolvedXOTemplate;
@@ -357,20 +364,14 @@ interface ResolvedStartEntry {
// ─── The full resolved template ──────────────────────────────────
interface ResolvedXOTemplate
extends Omit<
XOTemplate,
| "actions"
| "transactions"
| "outputs"
| "inputs"
| "lockingScripts"
| "start"
> {
interface ResolvedXOTemplate extends Omit<
XOTemplate,
"actions" | "transactions" | "outputs" | "inputs" | "lockingScripts" | "start"
> {
start: ResolvedStartEntry[];
actions: Record<string, ResolvedActionDefinition>;
transactions: Record<string, ResolvedTransactionDefinition>;
outputs: Record<string, ResolvedOutputDefinition>;
inputs: Record<string, ResolvedInputDefinition>;
lockingScripts: Record<string, ResolvedLockingScriptDefinition>;
}
}