Questions tagged [typescript]

The tag has no usage guidance.

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

InvalidAccountData Passing a price id to rust pyth-sdk program from typescript client - Pyth

I'm trying to use pyth SDK make a program to fetch a price, then using a typescript client to pass the id of the price feed I want to the program. My rust lib.rs is essentially this: pub fn ...
NDXP's user avatar
  • 1
1 vote
1 answer
29 views

solana/web3.js TransactionMessage issue with payerKey. TypeError: pubkey.toBase58 is not a function

got a problem with this part of the code const messageV0 = new TransactionMessage({ payerKey: wallet.publicKey, recentBlockhash: latestBlockhash.blockhash, instructions: insts })....
The Selected One's user avatar
0 votes
1 answer
20 views

How can I call from Angular App a function from Rust Smart Contract Solana?

I have this function in Rust Smart Contract Solana: pub fn buy_ticket(ctx: Context<BuyTicket>, lottery_id: u32) -> Result<()> { let lottery = &mut ctx.accounts.lottery; ...
Anonymous Billionaires's user avatar
1 vote
2 answers
52 views

Decode account data

I am trying to decode data from accounts. This is the IDL for the data I want to decode: { "name": "deployment", "type": { "kind": "...
CryptoTioSam's user avatar
0 votes
0 answers
68 views

How can I make a swap on raydium using typescript on devnet?

My end goal is to create a swap script, where user have SOL, if he does not hold WSOL it get's wrapped into it and then gets swapped with user's entered token address. Can someone help me out?
Dastageer Sayed's user avatar
1 vote
0 answers
61 views

Problem with token image

I'm new to solana blockchain development and I was trying my hand at creating a custom token on the devnet but I've been stuck for about a week now. When I mint my token, the name and symbol as well ...
johnny's user avatar
  • 49
3 votes
1 answer
54 views

Is there any way to get nonce accounts of an authorized account?

Is it possible to get an authorized account's nonce accounts by using only authorized account's public key? I could not find such a solution on github, discord, and in docs. They always use the public ...
Dante Alighieri's user avatar
2 votes
1 answer
24 views

canonical method of calling programs functions in script format

I have a couple deployed programs on Devnet. Is there a standard way of calling functions on a deployed program, assuming I have the IDL? Obviously I could write a test but a test typically deploys a ...
AceGravity's user avatar
1 vote
1 answer
73 views

Issues with Solana CLI install & web3.js package

I need some help I'm new to solana development and I was following the Solana development course but ran into a lot of issues from the transactions part where packages I installed will no longer work ...
johnny's user avatar
  • 49
1 vote
2 answers
107 views

You cannot/should not initialize the payer account as a program account

I'm creating a basic staking contract and just trying to initialize the pool where the reward tokens will be held. I'm receiving the following error: TryingToInitPayerAsProgramAccount. Error Number: ...
blockchief's user avatar
0 votes
2 answers
171 views

Issue with .env file

I'm just beginning to learn and I'm using the SolDev bootcamp however, I've found an issue where I get this error message, PS C:\Users\Student\Documents\Solana_Web3\generate-keypair> npx esrun ...
johnny's user avatar
  • 49
0 votes
2 answers
40 views

Whirlpools SDK: generating transaction and signing it separately

At this moment whirlpools SDK have building/signing/sending tx steps meshed together. Trying to separate transaction signing into separate secure environment. generate transaction without private key,...
thousandsofthem's user avatar
0 votes
0 answers
54 views

Add custom proxy agent to solana connection [duplicate]

I would like to know how can I add a proxy agent to a RPC connection in TypeScript ( I've already checked this question How to get @solana/web3.js to access the RPC endpoints through a proxy? but it ...
Yassir's user avatar
  • 1
0 votes
1 answer
71 views

ThawAccount Error: Invalid account state for operation

When I perform a transaction I get an error and log entries: 'Program log: Instruction: ThawAccount', 'Program log: Error: Invalid account state for operation', How to check whether an account is ...
Leo Loki's user avatar
  • 362
0 votes
1 answer
41 views

TypeError: off is not a from solanaWalletAdapter [closed]

I am getting this error in next.js thats my index.tsx import React, { FC, useMemo } from 'react'; import { ConnectionProvider, WalletProvider } from '@solana/wallet-adapter-react'; import { ...
Sebastian_B's user avatar
1 vote
1 answer
58 views

Ways to fetch ATA account in typescript?

I have the following code that works fine with PDAs. const escrow_pda = PublicKey.findProgramAddressSync([Buffer.from("escrow"), fundraiser.publicKey.toBytes()], program.programId)[0]; const ...
WowBow's user avatar
  • 135
2 votes
1 answer
136 views

Cannot use solana TS packages on CommonJS module

I've been trying to use Solana wallet adapters on my NextJS-TypeScript-based project with no luck. I can run it on the development, but I cannot build it for production. This is what I got when I run ...
Seto's user avatar
  • 131
1 vote
1 answer
41 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
3 votes
1 answer
144 views

When importing a mnemonic phrase into a phantom app, the wallet addresses do not match

I tested a code example for generating a mnemonic phrase and restoring a wallet using a mnemonic phrase from the official Solan documentation and a question arose. const mnemonic = "pill ...
Leo Loki's user avatar
  • 362
0 votes
0 answers
46 views

I keep getting error in this typescript code

I have the following code: import { clusterApiUrl, Connection, Keypair, PublicKey, } from "@solana/web3.js"; import { createMint, createAccount, mintTo,getAccount,getMint, ...
Encrypted's user avatar
2 votes
1 answer
38 views

Error Minting NFT to Unsized Collection in Solana Metaplex: "Can't Use This Function on Unsized Collection"

I'm working on a project using Solana's Metaplex protocol where I'm trying to mint NFTs to an unsized collection. However, I keep encountering an error that says "Can't use this function on ...
Patrick Whelan's user avatar
0 votes
3 answers
374 views

Proper way to integrate Solana's Wallet Adapter with Anchor and further questions

After spending some days battling to implement Phantom + Anchor I found out about Solana's Wallet adapter. I sighed in relief thinking the end was nigh but: The the wallet adapter for Solana Apps is ...
CrossedCarpet's user avatar
0 votes
1 answer
118 views

createTransferCheckedInstruction - invalid account data for instruction

I'm trying to write instructions for transferring spl-tokens(not nft): const transfer = createTransferCheckedInstruction( account_from.publicKey, mintId, account_desc.publicKey, ...
Leo Loki's user avatar
  • 362
1 vote
2 answers
60 views

How to construct a VersionedTransaction from raw bytes?

For context, this question is in the context of a typescript browser client. How can I construct a VersionedTransaction from an input of raw bytes of a transaction? With legacy Transaction, I can just ...
michaelsulistio's user avatar
0 votes
1 answer
60 views

Getting different Buffers in Solana transactions. The front-end and back-end transactions are different

I have a Solana dApp that requests tokens from a wallet that I own. When the user try to claim the Tokens, one transaction is created on the frontend and signed by the user; the signature is coded and ...
ZuckOFB's user avatar
0 votes
1 answer
77 views

About SystemProgram.assign

While I have a main account A and has its keypair. Then I use createWithSeed create one account derived account x, and asign it to one program C. Now the problem is : I want to change the account x's ...
xingyue's user avatar
0 votes
1 answer
76 views

How to fetch PDA data on a TS client

I am trying to read the data on an pda account like so let pdaData = awaitprogram.account.PdaAccount.fetch(pdaAccount); But I am getting this error TypeError: Cannot read properties of undefined (...
Jimii's user avatar
  • 1,438
0 votes
1 answer
772 views

TypeError: Cannot convert a Symbol value to a string error

I'm back with new question. I'm stucked with this error: TypeError: Cannot convert a Symbol value to a string Weird thing is, My code is exactly same at both linux and window WSL. but when I copy and ...
0xLuckycig's user avatar
0 votes
0 answers
133 views

Mint Error TypeError: Cannot read properties of undefined (reading 'length')

I'm using @metaplex-foundation/umi version 0.8.2. I upgraded from 0.7.14 because the older version doesn't install correctly anymore(get error missing serializers module) with the new version my mint ...
Miles Donald's user avatar
2 votes
1 answer
156 views

Integrate solana wallet adapter react ui in angular project

i am still new to solana developpement and i found solana/wallet adapter react ui and i was wondering if there is a tool or documentation on how to implement it on my angular appilication ?
Youssef Massabi's user avatar
2 votes
1 answer
71 views

Alchemy endpoint gives wrong wallet balance

I am doing unit tests and I notice that my alchemy endpoint lags behind mainnet-beta in several situations. Sometimes it doesn't get a websocket account update, but the worst obvious case is after ...
mehh's user avatar
  • 117
0 votes
1 answer
89 views

TokenAccountNotFoundError with getOrCreateAssociatedTokenAccount Typescript

I am trying to simulate minting 100 tokens to a wallet address and when I start the program, I get thrown this error: TokenAccountNotFoundError This is the typescript code for creating the token ...
kattyd's user avatar
  • 1
1 vote
1 answer
194 views

Handle optional accounts when calling methods

Let's say updateAccount instruction accepts following accounts #[account()] pub payer: Signer<'info>, #[account(mut), constraint = optional_ata.mint = treasury_ata.mint] pub optional_ata: ...
gud's user avatar
  • 395
1 vote
0 answers
165 views

How to deserialize Metadata account in Typescript without Anchor IDL?

I managed to deserialize everything with this custom getMetadata() function, except for CollectionDetails and ProgrammableConfig. Does anybody know the solutions? /** * This blob of a file is pulled ...
jonasXchen's user avatar
3 votes
1 answer
206 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
0 votes
1 answer
69 views

Passing enum as function argument (TWAMM)

In the program, OracleType enum is defined as #[derive(Copy, Clone, AnchorSerialize, AnchorDeserialize, Debug)] pub enum OracleType { None, Test, Pyth, } When I use let tx = await program....
gud's user avatar
  • 395
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
3 votes
2 answers
54 views

solana pda clarification

Youtube solana pda I've been watching this tutorial for a while trying to build that muscle memory and replicate the code as I understand the concepts, the rust side is not that difficult, maybe when ...
dayofthetech's user avatar
2 votes
1 answer
88 views

TypeScript production code to mint an NFT vs anchor testing code

How would I go about converting the following testing code (from an anchor project) to something that would interact with my frontend in production (or convert it into a function to be used in react ...
xkycc's user avatar
  • 99
2 votes
1 answer
91 views

Fetch Anchor Discriminator (Typescript)

How to fetch the anchor discriminator in Typescript?
vicyyn's user avatar
  • 3,875
1 vote
1 answer
197 views

Error TS1259 with Metaplex JS SDK

I am receiving all these errors when working with TypeScript and Metaplex SDK? Anyone know why? 2 import BN from 'bn.js'; ~~ node_modules/@types/bn.js/index.d.ts:598:1 598 export = ...
Bryson's user avatar
  • 63
1 vote
1 answer
109 views

How to export an Anchor defined enum to Typescript?

I have an enum used in one of my account that looks like this: #[derive(AnchorSerialize, AnchorDeserialize, Clone)] pub enum ItemType { Empty, Folder { folder_mint: Pubkey }, Reference { ...
Dodecahedr0x's user avatar
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,650
0 votes
1 answer
21 views

GetMultiple for Mints?

Let's say we have an array of Pubkeys: let arr: Pubkey[] = [whatever] We have connection.getMultipleAccountsInfo(arr) to get many AccountInfo in one RPC call. We have getMint() from the spl-token ...
Whiteseal's user avatar
  • 2,562
3 votes
1 answer
88 views

I need help with changing the contents of a page once a wallet has been connected

Im currently building a project using Create React App with Typescript, web3.js and ChakraUI. I've set up the 'connect to wallet' button using the Solana Wallet Adapter, and the wallet stays connected ...
Ryan Chipwanya's user avatar
2 votes
1 answer
270 views

How to import METADATA_PROGRAM_ID. (Buildspace Solana Staking Anchor course)

I'm doing the Anchor Staking part of the solana Buildspace course. I get this error when running the first test: ReferenceError: METADATA_PROGRAM_ID is not defined This is the Anchor Smartcontract I ...
Matti's user avatar
  • 129
2 votes
0 answers
59 views

How does the yaaaw escrow program work for multiple NFTs? [closed]

yaaaw is a solana dapp built on the basic escrow program to safely exchange tokens , they upgraded it to work with NFTs and solana and other tokens , you can deposit multiple NFTs in the same ...
user3210's user avatar
3 votes
2 answers
376 views

Confirm a transaction reliably

I need to reliably validate in an API whether a call to the Solana program made by a user has been successful. I use the confirmTransaction function (in devnet) as follows: import { web3 } from "@...
cris.sol's user avatar
  • 272
1 vote
1 answer
107 views

Can not get mint address from NFT metadata response

Using TS and there is the code: let nftMetadata: any[] = []; let allMetadata: any[] = []; const owner = new PublicKey(publicKey); const allNfts = await metaplex.nfts().findAllByOwner({ owner: ...
user2880's user avatar
1 vote
2 answers
115 views

0x0 error when trying to send NFT into PDA vault

I keep getting this 0x0 error when trying to send an nft from my wallet into a vault from a program. I'm trying to create an NFT auction (bids in sol) with escrow. This is an attempt to initialize ...
Matti's user avatar
  • 129