Skip to content

Commit a29fd21

Browse files
committed
update readme
1 parent ccdd157 commit a29fd21

File tree

4 files changed

+27
-1
lines changed

4 files changed

+27
-1
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Generates a crate for cross-program invocations to an Anchor program from a JSON
66

77
In a new crate, write:
88

9-
```rust
9+
```skip
1010
anchor_gen::generate_cpi_crate!("../../examples/govern-cpi/idl.json");
1111
1212
declare_id!("GjphYQcbP1m3FuDyCTUJf2mUMxKPE3j6feWU1rxvC7Ps");
@@ -16,4 +16,6 @@ This will generate a fully functional Rust CPI client for your IDL.
1616

1717
More examples can be found in the [examples/](https://github.com/saber-hq/anchor-gen/tree/master/examples) directory.
1818

19+
Note: This does not work on legacy IDLs. To migrate a legacy IDL, use `anchor idl convert idl.json`.
20+
1921
License: Apache-2.0

crates/anchor-gen/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
//! This will generate a fully functional Rust CPI client for your IDL.
1414
//!
1515
//! More examples can be found in the [examples/](https://github.com/saber-hq/anchor-gen/tree/master/examples) directory.
16+
//!
17+
//! Note: This does not work on legacy IDLs. To migrate a legacy IDL, use `anchor idl convert idl.json`.
1618
1719
pub use anchor_generate_cpi_crate::generate_cpi_crate;
1820
pub use anchor_generate_cpi_interface::generate_cpi_interface;

flake.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
rustup
2828
anchor
2929
cargo-expand
30+
cargo-readme
3031
];
3132
};
3233
}

0 commit comments

Comments
 (0)