-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
ts: Automatically convert legacy IDLs #3238
Comments
Yep, we should do it. The Rust conversion should also work in WASM, so maybe we can use that instead rather than duplicating the logic. |
I think I'd prefer vanilla TS so I don't have to think about where it runs. Example port I wrote for TS: solana-labs/explorer#374 |
solana-labs/explorer#374 looks great! It would be helpful to support it from Anchor itself for other people to also benefit from it. Would you like to create a PR? |
Yes I can create a PR. I will note that in order to get legacy IDLs supported, I had to prune unused types after formatting them to the new spec. Is this expected behavior? If I don't do this, an error is thrown in the construction of the Borsh coders. |
I think it makes sense for it to error if a field references a type that's not included in the IDL (or a default type). Otherwise how can we de/serialize it correctly? |
@acheroncrypto what if the type that's doing the dangling reference is never used? In this case I think it should be fine to prune, right? I think the old coder seemed to be fine loading this. |
It should be fine to prune in that case.
I think that's because the old generation did not know whether a type was being used or not, so the old coder also had to be loose. In contrast, the new generation doesn't include unused types in the IDL. |
That way explorers have easy access to same functionality as in #3009
The text was updated successfully, but these errors were encountered: