Skip to main content

Questions tagged [anchor-client]

Filter by
Sorted by
Tagged with
0 votes
0 answers
20 views

Created Todo: Error Message: A seeds constraint was violated

Anchor code #[derive(Accounts)] #[instruction(todo_index: u8)] // Added this to pass the index as an instruction argument pub struct CreateTodo<'info> { #[account(mut)] pub authority: ...
pranay raj's user avatar
0 votes
0 answers
16 views

anchor verify 5nfdb6vRYEgh7i41jcv5eC4gMUA5stV2bUDJcbM9JzBQ --skip-build

Having issues with anchor verify anchor verify 5nfdb6vRYEgh7i41jcv5eC4gMUA5stV2bUDJcbM9JzBQ --skip-build Error: package section not provided Need your guys help let me know!! Important point I tried ...
Jahanzeb Hussain's user avatar
1 vote
1 answer
16 views

Inconsistent Results Running The Same Code In Playground

I'm using the Solana Playground where I deployed an anchor program that stores a counter and increments the number: use anchor_lang::prelude::*; declare_id!("XXXXX...."); #[program] mod ...
Jim's user avatar
  • 165
1 vote
1 answer
35 views

error while executing create token account instruction

const sleeperAccountInstruction = await program.methods .createNewSleeper("test") .accountsPartial({ payer: account, mint: mintPDA, sleeperAccount: sleeperPDA, ...
Hiderr Kamado's user avatar
0 votes
1 answer
14 views

Error while calling an instruction with PDA in client side code

I’m trying to send SOL to a “hold account” (which I’m thinking should be a PDA) and then only be able to claim it from the address that sent this SOL. I am getting an error as I’m trying to now call ...
juic3n's user avatar
  • 115
0 votes
1 answer
168 views

Error: expected environment variable `ANCHOR_WALLET` is not set

I had an error, seems like I'm missing something. Hope someone can help const connection = new Connection(clusterApiUrl("devnet"), "confirmed"); const program = new anchor....
Hiderr Kamado's user avatar
0 votes
0 answers
17 views

Could not able to run tests in anchor. Main error is anchor test command is not finding .ts file

The Error, I am receiving in the terminal after running the command 'anchor test' is : TypeError: Unknown file extension ".ts" for /home/ahmed/development/your-x/tests/your-x.ts My anchor....
Sardar Ahmed Khan's user avatar
0 votes
0 answers
12 views

Error: Property 'all' does not exist on type 'ticket' account in Anchor program

I'm working on a Solana program using Anchor ("^0.30.1") and encountered an error while trying to fetch accounts with the all method. I want to retrieve all tickets for a specific lotteryId ...
Saakshi Raut's user avatar
4 votes
2 answers
219 views

Can anchor client be used with @solana/web3.js 2.0rc?

Anza team introduced new version of solana web3.js. It has significant changes in its structure. Can I use web3.js 2.0 with anchor client to interact with solana program? For example: import { ...
toygr's user avatar
  • 190
1 vote
1 answer
26 views

where to specify progamId on client side to interact with a progam if at all

I am trying to interact with a basic counter program using coral-xyz, deployed it in localnet and devnet but failed to interact with both. following soldev/course Error: Simulation failed. Message: ...
xTwo56's user avatar
  • 11
2 votes
0 answers
104 views

How can I decode the data for an event emitted by an inner instruction?

For this transaction for example - how can I decode the data in the buy function? I have the IDL. I've tried creating a struct and converting the data to an Uint8 Array and then decoding but I'm ...
eth_developer's user avatar
3 votes
1 answer
250 views

Anchor deployment on Solana mainnet is failing

I'm trying to deploy the contract to Solana mainnet and it's failing. Deployment command used: #!/bin/bash RPC_URL=RPC_URL_FROM_QUICKNODE anchor build anchor deploy --provider.cluster $RPC_URL -- --...
Akshay Soam's user avatar
1 vote
1 answer
113 views

Request solana airdrop in rust/anchor

We can use solana airdrop 1 <my pubkey> to request an airdrop with the solana cli. Is there a way we can do this in rust/with anchor_client directly?
McBain's user avatar
  • 5,384
1 vote
1 answer
48 views

Error Message: A seeds constraint was violated. The ts client does not correspond to the pda of the Solana program

Issue I encountered a strange issue where the PDA found using findProgramAddressSync in the TypeScript client does not match the PDA found in the Solana program instruction account structure, despite ...
jin yang's user avatar
2 votes
1 answer
213 views

Using `onAccountChange` in Rust

If I want to react to an account changing, I can use the onAccountChange function in web3.js, like described here for example. I'm building a client in rust though, does anchor_client or solana_sdk ...
McBain's user avatar
  • 5,384
1 vote
1 answer
29 views

Fetching an account declared in `declare_program!` using anchor_client

If I have my program idl imported using declare_program! how can I fetch and parse an on-chain account using it?
McBain's user avatar
  • 5,384
1 vote
4 answers
252 views

Using anchor_client with tokio

I'm trying to invoke a transaction with anchor_client from a tokio context. Here's how I'm doing it: let pid = Keypair::new().pubkey(); let payer = Rc::new(Keypair::new()); let client = ...
McBain's user avatar
  • 5,384
1 vote
1 answer
260 views

Anchor build not working

When I try to run anchor build in my terminal, this is the result I am getting in the terminal. I have uninstalled and installed rust but I am still getting the same output.
Timilehin Israel's user avatar
0 votes
1 answer
93 views

How can I initialize an SPL token mint using anchor_client?

If I want to create an spl token without anchor in rust, I can do this like described here. How do I do it using the anchor_client crate?
McBain's user avatar
  • 5,384
2 votes
0 answers
56 views

How to create an instruction from an anchor program with rust client?

Hi I have a simple contract testing slots pasted below. I have a question is there a way I can create an instruction for check_slot that passes in the 2 arguments? I read that anchor-client in rust ...
solfan123's user avatar
1 vote
1 answer
177 views

How do I build a transaction using `declare_program!` with anchor_client?

If I try to create a transaction using declare_program! for accounts and args and anchor_client for building the transaction: use anchor_lang::prelude::*; declare_program!(my_program); use my_program::...
McBain's user avatar
  • 5,384
3 votes
1 answer
921 views

What is the difference between @coral-xyz/anchor and @project-serum/anchor?

I came across two anchor client library in nodejs. One is @coral-xyz/anchor which current version is 0.30.0 and another is @project-serum/anchor which is at 0.27.0. What is the difference between both ...
kaushik_pm's user avatar
1 vote
0 answers
98 views

Property 'accountName' does not exist on type 'AccountNamespace<ProgramName>'.ts(2339)

Trying to fetch data from an on-chain account using Anchor and getting the error Property 'accountName' does not exist on type 'AccountNamespace<ProgramName>'.ts(2339) fetch method const ...
Jimii's user avatar
  • 7,672
0 votes
1 answer
84 views

Facing issue with account creation with bubblegum, Error: Transaction <some signature> failed ({"err":{"InstructionError":[0,{"Custom":1}]}})

I am trying to create account using below method of bubblegum but getting strange error({"err":{"InstructionError":[0,{"Custom":1}]}}) as described here https://github....
blackhorse's user avatar
3 votes
1 answer
343 views

bug? anchor build got error: `Stack offset of 4608 exceeded max offset of 4096 ...` if there is v1.18.10 solana, but v1.16.25 is OK

Question1: anchor build got error: Stack offset of 4608 exceeded max offset of 4096 ... if let solana v1.18.10 present in ENV/PATH ❱❱❱ which solana /mnt/volume2/solana_dev_env/v1.18.10/solana-release/...
breeze wang's user avatar
1 vote
0 answers
168 views

How to send a solana/web3.js transaction to a anchor program?

I want to send a transaction to a anchor program, I have found the function discriminator const dis = [125,112,23,1,23,45,24,12] I have checked ,that this is the right function, Now i want pass a vec&...
Abhishek Faliya's user avatar
1 vote
1 answer
151 views

Problems deploying and testing with Anchor on Devnet

I am getting this error when trying to test and deploy my program using Anchor. Error: Deploying program failed: RPC response error -32002: Transaction simulation failed: Error processing Instruction ...
gconnect's user avatar
1 vote
1 answer
525 views

How do I resolve the anchor build error: Failed to obtain package metadata

I created a project with the command: anchor init solanasc and I receive this error when I run anchor build ERROR cargo_build_sbf] Failed to obtain package metadata: `cargo metadata` exited with an ...
DreadedHippy's user avatar
1 vote
1 answer
318 views

thread 'main' panicked at 'Not in workspace, cli/src/lib.rs note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

The version of anchor i'm using is 0.29.0 I tried to set RUST_BACKTRACE=1 in the terminal by export RUST_BACKTRACE=1. I got the following error
Jaydeep Dey's user avatar
4 votes
1 answer
217 views

how can I get the return value of an instruction upon sent the Tx from JS client?

Having a instruction that return a number: pub fn get_value(ctx: Context<DataGet>) -> Result<u64> { let ret = 0; // ... Ok(ret) } then, how can I get ...
breeze wang's user avatar
1 vote
2 answers
321 views

How do I get a connection from Anchor?

I'm used to the Solana web3.js library, but have recently started using Anchor. I can see Anchor's TS client connects to my local cluster when I run my transaction, but how do I get the normal web3.js ...
mikemaccana's user avatar
  • 2,734
1 vote
1 answer
72 views

NFTs on anchor tests

I'm trying to use this guide to create an NFT to test with my anchor program. When I attempt to mint the NFT, I am met with the following error. FailedToSendTransactionError: The transaction could not ...
Morgandril's user avatar
2 votes
1 answer
108 views

Signer issues with anchor tests

i'm getting a weird signer error when running my tests; Error: Signature verification failed. Missing signature for public key [`6jAudYFBbfQS59oPNjYcMkqr9MqBf312T7oP6WSYRjsg`]. In this case, ...
Morgandril's user avatar
0 votes
1 answer
422 views

Localnet transaction stuck finalizing

I attempted to run my test using anchor on Localnet but got my test stuck like this ⠤ [0/1] Finalizing transaction ...
Kombi's user avatar
  • 21
2 votes
1 answer
234 views

How can I fix Error Code: InstructionFallbackNotFound?

Today I had this error that took me a while to determine what was happening. 1) Create suscription Is initialized!: Error: AnchorError occurred. Error Code: InstructionFallbackNotFound. ...
Mateo Lafalce's user avatar
1 vote
1 answer
201 views

How to convert Vec<u8> to typescript bytes?

In my rust solana smart contact, build with anchor framework, there is one of my variable that is of type in below format struct X { a: Vec<u8> } while building the contract with anchor ...
blackhorse's user avatar
1 vote
2 answers
258 views

You cannot/should not initialize the payer account as a program account

I'm creating a basic staking contract and just trying to initialize the pool where the reward tokens will be held. I'm receiving the following error: TryingToInitPayerAsProgramAccount. Error Number: ...
blockchief's user avatar
0 votes
1 answer
427 views

Unable to use remaining accounts in anchor program sent from anchor-js?

if i use remaining accounts that are sent from anchor js client in rust anchor program I am getting this error lifetime may not live long enough requirement occurs because of the type anchor_lang::...
Aravind Makam's user avatar
0 votes
1 answer
321 views

How can i get the events emitted from a transaction ID in rust client?

I am trying to fetch the events emitted in a transaction so that i can parse the data and use it on the client. But wondering on how i can fetch it on the anchor client in rust since i couldnt find ...
Dhruv D Jain's user avatar
2 votes
2 answers
419 views

Is there a go package to create clients for anchor programs?

Like typescript package do we have go package that generates clients for solana anchor programs?
Aravind Makam's user avatar
0 votes
1 answer
134 views

Transaction failing while calling a Solana program with PDA

I'm calling a function of anchor_movie_review_program program on devnet CLA5Pk8tpcsA3RPmCYPaRNBdU6xBknRnqshsT1bKT7if. I cloned the following GitHub https://github.com/Unboxed-Software/anchor-movie-...
kc.sol's user avatar
  • 13
2 votes
2 answers
287 views

How to view logs on anchor rust client

I am trying to send a transaction to my program through rust client. But i am running into an issue and i would like to see the logs so that i can trace it. I am using the anchor rust client and ...
Dhruv D Jain's user avatar
0 votes
1 answer
221 views

Getting error when I'm going to mint NFT on testnet using Metaplex

Here is my mint contract use anchor_lang::prelude::*; use anchor_lang::solana_program::program::invoke; use anchor_spl::token::mint_to; use anchor_spl::token::{MintTo, Token}; use mpl_token_metadata::...
Isha Padalia's user avatar
2 votes
1 answer
434 views

How to deserialized Anchor accounts in Rust

In JS/TS I can decode an account from bytes using the coder: const program = new Program(IDL, new PublicKey(""), anchorProvider) const decoded = program.coder.accounts.decode("...
lameren's user avatar
  • 173
2 votes
2 answers
337 views

ERR_INVALID_URL for project-serum/anchor node package

When trying to deploy website I get get the error invalid url error from @project-serum/anchor. Is there an alternative anchor package I could use? TypeError [ERR_INVALID_URL]: Invalid URL at new ...
Miles Donald's user avatar
0 votes
1 answer
178 views

program return data to client error

I'm returning a Result<u64> from my program and want to get that value in the typescript client. I'm using anchor, and attempting to use the functions below: const getReturnLog = (...
joebuild's user avatar
  • 455
3 votes
1 answer
472 views

How to use Anchor's `.view()` in frontend without prompting wallet to sign?

Solang currently uses Anchor's .view() to fetch account state from the client. The issue is that when using .view() in a frontend, it also prompts the wallet to sign a transaction. Is there a way to ...
john's user avatar
  • 7,794
1 vote
3 answers
1k views

Getting insufficient balance error while trying 'anchor deploy' , but I have enough fund in my wallet. How to solve this?

Deploying workspace: http://localhost:8899 Upgrade authority: /home/dev_roy/.config/solana/id.json Deploying program "basic-1"... Program path: /home/dev_roy/User/solana-wallet-setup/anchor/...
soumyadeep.eth's user avatar
3 votes
1 answer
465 views

Fetch all() isn't working in Anchor Client

I am trying to fetch all accounts owned by my program using all() method but it is giving me this nasty error: Uncaught (in promise) ReferenceError: Buffer is not defined at AccountClient.all Code: ...
CryptoSar's user avatar
  • 419
4 votes
1 answer
490 views

What is first 8 bytes of anchor generated instruction data? [duplicate]

I am passing two u32 argument to the instruction. They are appearing at the end but not sure about the first 8 bytes of the instruction data.Another question maybe similar to this how anchor ...
Imran Sheikh's user avatar