Questions tagged [javascript]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
0 answers
31 views

Jupiter V6 Swap API. Problem with commission

Jupiter Swap V6 Problem with commission. Hello, I have a problem. I made a node js script to send a swap through the jupiter ag platform. My transaction is successful, but the solscan page displays No ...
EnFlyge Itfy's user avatar
0 votes
0 answers
21 views

Auto-Populate Wallet Address in Input Field After Connecting Phantom Wallet with Solana Adapter

I'm working on a React project utilizing the Solana wallet adapter and encountering an issue with automatically filling in the user's wallet address into an input field upon connecting their Phantom ...
Yazılım Destek's user avatar
1 vote
1 answer
22 views

Display all SOL transfers from one Address to Another. Both addresses are specified

I am very new to JS and Solana. I am trying to show the total amount of SOL that has been transferred from Address_1 to Address_2. When trying the script below, I get: Total SOL received from ...
Chris Cranston's user avatar
0 votes
0 answers
23 views

Blank Transactions on block explorer but returns successful in code

How can I prevent this from happening https://solscan.io/tx/3gphnLPNXHMkE2M8QgRgGXkUPZtZsxs2PEeSZVPBUfmEUemKnpasR3AV6QAVjgsVia5LtCXp9nAK512KvqynfxTm ? Or make it so those are retried until success? ...
Muhit Raihan's user avatar
-2 votes
2 answers
50 views

Where can I find the Solana Javascript SDK?

Nothing is defined. Do I need to write everything myself? All I need is Transaction and SystemProgram for my product wanted to sell via SPL.
Tom's user avatar
  • 1
1 vote
2 answers
46 views

I get an error when deactivate a stake account

I get this error SendTransactionError: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: invalid instruction data at Connection.sendEncodedTransaction (C:\...
Justin Lavoie's user avatar
2 votes
1 answer
40 views

Issue with mintTo function

I tried to run the script below but got this error and was wondering where I may have made a mistake? bigint: Failed to load bindings, pure JS will be used (try npm run rebuild?) The token was created,...
johnny's user avatar
  • 49
1 vote
1 answer
60 views

Can i implement wallet adapter for solana in vanilla js?

I would like to implement wallet adapter in a vanilla js script using something like unpkg or jsdlivr. Is it possible to do that?
user19288852's user avatar
1 vote
1 answer
37 views

Token transfer with splToken throwing error wehen asking to sign

i made a function to transfer a custom token on Solana with spl-token, but when i get to sign the transaction it prompts me this error: Error processing intruction 2: invalid accounr data for ...
user19288852's user avatar
1 vote
1 answer
107 views

How do I use spl-token through cdn.jsdelivr.net?

I am having some troubles using the spl-token library. How do I use it? <script src="https://cdn.jsdelivr.net/npm/@solana/[email protected]/lib/cjs/index.min.js"></script> It is ...
user19288852's user avatar
1 vote
0 answers
59 views

Websocket readyState 2

I've built a small program that monitors for new transactions on an address and then uses signatureSubscribe to watch for transaction confirmation. After running the program for a while, it will ...
Squirrel's user avatar
1 vote
1 answer
37 views

Is there any demo of using javascript / typescript to interact with solana program

Is there any demo of using javascript / typescript to interact with solana program ? For example, how to interact with this program ? https://solscan.io/account/...
Z W's user avatar
  • 11
0 votes
1 answer
553 views

How to interact with router for swap transaction?

hope all doing good in your life, How can I perform a transaction using a Solana router(like orca, Raydium) to swap Solana's native token with another token? I've come across various crates such as ...
PandaKungFuu's user avatar
0 votes
1 answer
88 views

Getting token metadata by name/symbol?

Given a token symbol (let's say $RAY), how can I programatically get all token addresses with that symbol? I know I can pull metadata by contract using: import { Metaplex } from '@metaplex-foundation/...
Abraham P's user avatar
  • 101
0 votes
1 answer
87 views

having issues with the token programme ID when trying to send SPL tokens from my game to the connected users wallet

I'm trying to perform a token transfer using postman with the script I have, I want the script to be my backend server for token transfers in my unity game. I have tried multiple debug logs attached ...
Solana_dean's user avatar
1 vote
1 answer
65 views

How do I pass in `Option<MyEnum>` as an argument when testing

I have a functions looks somewhat like this in the program enum DummyState { one, two } fn dummy(ctx: Context<Dummy>, state: Option<DummyState>) { ... } How do I pass in the ...
Jimii's user avatar
  • 1,438
1 vote
1 answer
104 views

ng build --configuration production --aot --build-optimizer --optimization

Optimization error [main.2d5f2a771afdf2fe.js]: X [ERROR] Big integer literals are not available in the configured target environment ("chrome103.0", "edge108.0", "firefox102.0&...
Athira V. Gopi's user avatar
0 votes
1 answer
88 views

Is solana_sdk wasm incompatible with @solana/web3.js?

I'm trying to create a rust wasm crate that takes a TransactionInstruction from js, mutates it, and return it. I'm trying to use serde-wasm-bindgen to handle the js-wasm interop. As a test, I have ...
billy's user avatar
  • 313
3 votes
2 answers
271 views

Is there a way to fetch all the Stake Accounts of a given sol address?

It seems like there is no function from @solana/web3.js to call to fetch all the stake accounts of a given sol address.
Rick Fu's user avatar
  • 31
0 votes
1 answer
43 views

Transactions in Solana

I need to understand and know how transactions work in Solana. Whether the transactions are similar or completely different from other blockchains. Also, an example javascript implementation would be ...
AlexCav's user avatar
  • 11
2 votes
2 answers
149 views

Can I send signed message into a smart contract?

I was wondering If I can sign a message offchain with privatekey, for example using tweetnacl and then send it as an argument to a smart contract. The contract would decide if the message is legit and ...
Maus's user avatar
  • 21
3 votes
1 answer
200 views

How to sign a message using Baclpack?

I want to sign an arbitrary data (eg. a string message) with Backpack and receive the signature as a result. How can I do it with backpack?
Sasha Shpota's user avatar
1 vote
1 answer
512 views

Solana private-key to derive the path of BIP-44 standard

Hi all I'm trying to develop my own deterministic key hierarchy with BIP-44 , BIP-39 and BIP-32. The initial part of the project is done: I generated the seed phrase thanks to BIP-39; I created my ...
AlexCav's user avatar
  • 11
1 vote
1 answer
4k views

How do I fix error Syntax Error: Unexpected token '.' when running anchor test

I get the following error when I run anchor test to test my smart contract using typescript: Error snippet abortSignal: options?.abortSignal, ^ SyntaxError: ...
dsapalo's user avatar
  • 125
0 votes
1 answer
116 views

How to convert _bn back to PublicKey in JS?

I have this dict in JS, I want to convert it to PublicKey. const account = { "_bn": { "negative": 0, "words": [ 37883239, ...
rudy rhatal's user avatar
0 votes
2 answers
294 views

Solana Token Swap Program - Program log: panicked at 'index out of bounds: the len is 0 but the index is 0', token-swap/program/src/state.rs:61:17

I am facing an issue when I try to create a token swap through the js binding for the token swap program. https://github.com/solana-labs/solana-program-library/tree/master/token-swap I don't get the ...
Skelt's user avatar
  • 31
2 votes
1 answer
100 views

How can I mint a non-transferrable token using Token-2022 in JS/TS?

How do I mint a non-transferrable token using Token 2022 using JS/TS (eg @metaplex-foundation/js or similar). Right now I use @metaplex-foundation/js to run: const createOutput = await metaplexNFTs....
mikemaccana's user avatar
  • 1,620
3 votes
2 answers
632 views

Keypair.generate() vs creating keypair with solana-keygen?

I see two ways of generating Keypair. the easiest one is import { Keypair } from "@solana/web3.js"; const randomKey = Keypair.generate(); I see the other way which needs more work to do. ...
Yilmaz's user avatar
  • 1,071
3 votes
4 answers
1k 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,620
0 votes
0 answers
43 views

trying to connect my vue.js app to my anchor program deployed on devnet, but can't get past this error

tTypeError: Cannot read properties of undefined (reading 'postV0') at sendTweet (send-tweet.js?74a7:53:1) at async send (VM4954 TweetForm.vue:49:21) const wallet = useAnchorWallet() const ...
Tom DeVito's user avatar
1 vote
1 answer
302 views

Attempt to debit an account but found no record of a prior credit

I am trying to map the parking space in a location. In the flowing is my account and method to return the available position in a location. #[account] pub struct Location { pub id : String, ...
Thiago's user avatar
  • 21
1 vote
1 answer
116 views

How to get "feeCalculator` since "getRecentBlockhash()" deprecated?

This is how feeCalculator is received before: const { feeCalculator } = await connection.getRecentBlockhash(); getRecentBlockhash() is deprecated. Instead we use connection.getLatestBlockhash() I ...
Yilmaz's user avatar
  • 1,071
2 votes
1 answer
494 views

How do we call solana methods if program.rpc deprecated?

I initialized a correct program const provider = getProvider(); const program = new Program(idl, programID, provider); When I called this function await program.rpc.create("name", "...
Yilmaz's user avatar
  • 1,071
3 votes
2 answers
274 views

How to build airdrop script for sending equalamount of SOL to multiple addresses?

As a newbie dev, I tried to write an airdrop script using AI but I'm failing to get it to work. My goal is to be able to send an equal amount of Solana to multiple wallet addresses listed in a .txt ...
alo's user avatar
  • 31
4 votes
1 answer
237 views

Just using the Browser bundle, how can I send a transaction (ReferenceError: Buffer is not defined)?

I've been messing around for a while with the @solana/web3.js browser bundle (https://docs.solana.com/developing/clients/javascript-api#bundle) and I'm having some difficulty sending a transaction. My ...
jeffersonbenson's user avatar
1 vote
1 answer
45 views

Signature verification fails when trying to sign transaction with a delegate accout

I am trying to sign a transaction using a delegate account, but transaction.verifySignature() always returns false. However, the transaction works perfectly when I sign it with the owner's keypair. ...
Farrukh Raza's user avatar
2 votes
2 answers
201 views

Whats the highest number of sol-transfers you can pack into one transaction?

I know Solana has a size limit on transactions. If I wanted to distribute solana from one account to hundreds of accounts, what would be the fastest way to go about it, in as few transactions as ...
Helix Development's user avatar
1 vote
1 answer
199 views

Looking for complete/good example of how to test Solana Smart contracts with Javascript (Jest)

I'm looking for a good example or open-source project where I can see and learn how to test Solana smart contracts properly. I would also like to see how to test smart contracts using other programs ...
Ladi's user avatar
  • 23
2 votes
1 answer
2k views

Error: Hydration failed because the initial UI does not match what was rendered on the server | Using solana wallet adapter

when I try and use the Solana front-end wallet adapter and add it to my next project, I keep getting the following error until I change something on the UI. Error: Hydration failed because the initial ...
incog's user avatar
  • 567
0 votes
1 answer
188 views

How can you send an NFT with Phantom Wallet in the web browser without React and using something like PHP, Python, Ruby, Java, C# server side?

How can you send an NFT with Solana API Client-Side in the web browser with Phantom Wallet without React, and with any Server-Side technology like PHP, Python, Ruby, Java, C#? Can anyone post a code ...
paradigm111's user avatar
2 votes
2 answers
135 views

Solana JavaScript Interaction

Is there any way to interact to solana smart contracts using javascript? I have tried many APIs pf moralis and quicknode but I need sole interaction between the smart contract and js.
Harsh Bhatt's user avatar
1 vote
1 answer
50 views

How can I take an extra percentage fee out of every transaction?

I run a coinflip site built with anchor, and I would like to know how I could take an extra fee out of every transaction. Thank you.
dee's user avatar
  • 11
3 votes
1 answer
125 views

Is there a way to get all accounts for pda with one missing seed?

#[account( init, payer = signer, seeds = ["dummySeed".as_bytes(), party.key().as_ref(), member.key().as_ref()], bump, space = DummyStruct::LEN )] ...
Mehmet Ayd's user avatar
1 vote
1 answer
203 views

How to ask the user to sign multiple transactions at once using anchor?

I succeeded to have 2 transactions being executed one after the other. I am trying to only ask the user to validate the transaction on wallet once using signAlltransactions. Works with 2 transactions:...
rudy rhatal's user avatar
1 vote
3 answers
235 views

How do i convert the phantom mnemonic

How to convert a mnemonic from phantom i.e: 'some words that are secret ...' Into the following format: [ 118, 72, 137, 65, 79, 174, 185, 29, 222, 164, 107, 111, 226, 137, 150, 19, 162, 10, 56, 231, 5,...
Darjusch Schrand's user avatar
1 vote
2 answers
101 views

Error with newly migrated Certified NFT Collection

I just migrated my NFT collection to the new Metaplex certified collection standard using their tool at link Now when I try and run .nfts().update() I get the following error Source: Program > ...
jack long's user avatar
1 vote
0 answers
30 views

How do I create a BpfLoaderUpgradable update instruction using the JavaScript SDK?

I need to deploy a buffer to program_id using an app that utlizes a multisig contract. A prudent method to managing deployment is to upload to a buffer with a less trusted account and then use a ...
kathodler's user avatar
2 votes
2 answers
237 views

getOrCreateAssociatedTokenAccount() throws TokenAccountNotFoundError

I am trying to figure out why createAssociatedAccount does not work. This is the code: const SendTransaction = ({ children }) => { const { connection } = useConnection(); const { publicKey, ...
Michael's user avatar
  • 308
2 votes
1 answer
59 views

How to get the Solana unix_timestamp on the front-end (in JavaScript)?

Solana Rust onchains program have access to solana_program::clock::Clock::get()?.unix_timestamp which is seconds from epoch (midnight Jan 1st 1970 GMT) but has a significant drift from any real-world ...
Rajat's user avatar
  • 127
0 votes
2 answers
151 views

Solflare web wallet

GM everyone, Very specific question here ⁉️ Is there any way to connect to solflare web wallet directly, from a program point of view ? When I try to connect to solflare wallet, I have a pop-up asking ...
Flo's user avatar
  • 53