Questions tagged [anchor-spl]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
42 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
17 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
33 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
  • 3,963
1 vote
1 answer
41 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
30 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
41 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
56 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
74 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
0 votes
1 answer
103 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
121 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
48 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
124 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
35 views

How to catch error or throw custom error if PDA doesn't exist in smart contract

Is there a way to throw custom error if PDA account does not exist in solana smart contract itself?
blackhorse's user avatar
0 votes
1 answer
113 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
  • 3
0 votes
1 answer
49 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
127 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
98 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
  • 1,438
3 votes
1 answer
101 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
2 answers
80 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
36 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
54 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
  • 1,438
0 votes
1 answer
58 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
55 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
0 votes
1 answer
280 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
114 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
57 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
142 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
68 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
67 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
353 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
2k 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
168 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
288 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
2 votes
1 answer
131 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
130 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
143 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
453 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
159 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
59 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
217 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
79 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
94 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
1 vote
3 answers
646 views

error of "Cross-program invocation with unauthorized signer or writable account"

I am trying to create an ATA using this but i get this error #[account( init, payer = signer, seeds = [rent_manager.key().as_ref()], bump, token::mint = pay_mint, token::authority = rent_manager, )] ...
Pratik.js's user avatar
  • 1,613
0 votes
2 answers
555 views

Anchor init macro initialise PDA and token account

I am trying to anchor init an PDA with a vault account, however accounts are not getting created. Rust Code: pub struct Initialize<'info> { /// CHECK: This is not dangerous because we don't ...
Piyush Chittara's user avatar
6 votes
2 answers
246 views

Looking for implementation example of anchor_spl::token::initialize_account

I want to use the initialize_account function from anchor_spl::token. The function is given below: pub fn initialize_account<'a, 'b, 'c, 'info>( ctx: CpiContext<'a, 'b, 'c, 'info, ...
fahad's user avatar
  • 389
2 votes
1 answer
159 views

Solana can't mint to a different token account

Folks, I'm starting with Solana and it's been rough to learn. Despite the poor error messages and the learning curve of Rust, I'm making my way through it. I'm trying to develop a new token that will ...
Dinaiscoding's user avatar
2 votes
1 answer
331 views

error[E0658]: destructuring assignments are unstable, why?

I have created anchor program with following dependencies [dependencies] anchor-lang = "0.25.0" anchor-spl = { version = "^0.25.0" } solana-program = "~1.10.29" ...
LUK3ARK's user avatar
  • 21
6 votes
1 answer
89 views

Lifetime error while transferring custom token to dynamic list of accounts

I have a dynamic list of accounts which I need to transfer spl tokens to, I am using the following function: pub fn transfer_token(ctx: Context<TransferToken>, amount_of_tokens:u64) -> ...
fahad's user avatar
  • 389
0 votes
1 answer
57 views

Close Token Account With Multiple Destinations

Is it possible to call close_account function by providing multiple destinations? If so, how do I do it. Otherwise, is using a proxy account as a destination which will send the rent money to multiple ...
user avatar
1 vote
1 answer
49 views

How to verify my smartcontract/program as creator on metaplex minted NFT using rust? [closed]

I want to add my program/smart-contract as creator and verify that. I am using anchor and mpl library on rust. pub fn mint_nft( ctx: Context<MintNFT>, creator_key: Pubkey, ...
Piyush Chittara's user avatar