Does anchor idl support HashMap (and generally - can it support all types)?

Viewed 263

After a successful anchor build, I went to run tests within my anchor program. But I received the following error.

Type not found: {"name":"judges","type":{"defined":"HashMap<Pubkey,u16>"}}

Is there a way for the client side to detect this Rust type. I am using typescript for the client side.

For reference, this is what the program looks like on the rust backend.

use std::collections::HashMap;

.
.
.

#[account]
pub struct CompAccount {
    name: String,
    judges: HashMap<Pubkey, u16>,
    contestants: HashMap<Pubkey, u16>,
    judging: bool,
    winner: Option<Pubkey>,
}
1 Answers

HashMaps are not supported in a Solana program, it is not an Anchor constraint per se.

Solana does support BTreeMap and BTreeSet data types.

Related