drift-idl-gen

Crates.iodrift-idl-gen
lib.rsdrift-idl-gen
version0.1.2
sourcesrc
created_at2024-09-28 01:24:44.711359
updated_at2024-11-22 15:31:05.36061
descriptionGenerates Drift v2 structs/types from anchor IDL
homepage
repositoryhttps://github.com/drift-labs/drift-rs
max_upload_size
id1389665
size28,860
(wphan)

documentation

README

drfit-idl-gen

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.
Commit count: 166

cargo fmt