Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 5x 5x 2x 1x | import type { MethodSpec, Handler } from '@metamask/kernel-rpc-methods';
import type { Kernel, VatId } from '@metamask/ocap-kernel';
import { VatIdStruct } from '@metamask/ocap-kernel';
import { object, literal } from '@metamask/superstruct';
export const terminateVatSpec: MethodSpec<
'terminateVat',
{ id: VatId },
Promise<null>
> = {
method: 'terminateVat',
params: object({ id: VatIdStruct }),
result: literal(null),
};
export type TerminateVatHooks = { kernel: Pick<Kernel, 'terminateVat'> };
export const terminateVatHandler: Handler<
'terminateVat',
{ id: VatId },
Promise<null>,
TerminateVatHooks
> = {
...terminateVatSpec,
hooks: { kernel: true },
implementation: async ({ kernel }, params): Promise<null> => {
await kernel.terminateVat(params.id);
return null;
},
};
|