#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

#4 in #anchor-gen

Download history 509/week @ 2024-09-01 565/week @ 2024-09-08 565/week @ 2024-09-15 344/week @ 2024-09-22 517/week @ 2024-09-29 425/week @ 2024-10-06 833/week @ 2024-10-13 1323/week @ 2024-10-20 1620/week @ 2024-10-27 2021/week @ 2024-11-03 1711/week @ 2024-11-10 1958/week @ 2024-11-17 2192/week @ 2024-11-24 2478/week @ 2024-12-01 3284/week @ 2024-12-08 1641/week @ 2024-12-15

9,653 downloads per month
Used in 27 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
~90K SLoC