Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Questions regarding the JavaScript SDK @solana/web3.js.
4
votes
Accepted
Account vs Keypair
You should always use Keypair. Account is deprecated since v1.10.0
See https://solana-labs.github.io/solana-web3.js/classes/Account.html
[deprecated] since v1.10.0, please use Keypair instead.
2
votes
Accepted
Set feepayer for sol transaction
You can set it using the non-deprecated constructor, which takes as input TransactionBlockhashCtor with shape:
{
blockhash: Blockhash,
feePayer?: PublicKey | null,
lastValidBlockHeight: number,
…
3
votes
Accepted
How to get solana token address from mint address?
This is the associated token address for the mint 89dre8rZjLNft7HoupGiyxu3MNftR577ZYu8bHe2kK7g and the owner 72QTssce1DbnmkbytEewssHMd4xGxUY3faEF8RGoBZde. You need to know both pieces of information t …
3
votes
Accepted
Is there a helper method from the new web3.js library to convert a public Key to string
Yep, getAddressFromPublicKey
const addressBase58 = await getAddressFromPublicKey(publicKey)
https://solana-labs.github.io/solana-web3.js/functions/_solana_addresses.getAddressFromPublicKey.html
2
votes
Accepted
How to sign transaction message using new web3.js
You need to compile the transaction first:
const transaction = compileTransaction(transactionMessage);
const signedTransaction = signTransaction([yourKeypair], transaction)
Note that signTransaction …
6
votes
How do I send transactions with new web3.js?
The sendTransaction JSON-RPC method defaults to a base58 encoding: https://solana.com/docs/rpc/http/sendtransaction#parameters
You need to pass base64 encoding to override that:
const sig = rpc
…
2
votes
How are NFT attributes such as StepN's shoe "levels" updated?
Answering for the general case: updating values that are already allocated (so for example incrementing an existing level) doesn't cost anything in Solana. You pay for storage (by depositing enough SO …
4
votes
Accepted
Solana JSON RPC method `getLatestBlockhash` failing on localnet
The getLatestBlockhash function is new in Solana version 1.9, see here: https://docs.solana.com/developing/clients/jsonrpc-api#getlatestblockhash
NEW: This method is only available in solana-core v1. …
0
votes
How do I prevent it from simulating the process in Solana
The simulation that you're seeing is a feature of the Phantom wallet and many others (all I know of do some form of it) that is designed to protect users. The idea is that a user should be able to see …
2
votes
Accepted
Solana Pay Get Signature
You can use findReference from @solana/pay which will make this a bit easier: https://docs.solanapay.com/api/core/function/findReference
But fundamentally you're doing the right thing, you need to loo …
3
votes
Accepted
How to initiate connect wallet on phantom mobile app
The problem here seems to be caused by the URL you're using, the http://192.168... address
As a workaround you can use ngrok to get a public https URL to your localhost:3000 and use that instead. Once …
2
votes
How to obtain block/slot time?
You can use the RPC method getRecentPerformanceSamples: https://docs.solana.com/developing/clients/jsonrpc-api#getrecentperformancesamples
It gives a result like this:
[
{
"numSlots": 126,
…
2
votes
Accepted
How to get this code with browser based solanaweb3
You're misunderstanding how browser based dapps work. The app never gets access to the user's private key. You also can't sign a transaction without the user's private key. Instead you can request the …
1
vote
Error: unknown signer: 149J5z7P1MLvbUMepVf2DCxESoRPN5cQHFdA7dwCW121
In your accounts struct the only expected signer is owner: owner: Signer<'info>
When you call this you pass the connected wallet as the owner: owner: provider.wallet.publicKey
But then you pass a diff …
1
vote
Failing to deserialize a tx from rpc, Error deserializing transaction: Reached end of buffer...
The base64 transaction looks ok in the Explorer inspector
I think the issue is that you have a serialized transaction, not transaction message. A transaction is a compiled message + signatures.
Try us …