Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/anchor-idl/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub fn generate_account(
}
};
quote! {
#[account(zero_copy)]
#[account(zero_copy(unsafe))]
#repr
}
} else {
Expand Down
3 changes: 2 additions & 1 deletion crates/anchor-idl/src/typedef.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ pub fn generate_struct(
}
};
quote! {
#[zero_copy]
#[derive(::borsh::BorshSerialize, ::borsh::BorshDeserialize)]
#[zero_copy(unsafe)]
#repr
}
} else {
Expand Down
4 changes: 4 additions & 0 deletions examples/kamino-lend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ cpi = ["no-entrypoint"]
[dependencies]
anchor-gen = { version = "0.4.0", path = "../../crates/anchor-gen" }
anchor-lang = ">=0.20"
# Override anchor to use borsh with the const-generics feature
# Allows to borsh serialize arrays of any length
borsh = { version = "0.10.3", features = ["const-generics"] }
bytemuck = { version = "1.23", features = ["derive", "min_const_generics"] }
42 changes: 41 additions & 1 deletion examples/kamino-lend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,44 @@

#![allow(clippy::too_many_arguments)]

anchor_gen::generate_cpi_interface!(idl_path = "idl.json");
use anchor_lang::zero_copy;

anchor_gen::generate_cpi_interface!(
idl_path = "idl.json",
zero_copy(
UpdateConfigMode,
UpdateLendingMarketConfigValue,
UpdateLendingMarketMode,
LastUpdate,
ElevationGroup,
InitObligationArgs,
ObligationCollateral,
ObligationLiquidity,
AssetTier,
BigFractionBytes,
FeeCalculation,
ReserveCollateral,
ReserveConfig,
ReserveFarmKind,
ReserveFees,
ReserveLiquidity,
ReserveStatus,
WithdrawalCaps,
PriceHeuristic,
PythConfiguration,
ScopeConfiguration,
SwitchboardConfiguration,
TokenInfo,
BorrowRateCurve,
CurvePoint,
UserState,
LendingMarket,
Obligation,
ReferrerState,
ReferrerTokenState,
UserMetadata,
Reserve,
Referrer,
ReferrerToken,
)
);
Loading