Skip to main content

Questions tagged [typescript]

The tag has no usage guidance.

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

Transaction failed to sanitize accounts offsets correctly

I am using Solana Playground to write Solana code.I have written a simple Greeting struct with rust that has a counter field. When I try to interact with the contract using typescript I get this error ...
xyzkal's user avatar
  • 11
2 votes
0 answers
22 views

Typescript files not running due to strict mode

here is the code mkdir generate-keypair cd generate-keypair npm init -y npm install typescript @solana/web3.js esrun @solana-developers/helpers and make a new file called generate-keypair.ts import {...
abhinabphy's user avatar
1 vote
1 answer
21 views

Fetching authorization rules PDA for a pNFT

I'm using Metaplex's Umi library to work with pNFTs via a custom program that I built, and one of the required accounts for most instructions is the Authorization Rules (& auth rules program). ...
Joey Meere's user avatar
0 votes
0 answers
17 views

How to input a u64 parameter in Anchor

I have a function which creates a lookup table pub fn create_lookup_table( ctx: Context<CreateLookupTable>, recent_slot: u64, _discriminator: u64, ) -> Result&...
qubitz's user avatar
  • 178
0 votes
1 answer
23 views

Error: failed to get recent blockhash: TypeError: fetch failed when running anchor test

This is a small test that I want to run on the devnet. export async function createMintsTransaction( wallet: AnchorWallet ): Promise<anchor.web3.Transaction> { const [provider, program, ...
Yash Patil's user avatar
0 votes
0 answers
39 views

How to force wallet adapter to connect to specific wallet

We are building an app that utilizes the Anza Wallet Adapter. For our specific use case, we get the user to choose a specific wallet address that will be linked to their account. The intended ...
Kraz's user avatar
  • 13
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
19 views

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

Im setting up a standard env for Solana using NextJS/Typescript. When I try to add standard packages via Yarn: yarn add @solana/wallet-adapter-react @solana/wallet-adapter-wallets @solana/web3.js @...
dectral's user avatar
  • 21
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
1 answer
26 views

What is the typescript equivalent of Option<T> in anchor?

The title says it all: If my anchor instruction expects an Option<T> to be passed what do I need to send in typescript for None and Some<T> respectively? I checked the docs but couldn't ...
Ahri's user avatar
  • 3,365
1 vote
0 answers
34 views

How do I securely allow users to export their private keys?

I am working on a Telegram based trading bot which gives each new user a new wallet, into which they can transfer SOL for further trading. I am using Keypair.generate() from solana/web3js(Node.js,...
Anish Mukherjee's user avatar
0 votes
1 answer
90 views

Jupiter v6 Transaction Serialization Failing

I am following along the Jupiter v6 docs to implement the Swap API. I am successfully getting the Quote Response from the v6/quote endpoint. After that I am trying to get the serialized transactions ...
Anish Mukherjee's user avatar
0 votes
1 answer
23 views

How do I get lamports sent from a parsed transaction

How do I get the lamports sent in each transaction and why are there multiple transaction accounts on each message? This is the code I have, but 'parsed' is typed as any in the SDK const ...
Daniel Duong'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
1 vote
1 answer
47 views

sendAndConfirmTransaction does not exist for typ connection

How can I solve this? as far as I have seen, it has the typ connection.. export async function createMint( wallet: WalletAdapter, mintAuthority: Keypair, decimals: number ) { if (!wallet....
JackSparrow's user avatar
0 votes
0 answers
21 views

Wallet or wallet owner is undefined in createTokenAccount

It won't create the Token Account, it says: Wallet or wallet owner is undefined. I tried to change it to Wallet: wallet instead of Wallet: any. try { // const connection = new Connection('...
JackSparrow's user avatar
1 vote
1 answer
38 views

"Unexpected error" when trying to create a mint account on React

I am using @solana/spl-token to create a minting account on a react typescript application. When the following code work to send a normal transaction, the instruction SystemProgram.createAccount, once ...
Asalvatore's user avatar
1 vote
1 answer
48 views

Minting a Fungible SPL token to same ATA (more than 1 time) always fails

I'm pretty new solana ecosystem and have been following multiple tutorials on minting Fungible SPL tokens. On all the tutorials, you create a Mint and ATA and the then the first time the mint ...
newbreedofgeek's user avatar
0 votes
1 answer
47 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
199 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
39 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
234 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
278 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
156 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
  • 69
3 votes
1 answer
200 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
30 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
199 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
  • 69
1 vote
2 answers
125 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
531 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
  • 69
0 votes
2 answers
78 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
57 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
99 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
  • 382
0 votes
1 answer
64 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
111 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
438 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
  • 141
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
3 votes
1 answer
354 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
  • 382
0 votes
0 answers
60 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
61 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
1k 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
431 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
  • 382
1 vote
2 answers
106 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
85 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
128 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
  • 13
0 votes
1 answer
176 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
  • 2,184
0 votes
1 answer
1k 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
183 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
304 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
121 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
157 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