From e9bc6186b99fc4d610e28f5a49b66fb1727e9ff9 Mon Sep 17 00:00:00 2001 From: Harvey Zuccon Date: Tue, 19 May 2026 13:35:22 +0200 Subject: [PATCH] Use flatMap in findSuitableResources --- src/services/invitation.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/invitation.ts b/src/services/invitation.ts index a740853..6934492 100644 --- a/src/services/invitation.ts +++ b/src/services/invitation.ts @@ -510,7 +510,7 @@ export class Invitation extends EventEmitter { const templates = await this.engine.listImportedTemplates(); // For each template, we need to create a 2d array of all the outputs - const outputs = templates.map(template => { + const outputs = templates.flatMap(template => { return Object.keys(template.outputs).map(output => { const templateIdentifier = generateTemplateIdentifier(template); @@ -522,7 +522,7 @@ export class Invitation extends EventEmitter { }); // then, for each output, we need to get the spendable resources - const spendableResources = await Promise.all(outputs.flat().map(output => { + const spendableResources = await Promise.all(outputs.map(output => { return this.engine.getSpendableResources(this.data, { templateIdentifier: output.templateIdentifier, outputIdentifier: output.outputIdentifier,