Skip to content

Commit bbc89c0

Browse files
committed
remove old whirlpool crate, add kamino lend
1 parent 5b56721 commit bbc89c0

File tree

11 files changed

+4680
-1597
lines changed

11 files changed

+4680
-1597
lines changed

Cargo.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/anchor-generate-cpi-interface/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ use syn::parse_macro_input;
2929
///
3030
/// ```
3131
/// anchor_generate_cpi_interface::generate_cpi_interface!(idl_path = "../../examples/govern-cpi/idl.json");
32-
/// declare_id!("GjphYQcbP1m3FuDyCTUJf2mUMxKPE3j6feWU1rxvC7Ps");
3332
/// # fn main() -> Result<()> {
3433
/// let _my_governor = GovernanceParameters {
3534
/// quorum_votes: 0,

crates/anchor-idl/src/instruction.rs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use quote::{format_ident, quote};
66
/// Generates a single instruction handler.
77
pub fn generate_ix_handler(ix: &IdlInstruction) -> TokenStream {
88
let ix_name = format_ident!("{}", ix.name.to_snake_case());
9-
let accounts_name = format_ident!("{}Instruction", ix.name.to_pascal_case());
9+
let accounts_name = format_ident!("{}", ix.name.to_pascal_case());
1010

1111
let args = ix
1212
.args
@@ -45,18 +45,30 @@ pub fn generate_ix_handler(ix: &IdlInstruction) -> TokenStream {
4545
/// Generates instruction context structs.
4646
pub fn generate_ix_structs(ixs: &[IdlInstruction]) -> TokenStream {
4747
let defs = ixs.iter().map(|ix| {
48-
let accounts_name = format_ident!("{}Instruction", ix.name.to_pascal_case());
48+
let accounts_name = format_ident!("{}", ix.name.to_pascal_case());
4949

5050
let (all_structs, all_fields) =
5151
crate::generate_account_fields(&ix.name.to_pascal_case(), &ix.accounts);
5252

53+
let struct_def = if ix.accounts.is_empty() {
54+
quote! {
55+
pub struct #accounts_name {
56+
#all_fields
57+
}
58+
}
59+
} else {
60+
quote! {
61+
pub struct #accounts_name<'info> {
62+
#all_fields
63+
}
64+
}
65+
};
66+
5367
quote! {
5468
#all_structs
5569

5670
#[derive(Accounts)]
57-
pub struct #accounts_name<'info> {
58-
#all_fields
59-
}
71+
#struct_def
6072
}
6173
});
6274
quote! {
File renamed without changes.

examples/whirlpools/Cargo.toml renamed to examples/kamino-lend/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
2-
name = "whirlpools"
2+
name = "kamino-lend"
33
version = "0.3.0"
44
edition = "2021"
5-
description = "Autogenerated CPI client for the Orca Whirlpools program."
5+
description = "Autogenerated CPI client for the Kamino Lend program."
66
authors = ["Ian Macalinao <[email protected]>"]
77
repository = "https://github.com/saber-hq/anchor-gen"
88
license = "Apache-2.0"

examples/kamino-lend/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# kamino-lend
2+
3+
Autogenerated CPI client for the Kamino Lend program.
4+
5+
CPI helpers for the [Kamino Lend](https://github.com/Kamino-Finance/klend) program.
6+
7+
This crate was automatically generated by
8+
[anchor-gen](https://github.com/saber-hq/anchor-gen), a crate for generating
9+
Anchor CPI helpers from JSON IDLs.
10+
11+
License: Apache-2.0
12+
13+
WARNING: the `refresh_reserves_batch` instruction is not included in the IDL because it has no accounts, breaking Anchor codegen.
14+
15+
```json
16+
{
17+
"name": "refresh_reserves_batch",
18+
"discriminator": [144, 110, 26, 103, 162, 204, 252, 147],
19+
"accounts": [],
20+
"args": [
21+
{
22+
"name": "skip_price_updates",
23+
"type": "bool"
24+
}
25+
]
26+
},
27+
```

0 commit comments

Comments
 (0)