Simple anchor IDL Parser
A simple parser for partial part of anchor IDL without importing anchor types or causing build panics for WASM targets.
It only parses the address of the program and the instructions containing the instruction name and the discriminant which are useful for the scope of the wallet-adapter templates.
Macro for creating a path to the IDL
the partial-idl-parser crate is used to read the IDL from the CARGO_WORKSPACE_DIR/target/temp.json file using a .cargo/config.toml in the root
[]
= { = "", = true }
Get the AnchorIdlPartialData data structure containing the IDL of an anchor example called temp
use *;
const IDL: &str = get_idl!;
If the directory is different you can use idl_custom_path macro:
use *;
const IDL: &str = idl_custom_path!;
The AnchorIdlPartialData
Parsed IDL is stored within a AnchorIdlPartialData struct.
LICENSE
MIT OR APACHE-2.0