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 1202
6 votes
Accepted

What does #[account] do in Anchor beside adding constraints?

Short answer: The answer is that there's no difference. In this case, #[account] has no effect in the generated code. The reason for this is that the parsing logic for the #[account] macro in this spe …
Ademola's user avatar
  • 3,944
1 vote

Deserialise getAccountInfo data from Rust rpcclient for a PDA from drift protocol

Looks like the User struct isn't serialized with Borsh on the drift side, hence deserialization that way will fail. It's a zero-copy account instead. Try using anchor's AccountLoader to deserialize ac …
Ademola's user avatar
  • 3,944
5 votes

How can I receive SOL from an account into a program?

You’ll have to make sure that both the sending and receiving account are marked as mut on the client side. If you’re using anchor, you can do this by annotating the account field with the #[account(mu …
Ademola's user avatar
  • 3,944
3 votes

Lifetime may not live long enough when passing account into anchor function

'info is a lifetime, a rust concept. tldr is that a struct A that holds a reference to some type B must specify a lifetime. This lets the compiler enforce that A isn't "alive" after B has "died". …
Ademola's user avatar
  • 3,944
0 votes
Accepted

failed to send transaction: Transaction simulation failed: Error processing Instruction 0: i...

#[account(init, payer = tweet, space = 100)] pub tweet: Account<'info, Tweet> This seems to be the issue. The simple answer is that the payer you specify must be different from the account you're tr …
Ademola's user avatar
  • 3,944
3 votes
Accepted

Why we need to pass all that accounts into functions in native solana?

A smart-contract execution environment depends on all the state that it needs being loaded unto it at runtime. Different chains have different ways of providing a program with the data that it needs. …
Ademola's user avatar
  • 3,944
0 votes

Anchor CPI Bubblegum Burn Error Cause Not Signer

In your ProcessRedeemReward struct make sure the accounts in question are indicated as signers either by making them of type Signer or using the #[account(signer)] attribute. In the case of a direct t …
Ademola's user avatar
  • 3,944
3 votes

is it possible to make automatic transaction on solana?

Clockwork lets you do this. It's an automation engine that lets you schedule transactions. Check out this repo for an example of on-chain usage. Here a Pda is given delegation over a token account, ma …
Ademola's user avatar
  • 3,944
1 vote
Accepted

Problem after anchor build

This is an issue with Anchor 0.26. It won't actually stop your project from being built so you should just ignore it.
Ademola's user avatar
  • 3,944
2 votes

unable to get token account balance from AccountInfo

Both pack and unpack are provided by the Pack trait. You'll have to first bring the trait into scope with use solana_program::program_pack::Pack;
Ademola's user avatar
  • 3,944
3 votes

InstructionFallbackNotFound. Error Number: 101. Error Message: Fallback functions are not su...

You can only conveniently access code written in Anchor with the interface Anchor provides through its ts package. This is because the entrypoint to an Anchor program first attempts to strip any instr …
Ademola's user avatar
  • 3,944
1 vote

How do pass Context into multiple helper functions?

Try this: impl<'info> BuyIn<'info> { pub fn transfer_to_vault(&self, amount: u64) -> Result<()> { let cpi_context = CpiContext::new( ctx.accounts.system_program.to_account_info …
Ademola's user avatar
  • 3,944
5 votes

What is the Solana idiomatic way of logging/accessing information about who sent tokens via ...

A way to do this would be to create a separate account for each wallet that contributes. That account would be a PDA to prevent duplicity, and would store contribution details such as the amount contr …
Ademola's user avatar
  • 3,944
1 vote
Accepted

Withdraw NFT from PDA/ TokenAccount Anchor-lang

Here's a code snippet to transfer tokens from a token account with PDA authority: let config_bump = ctx.accounts.config.bump; let config_seeds = &[ "config".as_bytes().as_ref(), ctx.accounts. …
Ademola's user avatar
  • 3,944
2 votes

0x0 error when trying to send NFT into PDA vault

Quoting an answer to this exact issue as shown here, with minor changes: "0x0 means you're attempting to initialize an already initialized account. What's happening here is that because your vaultAcco …
Ademola's user avatar
  • 3,944

15 30 50 per page