From bde72cf292133a1e78e3e765f55a7bd5f7f508b2 Mon Sep 17 00:00:00 2001 From: Z1000k <123022998+Z1000k@users.noreply.github.com> Date: Fri, 7 Feb 2025 09:21:36 +0200 Subject: [PATCH] Update lib.rs this way i can see the favorites choices on the solana explorer transaction logs --- project-1-favorites/programs/favorites/src/lib.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/project-1-favorites/programs/favorites/src/lib.rs b/project-1-favorites/programs/favorites/src/lib.rs index 6552ef8..3c13e2a 100644 --- a/project-1-favorites/programs/favorites/src/lib.rs +++ b/project-1-favorites/programs/favorites/src/lib.rs @@ -13,17 +13,11 @@ pub mod favorites { // Our instruction handler! It sets the user's favorite number and color pub fn set_favorites(context: Context, number: u64, color: String, hobbies: Vec) -> Result<()> { - let user_public_key = context.accounts.user.key(); msg!("Greetings from {}", context.program_id); - msg!( - "User {user_public_key}'s favorite number is {number}, favorite color is: {color}", - ); - - msg!( - "User's hobbies are: {:?}", - hobbies - ); - + let use_public_key = context.accounts.user.key(); + msg!("User {}'s favorite number is {}, favorite color is {}, and their hobbies are {:?}", + user_public_key, number, color, hobbies); + context.accounts.favorites.set_inner(Favorites { number, color,