Questions tagged [typescript]

The tag has no usage guidance.

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

I keep getting error in this typescript code

import { clusterApiUrl, Connection, Keypair, PublicKey, } from "@solana/web3.js"; import { createMint, createAccount, mintTo,getAccount,getMint, getOrCreateAssociatedTokenAccount,...
Encrypted's user avatar
2 votes
1 answer
17 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
77 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
35 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
  • 278
1 vote
2 answers
34 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
43 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
21 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
37 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,032
0 votes
1 answer
395 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
59 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
61 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
49 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
45 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
89 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
  • 365
1 vote
0 answers
89 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
137 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
58 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
  • 365
1 vote
1 answer
3k 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
50 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
71 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
70 views

Fetch Anchor Discriminator (Typescript)

How to fetch the anchor discriminator in Typescript?
vicyyn's user avatar
  • 3,775
1 vote
1 answer
176 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
71 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
0 votes
0 answers
45 views

shadow drive.createStorageAccount returns "Server response status message: Timed out awaiting confirmation on transaction"

I need to upload photos to shadow drive. this is the complete code. all you need is to create a .ts file and run ts-node filename import { ShdwDrive } from "@shadow-drive/sdk"; import { ...
Yilmaz's user avatar
  • 1,067
3 votes
4 answers
837 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,297
0 votes
1 answer
16 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,252
3 votes
1 answer
67 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
0 votes
0 answers
27 views

Get typed accounts from account.whatever.fetchMultiple

When fetching a single account with an anchor fetch, you get a typed value back. E.g.: let acc = await program.account.whatever.fetch(someKey); will return your IDL type for acc. Here you would get a ...
Whiteseal's user avatar
  • 2,252
2 votes
1 answer
170 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
53 views

How does the yaaaw escrow program work for multiple NFTs?

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
281 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
92 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
99 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
2 votes
1 answer
114 views

solana token program 0xc Invalid Instruction

I have recently begun getting the below error when running the createMint instruction from @solana/spl-token. To my knowledge, I have not changed any code or dependencies that would affect this. ...
austinmilt's user avatar
2 votes
1 answer
3k views

How to solve Typescript errors TS2307 Cannot find module

I keep getting TS2307 Cannot find module error whenever I run typescript checks on my project. The src/index.ts file has the following imports: import BigNumber from 'bignumber.js'; import {WebBundlr} ...
Ander's user avatar
  • 863
0 votes
1 answer
15 views

My variable u64 is not saved and appears as undefined [closed]

When I use the fetch method my variable u64 appears as undefined
rust_everywhere's user avatar
2 votes
0 answers
119 views

WalletMultiButton in react/typescript application does not seem to be functioning as a button

I have followed along with a few tutorials at this point, but I pulled code directly from the following website: https://www.0xdev.co/how-to-connect-to-a-solana-wallet-to-your-react-app/ After ...
Lexi's user avatar
  • 21
0 votes
1 answer
82 views

variable of public key isn't updated in useEffect hook

i have cloned the solana dapp-scaffold repo and i am trying to display the pubkey of the user connected with an alternative way, using web3js. When i try to do it the pubkey is initially set to null ...
shauna vayne's user avatar
0 votes
1 answer
63 views

Avoid 'parsed' type error from getParsedTransaction

As you can see in screenshots, I have a type error. How can I avoid this problem ? The type of my transaction is 'ParsedTransactionWithMeta' from getParsedTransaction method. Same problem with '...
Swifty's user avatar
  • 398
0 votes
2 answers
649 views

How to convert string to as_bytes in typescript?

So, I have a PDA seed where I'm hashing a string (which is converted to bytes) and converting the hash result to_string and then as_bytes. code: anchor_lang::solana_program::hash::hash(name.as_bytes())...
Gajesh S Naik's user avatar
0 votes
0 answers
46 views

Metaplex JS implementation in React Native: TypeError: Conversion from 'BigInt' to 'number' is not allowed [duplicate]

Trying out this package in React Native RN Version: 0.69.5 Metaplex js version: 0.15.0 @solana/web3.js: 1.41.6 Error log: TypeError: Conversion from 'BigInt' to 'number' is not allowed. App@http://...
Ritvij Sharma's user avatar
1 vote
2 answers
65 views

CandyMachine Metaplex in Javascript?

I'm creating an application to expose an NFT collection. I already started to make my application using a normal React APP. I made the entire site using .js and .jsx, but now the most important part ...
Bruno Raphael Rocha's user avatar
1 vote
0 answers
45 views

Event Index In Solana

What are the index and non-index properties in the Event (in Solana) and how many indexes are allowed (I know that in EVM Solidity there are three index properties allowed in the Event)
Bilal Afzal's user avatar
1 vote
1 answer
315 views

Importing '@metaplex-foundation/js' results in 'process is not defined' error

It looks like someone previously asked the question and deleted it - sadly I can see the question in search engines but can't see the answer! When I import Metaplex: import { Metaplex } from "@...
mikemaccana's user avatar
  • 1,297
0 votes
1 answer
23 views

TS warning when dependency using different Anchor version

What is the canonical way to deal with a dependency using an older Anchor version? Basic example: import { SomeDependency } from "deps/blahblah/packages/some-dependency/src"; export const ...
Whiteseal's user avatar
  • 2,252
3 votes
1 answer
489 views

Solana Wallet adapter with different react UI

I am a newbie to React/Typescript and I am trying to build a DeFi project using the Solana Wallet adapter. From what I can see the wallet adapter comes with a React UI look and feel based on the ...
PutCallTheta's user avatar
0 votes
1 answer
186 views

Anchor event type on typescript

How do I declare a variable to be of a certain Anchor event type? In general, I am not sure how to extract a subtype within the program idl
ImSandwich's user avatar
1 vote
1 answer
403 views

Error: Signature verification failed

I am writing a Solana Program using Anchor framework. I can't seem to get rid of a signing error I'm having while testing. Instruction Accounts validation: #[derive(Accounts)] pub struct ...
Daniel Pavel's user avatar
1 vote
0 answers
234 views

How do I prevent 'open handles' issues when using the Solana 'Connection' object?

I am using Solana and Solana SPL in TypeScript with Jest, running integration tests with solana-test-validator running. Whenever I do await connection.getTokenAccountsByOwner() or await connection....
mikemaccana's user avatar
  • 1,297
1 vote
1 answer
80 views

How to generate new wallets in anchor typescript tests

I'm writing some unit tests and want to test that a user cannot update data on a PDA created by another user. How can I get "another user?" I'm creating the first user: const provider = ...
Will's user avatar
  • 113