|
@@ -26,6 +26,12 @@ fn gen_cpi_instructions(idl: &Idl) -> proc_macro2::TokenStream {
|
|
|
let method_name = format_ident!("{}", ix.name);
|
|
|
let accounts_ident = format_ident!("{}", ix.name.to_camel_case());
|
|
|
|
|
|
+ let accounts_generic = if ix.accounts.is_empty() {
|
|
|
+ quote!()
|
|
|
+ } else {
|
|
|
+ quote!(<'info>)
|
|
|
+ };
|
|
|
+
|
|
|
let args = ix.args.iter().map(|arg| {
|
|
|
let name = format_ident!("{}", arg.name);
|
|
|
let ty = convert_idl_type_to_syn_type(&arg.ty);
|
|
@@ -61,7 +67,7 @@ fn gen_cpi_instructions(idl: &Idl) -> proc_macro2::TokenStream {
|
|
|
|
|
|
quote! {
|
|
|
pub fn #method_name<'a, 'b, 'c, 'info>(
|
|
|
- ctx: anchor_lang::context::CpiContext<'a, 'b, 'c, 'info, accounts::#accounts_ident<'info>>,
|
|
|
+ ctx: anchor_lang::context::CpiContext<'a, 'b, 'c, 'info, accounts::#accounts_ident #accounts_generic>,
|
|
|
#(#args),*
|
|
|
) -> #ret_type {
|
|
|
let ix = {
|