Open
Description
Describe the bug
Dojo creates one additional Value
model for every dojo::model. It is useful on-chain, allowing a more efficient data fetching, but clients do not have any use case for those models.
Those models are converted to TypeScript anyway, adding unnecessary complexity.
To Reproduce
Generate bindings on dojo-starter
example, all Value models are exported.
The Modes model:
#[derive(Copy, Drop, Serde, Debug)]
#[dojo::model]
pub struct Moves {
#[key]
pub player: ContractAddress,
pub remaining: u8,
pub last_direction: Option<Direction>,
pub can_move: bool,
}
generates...
// Type definition for `dojo_starter::models::Moves` struct
export interface Moves {
player: string;
remaining: BigNumberish;
last_direction: CairoOption<DirectionEnum>;
can_move: boolean;
}
// Type definition for `dojo_starter::models::MovesValue` struct
export interface MovesValue {
remaining: BigNumberish;
last_direction: CairoOption<DirectionEnum>;
can_move: boolean;
}
Expected behavior
Let's keep it simple and clear, those models are not necessary on clients. It just increases build size.