Questions tagged [typescript]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
19 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: ...
0 votes
2 answers
33 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 ...
  • 15
1 vote
2 answers
36 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. ...
1 vote
1 answer
45 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} ...
  • 372
0 votes
0 answers
15 views

Python and Javascript returning different public keys in HD Wallet path derivation

So I have been trying to figure out HD Wallet derivation in Python and I recently found a way using the bip-utils module. Btw I am using a 12 word mnemonic phrase from mnemonic import Mnemonic from ...
  • 325
0 votes
1 answer
14 views

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

When I use the fetch method my variable u64 appears as undefined
1 vote
0 answers
21 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 ...
  • 11
0 votes
0 answers
17 views

How to externally invoke transaction signed by user

I am just trying to sign a transaction on a front-end using a user wallet and then pass the signature to the server, where the transaction is invoked. The transaction pass seemingly, but when I ...
  • 11
0 votes
0 answers
3 views

How to autogenerate typescript types for the spl-governance package?

Basically, I'm trying to see how feasible is to generate and keep it up to date generated types from a smart contract. In my case, the SPL governance package. Even simpler, how can I get this enum ...
0 votes
1 answer
25 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 ...
0 votes
0 answers
12 views

Locking an NFT for an upcoming NFT merge

I am very new to Solana development and I had a question about locking an NFT for {x} time to merge into a mega NFT. Two NFTs will be locked. One will be returned and one will be burnt. I just need ...
0 votes
1 answer
26 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 '...
  • 360
0 votes
2 answers
50 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())...
0 votes
0 answers
33 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://...
1 vote
2 answers
46 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 ...
0 votes
0 answers
20 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)
1 vote
1 answer
73 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 "@...
0 votes
0 answers
15 views

borsh deserializeUnchecked TypeError: reader[capitalizeFirstLetter(...)] is not a function

I have the following schema: export class StakeData { timestamp: number staker: PublicKey mint: PublicKey active: Boolean withdrawn: number harvested: number static schema: Schema = new ...
  • 1
0 votes
1 answer
14 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 ...
  • 701
2 votes
1 answer
201 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 ...
0 votes
0 answers
6 views

Cannot assign to read only property '_nextClientSubscriptionId' of object '#<Connection>' at Connection._makeSubscription [duplicate]

When I use Anchor rpc to sell NFT, TS gets an error, but tx sends successfully.
0 votes
1 answer
43 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
1 vote
1 answer
103 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 ...
0 votes
0 answers
14 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....
1 vote
1 answer
32 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 = ...
  • 113
3 votes
2 answers
36 views

How to test a function that is expected to return error?

I got two questions : First : I have some custom error type declared in the smart contract and I want to check the appropriate error to be returned from the function call , I wonder how can I get the ...
0 votes
1 answer
51 views

How to identify a swap transaction and get details

I am trying to list the history of a token in my wallet. So, I am dealing with different scenarios right now, and I am stucked with a swap transaction and I am wondering the best way to identify a ...
4 votes
2 answers
89 views

How do I solve this: `Error: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: custom program error: 0x0`

I have this in my lib.rs file: #[derive(Accounts)] pub struct Initialize<'info> { #[account( init, payer = authority, space = 8 + Config::SIZE, seeds = ["config"....
  • 1,309
0 votes
4 answers
64 views

Checking to see if a token account exists using anchor-ts

I have a workflow such that an ATA needs to be passed into an instruction in a contract but I would like to check to see whether or not i need to initialize it first on the client (there may be ...
3 votes
2 answers
169 views

Support of Anchor IDL for enums

Currently I am writing smart contract code in anchor. When i declare a pub struct in smart contract I can access it in type script easily using IdlType example: #[derive(AnchorSerialize, ...
0 votes
1 answer
134 views

Failed to serialize or deserialize account data: Unknown

I am trying to write data to an account that is the account of the created bet. My smart contract should send reports from the user's account to the bet account. then write down some data (the amount ...
4 votes
2 answers
111 views

"Signature verification failed" error while creating an account

I am trying to create an account but I get an error while creating it. const provider = anchor.AnchorProvider.env(); anchor.setProvider(provider); const newAccountKeypair = anchor.web3.Keypair....
  • 377