Skip to main content

Questions tagged [spl-token-program]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
19 votes
2 answers
2k views

What is the difference between Transfer and TransferChecked instruction from the SPL Token Program?

I'm curious what the practical difference is between the Transfer and TransferChecked instructions, and when should we use one over the other. In this question, I'm using Transfer/TransferChecked as ...
beeman's user avatar
  • 950
5 votes
2 answers
6k views

"Invalid account data for instruction" when trying to transfer USDC tokens

I want to transfer tokens from one account to another using Solana-py library. Here's what I have now: sender_address = '7FdZ8Rv5QZ8zLzGhDpyGYB95uXEK5BaxpKKCjqmBZJnL' sender_secret_key = '...' ...
Mortasen's user avatar
5 votes
2 answers
821 views

Is it possible to make an ATA in one instruction, then use that created ATA in the next instruction, in a single transaction?

This is similar to Can I Create an Account and Transfer Tokens in the same Transaction? but the 'answer' to that question doesn't actually show how to use the token account created in the first ...
mikemaccana's user avatar
  • 2,031
5 votes
1 answer
34 views

({"err":{"InstructionError":[2,"PrivilegeEscalation"]}})

use anchor_lang::prelude::*; use anchor_spl::token::{Mint, Token, TokenAccount, Transfer}; declare_id!("5L3ky71YgB1rRMbJMxw9iH2vw9A59wZ2krWW7vdwfn61"); #[program] pub mod hodl_token_lock { ...
tushar mahajan's user avatar
4 votes
2 answers
277 views

Check mint to create either Token or Token2022 on demand

Solana's Token 22 tutorial tells you how to upgrade to 2022, but most deployed programs need to support existing accounts that were made with the Token program. Let's say we have an ix that makes a ...
Whiteseal's user avatar
  • 3,165
4 votes
3 answers
2k views

TokenAccountNotFoundError when sending SPL tokens in React

When I try to send my SPL tokens I get this error: OrderRow.js:72 TokenAccountNotFoundError at unpackAccount (account.ts:170:1) at getAccount (account.ts:103:1) at async ...
Héctor's user avatar
  • 41
4 votes
1 answer
618 views

Why is one of the transactions for my token account missing from my wallet in Solana Explorer?

I have a wallet 5FHwkrdxntdK24hgQU8qgBjn35Y1zwhz1GZwCkP2UJnM that has a token account Tig6ugKWyQqyRgs8CeDCuC3AaenQzRJ5eVpmT5bboDc. I can see the transaction ...
mikemaccana's user avatar
  • 2,031
3 votes
1 answer
1k views

Parse transactions in human readable format

How can I convert the data to the same form as it is done on the solana explorer for better readability?
slntrx's user avatar
  • 111
3 votes
2 answers
333 views

How to get the Collection's public key out of certain NFT in Anchor

How can I find out the Collection's public key of some NFT in Anchor? I know it was easy to do with the Solana SDK, but as far as I know it is not compatible with Anchor. More specifically, how can I ...
Ander's user avatar
  • 965
3 votes
1 answer
191 views

How to get Mint Address of of SPL token using associated token account? without rpc call

I can get an associated token account knowing the mint address and wallet address with spl_associated_token_account::get_associated_token_address function But is it possible to get a mint address, ...
Scott's user avatar
  • 33
3 votes
1 answer
52 views

Confidential Transfer Solana Setup script failing

I am trying to understand Solana Confidential Transfers, so I ran this script from the official Solana repository for a simple demonstration https://github.com/solana-labs/solana-program-library/blob/...
0xSOL's user avatar
  • 31
3 votes
1 answer
118 views

Is executing `SystemProgram.createAccount` and `Token. InitializeAccount` in different transactions considered safe?

Solana Docs for the Token program state that: It's important to note that the InitializeAccount instruction does not require the Solana account being initialized also be a signer. The ...
eRunner's user avatar
  • 246
3 votes
1 answer
296 views

How to take a snapshot of Token2022 holders?

How to take a snapshot of all holders of a Token2022? I get an output of 0 require('dotenv').config(); const fs = require('fs'); const path = require('path'); const {PublicKey, Connection} = require('@...
David Dacruz's user avatar
3 votes
1 answer
118 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
3 votes
1 answer
108 views

Metaplex Transfer pNFT failing

I am trying to transfer a pNFT via an anchor program, but it is failing at the TokenProgram. Logs below
Jimii's user avatar
  • 3,160
3 votes
1 answer
83 views

spl-token 2.2.0 at solana 1.13.5 getting multisig error: Client(PresignerError(VerificationFailure))

I've been using spl-token multisig for quite a while, but recently it stopped working and I'm getting this error: Client(PresignerError(VerificationFailure)) We checked everything 10 times, rotated ...
rinegade.sol's user avatar
3 votes
1 answer
295 views

signer privilege escalated when trying to transfer tokens out of a PDA owned escrow wallet

Here is the list of accounts I passed in (the ... is extra constraints and stuff I removed for readability) #[derive(Accounts)] pub struct SendTokens<'info> { #[account(mut, seeds = ...
coco's user avatar
  • 73
3 votes
0 answers
190 views

How to Bridge ERC-20 Tokens to a Similar Contract on Solana Using Wormhole or Equivalent Platform?

I am currently working on a blockchain project where I’ve encountered a challenge that I hope to get some insights on. Background: I have an existing ERC-20 token contract on Ethereum, which includes ...
RookLifting's user avatar
2 votes
1 answer
33 views

Observing a contract's behavior and withdrawing tokens from it

I recently encountered an error while trying to withdraw stSOL from the Tulip Protocol's "Lending" section: Program Error: "Instruction #3 Failed - null" At first, I thought it ...
Max Pasmanik's user avatar
2 votes
1 answer
66 views

Transfer specific token to and from a known account

Given that I have the following program use anchor_lang::prelude::*; use anchor_spl::token::{self, Mint, Token, TokenAccount, Transfer as SplTransfer}; declare_id!("...
mstelz's user avatar
  • 45
2 votes
1 answer
126 views

how to transfer spl token with transfer-hook extension

I used the Solana Playground wallet to deploy a program and obtained the program ID. The ID is 6baxXgMr7HypeTBhN64rbrt31UwbSeRtsQQxGw1KBi5b. Then, I used the following script to create an SPL token. //...
blueboy's user avatar
  • 23
2 votes
2 answers
215 views

InterfaceAccount<'_, TokenAccount> fails to create Associated Token Account

I have basic instruction, all it does is create an ATA for a user (mint is already initialized), this is what my context looks like // lib.rs use { crate::constants::*, crate::states::*, ...
Isaac Frank's user avatar
2 votes
1 answer
782 views

SendTransactionError: failed to send transaction: Transaction simulation failed: Attempt to debit an account but found no record of a prior credit

SOL token has been airdropped successfully on the generated payer address. Still I am getting the above error. Here's the code: import * as spl from "@solana/spl-token"; import * as web3 ...
denimcodes's user avatar
2 votes
1 answer
159 views

How to i derive the owner account of an ATA (given the ATA)

One example will be the SyncNative instruction in Token Program - it gives the ATA but I want to retrieve the owner.
Sewy's user avatar
  • 85
2 votes
1 answer
231 views

Can I Create an Account and Transfer Tokens in the same Transaction?

Is it possible to create associated token account and transfer token to that token account at the same time in one transaction?
Muhit Raihan's user avatar
2 votes
1 answer
72 views

Transfer Hook vulnerabilities

I can't tell how safe it is to arbitrarily support transfers on "transfer hook" enabled tokens via CPI from my program. At the moment i am setting is_signer and is_writable to false on all ...
Trevor's user avatar
  • 145
2 votes
2 answers
636 views

Making existing token immutable

How can I change an existing token I created from mutable to immutable? I want to change this on an SPL token would appreciate any help!
Tony's user avatar
  • 21
2 votes
1 answer
509 views

JSON RPC get all SPL token holders during specific time

I am trying to get all the holders of a specific SPL token during a specific time. I get the Error: {'code': -32010, 'message': 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA excluded from account ...
4 1's user avatar
  • 121
2 votes
1 answer
275 views

Sending USDC dev token not working until recepient wallet has >0 value of said token

I am trying to send usdc dev token using code to a wallet address but it kept on showing "Unable to simulate. Make sure you trust this website since approving can lead to loss of funds." And ...
Nooblantis District's user avatar
2 votes
1 answer
135 views

Does one have to generate a special token address for USDT, USDC... when one generates a new address?

In my application I need to generate new addresses from time to time. I need them for SOL as well as for the stable coins on Solana. A new address will be assigned to a new user. Since Solana has ...
Camila326's user avatar
  • 159
2 votes
1 answer
176 views

What are the potential pitfalls of making the mint authority and freeze authority the same as the mint address?

For the TOKEN_2022_PROGRAM_ID spl-token program, it seems like it would be a best practice to make the mint authority and freeze authority different from the mint address, perhaps best to make them ...
OCDev's user avatar
  • 752
2 votes
1 answer
127 views

How does one read a confirmed spl-transfer transaction's instructions?

Creating an spl-transfer transaction: const transaction = new Transaction().add( createTransferInstruction( // Pretend this is filled in ) ) const signature = await ...
Emma Zhu's user avatar
2 votes
1 answer
17 views

SNS - Retrieve all Domains+Subdomains of an User

The following code is used to retrieve all Sub-Domains of a Public-Key. const getAllSNSProgramAccounts = async () => { const accounts = await connection.getProgramAccounts(new PublicKey('...
Eduardo Chongkan's user avatar
2 votes
2 answers
546 views

Using @solana/spl-token-swap package on devnet

I'm following along with this site https://www.soldev.app/course/token-swap. However, there seems to be a version difference in the use of TokenSwap.withdrawAllTokenTypesInstruction: I'm using the ...
MONO's user avatar
  • 51
2 votes
1 answer
3k views

How do I get real-time information about new created tokens on Solana?

So guys, I followed this question How do I get real-time information about newly created tokens on Solana?. I configured a helius hook that monitors the token program at the address ...
slntrx's user avatar
  • 111
2 votes
1 answer
2k views

How to swap SPL token using Raydium Liquidity Pool V4

Please let me know how to swap SPL token using Raydium Liquidity Pool V4. I need sample code. Please help me.
anders nielsen's user avatar
2 votes
1 answer
260 views

Transfer Hook: Not backwards compatible with common wallets

As far as I understand from documentation all the Token-2022 extensions should be backwards compatible with normal transfers from spl-token standard. However when testing Transfer Hooks I was only ...
LubWn's user avatar
  • 23
2 votes
1 answer
512 views

Does token-2022 allow selling fees instead of a basic transfer fee?

I understand now that the token-2022 standard allows transfer fees but does this also allow a fee that only enforces itself when the coin is being sold just like on Ethereum.
lolswag's user avatar
  • 21
2 votes
1 answer
5k views

How to set token tax fee?

In certain tokens on others blockchains, people who are selling/buying/transferring the tokens will be hit by a 10% or more penalty tax fee on the transactions set by token creator. Some of the ...
overdeveloping's user avatar
2 votes
1 answer
229 views

SPL TOKEN recognized as NFT instead of a regular token

I created a spl-token using strata protocol and it is being recognized as NFT on my wallet, even on solscan it is not showing similar to any other token. I found that maybe i would need to pull a ...
loa's user avatar
  • 21
2 votes
1 answer
407 views

Explanation for two token accounts for one owner?

These two token accounts have the same mint and owner. https://explorer.solana.com/address/2xPnqU4bWhUSjZ74CibY63NrtkHHw5eKntsxf8dzwiid https://explorer.solana.com/address/...
euler's user avatar
  • 31
2 votes
1 answer
88 views

Trying to send specific SPL Token but creates new token instead

I'm trying to send a SPL Token but when I execute the code below it creates an unknown token and sends it, It does not recognize the token address / programID. Where should I pass the token address? ...
korimusk's user avatar
2 votes
1 answer
67 views

Where to specify SPL token name or address when transferring

Somebody from Discord was nice enough to point me to look at https://solana-labs.github.io/solana-program-library/token/js/modules.html#transfer but where do I specify what SPL token I want to ...
ratib90486's user avatar
2 votes
0 answers
22 views

Decoding an instruction for a token on the spl token program

Hello you may have seen my last post, Error : TypeError: Cannot read properties of undefined (reading 'equals') This is a follow up to that post. I decided to experiment more with ...
Golden's user avatar
  • 49
2 votes
0 answers
21 views

How to identify liquidity pool burns in Sol Incinerator and determine authority in Solana?

When a liquidity pool is burned in Sol Incinerator on Solana, will the associated token always have Raydium as the authority? Additionally, how can I filter transactions to specifically identify when ...
Nerevaine's user avatar
  • 159
2 votes
0 answers
36 views

What function should I use to purchase a token transfer with program_id?

I am trying to repeat this transaction (4Ku7oqwPAwRLPm7jNp2oTigYv8XpcTPLJwF49dLVS6ypi35vH9orwRAPcfMj37jj8FwmpMFuP5j8cS1hwdoXJp67) programmatically on solana or solana cli (I will be grateful for any ...
AREW's user avatar
  • 33
1 vote
2 answers
316 views

How to create a PDA and enable data storage?

I'm using PDA to hold the funds and the smart contract will sign it to transfer funds from the PDA to anyone. What's the best way to create a PDA to store multiple NFTs/tokens and also custom data ...
NaveeN .G's user avatar
1 vote
2 answers
2k views

how to decode data instructions with javascript

upd: https://docs.solana.com/developing/programming-model/transactions#instruction-data here, my task is to decode this data using js I tried to solve the issue with this post How to get Solana ...
slntrx's user avatar
  • 111
1 vote
2 answers
421 views

Mint Token as a PDA via SPL

I'm converting my custom SPL token anchor program from using mint token as a newly generated anchor keypair, to using a PDA instead. It seems that SPL can take either a keypair or PDA for the mint ...
AceGravity's user avatar
1 vote
2 answers
5k views

How to calculate token prices from LP pairs using `getTokenAccountBalance`?

I want to reference this post: https://solana.stackexchange.com/a/518/7486. I am trying to achieve the same as OP of that post. I want to fetch the price of a token. One response (the one I referenced)...
Eric Goerens's user avatar