Files
cfw-autumn/shared/api/balances/finalizeLock/finalizeLockParamsV0.ts
2026-03-10 18:04:48 +00:00

26 lines
821 B
TypeScript

import { z } from "zod/v4";
export const FinalizeLockParamsV0Schema = z
.object({
lock_id: z.string().meta({
description: "The lock ID that was passed into the previous check call.",
}),
action: z.enum(["confirm", "release"]).meta({
description:
"Use 'confirm' to commit the deduction, or 'release' to return the held balance.",
}),
override_value: z.number().optional().meta({
description:
"Override the original lock value with a different deduction amount. Only valid when action is 'confirm'.",
}),
})
.refine(
(data) => !(data.action === "release" && data.override_value !== undefined),
{
message: "override_value cannot be provided when action is release",
path: ["override_value"],
},
);
export type FinalizeLockParamsV0 = z.infer<typeof FinalizeLockParamsV0Schema>;