"Unable to read keypair file" during 'anchor test', but...
I have a project that fails with Unable to read keypair file when I run anchor test: anchor test Finished release [optimized] target(s) in 0.09sFound a 'test' script in the Anchor.toml. Running it as a...
View ArticleHow to use realloc to increase account space in Anchor?
Lets say that I have the following account struct for my instruction:#[derive(Accounts)]pub struct IncreaseDataSize<'info> { #[account( mut, seeds = [signer.key().as_ref()], bump, realloc = 8 +...
View ArticleAnchor build fail due to no platform tools rust lib
I am using Mac, and installed rust, solana cli, anchor which works before.Recently after I did some version upgrade.I have installed all three stuffs:> rustc --versionrustc 1.77.2 (25ef9e3d8...
View ArticleInvalid arguments error when calling program method via anchor
I am trying to call a program method using anchor. I have the idl.json, I initialize the program and then i call the method. I do it through this:const program = new Program(idl as Idl, programId,...
View Articleerror[E0599]: no associated item named `__anchor_private_full_path` found for...
I run my code, and it shows, looks like I need to intro pub token_program: Program<'info, Token>, but I did, you can get more information from my code belowerror[E0599]: no associated item named...
View Article`Anchor build`: failed to select a version for the requirement `rust_decimal...
Both anchor build and cargo build-bpf fail with:BPF SDK: /home/fish/.local/share/solana/install/releases/1.9.29/solana-release/bin/sdk/bpfcargo-build-bpf child: rustup toolchain list -vcargo-build-bpf...
View ArticleError: AnchorError caused by account: token_metadata_program. Error Code:...
I run anchor test and then it shows Error: AnchorError caused by account: token_metadata_program. Error Code: InvalidProgramExecutable. Error Number: 3009. Error Message: Program account is not...
View ArticleError: target/idl/sol_404.json doesn't exist. Did you run `anchor build`?
I run anchor build , and it indeeded generate a sol404.json , but when I run the anchor test it shows /Users/brooke/Desktop/sol404/node_modules/.bin/ts-mocha -p ./tsconfig.json -t 1000000...
View ArticleDefault program won't build on Anchor 0.30, ahash 0.84 no longer builds
I am attempting to build a default program on Anchor 0.30.anchor init test-projectcd test-projectanchor buildSimilar to this question, this error still occurs in Anchor 0.30:error[E0658]: use of...
View ArticleWhat is the 'info type in Anchor?
In this code snippet:#[derive(Accounts)]pub struct AddToWhitelist<'info> { //etc...Regarding 'info I understand that the ' is a Rust lifetime elision (I think...), but what is the info type. Why...
View ArticleTry to create mint and ATAaccount shows Error:Transaction simulation...
Try to create mint and ATA account, When I run anchor test, it shows Error: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: Program failed to completehere is...
View ArticleI got an issue when interact with anchor project using coral-xyz/anchor
I try to run this function in client, but I got an issue with it. try { const provider = getProvider(); const program = new Program(idl, provider); const accounts = { accounts: { campaign: publicKey,...
View ArticleHow to use timestamp as seed for my PDA?
I'm wondering what are the best practices when using timestamps as a seed to calculate a PDA (or if using a timestamp is recommended at all). I should generate the timestamp from within my program:use...
View ArticleHow to parse the inner instructions of the transaction's instruction?
Its parsing only transaction instructions, but not inner.import { PublicKey, Connection, LAMPORTS_PER_SOL } from "@solana/web3.js";import { SolanaParser } from...
View Articleanchor build fails with 'no such command: `build-sbf`', but I can see...
I've installed Rust, Solana 1.18 (currently in beta) and Anchor 0.30.On a new project:anchor init projectcd projectanchor buildfails with:error: no such command: `build-sbf` View all installed commands...
View ArticleStack offset error for anchor build
How can I fix this error? This is a basic anchor smart contract that initializes an account. There's only one value, an integer, stored. I tried boxing the account (to put the storage on the heap,...
View Articlehow to swap between spl tokens inside rust anchor program
I'm going to implement spl token swap with rust inside Anchor project.Basically it's about compounding logic in staking project, so I have to swap reward tokens into stake token and add it to staking...
View ArticleCompressed NFT with attributes
Is there a way to add attributes in metadata to compressed NFT?
View ArticleError: missing field `discriminator` at line 28 column 5
Hello im trying to build simple smart contract using anchor and solang but when im trying "anchor build" command im getting this error:info: Solang version v0.3.3help: found contract 'helloworld'┌─...
View ArticlePubkey to std::vec::Vec error when running anchor build v0.30.0
Error here when running anchor build on version 0.30.0.It turns out I was simply using <generic_program>::ID.key() and i just needed to remove .key(), so <generic_program>::ID
View ArticleHow to validate the accounts passed on remaining_accounts in Anchor?
I'm wondering what would be the correct way to deal with multiple accounts in Anchor. For example, lets say that we have a program with User PDA accounts and multiple Data PDA associated to each user....
View ArticleIs it possible to set up an account to point to another account?
I'm making an anchor program where I would like to make a user ID easily retrievable with their Pk, sequential ID or username. one way I thought is to make a PK link account (in case the seed for the...
View ArticleCan't run local validator on MAC
Hello I'm getting the following error:Error: failed to start validator: Failed to create ledger at test-ledger: io error: Error checking to unpack genesis archive: Archive error: extra entry found:...
View ArticleHow to use lifetime on Context correctly?
I want to iterate over the accounts passed in ctx.remaining_accounts as in:pub fn do_something(ctx: Context<DoSomething>) -> Result<()> { for acc in ctx.remaining_accounts.iter() { let...
View ArticleIssue While Connecting to Frontend with Anchor Backend
Issue DescriptionI followed all the steps mentioned in the documentation Full Stack Solana development with React and...
View ArticleHow resolve "cannot find value `collection_mint` in this scope" for struct...
I try to create a program with Anchor/Rust to mint a cNFT as a part of a collection, I have this following error on the anchor build and don't understand why he can't access the collection_mint inside...
View Article"Unable to get latest blockhash. " when running "anchor test"
Unable to get latest blockhash. Test validator does not look started.Check .anchor/test-ledger/test-ledger-log.txt for errors. Considerincreasing [test.startup_wait] in Anchor.toml.This shows up...
View ArticleProgram returned error: "Overlapping copy"
I tried to mint NFT to someone , but it gives me a error "Error: Raw transaction 5A6sSQPmAUBTQXDkrz9DM1tkYnwp7mjFLLi2S2cUpVjxnkYXHaSvHLHq2fz7Z5ViDdghrAgKPwqBVDC5m7ud3oEK failed...
View ArticleType 'SolanaNftAnchor' is missing the following properties from type 'Idl':...
Hi I am new to solana and i am testing my mint nft contract , while testing when i import my program using :import { SolanaNftAnchor } from "../target/types/solana_nft_anchor";It gives me an error:Type...
View ArticleHow to determine who can change data on a PDA?
I'm kinda confused on how ownership and signing works in Solana/Anchor, like if I create a user like this:#[derive(Accounts)]pub struct InitializeUser<'info> { #[account( init, payer = signer,...
View Article
More Pages to Explore .....