Skip to content

Commit

Permalink
feat: Simplify buildManaDetailsForOutput call
Browse files Browse the repository at this point in the history
  • Loading branch information
msarcev committed Jan 31, 2024
1 parent cd1156e commit 056b2b3
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions client/src/app/routes/nova/OutputPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,11 @@ const OutputPage: React.FC<RouteComponentProps<OutputPageProps>> = ({
const outputIndex = computeOutputIndexFromOutputId(outputId);

let outputManaDetails: OutputManaDetails | null = null;
if (output !== null && createdSlotIndex !== null && protocolInfo !== null) {
if (spentSlotIndex !== null) {
outputManaDetails = buildManaDetailsForOutput(output, createdSlotIndex, spentSlotIndex, protocolInfo.parameters);
} else if (latestConfirmedSlot > 0) {
outputManaDetails = buildManaDetailsForOutput(output, createdSlotIndex, latestConfirmedSlot, protocolInfo.parameters);
}
if (output && createdSlotIndex && protocolInfo) {
const untilSlotIndex = spentSlotIndex ? spentSlotIndex : latestConfirmedSlot > 0 ? latestConfirmedSlot : null;
outputManaDetails = untilSlotIndex
? buildManaDetailsForOutput(output, createdSlotIndex, untilSlotIndex, protocolInfo.parameters)
: null;
}

return (
Expand Down

0 comments on commit 056b2b3

Please sign in to comment.