Skip to main content

Questions tagged [anchor-client]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2 votes
1 answer
67 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
25 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?
Ahri's user avatar
  • 4,897
1 vote
1 answer
19 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
71 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 ...
Ahri's user avatar
  • 4,897
1 vote
1 answer
16 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?
Ahri's user avatar
  • 4,897
1 vote
4 answers
92 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 = ...
Ahri's user avatar
  • 4,897
1 vote
1 answer
116 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
48 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?
Ahri's user avatar
  • 4,897
1 vote
0 answers
24 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
76 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::...
Ahri's user avatar
  • 4,897
2 votes
1 answer
269 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
0 votes
0 answers
32 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
  • 3,967
0 votes
1 answer
24 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
1 vote
1 answer
99 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
85 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
102 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
227 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
136 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
110 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
202 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,170
1 vote
1 answer
58 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
61 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
226 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
  • 11
2 votes
1 answer
76 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
132 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
156 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
263 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
243 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
228 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
114 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
185 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
193 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
318 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
  • 163
2 votes
2 answers
226 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
116 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
353 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,537
1 vote
3 answers
792 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
360 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
  • 399
3 votes
1 answer
354 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
3 votes
1 answer
1k views

Error: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: Program failed to complete

I get this error when I am calling an instruction of a program from a client. I am using Seahorse library to write smart contract. The library transpiles python code to anchor rust program. Here's the ...
denimcodes's user avatar
1 vote
0 answers
78 views

When using Event listener the rpc call to program function does nothing and eventualy time limit will exceed and test fails

This block of code is giving the trouble.. let listener = null; //@ts-ignore let [event, slot] = await new Promise((resolve, _reject) => { listener = program.addEventListener(&...
Lobo1897's user avatar
  • 153
1 vote
1 answer
224 views

How to verify data on chain with Solana

I am currently facing a big problem with Solana. I will start with a very simple example for the explanation: In fact I want to create a smart contract, in this smart contract there will be the name ...
RevOneX9's user avatar
1 vote
1 answer
3k views

Stuck at Error: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: custom program error: 0x0

I want to call a method of solana smartcontract. I have an IDL. While I'm calling it I'm getting the following error (when I'm calling await this.program.methods.initialize() method): Error: failed ...
Bakhrom Achilov's user avatar
1 vote
1 answer
96 views

How to read an account state without needing Phantom wallet provider?

I create an instance of a Program in the following way and try to read accounts from the program instance. const network = clusterApiUrl('devnet'); const connection = new Connection(network, "...
Sasha Shpota's user avatar
1 vote
0 answers
58 views

Calling anchor function in the background

How do I call a anchor function without having the end user approve/sign in their wallet? During development in my anchor project, I was able to create tests where I can call anchor functions without ...
ZeroNine's user avatar
  • 496
2 votes
1 answer
63 views

What is a smart contract and what do they do?

I’ve been interested in smart contract’s lately and I was wondering what separates them from just normal scripts that track transactions or something. Can they control NFTs and wallets? Like what ...
Pixeled's user avatar
  • 476
6 votes
1 answer
133 views

Add max Whitelist mint check per user

I need to put a check on Max whitelisted NFTs. Like each user can mint 10 NFTs. Any rust code snippet or reference would be helpful.
Abdullah Qureshi's user avatar
1 vote
1 answer
119 views

Serum dex swap error: Error settling funds

i'm trying to make a serum dex token swap in my program. But the problem is, it only works halfway here's what I mean: when I do orderbook.sell(sell_proceeds, None)?; the swap works and the token I'm ...
iMEF's user avatar
  • 346
3 votes
1 answer
75 views

Uncaught TypeError in React Client

I want to create an account that will hold data for my program on the client side. I've imported the dependencies I need for that: import web3 from '@project-serum/anchor'; and I go ahead to create ...
Kirima's user avatar
  • 155
1 vote
1 answer
155 views

Trouble initializing solana contract on front-end client

I have a very simple program which stores GIFs in a solana contract. Before I can get the gifs, however, I believe I need to call the "initialize" function in my front-end. I have created ...
user2487's user avatar