1

I have an enum used in one of my account that looks like this:

#[derive(AnchorSerialize, AnchorDeserialize, Clone)]
pub enum ItemType {
    Empty,
    Folder { folder_mint: Pubkey },
    Reference { folder_mint: Pubkey },
    External { uri: String },
}

#[account]
pub struct Item {
    /// Used as seed
    pub folder_mint: Pubkey,
    /// Used as seed
    pub index: u32,
    pub previous_index: u32,
    pub creation_timestamp: i64,
    pub item_type: ItemType,
}

I know I can export the account like so: export type Item = IdlAccounts<MyProgram>["item"];

But how can I export the enum type?

1 Answer 1

5

i think you can use : type myEnum = IdlTypes<ProgramIdl>["enumName"]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.