#anchor #generate #idl #solana #json #cpi #declare-id

macro clockwork-anchor-generate-cpi-interface

Generates an Anchor CPI crate from a JSON IDL

2 releases

0.3.2 Apr 10, 2023
0.3.1 Mar 31, 2023

#72 in #cpi

Download history 70/week @ 2024-11-02 12/week @ 2024-11-09 29/week @ 2024-11-16 56/week @ 2024-11-23 63/week @ 2024-11-30 97/week @ 2024-12-07 99/week @ 2024-12-14 25/week @ 2024-12-21 14/week @ 2024-12-28 57/week @ 2025-01-04 90/week @ 2025-01-11 86/week @ 2025-01-18 52/week @ 2025-01-25 77/week @ 2025-02-01 172/week @ 2025-02-08 50/week @ 2025-02-15

369 downloads per month
Used in 17 crates (via clockwork-anchor-gen)

Apache-2.0

5KB

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