ts: Add program.coder.types for encoding/decoding user-defined types - #1931
Merged
armaniferrante merged 2 commits intoMay 29, 2022
Merged
Conversation
| /** | ||
| * Coder for user-defined types. | ||
| */ | ||
| readonly types: TypesCoder<T>; |
Contributor
There was a problem hiding this comment.
Please add a CHANGELOG.md entry for this change.
vovacodes
force-pushed
the
feature/add-coder-types
branch
from
May 29, 2022 18:20
aa071c5 to
d6ec864
Compare
vovacodes
force-pushed
the
feature/add-coder-types
branch
from
May 29, 2022 18:21
d6ec864 to
9e52562
Compare
Contributor
|
Thank you! |
snawaz
reviewed
Jun 8, 2023
Comment on lines
+26
to
+28
| const layouts: [N, Layout][] = idl.types.map((acc) => { | ||
| return [acc.name as N, IdlCoder.typeDefLayout(acc, idl.types)]; | ||
| }); |
Contributor
There was a problem hiding this comment.
Is that a typo on line 26? I believe types must included both idl.types and idl.accounts , after all idl.accounts are types as well, and they can be used in all places, such as #[event] and return value in view functions.
const layouts: [N, Layout][] = idl.accounts.map((acc) => { // changed: types -> accounts
return [acc.name as N, IdlCoder.typeDefLayout(acc, idl.types)];
});Also, the name of the closure argument is acc , so I believe it was meant to be iteration over accounts.
Contributor
There was a problem hiding this comment.
OR, we have a problem in event.js as it does not use accounts. Events could use accounts as well(especially the smaller ones).
akash-osec
pushed a commit
to akash-osec/anchor
that referenced
this pull request
Mar 25, 2026
akash-osec
pushed a commit
to akash-osec/anchor
that referenced
this pull request
Jul 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #1930