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/asking #97

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

feat/asking #97

wants to merge 1 commit into from

Conversation

mirageruler
Copy link

  • Hi @gagliardetto, it's my pleasure to be connected with you. Currently, I'm using your solana-go and anchor-go in order to parse instructions from Solana programs. The intention is to parse as many as possible instructions (into Go struct) that are called in transactions that are related to each of the NFTs of an NFT collection.
  • I have found myself some questions during the development, for example:
  1. How can I generate IDLs for native Solana programs (like system, stake, bff...) from the newest Rust code program version. Since your existing one (you have the Go code but not the IDL here) in solana-go do not have the latest instructions that can be parsed successfully.
  2. I've followed this repo: https://github.com/acheroncrypto/native-to-anchor. Turns out it helps me to easily generate anchor IDLs from the latest SPL programs, but some of the output caused panic when I run anchor-go to generate their corresponding Go codes.
  3. I'm relatively new to programming, and I would love to contribute to your repository so I could also help myself solve my problems but my knowledge and capabilities are kinda lacking to perfectly solve, can I give you the IDLs that the anchor-go can't generate Go code so we could together proceed on improving the repository so the IDLs are generated successfully, it would be a lot of ease, thank you very much.
  • Most of the time, the problem was caused by unsupported types defined in the program. For example, the spl_token has type COption<Pubkey> that your generator does not understand (I think it should be converted into something like *solana.PublicKey in Go) like the Go code inside the solana-go repo.

spl_token_json_IDL.txt
spl_token_swap_json_IDL.txt
spl_stake_pool_json_IDL.txt
spl_governance_json_IDL.txt
spl_feature_proposal_json_IDL.txt

@gagliardetto
Copy link
Owner

Hi @mirageruler

Two things before I respond in a more extended way:

  1. anchor-go has unreleased fixed in the main branch; you can pull with go get github.com/gagliardetto/anchor-go@e02ff9267d07c1d64aa745aa9216e20fd637abbc ; that might fix some errors (but not Coption which is not implemented).
  2. anchor-go has some undocumented features that allow to generate clients for non-achor programs (or at least stub out something that with a few modifications can work).
    Example: anchor-go --src=idl.json --dst=./generated-client --type-id=uint32 --codec=borsh where the generated client will handle instruction IDs as uint32 and data encoding as borsh.

@gagliardetto
Copy link
Owner

Hi @mirageruler

Thanks for your detailed note! 🤝

I agree with you that fixing and expanding anchor-go would give an immense amount of new clients and expand what can be done with solana-go.

This week I'm going to start fixing anchor-go and start throwing at it the IDLs you posted above.

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