#anchor #idl #json #generate #cpi #solana #gen

anchor-gen

Generates an Anchor CPI crate from a JSON IDL

6 releases

0.3.1 Sep 27, 2022
0.3.0 Jul 26, 2022
0.2.0 Jul 24, 2022
0.1.2 Jun 6, 2022

#11 in #cpi

Download history 1983/week @ 2024-11-16 2034/week @ 2024-11-23 2624/week @ 2024-11-30 3272/week @ 2024-12-07 1685/week @ 2024-12-14 1845/week @ 2024-12-21 1370/week @ 2024-12-28 2636/week @ 2025-01-04 2729/week @ 2025-01-11 2077/week @ 2025-01-18 2995/week @ 2025-01-25 3435/week @ 2025-02-01 2773/week @ 2025-02-08 3422/week @ 2025-02-15 2635/week @ 2025-02-22 1589/week @ 2025-03-01

10,798 downloads per month
Used in 30 crates (28 directly)

Apache-2.0

4KB

anchor-gen

Generates a crate for cross-program invocations to an Anchor program from a JSON IDL.

Usage

In a new crate, write:

anchor_gen::generate_cpi_crate!("../../examples/govern-cpi/idl.json");

declare_id!("GjphYQcbP1m3FuDyCTUJf2mUMxKPE3j6feWU1rxvC7Ps");

This will generate a fully functional Rust CPI client for your IDL.

More examples can be found in the examples/ directory.

License: Apache-2.0


lib.rs:

Generates a crate for cross-program invocations to an Anchor program from a JSON IDL.

Usage

In a new crate, write:

anchor_gen::generate_cpi_crate!("../../examples/govern-cpi/idl.json");

declare_id!("GjphYQcbP1m3FuDyCTUJf2mUMxKPE3j6feWU1rxvC7Ps");

This will generate a fully functional Rust CPI client for your IDL.

More examples can be found in the examples/ directory.

Dependencies

~4.5MB
~100K SLoC