Skip to content

Commit

Permalink
feat: add info about terminated vats
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris-Hibbert committed Feb 11, 2025
1 parent 80b3987 commit d8bbbc6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/synthetic-chain/src/lib/vat-status.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ const makeSwingstore = db => {
options: () => kvGetJSON(`${vatID}.options`),
currentSpan: () =>
sql.get`select * from transcriptSpans where isCurrent = 1 and vatID = ${vatID}`,
terminated: () => {
const terminatedIDs = kvGetJSON('vat.terminated');
return terminatedIDs.some(terminatedID => vatID === terminatedID);
},
});
};

Expand Down Expand Up @@ -88,7 +92,9 @@ export const getVatDetails = async vatName => {
const source = vatInfo.source();
// @ts-expect-error sqlite typedefs
const { incarnation } = vatInfo.currentSpan();
return { vatName, vatID, incarnation, ...source };
const terminated = vatInfo.terminated();

return { vatName, vatID, incarnation, ...source, terminated };
};

/**
Expand Down Expand Up @@ -118,7 +124,8 @@ export const getDetailsMatchingVats = async vatName => {
const source = vatInfo.source();
// @ts-expect-error cast
const { incarnation } = vatInfo.currentSpan();
infos.push({ vatName: name, vatID, incarnation, ...source });
const terminated = vatInfo.terminated();
infos.push({ vatName: name, vatID, incarnation, ...source, terminated });
}

return infos;
Expand Down

0 comments on commit d8bbbc6

Please sign in to comment.