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

Move seahorse_util to separate file #21

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

z80dev
Copy link

@z80dev z80dev commented Nov 27, 2024

this makes the generated lib.rs much easier to read

it also sets a pattern for adding future library files as needed.

this makes the generated lib.rs much easier to read
it also sets a pattern for adding future library files as needed
Copy link
Collaborator

@mcintyre94 mcintyre94 left a comment

Choose a reason for hiding this comment

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

This seems like a good idea! I just want to make sure it'll still work with Solana Playground

Can you give a bit more detail on what this changes about the output files?

@z80dev
Copy link
Author

z80dev commented Dec 13, 2024

Seahorse generates what is essentially a regular valid Anchor Rust project to be compiled by the Anchor CLI. Currently, all the code is thrown into a single lib.rs file. This includes code that is in a module seahorse_util. This module contains a bunch of seahorse boilerplate, helper functions, and traits for properly generating valid working Rust code from the python source.

This Seahorse boilerplate clutters the lib.rs file unnecessarily, it is trivial to put it in an adjacent file and then just "import" it via use. An additional benefit is that this makes it easier to test that Seahorse outputs are correct, since we now can generate much smaller and simpler lib.rs files that do not include all the Seahorse boilerplate.

I haven't ever used the Solana playground but I'll take a look and respond with more thoughts once I do

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.

2 participants