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 |
1
vote
Enum in PDA does not update, ever
Here's a code snippet showing a way of storing PDAs in accounts. It might be better for your purposes.
#[derive(Clone, Copy, PartialEq, AnchorDeserialize, AnchorSerialize)]
pub enum VoterType {
Do …
3
votes
Is there a way to overwrite data in an account?
Unless you increase the space allocation for your account, it can only store a maximum of the number of bytes it was allocated during initialization(in this case likely 8 + 4). Hence deserialization f …
4
votes
Accepted
Stuck at Error: failed to send transaction: Transaction simulation failed: Error processing ...
0x0 means you're attempting to initialize an already initialized account. What's happening here is that because your PDAs have only constant seeds, the same address is generated for them on each run o …
4
votes
What's the best way to use a u16 as a seed for a PDA?
Using a u16 as part of the seeds for a PDA works like this:
Rust
seeds = [.., x.to_le_bytes().as_ref()]
Javascript
x = 12;
[.., new anchor.BN(x).toBuffer('le', 2)]
We use the 2 argument because a u1 …