Armani Ferrante 3 gadi atpakaļ
vecāks
revīzija
ddcd7f47c6

+ 2 - 2
lang/src/accounts/account_loader.rs

@@ -113,7 +113,7 @@ impl<'info, T: ZeroCopy + Owner> AccountLoader<'info, T> {
         }
     }
 
-    /// Constructs a new `Loader` from a previously initialized account.
+    /// Constructs a new `AccountLoader` from a previously initialized account.
     #[inline(never)]
     pub fn try_from(
         acc_info: &AccountInfo<'info>,
@@ -135,7 +135,7 @@ impl<'info, T: ZeroCopy + Owner> AccountLoader<'info, T> {
         Ok(AccountLoader::new(acc_info.clone()))
     }
 
-    /// Constructs a new `Loader` from an uninitialized account.
+    /// Constructs a new `AccountLoader` from an uninitialized account.
     #[inline(never)]
     pub fn try_from_unchecked(
         _program_id: &Pubkey,

+ 7 - 0
lang/syn/src/lib.rs

@@ -310,6 +310,13 @@ impl Field {
                     )?
                 }
             }
+            Ty::AccountLoader(_) => {
+                quote! {
+                    #container_ty::try_from(
+                        &#field,
+                    )?
+                }
+            }
             _ => {
                 let owner_addr = match &kind {
                     None => quote! { program_id },

+ 1 - 0
ts/tests/events.spec.ts

@@ -12,6 +12,7 @@ describe("Events", () => {
       "Program J2XMGdW2qQLx7rAdwWtSZpTXDgAQ988BLP9QTgUZvm54 success",
     ];
     const idl = {
+      layoutVersion: "0.1.0",
       version: "0.0.0",
       name: "basic_0",
       instructions: [

+ 1 - 1
ts/tests/transaction.spec.ts

@@ -15,7 +15,7 @@ describe("Transaction", () => {
     data: Buffer.from("post"),
   });
   const idl = {
-		layoutVersion: '0.1.0',
+    layoutVersion: "0.1.0",
     version: "0.0.0",
     name: "basic_0",
     instructions: [