Skip to main content

Questions tagged [javascript]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
23 views

Problem with SPL Token accounts TokenAccountNotFoundError

I am trying to transfer some SPL tokens from X wallet to Y. const key = new web3.PublicKey( 'bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1', ); const fromTokenAccount = ...
chenzen's user avatar
0 votes
1 answer
9 views

in tweetnacl-rust Is there a way to Verify(detached_verify) signature on contract side in rust?

i saw TweetNacl-js library in Solana-Coookbook and if i want to sign signature in client side and sign the transaction and send it to solana smart contract. Is there a way? if i consider to use ...
Tushar Sharma's user avatar
0 votes
1 answer
43 views

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

I am working on a solana and raydium project need to know how to get the lp supply, lp burned and circulating supply of a spl-token?
Kumar Shivam's user avatar
0 votes
1 answer
17 views

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

This is my code. I don't understand what this error is for. My console shows the account data has been added to the array successfully. for (const accountInfo of allAccounts) { const ...
user14441's user avatar
1 vote
1 answer
41 views

Anchor error while running test

pub struct InitUser<'info> { #[account( mut, seeds = [CONFIG_ACCOUNT_SEED.as_bytes(), authority.key().as_ref()], bump )] pub config_account: Box<Account<...
ajaythxkur's user avatar
0 votes
0 answers
24 views

Error while swapping solana token: TypeError: pubkey.toBase58 is not a function

async getSwapTransaction( toToken: string, amount: number, poolKeys: LiquidityPoolKeys, useVersionedTransaction: boolean = true, fixedSide: 'in' | 'out' = 'in', ): Promise&...
Kumar Shivam's user avatar
1 vote
1 answer
45 views

Can I change mint authority from null to an address

I have created an SPL token, minted some tokens and then paused the minting by setting authority to null. Can I reset the authority to my/some other wallet from Null ? I am using SPL through ...
Shubhankar Banerjee's user avatar
1 vote
1 answer
39 views

Cant create new associated token account [duplicate]

getOrCreateAssociatedTokenAccount from the @solana/spl-token library executes until timeout and throws the error "TransactionExpiredBlockheightExceededError" when used in this function: ...
Lars Mohammed's user avatar
1 vote
1 answer
39 views

seeds do not result in a valid address javascript

async function ata() { const secretKey = Uint8Array.from(JSON.parse(process.env.PRIVATE_KEY)); const keypair = Keypair.fromSecretKey(secretKey); const owner = new PublicKey(keypair.publicKey); ...
Roomka's user avatar
  • 47
1 vote
2 answers
41 views

Set Mint Authority as PDA

I have written my code and tests in typescript to create a Token 2022 which I would like to have it's PDA be the mint authority. This was working using spl-token but it seems the function I am using ...
Russell's user avatar
  • 11
0 votes
0 answers
5 views

javohirnasuloyev

Salom doʻstlar saytimiz sizga yoqdimi yana quyib yubordi bu yerda forum uchun emas yozgan edim oʻshanda uyimda yosh farzandlarim xali ochilmagan gul yaxshi emas ushoqdan bilan ishlash komissiyasi ish ...
Javohir Nasuloyev's user avatar
0 votes
0 answers
53 views

how to do Swap Sol to different coins via TypeScript?

I'm currently working on a project where I need to swap Solana (SOL) for other cryptocurrencies programmatically using TypeScript. I understand the basics of working with blockchain technologies and ...
user12827's user avatar
0 votes
1 answer
139 views

How to Retrieve Token Metadata Using Web3.js

I'm working on a project where I need to fetch detailed metadata from the Solana blockchain using Web3.js. I'm looking to obtain the following information for a given token: Name, Symbol, Market Cap, ...
Kevin medou's user avatar
0 votes
1 answer
29 views

how to get AccountInfo from serialized data?

Info { data: <Buffer 00 00 00 00 94 f7 95 8c c0 31 ae b3 72 e0 42 65 62 06 ea c6 76 c4 ef ae bb a2 16 bd 87 07 5a 05 10 44 4b c4 2f 29 b5 f7 4c 59 f0 06 09 01 00 00 00 00 ... 32 more bytes>, ...
Roomka's user avatar
  • 47
0 votes
2 answers
119 views

[Phantom]: Is it actually possible to disconnect your wallet

I have a wallet connection setup where I eagerly connect to the wallet using provider.connect({ onlyIfTrusted: true }). When a user clicks disconnect I call provider.disconnect(). Now when they ...
Jonnmye's user avatar
4 votes
1 answer
298 views

Why can slippage only be set to whole numbers using Raydium Swap SDK?

I am currently using the Raydium SDK to perform token swaps. I use the Percent class from the sdk to create the slippage value which I then use in my transaction, but it seems that this Percent class ...
sashavsthewrld's user avatar
1 vote
1 answer
176 views

Transaction simulation failed: Account with insufficient funds for rent

I'm encountering an issue while trying to execute a transaction on the Solana Devnet. The error message I'm receiving is: Transaction simulation failed: Transaction results in an account (1) with ...
guneyuzel's user avatar
0 votes
1 answer
68 views

mintTo(...) of my Token-2022 - Error processing Instruction 0: invalid account data for instruction

Here's a part of the code of minting my Token-2022 which I've deployed previously //........................ console.log( `\npayer: ${payer} $$ ${payer.publicKey}`, `\nmint: ${mint}`, `\...
barugaggi's user avatar
0 votes
1 answer
53 views

borsh.serialize is not a function

class Initialize1 { constructor({ nonce, openTime }) { this.nonce = nonce; this.openTime = openTime; } static schema = new Map([ [ Initialize1, { kind: "...
Roomka's user avatar
  • 47
1 vote
1 answer
48 views

How can I enforce royalty?

I'm creating NFT using metaplex library in Javascript. I need to enforce royalty on my NFT but can't find any resource that explains how to achieve this. Can someone help find a solution? This a the ...
Amir reza Riahi's user avatar
1 vote
2 answers
254 views

How can I import bundlrStorage in metaplex library in js?

I've tried to use bundlrStorage but can' find where should I import it. const Metaplex = require('@metaplex-foundation/js'); // // // const MPX = Metaplex.Metaplex.make(connection).use(Metaplex....
Amir reza Riahi's user avatar
2 votes
1 answer
285 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
42 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
62 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
59 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
79 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
96 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
113 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
  • 69
2 votes
1 answer
130 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
39 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
171 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
127 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
92 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
1k 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
164 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
214 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
90 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
  • 2,184
1 vote
1 answer
137 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
96 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
  • 352
3 votes
2 answers
479 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
51 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
202 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
282 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
938 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
5k 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
178 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
461 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
120 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,962
3 votes
2 answers
2k 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,154
3 votes
4 answers
2k 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,962