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

macro anchor-generate-cpi-crate

Generates an Anchor CPI crate from a JSON IDL

2 releases

0.3.1 Sep 27, 2022
0.3.0 Jul 26, 2022

#54 in #cpi

Download history 158/week @ 2023-11-29 126/week @ 2023-12-06 191/week @ 2023-12-13 247/week @ 2023-12-20 215/week @ 2023-12-27 273/week @ 2024-01-03 500/week @ 2024-01-10 254/week @ 2024-01-17 456/week @ 2024-01-24 448/week @ 2024-01-31 209/week @ 2024-02-07 306/week @ 2024-02-14 422/week @ 2024-02-21 271/week @ 2024-02-28 370/week @ 2024-03-06 213/week @ 2024-03-13

1,351 downloads per month
Used in 17 crates (via anchor-gen)

Apache-2.0

25KB
558 lines

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
~85K SLoC