Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(torii): enum support #874

Merged
merged 9 commits into from
Sep 8, 2023
Merged

feat(torii): enum support #874

merged 9 commits into from
Sep 8, 2023

Conversation

broody
Copy link
Collaborator

@broody broody commented Sep 7, 2023

Resolves #772

Currently, indexer can't differentiate between enums and custom type in component members, so unknown types will default to enum. Will requires a bigger followup PR to support custom types

Down: (),
}

impl DirectionPrintImpl of PrintTrait<Direction> {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason, running sozo test something is forcing debug print of all component members so needed to implement PrintTrait, otherwise can be removed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I'll take a look at this

@broody broody requested a review from tarrencev September 8, 2023 04:29

let position_component = world.component("Position", block_id).await.unwrap();

let position = position_component.entity(vec![account.address()], block_id).await.unwrap();

assert_eq!(position, vec![11_u8.into(), 11_u8.into()]);
assert_eq!(position, vec![9_u8.into(), 9_u8.into()]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm why did this change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a None state to the Direction enum so it shifted the cmds up by one

Down: (),
}

impl DirectionPrintImpl of PrintTrait<Direction> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I'll take a look at this

@tarrencev tarrencev merged commit 35a68c8 into main Sep 8, 2023
@tarrencev tarrencev deleted the torii-enum branch September 8, 2023 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Torii not recognising enums in components
2 participants