Quantcast
Channel: Active questions tagged anchor - Solana Stack Exchange
Browsing latest articles
Browse All 353 View Live

"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 Article



How 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 Article

Anchor 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 Article

Invalid 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 Article

error[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 Article

Error: 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 Article

Error: 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 Article


Default 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 Article


What 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 Article

Try 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 Article

I 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 Article

How 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 Article


Image may be NSFW.
Clik here to view.

How 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 Article

anchor 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 Article


Stack 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 Article

how 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 Article


Compressed NFT with attributes

Is there a way to add attributes in metadata to compressed NFT?

View Article

Error: 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 Article

Image may be NSFW.
Clik here to view.

Pubkey 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 Article

How 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 Article


Is 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 Article


Can'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 Article

How 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 Article

Issue 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 Article


How 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 Article

Program returned error: "Overlapping copy"

I tried to mint NFT to someone , but it gives me a error "Error: Raw transaction 5A6sSQPmAUBTQXDkrz9DM1tkYnwp7mjFLLi2S2cUpVjxnkYXHaSvHLHq2fz7Z5ViDdghrAgKPwqBVDC5m7ud3oEK failed...

View Article

Image may be NSFW.
Clik here to view.

Type '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 Article



How 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
Browsing latest articles
Browse All 353 View Live




Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>