#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 445/week @ 2024-05-22 689/week @ 2024-05-29 632/week @ 2024-06-05 431/week @ 2024-06-12 420/week @ 2024-06-19 615/week @ 2024-06-26 153/week @ 2024-07-03 264/week @ 2024-07-10 279/week @ 2024-07-17 273/week @ 2024-07-24 250/week @ 2024-07-31 423/week @ 2024-08-07 463/week @ 2024-08-14 475/week @ 2024-08-21 497/week @ 2024-08-28 467/week @ 2024-09-04

2,008 downloads per month
Used in 22 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

~4.5MB
~92K SLoC