@lifi/composer-sdk
Version:
Public Composer SDK for building and submitting flows
17 lines (15 loc) • 544 B
text/typescript
import type { Outputs, TerminalOutput } from '@lifi/compose-spec';
/**
* The entries of `outputs` the caller actually receives: every port no later
* node spends, keyed `<nodeId>.<portName>` as on the wire. Consumed ports
* (intermediate amounts a later op takes as input) are dropped.
*/
export const terminalOutputs = (
outputs: Outputs,
): Record<string, TerminalOutput> =>
Object.fromEntries(
Object.entries(outputs).filter(
(entry): entry is [string, TerminalOutput] =>
entry[1].role === 'terminal',
),
);