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

[sozo] parse sozo call results #2936

Open
notV4l opened this issue Jan 20, 2025 · 3 comments
Open

[sozo] parse sozo call results #2936

notV4l opened this issue Jan 20, 2025 · 3 comments
Labels
enhancement New feature or request sozo

Comments

@notV4l
Copy link
Collaborator

notV4l commented Jan 20, 2025

Its should be possible to parse sozo call results in a more friendly representation.
And also keep the ability to display raw results ( splitted with , could be convenient)

@notV4l notV4l added enhancement New feature or request sozo labels Jan 20, 2025
@Nityam573
Copy link

Could I be assigned to this?

@glihm
Copy link
Collaborator

glihm commented Jan 22, 2025

Could I be assigned to this?

Do you have an idea how to tackle this @Nityam573?

@remybar
Copy link
Contributor

remybar commented Jan 29, 2025

Hi @notV4l ! Good idea 👍

I don't know what would be the best way to do that, so I share some ideas with you.

From the tag_or_address and the entrypoint we can retrieve the output type of the entrypoint from the contract ABI (as soon as the contract is known in the manifest_xxx.json file otherwise we should just display the raw output).
Then, from this output type which is a string, I guess we have to recursively parse it using the contract ABI until we find deserializable primitive types that can be displayed.

For example, I call ns-Actions get_player_position.
From the ns-Actions contract ABI, I find that:

  • the output type is "dojo_examples::models::Position",
  • dojo_examples::models::Position is composed of:
    • player which is a ContractAddress => we can deserialize and display it,
    • vec which is a Vec => search for Vec details in the ABI, ...

Maybe Cainome can also help us but I don't know if we can deserialize a type like dojo_examples::models::Position with Cainome, at runtime, with a string representation of that type 🤔 @glihm, any idea ?

Also, for the specific case of dojo_examples::models::Position, as it is a model, we can read its schema from its contract and deserialize it as we do in sozo model get.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request sozo
Projects
None yet
Development

No branches or pull requests

4 participants