Skip to content

Commit d1061cc

Browse files
committed
more readme updates
1 parent c00039f commit d1061cc

File tree

2 files changed

+11
-23
lines changed

2 files changed

+11
-23
lines changed

README.md

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +0,0 @@
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

crates/anchor-gen/src/lib.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,26 @@
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

0 commit comments

Comments
 (0)