Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

defineDeposit

defineDeposit<Name, Schema>(name, options): DepositKind<Name, Schema>

Declares a kind of deposit at module scope: its name, kebab-case and one per game, and the schema its payload is checked against where it is sent and where it is received. Register the kinds once, so each receive hook is typed by its kind: declare module "@spawnite/engine" { interface Register { deposits: typeof donation | typeof tribute } }.

Type Parameter
Name extends string
Schema extends SaveSchema
Parameter Type
name Name
options { schema: Schema; }
options.schema Schema

DepositKind<Name, Schema>

export const donation = defineDeposit("donation", {
schema: z.object({ coins: z.number() }),
});