Skip to main content

New answers tagged

0 votes

How to Display Custom Balance of an SPL-Token without Associated Token Account?

This might not be very useful for you but I will still suggest this approach, maybe it helps: in each assosiacted account save the following ratio: user_amount/total_supply, this should only be ...
Nika Pestvenidze's user avatar
1 vote

Struct field "token_account_owner_pda" is unsafe, but is not documented

TL;DR; this usage is safe and you are expected to add the /// CHECK: comment at the field. To understand the error, let's break it down: Struct field "token_account_owner_pda" is unsafe, but ...
chalda's user avatar
  • 1,082
2 votes

Struct field "token_account_owner_pda" is unsafe, but is not documented

Two ways to fix this - either add the comment, or make it a more specific account instead of an AccountInfo. In your example, this is a special account of length 0, so first declare a new Account type ...
Ahri's user avatar
  • 3,920
1 vote

Error Number: 2006. Error Message: A seeds constraint was violated

You migh be deriving the lottery address incorrectly, Try this and check whether the tests pass const [lotteryPda, lotteryBump] = PublicKey.findProgramAddressSync( [Buffer.from(lotterySeed), ...
Jimii's user avatar
  • 3,120
0 votes

Pay for PDA by a centralized wallet

I ended up sorting out my problem. First, I read the documentation located here https://solana.com/docs/core/pda (FTFM) LOL. Anyways, this code is working to create a PDA and allow another wallet to ...
Christopher Nolan Buckley's user avatar
0 votes

Pay for PDA by a centralized wallet

Could you change the PDA derivation to [deadcasterAddress, bump] = PublicKey.findProgramAddressSync( [Buffer.from('dead_caster'), newAccount.publicKey.toBuffer()], program....
Jimii's user avatar
  • 3,120
2 votes

Anchor pass parameters to PDA creation from initialization

I think bn is little endian. I just tried it in a progam and this works: Try in the client: const extraSeeds = new anchor.BN(10).toArrayLike(Buffer, "le", 8); const [playerPDA] = anchor....
Jonas H.'s user avatar
  • 5,727
2 votes
Accepted

Wrapping Sol results into Error: IncorrectProgramId

I finally figured out the problem: I was not initializing the ATA(I assumed it happens automatically when doing a transaction), the owner of the ATA was not the Token Program One more point worth ...
Nika Pestvenidze's user avatar
1 vote

Anchor Test has Transaction simulation failed: Error processing Instruction 0: custom program error: 0x0

I would recommend using SolanaProgramTest to test Solana programs. If you're using devnet, you'll have to redeploy under a different address or change the seeds between each initialization of an ...
frank's user avatar
  • 11
2 votes

Anchor Test has Transaction simulation failed: Error processing Instruction 0: custom program error: 0x0

This is an expected behaviour. At least based on the code you provided. The test says If PDA Account already created, then we expect an error. The error you receive is 0x0 'Allocate: account Address { ...
chalda's user avatar
  • 1,082
1 vote

Not able to read the updated value in a Solana Data Account

Instead of manually deserializing the account data, try: const account = await program.account.greetingAccount.fetch( greetingAccount.publicKey ) Anchor can automatically deserialize ...
john's user avatar
  • 7,445
4 votes
Accepted

Account creation on Solana

yes The system program is the default owner of the account however the program id used to find that PDA still has signing authority for that PDA
Mitch's user avatar
  • 316
3 votes
Accepted

passing anchor `#[instruction]` argument with another argument results in different address generated

The instructions are passed in order from left to right. So either you change the order of your parameters in the guess instruction or you write your instruction macro like this: #[instruction(dummy: ...
brimigs's user avatar
  • 176

Top 50 recent answers are included