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

clockwork-anchor-gen

Generates an Anchor CPI crate from a JSON IDL

2 releases

0.3.2 Apr 10, 2023
0.3.1 Mar 31, 2023

#30 in #cpi

Download history 19/week @ 2024-11-13 44/week @ 2024-11-20 62/week @ 2024-11-27 64/week @ 2024-12-04 121/week @ 2024-12-11 56/week @ 2024-12-18 2/week @ 2024-12-25 47/week @ 2025-01-01 52/week @ 2025-01-08 100/week @ 2025-01-15 69/week @ 2025-01-22 57/week @ 2025-01-29 164/week @ 2025-02-05 94/week @ 2025-02-12 57/week @ 2025-02-19 80/week @ 2025-02-26

406 downloads per month
Used in 16 crates (5 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