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

lang: generic structs not parsed correctly into IDL #1849

Closed
charlieyou opened this issue Apr 28, 2022 · 1 comment
Closed

lang: generic structs not parsed correctly into IDL #1849

charlieyou opened this issue Apr 28, 2022 · 1 comment
Labels
bug Something isn't working idl related to the IDL, either program or client side

Comments

@charlieyou
Copy link
Contributor

Example:

#[account]
pub struct Example {
    pub value: SlotTrackedValue<u64>,
}
#[derive(AnchorDeserialize, AnchorSerialize, Clone, Copy, Debug, Default)]
pub struct SlotTrackedValue<T> {
    pub value: T,
    pub last_update: LastUpdate,
}

gets parsed into the IDL as:

...
 {
    name: "value",
    type: {
        defined: "SlotTrackedValue<u64>",
    },
},
...
types: [
  {
    name: "SlotTrackedValue",
    type: {
        kind: "struct",
        fields: [
            {
                name: "value",
                type: {
                    defined: "T",
                },
            },
            {
                name: "lastUpdate",
                type: {
                    defined: "LastUpdate",
                },
            },
        ],
    },
  },
]
@acheroncrypto acheroncrypto mentioned this issue Feb 25, 2024
@acheroncrypto acheroncrypto added bug Something isn't working idl related to the IDL, either program or client side labels Mar 10, 2024
@acheroncrypto
Copy link
Collaborator

Fixed by #2824.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working idl related to the IDL, either program or client side
Projects
None yet
Development

No branches or pull requests

2 participants