Skip to main content

New answers tagged

0 votes

Set Mint Authority as PDA

Here is an example of an Anchor program instruction that creates a token2022 mint account with the metadata extension enable. You can use it as a starting point and update it to use a PDA as the mint ...
john's user avatar
  • 7,345
2 votes
Accepted

Transfer specific token to and from a known account

This looks okay, What I would add is checking whether the holding account to_ata is initialized, If it's not you could use anchor associated_token constraints #[derive(Accounts)] pub struct ...
Jimii's user avatar
  • 2,184
0 votes

How to get the pool balance and pool token balance in past epoch

There is not a way you can check via RPC calls on Solana nodes (https://solana.com/docs/rpc/http). You need to find this type of information "somehow offchain". I would think about ...
chalda's user avatar
  • 827
2 votes

Retrieve token metadata

To make your work easier, make the fetches using the DAS API and an RPC provider that supports it like Helius. Codewise, this would take the form. import { keypairIdentity, publicKey, } from &...
Jimii's user avatar
  • 2,184
1 vote

Sending SPL Token from PDA to ATA Problem

From your code, you are initializing a token account and not an Associated Token Account. Although, not secure, The first change I would recommend is using init_if_needed constraint to avoid account ...
Jimii's user avatar
  • 2,184
0 votes

Sending SPL Token from PDA to ATA Problem

ctx.accounts.wallet_to_deposit_to.to_account_info() is this marked #[account(mut)] in your Context?
frank's user avatar
  • 1
0 votes

How to use spl_token account with solana-program-test crate?

By providing an account with no data as the SPL Token program, your test is actually replacing the SPL Token program with an unusable program. This is an error condition, since the runtime does not ...
Jon C's user avatar
  • 14.4k
1 vote

How to add metadata (name, symbles, ...) to spl token?

You will need to add that using Metaplex Metadata Program](https://developers.metaplex.com/token-metadata) Using UMI and the helpers that they provide, you can have both create SPL and add metadata ...
Jimii's user avatar
  • 2,184
0 votes

I want to add liquidity into Raydium programmatically

This is good practice. https://github.com/raydium-io/amm_anchor/blob/master/tests/amm-proxy/programs/amm-proxy/src/instructions/deposit.rs I've tested and working correctly!
Alan Daniela's user avatar
1 vote

How to fetch token metadata on chain?

You could use the DAS API and make use of the fetchAsset RPC call. More info, https://docs.helius.dev/compression-and-das-api/digital-asset-standard-das-api/get-asset The examples are in JS, but I ...
Jimii's user avatar
  • 2,184
2 votes

Error "process is not defined" when importing { Metaplex } from '@metaplex-foundation/js';

The package is depracated and not in active development. Please switch to Umi and use the associated plugins Metadata Program - @metaplex-foundation/mpl-token-metadata Core Program - @metaplex-...
Jimii's user avatar
  • 2,184
0 votes

USDT received from Binance, but impossible to send or swap them

Solved by myself: found out I had to migrate to ATA tokens, from old raydium page. Binance support wasn't able to tell me the solutions. Case closed
Luca's user avatar
  • 1
0 votes

SplToken createMint Cannot read properties of undefined (reading 'createMint')

You need to add splToken to your project in order to use it. For example, you might need to add the package to your project: npm i @solana/spl-token` And then import it as needed: import * as ...
Jon C's user avatar
  • 14.4k
1 vote

Can I set up the Token extensions (Token 2022) on a Solana spl-token I already made?

If you want to use token-2022 to create your token, you'll need to do a few things during your call to create-token: specify --program-id TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb add any flags for ...
Jon C's user avatar
  • 14.4k
0 votes

What's the simplest way to implement a raffle on-chain?

ORAO has a very fast and cheap VRF available for Solana too. The SDK is on https://github.com/orao-network/solana-vrf and there is a nice Solana Program integration example in the form of an on-chain ...
oraodev's user avatar
1 vote

How to use createCloseAccountInstruction to close TOKEN-2022 ? Using @solana/spl-token

createCloseAccountInstruction( account, destination, authority, multiSigners, // use this: TOKEN_2022_PROGRAM_ID ) is the corect signature for the function, however, you get error 0x23, ...
Marian Bucuresteanu's user avatar
0 votes

Get first mint txn and total minted amount for SPL token using web3.js

You'll need to iterate through all transactions that involve this mint with getSignaturesForAddress followed by getTransaction, then parse through all instructions for any MintTo instruction using ...
Jon C's user avatar
  • 14.4k
1 vote
Accepted

Why do we close WSOL Token Program accounts?

It's really a question of user expectations. There's a fundamental inconsistency with how SOL is treated in wallets vs on-chain programs. In wallets, typically SOL is held directly in the user's ...
Jon C's user avatar
  • 14.4k
0 votes

SPL token transactions check

Hello could you please be more detailed on https://docs.solana.com/api/websocket#accountsubscribe - in the docs description i cant see how to achieve that when i listen to this websocket i can not ...
max's user avatar
  • 1
1 vote
Accepted

Error: failed to get recent blockhash: TypeError: fetch failed, but "connection.getLatestBlockhash()" works

I did not declare provider at the start, you can do this by anchor.setProvider(anchor.AnchorProvider.env());
Rishabh Jamwal's user avatar
0 votes

Error: failed to get recent blockhash: TypeError: fetch failed, but "connection.getLatestBlockhash()" works

Try using a new RPC provider like Helius for your connection string.
Jimii's user avatar
  • 2,184
0 votes

Not seeing transfer fee / tax in solscan devnet

Solana FM has very nice token extensions support. Check it out. also, mind sharing the txHash
Jimii's user avatar
  • 2,184
0 votes
Accepted

Problem with associated token account of a mint account which initialized using Token2022

When deriving an ATA for token-2022, you also need to provide the token-2022 program id. Try doing: const associatedTokenAccount = await getAssociatedTokenAddress( mintKeypair.publicKey, payer....
Jon C's user avatar
  • 14.4k
0 votes

How to Display Custom Balance of an SPL-Token without Associated Token Account?

If you're writing a custom token program, why not just store the correct balance on the ATA instead of the other PDA you've designed? The ATA is just a PDA too!
Jon C's user avatar
  • 14.4k
0 votes

How can I track all USDC transfers from a wallet to another wallet in solana network

If you use the programSubscribe endpoint https://solana.com/docs/rpc/websocket/programsubscribe, you can get a notification anytime an account owned by the token program ...
Jon C's user avatar
  • 14.4k
0 votes

How to fix this error "TypeError: Cannot read properties of undefined (reading 'length')" when trying to push publicKey to an array

There may be other errors, but createWithdrawWithheldTokensFromAccountsInstruction takes the parameters one by one, and not as an object, so you should do: const ix = ...
Jon C's user avatar
  • 14.4k
-1 votes

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

How did u solve the problem, I faced it too. Did u create the token swap with old program id?
Roy Lei's user avatar
0 votes

How to transfer frozen NFT's

You can use createThawAccountInstruction or thawAccount functions from token library to unfreeze your token account. But of course your keypair should have freeze authority.
Oleksii Bereza's user avatar
0 votes

If I'm already checking that the associated token account is owned by the expected owner, is there any benefit to token-2022's ImmutableOwner feature?

Any upgradeable program, including those built in, can be upgraded by the upgrade authority, in order to fix bugs and so forth. The same would happen for an Api, so solana is no different here really. ...
NotoriousPyro's user avatar
3 votes

How to differentiate spl token vs lp token vs nft?

You can use connection.getParsedAccountInfo(mint), which will give you the JSON of the mint account. Stackblitz example: https://stackblitz.com/edit/node-6hvxsq?file=index.mjs const mint = await ...
Callum M's user avatar
  • 3,050
1 vote

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

The Connection object doesn't have a publicKey field, which is why you're getting an undefined address. You can see all its fields/methods here: https://solana-labs.github.io/solana-web3.js/classes/...
Callum M's user avatar
  • 3,050
1 vote

How can I track all USDC transfers from a wallet to another wallet in solana network

Use Transfer API by Bitquery Here is an example https://ide.bitquery.io/Solana-transfer-websocket
Gaurav Agrawal's user avatar
2 votes

how to find a new token in the block

You can use the following API to create the latest tokens. Tokens created in a block - https://ide.bitquery.io/Solana-new-token-created-in-a-block Latest Tokens created API - https://ide.bitquery.io/...
Gaurav Agrawal's user avatar
0 votes

Verified token creators?

You can try solr network, had a good experience with them. Verified and not charging exorbitantly like others.
Ana's user avatar
  • 46
0 votes

SPL token image not showing in Phantom wallet

I have got the answer and its working for me. I created a spl 2022 token and image was not showing in phantom wallet. I initially created token, created account and minted tokens and then created ...
Hamza Sajid's user avatar
0 votes

SPL Token Image not displaying in Phantom or Solscan

Follow this tutorial to have best results https://awoyemivictor.notion.site/Latest-Solana-Token-Creation-Naming-Updating-Step-by-Step-Guide-for-Beginners-July-2022-fc2d8a4042ec49909047ba87eb3aa85a
Hamza Sajid's user avatar
0 votes

"Create Account: account Address already in use" when creating a custom token

I was having the same issue with below command as account was already is use solana-keygen grind --starts-with So i forgot the idea of custom public address and simply created token with this command ...
Hamza Sajid's user avatar
1 vote

Need tech documents about SPL 404

SPL-404 isn't a unified standard, and isn't apart of the official Solana Program Library. Rather, it's a loose idea (saying standard would be generous) for NFTs that can be swapped to normal SPLs/...
Joey Meere's user avatar
2 votes

Update metadata for fixed-supply spl-token

In order to create the metadata, Metaplex's metadata program requires a signature from the mint authority, because they don't want to allow anybody to create the metadata for a token. When you create ...
Jon C's user avatar
  • 14.4k
1 vote
Accepted

Can I change mint authority from null to an address

Once mint authority has been disabled, it is impossible to set it again. More information at the "disable future minting" step at https://spl.solana.com/token#example-create-a-non-fungible-...
Jon C's user avatar
  • 14.4k
1 vote
Accepted

How to create associated token account for a new mint?

Looks like you are missing the token program id. The guide is showing how to interact with the token extensions program. So if you want to find the associated token account you also need to pass in ...
Jonas H.'s user avatar
  • 5,497
3 votes

Confidential Transfer Solana Setup script failing

I think the token proof program for confidential transfers is not yet deployed to mainnet. It will come with Solana version 1.18.x. https://github.com/anza-xyz/agave/wiki/v1.18-Release-Schedule They ...
Jonas H.'s user avatar
  • 5,497
0 votes

Error processing Instruction 0: custom program error: 0x12

Playing around sent 63 Tim's to trust wallet, wallet showed 63000000 Tim's. Entered custom token put in Tim's solana address adjusted the decmil to 9 and then the trust wallet showed 63 the amt. I ...
RL P's user avatar
  • 1
1 vote

Update metadata for fixed-supply spl-token

You can set the mint authority to null. This means there can be no more tokens minted: In js you can do that like this: const freezMint = await setAuthority( connection, keyPair, mintkeyPair....
Jonas H.'s user avatar
  • 5,497
1 vote

How exactly can I find if "Liquidity" is locked or unlocked for an SPL token?

https://api.rugcheck.xyz/v1/tokens/{token_address}/report This api doesnt work in my code , do you have a link to the docs
Timothy Adigwe's user avatar
0 votes
Accepted

Error: solders.SignerError: not enough signers

Since you're using the mint_to command on the client, you're not buying tokens, you're trying to create new tokens. Only the mint authority has the ability to create new tokens on a mint. If you want ...
Jon C's user avatar
  • 14.4k
0 votes

SPL-Token-2022 Fee Epoch length

The epochs are Solana epochs, so every 432,000 slots. You can look around at some of the terminology starting at https://solana.com/docs/terminology#epoch and https://solana.com/docs/terminology#slot
Jon C's user avatar
  • 14.4k
1 vote
Accepted

Unable to Retrieve Data Using get_program_account with SPL Token Program (Python)

Because the SPL Token Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA has so many accounts, most RPC providers prohibit calling get_program_accounts with it. It would return millions of accounts, ...
Jon C's user avatar
  • 14.4k

Top 50 recent answers are included