Skip to main content
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
Results tagged with
Search options answers only not deleted user 153
1 vote
Accepted

Calculate account size in anchor

That looks right to me. Nested structs just get laid out per their fields with no additional prefixes. I find this reference quite handy for this stuff: https://www.anchor-lang.com/docs/space
sohrab's user avatar
  • 1,851
6 votes
Accepted

How can I create a PDA account dynamically or conditionally

The best way to see what Anchor is currently doing is to use anchor expand to see the expanded macros. Then you can pull that logic inside your own function. How can we check if a PDA account alread …
sohrab's user avatar
  • 1,851
1 vote

How to convert string to as_bytes in typescript?

If you simply want to translate that Rust code to TypeScript, then it'd be something along these lines (I haven't tested this): import sha256 from 'crypto-js/sha256'; Buffer.from(sha256(name)) If yo …
sohrab's user avatar
  • 1,851
1 vote

How to store signatures in a Solana account

Signatures can be stored as 64 bytes. Simply decode it back, say using bs58: pub struct MyAccount { signature: [u8; 64], } let my_account = MyAccount { signature: bs58::decode("<your signature b5 …
sohrab's user avatar
  • 1,851