Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
4
votes
5
answers
497
views
Anchor - Manually setting program account discriminator
I'm trying to initialize a new pda account in an instruction, but not all of the seeds are available in the context (can't use instruction(...) macro to get seed either). … I still want to initialize the account as an Anchor #[account] though, so that I can access it in subsequent instructions.
Basic program setup:
#[account]
pub struct MyAccount {...} …
2
votes
Anchor - Manually setting program account discriminator
As hana said, you can get the discriminator for an account using MyAccount::discriminator(); so long as you import anchor_lang::Discriminator into your source file.
Then you can write the account data …