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

fix: read token_account from bumps #589

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yanCode
Copy link
Contributor

@yanCode yanCode commented Oct 28, 2024

Problem

in this page: https://solana.com/developers/courses/program-security/owner-checks
current rust code in the tutorial, using syntax *ctx.bumps.get("token_account").unwrap() to read token_account from bumps, that now no longer works on anchor-lang = "0.30.1". In fact, this has already been updated in the sample code repository, https://github.com/yanCode/owner-checks/blob/7bda9fb5051976b37ec7cd68aa9cf9595ad087b8/programs/owner-check/src/lib.rs#L49

I personally think while the code repository got updated, the doc has'nt been update accordingly.

Summary of Changes

Update the code as:

 let seeds = &[b"token".as_ref(), &[ctx.bumps.token_account]];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant