Skip to main content

Questions tagged [anchor-spl]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
18 views

Is there a new method for ctx.bumps.get in 0.30.0

I've encountered a problem trying to reuse an old project. I'm trying to build the project but the cli throws this error at me: "this is an associated function, not a method" for using *ctx....
Jonathan's user avatar
0 votes
1 answer
12 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
55 views

Transfer Hook - How to get destination ATA owner public key

For my program, I need to implement the Token2022 transfer hook. Inside the transfer hook, I need to read and write a PDA account driven from the address of the owner of the destination ATA. EDIT: In ...
Oleh's user avatar
  • 33
1 vote
1 answer
51 views

Send SPL token from PDA to ATA

I was testing https://github.com/ashishpandiit23/tokentopdatransfer/blob/master/programs/ANCHORFIRST/src/lib.rs but once i try to test sendtokenpda with Solana Play Ground alway i get If somebody can ...
Berkay Kaplan's user avatar
1 vote
1 answer
59 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
0 votes
1 answer
78 views

failed to send transaction: Transaction simulation failed: Error processing Instruction 0: custom program error: 0x5

I encountered an error while executing a program call. Specifically, the error arises during the invocation of a function where I'm attempting to create a metadata account using the ...
Manav Panchal's user avatar
1 vote
1 answer
136 views

Token 2022 rust anchor ( Instruction 0: custom program error: 0x4 )

newbie here ! I'm trying to mint some token 2022 from a rust program. i followed every single instruction i found about turning a classic token 2017 to a 2022 compatible, like changin the default ...
Alexandre Dury's user avatar
0 votes
0 answers
36 views

How to fetch all information about spl token with token address in anchor or in javascript

i want to fetch token information of spl token directly from the solana blockchain . Give some solution to fetch metadata , tokenomics data and security data of spl token . i want to fetch directly ...
muthu kumar's user avatar
1 vote
1 answer
70 views

CPI fails with "Cross-program invocation with unauthorized signer or writable account"

Hi I'm having this problem, I'm trying to execute the BuySingleListing from Tensor but by passing the instruction data to my program. The tx works when I just sign it in the frontend, here's the Tx ...
Jhintux's user avatar
  • 11
0 votes
0 answers
40 views

update Authority error

i have made an nft collection through candy machine i am trying to mint an nft in my rust code and trying to mint to that same collection but i am getting an error saying wrong update authority.while ...
MohammadTalha's user avatar
0 votes
1 answer
77 views

Token extension Transfer hooks js helper functions not adding additional account

I am trying to use the js helpers to add additional accounts to transfer hooks. Adding the accounts manually works fine: transferInstruction.keys.push( { pubkey: program.programId, ...
Jonas H.'s user avatar
  • 5,497
1 vote
1 answer
47 views

Is it possible to fetch pda of one contract in another?

While interacting with 2 smart contracts, I need to write a testcase in typescript where I need to pass PDA of 1st contract in second contract, like pub first_contract_pda_account: AccountInfo<'...
blackhorse's user avatar
1 vote
0 answers
38 views

Err while deploying to devnet on Solana

The build is successful using anchor build. and when i deploy my program using anchor deploy i am getting below error anchor_cli = 0.28.0
Mohammad Abuzar's user avatar
1 vote
2 answers
75 views

Is there any rust function available for getParsedAccountInfo similar to typescript from solana/web3 library?

I am trying to derive AccountInfo from given public key on Rust, Is there any similar anchor function available like getParsedAccountInfo from solana/web3 library?
blackhorse's user avatar
2 votes
1 answer
263 views

What is the meaning of custom program error code 0xc?

I am trying to test my program but I am getting Error: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: custom program error: 0xc Can someone suggest the ...
blackhorse's user avatar
0 votes
1 answer
176 views

Why my minted spl-token-2022 not coming up on phantom wallet?

I have created my spl-token-2022 from anchor smart contract but the minted tokens are not showing on my phantom wallet. What could be the possible reasons for this? This is my token https://solscan.io/...
blackhorse's user avatar
1 vote
1 answer
505 views

Build error: could not find `metadata` in `anchor_spl` and could not find `pda` in `mpl_token_metadata`

In https://beta.solpg.io/tutorials, pick up the "https://beta.solpg.io/tutorials" demo project. Here is the demo code I got: https://beta.solpg.io/65aa97e9cffcf4b13384cf03 But it failed to ...
breeze wang's user avatar
1 vote
1 answer
153 views

How to increase the PDA size after deployment with anchor framework

Is there a way to increase PDA size after contract deployment using anchor framework. Here is the reference of doing the same with realloc, https://dev.to/jacobcreech/how-to-change-account-size-on-...
blackhorse's user avatar
1 vote
0 answers
103 views

Getting error "An account required by the instruction is missing" while creating associated token address

I am trying to create associated token address on solana program with below configuration #[derive(Accounts)] #[instruction(params: TokenParams)] pub struct MintToken<'info> { /// CHECK: ...
blackhorse's user avatar
2 votes
3 answers
482 views

Is there a way to deploy same contract with new program id?

I have to deploy same solana programs with differnt different program ids, how can I do it?
blackhorse's user avatar
2 votes
1 answer
60 views

How to catch error or throw custom error if PDA doesn't exist in Solana program

Is there a way to throw custom error if PDA account does not exist in a Solana program?
blackhorse's user avatar
0 votes
1 answer
264 views

Temporarily lock SPL token transfer for all ATAs

I'm new to solana development, with previous EVM experience, so it's hard to change my paradigm😅 I'm wondering what is the best way to lock SPL token transfers temporarily. So, I have mint ...
Oleh's user avatar
  • 33
0 votes
1 answer
138 views

Getting Transaction simulation failed: Error processing Instruction 0: custom program error: 0x6, while creating permanent delegate

My instruction for creating permanent-delegate is invoke( &initialize_permanent_delegate( &ctx.accounts.token_program.key(), &ctx.accounts.mint_account.key()...
blackhorse's user avatar
1 vote
2 answers
266 views

Getting error while minting token to an account "Transaction simulation failed: Error processing Instruction 0: invalid account data for instruction"

My mint test cases are failing and I am clueless where it is going wrong pub fn mint(ctx: Context<MintToken>, params: MintTokenParams) -> Result<()> { // Check user balance ...
blackhorse's user avatar
1 vote
1 answer
179 views

Is it possible to get the number of decimals for an SPL token in an anchor program?

I want to use the transfer checked instruction to transfer fungible tokens. The problem is that I do not know the number of decimals that a token might have. Is it possible to find out the number of ...
Jimii's user avatar
  • 2,184
3 votes
1 answer
337 views

On calling ctx.bumps.get("mint_account"), failing with error method `get` not found for this struct

Hi I am trying to call ctx.bumps.get("mint_account") on #[derive(Accounts)] #[instruction(params: CreateTokenParams)] pub struct CreateToken<'info> { /// CHECK: New Metaplex ...
blackhorse's user avatar
0 votes
1 answer
181 views

How to transfer large number of SPL tokens?

pub fn transfer<'info>(ctx: CpiContext<'_, '_, '_, 'info, Transfer<'info>>, amount: u64) -> Result<()> The above code is the method defenition used in rust to transfer SPL ...
Aravind Makam's user avatar
0 votes
0 answers
46 views

Can't realloc and SPL transfer in the same instruction

I am trying to transfer an SPL token, and reallocating space in a PDA in one instruction. I am able to realloc (increase and decrease) if I remove the token transfer code in the instruction. I'm also ...
Joey B's user avatar
  • 1
0 votes
0 answers
55 views

Getting AccountNotInitialized error when creating metadata account

The Metadata and MasterEdition accounts are created using the create_metadata_accounts_v3 and create_master_edition_v3 instructions. For some reason anchor expects them to already be initialized. Is ...
Jimii's user avatar
  • 2,184
0 votes
1 answer
83 views

Is it possible for an anchor smart contract to detect which network it is running on

I'm trying to avoid having to make code changes when I move from testing on localnet to devnet and then mainnet. One of my account constraints checks the mint for the associated token account, which ...
Davie Clark's user avatar
1 vote
1 answer
66 views

How to implement a Buying NFT feature on solana program?

I am trying to implement a buying NFT feature in my solana program, but here i am struct on signature verification error. Can anyone find out what i am missing here ? pub fn buy_nft( ctx: ...
Bhawik chawda's user avatar
1 vote
2 answers
477 views

"Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s failed: custom program error: 0x4b"

I have also checked the error repository of metaplex and there i have found this msg: "#[error("This instruction was deprecated in a previous release and is now removed")] Removed, //...
Bhawik chawda's user avatar
4 votes
1 answer
151 views

How to fix Borsh serialize error on Anchor 0.28 when publishing crates

Related to the Borsh serialize error the changes suggested by @acheron only work for running the program, but doesn't work or are ignored when publishing the crate to crates.io. For instance when ...
Peter Schwarz's user avatar
1 vote
0 answers
70 views

Anchor Metadata Creation: insufficient account keys for instruction

I'm getting an error while creating a new token mint. I'm passing all the accounts but still get "Error: NotEnoughAccountKeys". Here's my Anchor Program: pub fn create_mint( ctx: ...
Ace's user avatar
  • 41
1 vote
1 answer
191 views

Why do I get Invalid account data when trying to reopen a token account?

I am trying to unwrap SOL from a WSOL account and then initialize the token account again. I am creating the account like so pub authority_pda: UncheckedAccount<'info>, ...
guccimane's user avatar
3 votes
1 answer
108 views

Token Rewards Calculation and Distribution

I'm doing a script to calculate rewards for a handful of addresses (from sensors). The script runs weekly where it takes a bunch of addresses from our DB, cleans the data and calculates the associated ...
gritty's user avatar
  • 61
0 votes
1 answer
79 views

How to create the seeds for invoking spl cpi instruction?

I need a program owned token account to hold WSOL. I am creating it like thus #[derive(Accounts)] pub struct InitializeProgramTokenAccount<'...
guccimane's user avatar
1 vote
3 answers
653 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
10 votes
2 answers
3k views

error: package `winnow v0.4.4` cannot be built because it requires rustc 1.64.0 or newer, while the currently active rustc version is 1.62.0-dev

When trying to run "anchor build" I get this error. I noticed I can run other programs but it seems as soon as i implement the anchor-spl crate i run into this problem. I've tried updating ...
0xraidr's user avatar
  • 103
0 votes
1 answer
191 views

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

I am trying to initialize an escrow account and I keep getting this error. Here's the instruction code use crate::state::*; use anchor_lang::prelude::*; use anchor_spl::{token::{Mint, TokenAccount, ...
denimcodes's user avatar
3 votes
2 answers
471 views

Deriving an associated token account address

How can I derive an associated token account address for a given wallet address and token mint?
Bayram's user avatar
  • 31
3 votes
1 answer
185 views

anchor build -> stack offset exceeding max offset

they said you can use like 30 accounts, i have only ten and already exceed the stack limit. five associated token accounts, two mints, a pda, the payer, and the token program.
user3438's user avatar
2 votes
1 answer
145 views

Withdraw NFT from PDA/ TokenAccount Anchor-lang

That is what am i doing, transferring my NFTs to TokenAccount with authority as stake_account which is a PDA. How can I tranfer NFTs back to a certian wallet in anchor-lang. use anchor_spl::token::{ ...
Abdullah Qureshi's user avatar
3 votes
1 answer
183 views

Do I need to create ATA for TokenAccount

library: use anchor_spl::token::{ Token, TokenAccount, Transfer } Token Account: #[account( mut, seeds = [mint.key().as_ref(), b"nfts_vault_seed", from.key().as_ref()], ...
Abdullah Qureshi's user avatar
3 votes
1 answer
676 views

TypeError: Cannot read properties of undefined (reading 'createInitMintInstruction')

I am getting this error. TypeError: Cannot read properties of undefined (reading 'createInitMintInstruction') I dont know where and how it went wrong. Appreciate the help. await program.rpc.mintNft({ ...
Syahmi Shaarani's user avatar
0 votes
1 answer
189 views

Error: Signature verification failed with PDA when transferring SPL token

I have been figuring this one out for a few days. Appreciate the help. I want to be able to send the tokens from the PDA ATA to the user who is removing his vault.\ This is the error I am getting: ...
Syahmi Shaarani's user avatar
0 votes
2 answers
74 views

is there a way to mass-burn all SPL tokens in existence (of which may be in various ATAs) in one function call, using anchor?

Let's say you created a spl token using anchor_spl::token::*; Then you minted a bunch and its now made its way to a bunch of people's associated token accounts. Is there a way to write an anchor ...
otter's user avatar
  • 31
1 vote
1 answer
293 views

How to create Associated token Account onchain

Please help i'm trying to create an Associated token account for a PDA onchain using let create_accounts = Create { payer: ctx.accounts.signer.to_account_info().clone(), ...
iMEF's user avatar
  • 326
0 votes
1 answer
92 views

Get NFT's owner on chain

Was wondering what would be the best solution to get the owner of an NFT on chain. I am trying to validate this as I need to run some fn on my program only if the signer is the owner of the NFT. I ...
Jaani's user avatar
  • 3
2 votes
1 answer
130 views

anchor-spl library 0.25.0 breaks on build

Something seems to be wrong with the anchor-spl crate (v0.25.0). When I add the following dependencies to my anchor project it breaks the build: [dependencies] anchor-lang = "0.25.0" anchor-...
Peter Schwarz's user avatar