Skip to main content

Questions tagged [anchor]

Should be used for all things relating to the Anchor Framework.

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

How to specify the Context struct type by it's location at other files if it's name is same?

I want to set the Context struct type by it's location at the file which it's names are same. Here is a PoC what I want. pub mod instructions; pub use instructions::*; #[program] pub mod myProgram { ...
Jung Chun's user avatar
0 votes
0 answers
8 views

make anchor tests run one after the other

So i'm writing tests for my anchor program, using the mocha testing framework (as per default) Inside of my describe, I want to do different tests, so different it() instructions, but I need them to ...
FluffyMuffin47's user avatar
0 votes
1 answer
14 views

src.toArrayLike is not a function

I am trying to do a dapp on Solona with Next.js and Ancor. I am getting that error Here is my program setup const connection = new Connection(clusterApiUrl("devnet"), "confirmed");...
Berkay Çırak's user avatar
0 votes
1 answer
16 views

Error processing Instruction 0: custom program error: 0x1d Metaplex Core

Getting the error Error processing Instruction 0: custom program error: 0x1d. when trying to mint a Metaplex Core asset from a collection using anchor. Message: Transaction simulation failed: Error ...
Jimii's user avatar
  • 3,877
2 votes
1 answer
45 views

Admin endpoints in a program

How can I ensure that a function can only be called by the address that deployed the program, or the address that is the mint authority ? In anchor
FluffyMuffin47's user avatar
0 votes
1 answer
22 views

Anchor build: Error - Large stack variables

I am still getting these errors upon Anchor build despite others claiming it has been solved by simply upgrading to solana-cli versions 18.2.0 and higher. Error: Function _ZN112_$LT$solana_program.....
Burner Wallet's user avatar
2 votes
0 answers
20 views

Unable to generate build in anchor , want to know the stable version of solana-sdk and solana-client compaitable

what should be the version of crates, since I am getting error of async-trait all time error: failed to select a version for the requirement `async-trait = "^0.1.77"` The version ...
hammad ali's user avatar
0 votes
1 answer
28 views

Transferring SPL Token Error "Changed the Balance of a Read-Only Account" (Using Anchor)

I'm working on a Solana program using Anchor where I mint tokens to a vault and am building a sell_tokens function to sell SPL tokens at a fixed rate. Below is the client-side code for selling tokens: ...
anor londo's user avatar
0 votes
0 answers
14 views

How to send transaction from wallet with secret key

I am trying to send a transaction from a wallet using secret key. I am trying to execute it using @solana/web3.js. Here's the script that I have created but it is not working for some reason. "...
Anas's user avatar
  • 41
0 votes
1 answer
40 views

Smart Program test anchor

here in my instruction it need two things one is signer and other is a PDA account right? PIC 1 but in here while i'm testing i'm not able to pass the todoPda account as you can see it's showing some ...
iamjoey.sol's user avatar
1 vote
0 answers
41 views

Remaining Accounts lifetime

I have problem of borrowing accounts mutably from remaining accounts. Not exactly how to use AccountInfo, as error says that accounts does not live long enough. I am using Anchor 0.29, Solana-Program ...
Vladimir Demidov's user avatar
0 votes
3 answers
75 views

Anchor detecting wrong Rust version

Anchor keeps detecting my Rust version as 1.68.0-dev even though it is the newest one, any idea? jano@Jans-MacBook-Pro counter_2 % anchor test warning: /Users/jano/Desktop/projekty/programowanie/...
user21619's user avatar
1 vote
0 answers
13 views

"Anchor deploy" deploys immutable program

I am using Anchor 0.30.1 which is the latest version. I used to use Anchor 0.30.0 and anchor deploy has deployed upgradeable programs. But after upgrading to 0.30.1, it deploys immutable program. ...
Julbh's user avatar
  • 138
0 votes
0 answers
47 views

React app with anchor 0.30.1 error: "WalletSendTransactionError: Unexpected error..."

I started getting this when I began using an anchor program using 0.30.1. Nothing else changed in the client. I am trying to sign with a phantom wallet (has devnet SOL via React frontend). I have ...
keegan's user avatar
  • 33
1 vote
0 answers
32 views

Anchor cli 0.30.0 missing field 'discriminator' [duplicate]

I have a program which builds fine with anchor 0.29.0, with anchor 30 it does not build at all with the following error: ➜ avm use 0.30.0 Now using anchor version 0.30.0. ➜ anchor build -p ...
Whiteseal's user avatar
  • 3,224
0 votes
1 answer
23 views

Unable to deploy a Hello World contract

I have created a very simple Hello World using anchor framework, rust, and Solana. But I am unable to deploy it, due to rust's version discrepancy. Refer the below image I have tried all types of ...
ispostback's user avatar
0 votes
1 answer
30 views

Increase timeStamp during Anchor Test cases of TS(typescipt)

How to increase timeStamp during Anchor Test cases of TS(typescipt), I have use sinon pkg but It's not happening const clockStub = sinon.stub(Date, 'now').returns(Date.now() + (15 * 24 * 3600 * 1000))...
hammad ali's user avatar
0 votes
1 answer
27 views

Deserializing Anchor Account Data

The IDL from anchor is this { "name": "GlobalVotes", "type": { "kind": "struct", "fields": [ { "name": &...
taborgreat's user avatar
0 votes
1 answer
181 views

RPC request error when requesting devnet airdrop and during anchor deploy

I am trying to deploy my first anchor program and I got it to successfully build. However when I try to deploy it, it returns the error, Error: RPC request error: cluster version query failed: HTTP ...
Joshua's user avatar
  • 1
0 votes
0 answers
20 views

Interact with my program on react app

I am a begineer on Solana blockchain development. I am trying to have my front end application built with react communicate with my program deployed on a localblockchain. What I did: Created a program ...
Louiscaillou's user avatar
0 votes
1 answer
22 views

Sign Program Method Transaction with Secret Key

I have a method in my program that can only be fired by the admin address. Now I am trying to fire this method using Next.js server actions using the secret key of the admin address. But I am having ...
Anas's user avatar
  • 41
0 votes
0 answers
16 views

Mainnet SPL token configuration in Anchor's Localnet tests

I have a query like I have deployed a token on mainnet and has declared that token on the anchor contracts. Now I want to know the best practices such that I can test in locally using anchor test . ...
hammad ali's user avatar
1 vote
0 answers
72 views

Getting this error in anchor while doing anchor build [duplicate]

error: custom attribute panicked --> programs/cpi-programs/src/lib.rs:6:1 | 6 | #[program] | ^^^^^^^^^^ | = help: message: Safety checks failed: Failed to get program path error: could not compile ...
iamjoey.sol's user avatar
1 vote
0 answers
94 views

anchor-spl v0.30.1 solana-spl 1.18.17 error[E0308]: mismatched types

I'm building solana smart contract with anchor. anchor version is 0.30.1 solana-cli version is 1.18.17 first time, I built and deploy smart contract without any issue. But after I add this two lines, ...
Rex Dev's user avatar
  • 11
2 votes
1 answer
28 views

Can not use zero_copy with u8 primitive type

I have this struct: #[derive(Copy, Clone)] #[derive(bytemuck::Zeroable)] #[derive(bytemuck::Pod)] #[repr(transparent)] struct BitSet(u8); It is used in: #[derive(Debug, Default)] #[zero_copy(unsafe)] ...
Vladimir Demidov's user avatar
0 votes
1 answer
39 views

Reliable devnet airdrops

I've been having trouble with getting reliable airdrops of Devnet SOL. I've tried the solana CLI, and every faucet site I could find (they all error out/ say faucet is empty). Only QuickNode works, ...
anor londo's user avatar
0 votes
0 answers
41 views

deploy program and failed at 99% almost every time?

Error: 1 write transactions failed There was a problem deploying: Output { status: ExitStatus(unix_wait_status(256)), stdout: "", stderr: "" }. what this means? some one rejected ...
user2873314's user avatar
0 votes
2 answers
228 views

seahorse build Error: anchor-spl v0.30.0 error[E0308]: mismatched types

I'm testing the test case program for the Seahorse architecture calculator.py and everything works fine when I test with beta.solpg.io, and when I test with a local environment I get an error. My ...
Tang Xiang's user avatar
0 votes
1 answer
110 views

spl-token causing typescript issue

I'm running into a problem calling @solana/spl-token createMint from my anchor tests. When I remove the code for createMint below the test runs successfully without any issues, but once I uncomment I ...
Steve F's user avatar
  • 11
2 votes
2 answers
50 views

Error when passing multiple accounts using the typescript program namespace

Object literal may only specify known properties and 'vestingAccount' does not exist in type 'ResolvedAccounts<{ name: "signer"; writable: true; signer: true; } | { name: "...
brimigs's user avatar
  • 196
1 vote
1 answer
47 views

Got error "account data too small for instruction" when run Anchor deploy?

Sometimes I got this error when deploy program with running "anchor deploy": Error: Deploying program failed: RPC response error -32002: Transaction simulation failed: Error processing ...
user2873314's user avatar
1 vote
1 answer
17 views

Why does has_one does not work?

So, i am making a escrow contract in solana, using anchor. I have this accept_job function. pub fn accept_job(ctx: Context<AcceptJob>) -> Result<()> { let escrow_account = &...
Saksham Chaudhary's user avatar
0 votes
0 answers
36 views

'The given account is owned by a different program than expected' trying to make a transaction, shows program error

I have written a contract where user can register as user and organisation and user can deploy sol to the organisation's address I deployed it in Solana Playground and tried out the functions there ...
Poulav's user avatar
  • 1
0 votes
1 answer
14 views

MPL token metadata via CPI — cannot provide verified creators, signing error

I'm trying to create a token and its metadata using CPI (anchor lang). Everything works except verifying creators. Transaction is first created in backend, on client side it is signed and backend ...
GRiMe2D's user avatar
  • 101
4 votes
1 answer
156 views

Error after updating Solana program to 1.18.17 and Anchor to 0.30.1

I recently updated my Solana program to version 1.18.17 and Anchor to version 0.30.1. After the update, I am encountering errors in the file token/program-2022/src/extension/confidential_transfer/...
0xEbo's user avatar
  • 145
0 votes
1 answer
21 views

Am I minting nfts or SPL?

Hey guys im trying to mint directly in anchor a SPL token and by accident I think im minting nfts: Here's my anchor call: create_metadata_accounts_v3( CpiContext::new( ctx.accounts....
André Garcia's user avatar
2 votes
1 answer
65 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
39 views

Error calling initialize function: TypeError: program.methods.x is not a function, but x IS a function

So, I'm facing an extremely confusing error. I have a solana anchor program, with 5 functions: { // console.log(program.methods) initialize: [Function (anonymous)], initiateSwapErc20: [Function (...
Nathan's user avatar
  • 176
4 votes
3 answers
373 views

Suddenly getting error message: Safety checks failed: Failed to get program path

Suddenly getting message: Safety checks failed: Failed to get program path error message during anchor build anchor version 0.30.0 solana version 0.18.17
blackhorse's user avatar
1 vote
1 answer
38 views

Getting build error: the `#[global_allocator]` in spl_token conflicts with global allocator in: spl_associated_token_account

Earlier I was able to build my solana programs using anchor build but suddenly getting strange error error: the #[global_allocator] in spl_token conflicts with global allocator in: ...
blackhorse's user avatar
2 votes
1 answer
55 views

Read metaplex metadata in rust & anchor

can someone tell me where can i find an example to decode metadata in rust & anchor ? i was using Metadata::from_account_info, but this is no available anymore in recent mpl_token_metadata ...
Effe2's user avatar
  • 1,250
2 votes
1 answer
34 views

How to remove seeds constraint in my solana program built with anchor?

I am currently a beginner in Solana development and following a tutorial by https://www.quicknode.com/guides/solana-development/anchor/create-tokens. pub fn init_token(ctx: Context<InitToken>, ...
NewbJoker's user avatar
0 votes
1 answer
15 views

Set supply After Minting?

so essentially I followed solana examples and I sucessfully minted a token with 'use anchor_spl::{ metadata::{ create_metadata_accounts_v3, mpl_token_metadata::types::DataV2, ...
André Garcia's user avatar
0 votes
2 answers
37 views

can not deploy, getting weird error

i'm trying to build and deploy a program, but i get errors while building (althought it still finishes the build), and i can't deploy. Here is the error while deploying : ELF error: Failed to parse ...
Effe2's user avatar
  • 1,250
1 vote
1 answer
22 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,857
2 votes
1 answer
140 views

Can I use Either in anchor instruction?

An example is a thousand word. Is something like this possible: #[program] pub mod cross_chain_swap { use super::*; pub fn my_fn(Either<Context<Instruction1>, Context<Instruction2&...
Nathan's user avatar
  • 176
1 vote
0 answers
23 views

Trying to retrieve on my frontEnd some account info

I am trying to use a minimalist example to get a feeling of how Solana/Anchor works. I am using anchor-cli v.0.30 and solana v.1.18.15. So I followed some basic tutorial to count the amount of time a ...
BurningTiger's user avatar
0 votes
1 answer
31 views

Hi, I was developing a program & deployed it using solana playground, got into major issue

So issue is it showed it had to confirm 238 transactions, although it completed 237 successfully, it couldnt retry last tx and that didnt chain onchain and my SOL just never came back, how do I claim ...
Kid Knot's user avatar
0 votes
1 answer
24 views

How to set contract ATA's authority to my program

I know how ATA and PDA works. I know that an ATA is a PDA, and so the account which the PDA was derived from is the one that can sign transactions for this PDA. So, I assume that a contract's ATA's ...
Nathan's user avatar
  • 176
1 vote
2 answers
35 views

Reference to mint is not recognized in Struct creation while trying to create an NFT in Anchor

I've tried to follow and complete the following guide to create an NFT through Anchor, but after finishing writing the code following each step throroughly following error while compiling: error[E0425]...
R. Vargas's user avatar

1
2 3 4 5
26