#anchor #solana #idl #generate #json #cpi #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

#15 in #cpi

Download history 60/week @ 2024-03-11 63/week @ 2024-03-18 76/week @ 2024-03-25 122/week @ 2024-04-01 39/week @ 2024-04-08 84/week @ 2024-04-15 93/week @ 2024-04-22 64/week @ 2024-04-29 73/week @ 2024-05-06 81/week @ 2024-05-13 80/week @ 2024-05-20 67/week @ 2024-05-27 60/week @ 2024-06-03 49/week @ 2024-06-10 62/week @ 2024-06-17 81/week @ 2024-06-24

261 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

~4MB
~88K SLoC