File tree Expand file tree Collapse file tree 2 files changed +11
-23
lines changed Expand file tree Collapse file tree 2 files changed +11
-23
lines changed Original file line number Diff line number Diff line change 1- # anchor-gen
2-
3- Generates a crate for cross-program invocations to an Anchor program from a JSON IDL.
4-
5- ## Usage
6-
7- In a new crate, write:
8-
9- ``` skip
10- anchor_gen::generate_cpi_crate!("../../examples/govern-cpi/idl.json");
11-
12- declare_id!("GjphYQcbP1m3FuDyCTUJf2mUMxKPE3j6feWU1rxvC7Ps");
13- ```
14-
15- This will generate a fully functional Rust CPI client for your IDL.
16-
17- More examples can be found in the [ examples/] ( https://github.com/saber-hq/anchor-gen/tree/master/examples ) directory.
18-
19- Note: This does not work on legacy IDLs. To migrate a legacy IDL, use ` anchor idl convert idl.json ` .
20-
21- License: Apache-2.0
Original file line number Diff line number Diff line change 22//!
33//! Now updated for Anchor 0.31.1!
44//!
5+ //! **Warning: this code has not been audited. Please use it at your own risk.**
6+ //!
57//! # Usage
68//!
7- //! In a new crate, write:
9+ //! First, add the following to a `Cargo.toml` file in a new crate:
10+ //!
11+ //! ```toml
12+ //! [dependencies]
13+ //! anchor-gen = "0.31.1"
14+ //! ```
15+ //!
16+ //! Then, in `lib.rs`, write:
817//!
918//! ```skip
1019//! anchor_gen::generate_cpi_crate!("../../examples/govern-cpi/idl.json");
1120//! ```
1221//!
1322//! This will generate a fully functional Rust CPI client for your IDL.
1423//!
15- //! More examples can be found in the [examples/](https://github.com/saber-hq/anchor-gen/tree/master/examples) directory.
24+ //! Usage examples can be found in the [examples/](https://github.com/saber-hq/anchor-gen/tree/master/examples) directory.
1625//!
1726//! Note: This does not work on legacy IDLs. To migrate a legacy IDL, use `anchor idl convert idl.json`.
1827
You can’t perform that action at this time.
0 commit comments