dojo
dojo copied to clipboard
[BUG] Typescript bindings: structs not exported
Describe the bug Structs used in contract calls, but not in any models, are not being exported.
To Reproduce
Generate typescript bindgens for a contract with a call like this... ( from pistols/fools branch)
// https://github.com/underware-gg/pistols/blob/fools/dojo/src/systems/game.cairo
use pistols::types::rules::{RewardValues};
#[starknet::interface]
pub trait IGame<TState> {
// ...
fn calc_season_reward(self: @TState, table_id: felt252, duelist_id: u128, lives_staked: u8) -> RewardValues;
// ...
}
// https://github.com/underware-gg/pistols/blob/fools/dojo/src/systems/bank.cairo
use pistols::models::pool::{PoolType, LordsReleaseBill};
#[starknet::interface]
pub trait IBank<TState> {
// ...
fn release_lords_from_fame_to_be_burned(ref self: TState, bills: Span<LordsReleaseBill>) -> u128;
// ...
}
Expected behavior
The structs RewardValues and LordsReleaseBill should be exported to typescript.
Having the same issue, for now just created a dummy model that includes the missing Structs.
Have not done this before, but if not urgent would like to take this.
bump!
@rsodre will try to get something out these 2 days, been travelling a bit.
@rsodre attempted to replicate this but can't manage to do it, the branch you pointed to seems to be missing / merged, do you have another example?
@cwkang1998 you can use this https://github.com/underware-gg/pistols/tree/3cf4909b0fcbbfb224cf5455da3a8e8817c49312/dojo
start a local katana, cd dojo and ./migrate dev --bindings
on the generated sources, LordsReleaseBill and MockedValue are not present.
this is the latest fix commit I made after generating bindings: https://github.com/underware-gg/pistols/commit/f30a9d6af4d112727564c540adde8c034a481f55
@rsodre, just fixed the underlying issue with Dojo bindgen, will open the PR and check with @MartianGreed to verify/complete the typescript part. 🫡
Sorry for the delay on that.