Skip to main content

New answers tagged

1 vote
Accepted

How do you pay fee with solana adapter for backend transcation of sol

It doesn't appear that you're sending the transaction, just signing it. You can use sendTransaction(transaction, connection) from the useWallet() hook in wallet adapter to handle the flow of signing ...
Joey Meere's user avatar
0 votes

Error running anchor test: Unable to get latest blockhash

You might be getting rate-limited. Try requesting the airdrop using the airdrop instead, of each time before the tests run. Other possible things to try. Check your local solana config and confirm ...
Jimii's user avatar
  • 1,800
0 votes

CandyMachine: Transaction signature verification failure (Backend to frontend)

When i had a similar problem, adding a delay helped me. Adding a timeout before verifying the transaction confirmation can help, as it gives the Solana blockchain time to process and finalize the ...
RAprogramm's user avatar
0 votes
Accepted

How to create a Signer for CreateMetadataAccountV3InstructionAccounts

The error seems to say what's wrong: Type '{ publicKey: PublicKey; signMessage: null; signTransaction: null; signAllTransactions: null; }' is not assignable to type 'Signer'. Types of property '...
Jon C's user avatar
  • 14k
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
  • 14k
1 vote
Accepted

Error fetching block: ReferenceError: GetBlockConfig is not defined

This looks like a syntax error in JavaScript. Try defining the object separately as: const GetBlockConfig = { commitment: 'finalized', maxSupportedTransactionVersion: 0, rewards: false, ...
Jon C's user avatar
  • 14k
0 votes

How to find the pool balance at the end of the epoch

Only the current pool balance is stored on the pool directly, so you would need to fetch the pool before the end of the epoch, and after the start of the next epoch, after the pool has been updated. ...
Jon C's user avatar
  • 14k
1 vote
Accepted

Comparing Performance: Python/JavaScript vs. Rust for Solana API Interaction

If you're interacting with RPC, the biggest performance bottleneck will be the networking aspect, waiting for the RPC node to return data, and the performance differences between languages will be ...
Jon C's user avatar
  • 14k
0 votes

Transitioning from iOS Development to Solana

If you're focusing on iOS development and interacting with the Solana blockchain using Rust and SolanaSwift, you'll likely only need JavaScript/TypeScript for web-based applications. So, for now, you ...
Saidu Bundu-kamara's user avatar
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
  • 1,800
0 votes

How to get the Circulating supply, lp supply and lp burned details of any token in solana web3 js and raydium sdk i am using typescript and javascript

You can get the current supply of a token using the getTokenSupply RPC endpoint: https://solana.com/docs/rpc/http/gettokensupply There's no difference between "circulating" and "non-...
Jon C's user avatar
  • 14k
0 votes

Can I read solana(lamport) balance changes from simulateTransaction result?

On its own, simulateTransaction doesn't give you changes to the accounts, just the new state of the accounts, so you'll need to fetch the accounts separately and compare the output.
Jon C's user avatar
  • 14k
1 vote

How do know which account are ReadonlySignedAccounts or ReadonlyUnsignedAccounts given a solana program transaction

Certainly! In the accountKeys, the order goes: writable signer accounts readonly signer accounts writable non-signer accounts readonly non-signer accounts And the "header" gives all the ...
Jon C's user avatar
  • 14k
2 votes

How can I retrieve the input/output token mint addresses of a Jupiter swap transaction?

You can simply use Bitquery's Jupiter API to get the data on Swaps. You can get the Swapped tokens and the addresses involved in swapping transaction. You can also get the route that jupiter took to ...
Akshat Meena'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

is there a way to get the SPL Transfer Transactions using the solana web3js?

I think @Serban's answer is very helpful, but I think it is slightly outdated, and since there is no accepted answer yet, here is a more correct answer in the form of a test it("should be able to ...
SSDD's user avatar
  • 1
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,040
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,040
0 votes

How to get the price of an spl token relative to solana?

To get the current value per (base) token in it's respective (quote) token, you would do something like: Get the pool baseVault and pool quoteVault, they are just ATAs so you would call ...
spaghetti's user avatar
  • 311
1 vote
Accepted

Error: Unknown https cluster: mainnet

The actual moniker for Solana mainnet is "mainnet-beta", so inputting that should work. Additionally, "https://api.mainnet-beta.solana.com/" should work as well.
Joey Meere'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

How does rate limiting work on Solana

Rate Limiting Mechanism: Public RPC providers for Solana, like those accessed via clusterApiUrl, implement rate limiting primarily based on the number of requests per unit time from a single IP ...
Ana's user avatar
  • 46
0 votes

Unexpected error while signing transaction if fee payer is set

You need to sign the transaction with feePayer if it's paying for the transaction. In this code, it's only be declared as the fee payer, but never actually signing the transaction. For each ...
Jon C's user avatar
  • 14k
0 votes

How can I listen to incoming transactions to my wallet?

You can use the accountSubscribe websocket endpoint and put in your wallet address, ie: { "jsonrpc": "2.0", "id": 1, "method": "accountSubscribe"...
Jon C's user avatar
  • 14k
1 vote

How to read validator information using the vote address?

The validator config account is totally different from a stake account, so you'll need to fetch it using different parameters. And the config program is a bit strange. Here's how to get all config ...
Jon C's user avatar
  • 14k
1 vote

How does rate limiting work on Solana

If you receive a 429 error from RPC, then it means you've made too many requests. A 429 response will also tell you how long to wait typically, and the RPC client will do that automatically. You can ...
Jon C's user avatar
  • 14k
1 vote

About solana token Decimals

use getParsedAccountInfo rpc method to fetch token details of a particular mint address const result = await connection.getParsedAccountInfo(new PublicKey(mint), { commitment: 'confirmed', ...
ashish0411's user avatar
1 vote

Fresh development environment fails to install required packages (NextJS/Typescript Env)

It looks like you might be missing some dependencies. According to https://github.com/anza-xyz/wallet-adapter/blob/master/APP.md#quick-setup-using-react-ui, you should run: yarn add \ @solana/...
Jon C's user avatar
  • 14k
1 vote

Issue while compiling the code | Using Anchor framework

Your error is arising from the AddCertificateRecord Accounts context. As the name suggest, the struct expect you to pass in accounts. You could pass the certificate informations fields as arguments ...
Jimii's user avatar
  • 1,800
1 vote

failed to send transaction: Transaction simulation failed: Transaction results in an account (0) with insufficient funds for rent

Its a bit hard to see without the full code. But it should be amountInLamports - 5000 I would log all the values and double check they are correct. If you are using the wallet adapter it maybe that ...
Jonas H.'s user avatar
  • 5,477
0 votes

Transfer max amount of SOL from wallet while accounting for gas fees

It's a bit annoying, but you can figure out the fee for your transaction using getFeeForMessage https://solana.com/docs/rpc/http/getfeeformessage and then subtract that from your wallet amount. The ...
Jon C's user avatar
  • 14k
0 votes

Problem with calling versioned transactions

getConfirmedTransaction has been deprecated, so I don't think it supports versioned transactions: https://solana.com/docs/rpc/deprecated/getconfirmedtransaction Try simply using getTransaction: ...
Jon C's user avatar
  • 14k
2 votes

Import solana keypair into a wallet application

Try using the using the solana-keygen new --no-outfile --derivation-path command this should work. i faced a similar issue earlie this week, i will try to explain as i understood it this has something ...
Mitchel Dennis's user avatar
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

can anyone tell me why i am getting this error when i trying to create a token

found my mistake i was only crediting the minimum amount needed to create token but forgot about the gas fee so added little more lamports to the amount to be credited and it worked import { ...
Money's user avatar
  • 1
0 votes
Accepted

Cant create new associated token account

'TransactionExpiredBlockheightExceededError' this error occurs when your transaction was to be included in a block that has already expired. This mostly happens if you have a lagging RPC and the ...
Tushar Sahoo's user avatar
0 votes

so i am following solana bootcamp and getting this error bigint

Node is trying to load a native dependency (i think its in c++) to load the bigint which you dont seem to have installed and instead reverts to using pureJs. I get the same error but it's not a ...
Lars Mohammed's user avatar
0 votes
Accepted

How to perform transaction using Solana Phantom on client-side (browser)?

The Buffer error is because Buffer is a Node.JS class and all examples around are based on react mostly, and they forget to mention that. Even when using modern package managers one gets that error ...
Eduardo Chongkan's user avatar
0 votes

Connect Phantom Wallet on Page Load with solana-wallet-adaper

Phantom has an accountChanged event. You can use them in plain JS, e.g. using the pageOnLoad event, with vanilla, or Jquery. provider.on('accountChanged', (publicKey) => { if (publicKey) { ...
Eduardo Chongkan's user avatar
3 votes
Accepted

Accept payment, mint specific NFT to user's wallet using Metaplex (but not candymachine)

Backend Code Modifications and Clarifications Original Implementation Issues: Incorrect Usage of asset: Initially, asset was mistakenly used where a mint address should have been specified. The asset ...
Christian Liz-Fonts's user avatar
3 votes

will it raise higher cost when setComputeUnitLimit to higer and higher CU than actually used?

Short answer is no: currently the cost-per-CU is not implemented on mainnet as of April 2024. Eventually, it will be! Also, it currently does not really matter how much you pay in priority fees. Txes ...
Whiteseal's user avatar
  • 3,040
0 votes

will it raise higher cost when setComputeUnitLimit to higer and higher CU than actually used?

Your impression of setComputeUnitLimit() is indeed correct. This function is used to set the maximum number of compute units (CUs) that the transaction is allowed to consume. If the actual compute ...
Christian Liz-Fonts's user avatar
1 vote

How to perform transaction using Solana Phantom on client-side (browser)?

The best way to connect to solana wallets in the browser is to use the solana wallet adapter. https://github.com/anza-xyz/wallet-adapter You can then send transactions like this for examples: const {...
Jonas H.'s user avatar
  • 5,477
2 votes

How to Interact with solana Programs?

On Solana most programs have an IDL which is a json representation of the program that can be used to generate clients in different languages. The js types are generated automatically when building an ...
Jonas H.'s user avatar
  • 5,477
1 vote

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

Late, but (for spl-2022 tokens) if you receive a mint notification from the RPC, it will look similar to the following image. Notably, it contains "mintAuthority" and "freezeAuthority&...
Zayd's user avatar
  • 11
1 vote

How to solve the problem of sol trading too slow

The slower processing speeds and increased use of computing resources, in your Web3.js application compared to Solflare could be a result of how you structure your transactions the inclusion of ...
Dawit Tilahun Davatron's user avatar

Top 50 recent answers are included