Skip to content

Conversation

@samkim-crypto
Copy link
Contributor

@samkim-crypto samkim-crypto commented Nov 20, 2025

Summary of Changes

I annotated the program using codama macros (see codama-macros branch e.g. bfb5a68) and generated idl.json.

Using this idl, I generated the js-clients, added wrapper functions, and then added tests for the js clients.

This is a pretty big PR, so I did not include yet:

  • the CI does not test the new js clients
  • the build js client generation script

I was planning on adding these on a follow-up PR, but I'd be happy to add these if the reviewers would prefer I include it in this PR.

Copy link
Contributor

@joncinque joncinque left a comment

Choose a reason for hiding this comment

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

I only looked at the idl.json, and it looks correct to me. Feel free to land this if you want, but it might be clearer in the future to add things in this kind of order:

  • Codama macros + idl in one PR
  • Client generation in another
  • Tests in a last one

@samkim-crypto
Copy link
Contributor Author

Okay got it. I'll follow the structure for the zk elgamal proof program.

For the codama macros, I added it to the codama-macros branch and not the main branch. Do you prefer to have the codama macros on the main branch?

@samkim-crypto samkim-crypto merged commit 2e35c0f into main Nov 21, 2025
16 checks passed
@grod220
Copy link
Member

grod220 commented Nov 21, 2025

For the codama macros, I added it to the codama-macros branch and not the main branch. Do you prefer to have the codama macros on the main branch?

I think that is quite valuable work to get pushed up. I'd imagine the gold standard future will be: codama macros -> generated idl -> generated clients.

So the source of truth for future changes will now be those macros versus manual editing of the idl.json.

@samkim-crypto
Copy link
Contributor Author

Alright, makes sense. I saw that none of the other solana-program repos had the code annotations/decorations in the actual program code, so I didn't add it. I'll add the macros in the follow-up 👍

@samkim-crypto
Copy link
Contributor Author

Actually if I add the macros, then I need to add codama as a dependency for the program (e.g. here). If I add it to dev-dependencies and have the decorations in the code, then the compiler will complain. Do you think it is still worth having it in the main branch?

@grod220
Copy link
Member

grod220 commented Nov 21, 2025

Graduating codama to a prod dependency sounds fine to me. I don't think a codama macro branch is the optimal workflow for keeping the schema up-to-date. Think it being in the main branch is more idiomatic. If an instruction changes, the dev will be able to update the schema+clients in one go---tightly coupling the program code with the clients.

@samkim-crypto
Copy link
Contributor Author

Okay makes sense. I'll add codama to the list of dependencies.

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.

4 participants