Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new helper to simplify escrow tests #108

Merged
merged 11 commits into from
Aug 9, 2024
Prev Previous commit
Next Next commit
Neaten
mikemaccana committed Aug 9, 2024
commit 46b84cf89ec28ac1dfa73adccfac9172b0de5997
5 changes: 3 additions & 2 deletions basics/favorites/anchor/programs/favorites/src/lib.rs
Original file line number Diff line number Diff line change
@@ -13,8 +13,8 @@ pub mod favorites {

// Our instruction handler! It sets the user's favorite number and color
pub fn set_favorites(context: Context<SetFavorites>, number: u64, color: String, hobbies: Vec<String>) -> Result<()> {
let user_public_key = context.accounts.user.key();
msg!("Greetings from {}", context.program_id);
let user_public_key = context.accounts.user.key();
msg!(
"User {user_public_key}'s favorite number is {number}, favorite color is: {color}, and their hobbies are {hobbies:?}",
);
@@ -53,7 +53,8 @@ pub struct SetFavorites<'info> {
payer = user,
space = ANCHOR_DISCRIMINATOR_SIZE + Favorites::INIT_SPACE,
seeds=[b"favorites", user.key().as_ref()],
bump)]
bump
)]
pub favorites: Account<'info, Favorites>,

pub system_program: Program<'info, System>,