1

I have a program with around 10/15 methods, all in the same file which represents 2K lines of code +/-.

I would like to have one file with the method pub fn my_method and the struct #[derive(Accounts)] for this method , that would keep things more maintainable. Is that possible ?

If not, how to organize the code properly in order to avoid files with Ks of lines ?

2

1 Answer 1

2

Take a look at https://github.com/coral-xyz/xnft/, this is the recommended way.

Putting the state in the state directory and instructions i.e. the functions together with the Accounts struct in the instruction directory.

But this opinion is subjective.

1
  • 1
    thank you very much, exactly what i was looking for !
    – Effe2
    Sep 21 at 19:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.