5 releases

0.2.0 Mar 21, 2025
0.1.3 Jan 23, 2025
0.1.2 Nov 22, 2024
0.1.1 Oct 22, 2024
0.1.0 Sep 28, 2024

#5 in #drift

Download history 123/week @ 2025-01-22 8/week @ 2025-01-29 24/week @ 2025-02-05 19/week @ 2025-02-12 9/week @ 2025-02-19 8/week @ 2025-02-26 15/week @ 2025-03-05 132/week @ 2025-03-19 15/week @ 2025-03-26 5/week @ 2025-04-02

158 downloads per month
Used in drift-rs

Apache-2.0

30KB
668 lines

Auto-generated IDL types, manual edits do not persist (see crates/drift-idl-gen)

IDL instruction types IDL types IDL Account types IDL error types IDL event types


drfit-idl-gen

⚠️ for drift-rs there's no need to run this manually. The build.rs script will trigger it.

Generates rust anchor structs from IDL json This is implemented rather than another project for a couple reasons:

  1. #[repr(C)] other IDL generation tools do not provide the ability to market structs with repr(C) which is necessary for ffi functionality throught the drift-rs project.
  2. does not rely on anchor vendored solana crates. anchor is pinned to older versions of the solana crates. drift-rs seeks to be readily upgradable to use lastest solana crates.

Dev Note ⚠️

  • An important assumption in this code is that the underlying types (serialization and deserialization) does not change among solana crate versions i.e solana_sdk_1.16::Pubkey == solana_sdk_2.x::Pubkey == anchor_lang::solana_sdk::Pubkey this allows the generated IDL code to ignore the anchor version of crates.

Dependencies

~1.2–2.2MB
~50K SLoC