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 |
2
votes
3
answers
413
views
How can I check the amount of lamports sent to in an anchor function?
Assume that I have the below program and I want to restrict the caller of hello function pay at least X number of lamports to be able to call it.
declare_id!("some-id");
#[program]
mod hello_world {
…
4
votes
1
answer
154
views
What does #[account] do in Anchor beside adding constraints?
I couldn't find anchor docs very clear about this. What is exactly the difference between these two structures:
#[derive(Accounts)]
pub struct Foo<'info> {
pub bar: Signer<'info>,
}
and
#[derive( …
2
votes
1
answer
265
views
Does changing wallet balance using try_borrow_mut_lamports really perform a transaction?
In an anchor based project, I've seen something like this in an instruction:
**user_pda_account.to_account_info().try_borrow_mut_lamports()? -= amount;
**transfer_to.try_borrow_mut_lamports()? += amou …
3
votes
1
answer
270
views
What is a system_program in anchor?
While defining my accounts' structures I encountered this error:
a non-optional init constraint requires a non-optional system_program
field to exist in the account validation struct. Use the Program …
1
vote
1
answer
151
views
How can I check whether an account is holder of a given NFT or not in Anchor?
I'm using anchor framework and I need to check whether an account holds a given NFT or not. According to this answer I can perform this check using mpl-token-metadata crate, but the answer does not wo …