metaplex-foundation / shank

Extracts IDL from Solana Rust contracts
https://docs.rs/crate/shank_macro/latest
116 stars 23 forks source link

feat: support HashSet and BTreeSet #38

Closed thlorenz closed 1 year ago

thlorenz commented 1 year ago

Summary

Adding support for HashSet and BTreeSet.

They are added to the IDL as follows:

{
  "type": {
    "kind": "struct",
    "fields": [
      {
        "name": "u8Set",
        "type": {
          "hashSet": "u8"
        }
      }
    ]
  }
}
"type": {
  "kind": "struct",
  "fields": [
    {
      "name": "vecHashMapU8",
      "type": {
        "vec": {
          "hashSet": "u8"
        }
      }
    },
    {
      "name": "optionBtreeMapU8",
      "type": {
        "option": {
          "bTreeSet": "u8"
        }
      }
    }
  ]
}

Related PR: https://github.com/metaplex-foundation/shank/pull/30 where the same was implemented for maps.

Helps resolve: https://github.com/metaplex-foundation/solita/issues/85