Questions tagged [spl-token]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
19 votes
2 answers
1k 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
  • 940
11 votes
3 answers
1k views

How do you get token symbols, name, images, and other metadata using new Metaplex API?

It used to be solana token list but it's deprecated now. How do you search for metadata using new metaplex API? Answer: const mintData = await ( await metaplex .tokens() ....
Alexey Zakharov's user avatar
10 votes
3 answers
1k views

How do I transfer an SPL token using web3.js?

I know the SPL-Token account and own some amount of the token in my account. How can I send some of it to another account using web3.js?
Ahri's user avatar
  • 3,245
9 votes
2 answers
601 views

When creating Associated Token Account "Provided owner is not allowed"

I am trying to create associated token accounts for SPL Transfers and I keep running into Provided Owner not allowed. I have never seen this error before and I am checking to make sure the token ...
0xDon's user avatar
  • 91
8 votes
1 answer
3k views

Get all token holders of a token (mint)

I want to know for a given mint what are all the token holders? I know aboutgetTokenLargestAccounts but want it without the top 20 cap?
y2kappa's user avatar
  • 113
7 votes
4 answers
799 views

What is an Associated Token Account?

The term "Associated Token Account" is often used when talking about tokens on Solana. What is it?
Jacob Creech's user avatar
  • 3,779
7 votes
4 answers
1k views

How many instructions can I add to a single transaction?

I am looking to create a bulk spl-token airdrop script using nodeJS and Solana npm packages. I know that we can add multiple instructions to a transaction but I suppose, each instruction would have a ...
Oguzhan's user avatar
  • 317
6 votes
2 answers
583 views

custom program error 0x11

I'm trying to transfer NFT using the following code which const transferInstruction = createTransferInstruction( sourceAta, recAta, walletAccount.publicKey, 1, [...
Icus1's user avatar
  • 441
6 votes
2 answers
304 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
  • 399
6 votes
1 answer
162 views

Is Token Program 2022 Live?

so I wanted to enquire that whether the token program 2022 is live and is being used by in place of the original token program?
Muhammad Ali's user avatar
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
  • 399
6 votes
3 answers
139 views

Error sending transaction to create ATA

I am trying to create ATA of a user using my own account and send custom tokens to that ATA. Using the following code: const recieverATA = await getAssociatedTokenAddress( tokenMintAddress, ...
fahad's user avatar
  • 399
5 votes
3 answers
4k views

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

I want to receive information about newly created tokens on the Solana blockchain with minimal latency. What are some ways to do this? So that I get information about a freshly created token after, ...
Andrew Swift's user avatar
5 votes
2 answers
518 views

How can I create Token Account at arbitrary PDA (not associated token account)?

Can you create a token account at a PDA that is not an "associated token account"? Meaning the PDA is derived with some arbitrary seeds that are different than what associated token accounts ...
ixmorrow's user avatar
  • 101
5 votes
2 answers
154 views

How to i pass a token accounts address as a argument in a solana program

I'm trying to write a program that mint token to an address being passed as an argument, my code looks like this pub fn mint_tok(ctx:Context<Donate>,amount_token:u64,address:pubkey) -> ...
Icus1's user avatar
  • 441
5 votes
2 answers
606 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
  • 1,805
5 votes
2 answers
5k 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
1k views

Are mint address and token address identical?

Let's take USDT token https://solscan.io/token/Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB I've fetched some of my transaction via Solana API method gettransactions. In those where USDT is transfered,...
Camila326's user avatar
  • 149
5 votes
5 answers
187 views

Is randomness achievable on-chain?

How, for example, might you implement a simple "coin-flip" game as an on-chain Solana program? The concept is that a player deposits a coin or token, and the onchain program generates a &...
Nate's user avatar
  • 411
5 votes
1 answer
477 views

spl-token-2022 compilation error in anchor build

I am running anchor build and faced into an issue mentioned on Anchor discord. After fixing this issue by adding to dependencies, now I am facing this error even if I do not use spl-token-2022. Here ...
gud's user avatar
  • 395
5 votes
1 answer
4k views

Get Token Metadata (decimals,symbol,name...)

I'm looking to query token metadata by looking up the token address(pubkey or mint). Specifically looking for data around the name, symbol, and decimals. Is there an RPC method for this? How does ...
Casey Wilcox's user avatar
5 votes
5 answers
1k views

Getting Error: failed to send transaction: Transaction simulation failed: Attempt to load a program that does not exist

I'm currently trying to run an escrow program and when i turn on the solana-test-validator in a different terminal it gives me this error: failed to send transaction: Transaction simulation failed: ...
Aengus's user avatar
  • 147
5 votes
1 answer
302 views

@solana/spl-token createMint() is broken with custom program error: 0xc / Invalid instruction after version 0.34

Note there's a similar question at solana token program 0xc Invalid Instruction - but the 'answer' is to simply downgrade metaplex. I (and probably many other people on Solana) would like to use fixes ...
mikemaccana's user avatar
  • 1,805
5 votes
1 answer
212 views

Filtering by collectionID tokens owned by a solana wallet

I would like to do the following on the front-end. I would like to have a list of "collections" we support and which user can select from. User connects to Phantom wallet and selects "...
Digital Dom's user avatar
5 votes
2 answers
784 views

Is it possible to close an SPL token Mint account?

Currently, we have code that could end up generating a lot of Mints in PDAs. We want users to be able to close these out as they're not neccessarily meant to stick around forever, but is that even ...
nathanleclaire's user avatar
4 votes
2 answers
255 views

Can I create an ATA of PDA account?

I get this error: "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL invoke [2]", "Program log: Create", "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [3]...
Abhishek Faliya's user avatar
4 votes
2 answers
87 views

Why do some token accounts own themselves?

I was under the impression that accounts owned by users owned a set of token accounts which each represent one distinct token that they own - meaning token accounts would only be owned by a user. For ...
xxl's user avatar
  • 43
4 votes
2 answers
681 views

Determine if a key is an associated token account

If I am given an arbitrary Solana public key without any transactions associated to it, is there a way I can determine if this is a normal account or an ATA? My initial approach would be to see if it ...
Ahri's user avatar
  • 3,245
4 votes
1 answer
502 views

How do I create a spl token with a rust anchor and add it to the token list?

I want to create my SPL token and upload it to https://github.com/solana-labs/token-list. But I found only articles with no-code solution: https://learn.figment.io/tutorials/sol-mint-token or using ...
Watchman's user avatar
4 votes
3 answers
1k views

How to verify solana program (SPL Token) on Solana?

I'm struggling to find an answer to how to verify solana programs code on Solana (for a SPL token). On Ethereum there's a function in the IDE to verify the contract, but I can't seem to find out how ...
Devino68's user avatar
4 votes
1 answer
246 views

How can I use @solana/spl-token's createMint() and mintTo() functions with solana wallet adapter?

I am trying to create a front end for minting and transferring tokens to accounts, and the @solana/spl-token library demands a private key for their functions. Is there a way to use solana wallet ...
incog's user avatar
  • 567
4 votes
3 answers
477 views

SPL-Token crate throws: failed to select a version for the requirement `toml_edit = "^0.18"`

I have been following a tutorial on Solana native development and need to interact with SPL-Token crate at some point. However, I can not build (cargo-build-bpf), it throws: BPF SDK: /Users/user1/....
Oguzhan's user avatar
  • 317
4 votes
1 answer
434 views

how to detect a spl-token balance change?

development environment : C#, Windows Connecting to solana-mainnet web server using wss address. wss = new WebSocketSharp.WebSocket(this.Address); wss.SslConfiguration....
figs's user avatar
  • 65
4 votes
1 answer
101 views

createCloseAccountInstruction() question

Can you issue a createTransferInstruction() then a createCloseAccountInstruction() in the same transaction? Like for instance if you had an NFT exchange like MagicEden, can they transfer an NFT and ...
paradigm111's user avatar
4 votes
1 answer
141 views

spl token 2022 - creating a transfer fee mint in rust "invalid account data for instruction"

I am trying to test out the spl token 2022 program to make a token with the transfer fee extentsion. So far I have the following: let extension_types = vec![spl_token_2022::extension::ExtensionType::...
LindleyLentati's user avatar
4 votes
2 answers
2k views

SPL token image not showing in Phantom wallet

Does anyone uploaded metadata for a SPL token on the mainnet (https://api.mainnet-beta.solana.com) recently ? I uploaded the metadata, hosted on arweave both image and metadata json, but only the text ...
Zjeed's user avatar
  • 53
4 votes
1 answer
162 views

How to createAssociatedTokenAccount for PDA?

Currently, I face into the TokenOwnerOffCurveError error trying to call createAccount from @solana/spl-token, what with createAssociatedTokenAccount being invoked under the hood which, in turn, calls ...
unegare's user avatar
  • 231
4 votes
1 answer
263 views

How to parse SPL2022 Token Metadata back from the @solana/spl-token-metadata JS library?

I'm trying to parse a mint-stored metadata as per the SPL Token 2022 Metadata extension (pointing to the mint itself). Here's what I'm trying to do: const mint = await program.provider.connection....
kevinrodriguez-io's user avatar
4 votes
2 answers
221 views

How can I send a SPL Token using web3.js, wallet-adapter, and spl-token?

I am trying to create a claiming function for a spl-token. The website currently has the user sign in with wallet-adapter, then they click a button, and it should create a transaction for which they ...
Joshua's user avatar
  • 83
4 votes
1 answer
196 views

Error closing token address with the CLI

Why do I get an error when I try to close a token address? spl-token close (token address) Error: Account could not be parsed as token account: pubkey= (my Ledger address) This is the same Ledger ...
Kent-I B's user avatar
4 votes
1 answer
65 views

Authority Delegated SPL token transactions without a program

i want to use authority delegation so a user can delegate his tokens and later a transaction can be created to transfer those tokens. can this be done without a smart contract and can the authority be ...
OverAchiever's user avatar
3 votes
3 answers
2k views

How to calculate token prices from LP pairs?

On EVM networks you can query the blockchain for the balance of the LP pair reserves (token0, token1) and calculate prices from there. How do I replicate something similar on the solana blockchain. I'...
0xKRN's user avatar
  • 31
3 votes
4 answers
2k views

How do I mint an SPL token with custom Metadata without using the Metaplex JS SDK?

Similar to https://stackoverflow.com/questions/69701491/add-meta-data-to-solana-token-with-solana-web3-js, however, the only answer for that question is in Rust and the question asker ended up moving ...
mikemaccana's user avatar
  • 1,805
3 votes
2 answers
1k views

Purpose of wrapping SOL

The Solana documentation describes how to wrap SOL into a custom token. Is that the same procedure used by wSOL? What would be other use cases for doing this? Token Program | Solana Program Library ...
Lukas's user avatar
  • 43
3 votes
3 answers
3k views

Transaction simulation failed: failed to send transaction: Transaction simulation…ocessing Instruction 0: custom program error: 0x1

when I transfer nft to my another account. It makes error. export const createWalletKey = async () => { const bs58 = require("bs58"); const bs = bs58.decode(secretKey); const wallet ...
Jerry's user avatar
  • 141
3 votes
2 answers
240 views

How can I make token accounts rent exempt when I create them?

Hi I am struggling to understand how to make token accounts rent exempt. I have used the following code to create my token account for an SPL token lifted out of the Solana docs. I see that Solana is ...
colinwink's user avatar
3 votes
1 answer
409 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
  • 97
3 votes
2 answers
142 views

Is it possible to fetch user account balance in smart contract?

Is it possible to fetch account balance or token balance in the smart contract itself?
blackhorse's user avatar
3 votes
1 answer
164 views

Error while initializing Account in Solana

I'm new to Solana development and I'm currently trying to initialize an Account using the following code: import { Connection, Keypair, PublicKey, Transaction, SystemProgram, ...
K T's user avatar
  • 33
3 votes
2 answers
293 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
  • 955

1
2 3 4 5
12