All Questions
Tagged with spl-associated-token-account spl-token
61 questions
6
votes
2
answers
604
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, ...
5
votes
2
answers
1k
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 ...
5
votes
1
answer
72
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 {
...
4
votes
4
answers
3k
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 ...
3
votes
1
answer
52
views
How to received typed getTransaction response with jsonParsed encoding?
Context:
I am using @solana/web3.js 2.0 to invoke the getTransaction RPC method with encoding: "jsonParsed". The transaction is expected to have SPL Token instructions (create, ...
3
votes
2
answers
172
views
getAssociatedTokenAddressSync returns different token account address than the one in solscan
I am trying to get token accounts from mint and owner address.
Mint : 7HR9uH1QgDS53GfzoNgG9jieKVY1FARN1oYDQyZ63X4y
Owner: GpMZbSM2GgvTKHJirzeGfMFoaZ8UR2X7F4v8vHTvxFbL -> Raydium LP Token
Token ...
3
votes
1
answer
366
views
How to Access SPL-Token ATA Account Inside a Program for Burning
I'm creating a Token-2022 token with a transfer hook that burns some of the token on transfer. However, the token I want to use I want to create in the CLI. However, in order the burn a token, I need ...
3
votes
1
answer
1k
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({
...
2
votes
1
answer
154
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!("...
2
votes
1
answer
182
views
Why is AssociatedToken Program not needed when using associated_token constraint in anchor?
I wrote a piece of code that uses associated_token::mint and associated_token::authority and I passed the Token Program but did not pass the Associated Token Program. Considering All Accounts must be ...
2
votes
2
answers
538
views
Why do we close WSOL Token Program accounts?
Background:
If I understand correctly: During transactions where we transfer SOL to/from wallets, we need to wrap the SOL in a temporarily created WSOL Token Program account. Then use that to transfer ...
2
votes
2
answers
732
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!
2
votes
3
answers
414
views
Add spl-token balance to wallet balance context provider
I'm trying to add a balance of USDC in a connected wallet that updates on a nextjs typescript website. I want to add it to my SOL balance context provider or do I need to make a completely separate ...
2
votes
1
answer
335
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 ...
2
votes
1
answer
178
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 ...
2
votes
1
answer
921
views
Are addresses in Solana unique accross all the tokens?
I'm working on a system wherein there're multiple blockchains involved, and withing each one, native assets and tokens too are used together, as well as wallet addresses of them.
In Ethereum and TRON, ...
2
votes
2
answers
367
views
How can I recover SPL tokens from an account that is nested inside another ATA account?
We have a Kin account that is nested under a USDC account. We have 2 USDC accounts, and the Kin is nested under a USDC account [1] that wasn’t created by the Associated Token Account program [2], ...
2
votes
1
answer
37
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('...
2
votes
1
answer
275
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 ...
2
votes
1
answer
549
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/...
2
votes
1
answer
91
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?
...
2
votes
1
answer
377
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 ...
1
vote
2
answers
425
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 ...
1
vote
3
answers
631
views
Do I have to explicitly create a USDC account to be able to receive USDC coins?
I have a Solana (#1) and USDT (#2) adddresses on the same account. I have some USDT coins in it. There's no USDC, though.
I've already sent some USDC to the #1 in testnet, from a faucet, but none of ...
1
vote
1
answer
107
views
Funding Native Mint: Sum of account balances before and after instruction do not match
I'm trying to fund a Native Mint token Account from a PDA and then Sync it like so.
**(funder.try_borrow_mut_lamports()?) -= excess_sol;
**(wrapped_sol_escrow.try_borrow_mut_lamports()?) += ...
1
vote
3
answers
880
views
Failing to create associated token account in rust tests. It says insufficient account keys for instruction
https://github.com/SushantChandla/test-mint-bug/blob/main/programs/mint-bug/tests/mint.rs
I am trying to create an associated token account please have a look at the github file.
The error I get is ...
1
vote
4
answers
4k
views
How can I get the bonding curve address for a pump.fun token?
I know that I can go through transactions and get the bonding curve address from buy/sell/create functions but I'm wondering if there is a way to do it through account info or something easier? I'm ...
1
vote
1
answer
97
views
Minting a Fungible SPL token to same ATA (more than 1 time) always fails
I'm pretty new solana ecosystem and have been following multiple tutorials on minting Fungible SPL tokens. On all the tutorials, you create a Mint and ATA and the then the first time the mint ...
1
vote
1
answer
352
views
How can I get metadata for newly minted tokens?
I'm trying to fetch metadata for newly minted tokens (SPL, not NFTs) and unable to get a lot of data apart from decimals, mint_authority etc, I'd like to get the Name, Picture of the token along with ...
1
vote
1
answer
568
views
freeze_authority being null
This isn't a very technical question but more of a theoretical.
I've heard in different places where the in Solana freeze authority violates the idea of immutability or decentralization if an SPL ...
1
vote
1
answer
560
views
How do I transfer the SOL on my token account?
I have a token account (example: https://solscan.io/account/3HJdseEK7G8cDEcDQPNmt5z1TuVb5AjCPxvqJCpkskbQ?cluster=devnet) and accidentally sent some SOL to it. I want to transfer this out to my SOL ...
1
vote
1
answer
43
views
When I try to add metadata to my spl token on my Mainnet coin
For some reason when I try adding metadata to my spl token it never works, I’m using the program id TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb and when I try to add metadata using my mint address it ...
1
vote
1
answer
36
views
How can I retrieve transactions of an address on a particular contract?
at the moment the only way I know is to get all the address signatures and then use getTransaction. But that is not efficient and I don't think it is the correct way to do it.
Any advice or solution?
1
vote
1
answer
286
views
spl-token-cli: how to fix this error
$ spl-token transfer --expected-fee 0.000005 ++m+++++++++++++++++2u++ 100000 destination.json
Transfer 100000 tokens
Sender: ++zt++++++++++++++++++Dw++
Recipient: ++LN+++++++++++++++++++75++
**...
1
vote
1
answer
90
views
Can you retrieve funds of an ATA owned by another ATA?
I created a USDC ATA and was accepting funds there.
I closed the ATA and recouped the SOL. This means the ATA's owner became the System Program instead of the Token Program.
Finally, someone sent ...
1
vote
2
answers
760
views
Error processing Instruction 0: custom program error: 0x12
I am getting this error when trying to do an SPL token transfer.
Solana Docs makes it seem as if this is a 'Frozen Account' error. I am not sure why the account of the sender or the newly created ...
1
vote
1
answer
99
views
Problem with associated token account of a mint account which initialized using Token2022
I have a mint account created from this script which utilizes Token2022 Program: Solana playground..
Now I am trying to create an ATA(Associated token account) by passing the mint account and user's ...
0
votes
3
answers
950
views
Is it possible to have reflection tokens like safemoon on solona?
A reminder on how reflection tokens like safemoon work is every ones balance is simply an equation instead of a fixed number. That way everyone's balance can be instantly updated with no gas needed ...
0
votes
2
answers
663
views
Can you send Custom tokens and NFTs to a PDA account?
I have used PDA account to send and receive sol, now I want to send spl token to PDA Account. What is the implementation for that?
0
votes
1
answer
29
views
Buy using TokenAccount with init errors on second call with "Provided owner is not allowed"
I have a buy instruction for a token which initializes the user's token in the context and it runs absolutely fine the first time I run / call it. But on subsequent calls I get the following error:
...
0
votes
1
answer
749
views
Parsing Token Program Transactions
I'm currently working on monitoring the Solana Token Program with the address TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA.
My goal is to filter out specific events, namely Token Mints, Token Burns, ...
0
votes
1
answer
848
views
Token-2022 extension enforcing immutable owner
I have a use case to assign a new owner to an associated token address (ATA) after it has been created. Having tried this against a local node I was met with an error saying that I could not change ...
0
votes
1
answer
223
views
Is their any API to fetch tranding meme tokens of solana?
I want to fetch all the meme tokens listed on solana network sorted according to the top tranding token first.
0
votes
2
answers
34
views
Freeze, Token two-level smart contract
I need to create a token on Solana using a two-level smart contract so that platforms like Dexscreener do not display the alert: "This token is freezable."
Implementation Idea:
First Level: ...
0
votes
1
answer
84
views
Can i get my tokens i made on my wallet?
I trying make a token according to official document I faced this part
https://solana.com/developers/guides/getstarted/how-to-create-a-token#mint-tokens
Look at picture first i should make an account ...
0
votes
1
answer
116
views
Multiple ATAs for the same mint
I've created a Python script that creates a wallet and monitors all SPL transactions of this wallet.
Using an example to illustrate the problem:
The generated public key belongs to account A with ...
0
votes
2
answers
61
views
Can assosiated addresses be generated on an account with no SOL on it?
Let's say, I've generated 1000 accounts manually, via code. I also want to generate USDT and USDC addresses for each of them. Then I'll give them to the users of my service for them to send USDT and ...
0
votes
1
answer
400
views
I sent Solana to an SPL token account on accident not realizing it can’t pay the fee to transfer it back - how to u retrieve? I have private key
How do i do this? Do i need to write a program? Is there an existing repo than can be cloned and run? I have tried using CLI in a terminal but haven’t had any luck.
0
votes
1
answer
2k
views
Error: failed to get accounts owned by program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA excluded from account secondary indexes; this RPC
I am trying to find all the token accounts that belong to a specific wallet address however i keep getting this error:
Error: failed to get accounts owned by program ...
0
votes
1
answer
37
views
What's the best practice around supporting token accounts other than associated token accounts
In my program, suppose I want to take tokens from a user, or send tokens to that user, etc. Should I support any token accounts (given the mint and the owner matches of course), or only the associated ...