Skip to main content
5 votes
Accepted

What method should a dApp use to detect a change in Wallet Network for any wallet supported in the Solana Wallet Adapter?

I'll answer this as comprehensively as I can. Unfortunately you may be displeased (as am I!) to know that this isn't generally possible. Let's cover network changes first. This issue (which is quite ...
Jordan's user avatar
  • 643
3 votes

Errors when using `@project-serum/anchor` with Next.js v14 using Webpack 5

You don't need to roll back to previous versions. NextJS allows you to opt out of bundling packages that use NodeJS features. Add the following to your nextjs.config.mjs: experimental: { ...
sohrab's user avatar
  • 1,851
3 votes
Accepted

Issue with Next.js 13 and Solana Wallet Adapter packages

Solved this by separating the WalletProvider component as a Client component. All components inside the app/ directory will be treated as Server components, unless you annotate the file with 'use ...
xenoshiba's user avatar
  • 136
3 votes

sendAndConfirmTransaction returns Cannot read properties of undefined (reading 'toString')

Presuming that useWallet() is from @solana/wallet-adapter, its return value is not a Signer. The return value of useWallet is a WalletContextState. WalletContextState does not expose the private key ...
steveluscher's user avatar
  • 3,153
2 votes
Accepted

sendAndConfirmTransaction returns Cannot read properties of undefined (reading 'toString')

I found the solution and turns out it was just a rookie mistake on my side. The mintPublicKey I was passing to the "getAssociatedAddress" function was the mint address in the string form ...
Ashwini Kumar's user avatar
2 votes

Display Updated Wallet Balance After Transaction Confirmed

figured out a solution with onAccountChange https://solana-labs.github.io/solana-web3.js/classes/Connection.html#onAccountChange here's my solution https://github.com/Unboxed-Software/solana-send-sol-...
bwnnwtt's user avatar
  • 21
2 votes

I am prevented from creating a next app by my PC

The problem you are facing isn't related to Solana but is a Windows limitation. Windows doesn't let you create a directory a directory in C:\Windows. If you try creating it on your desktop it will ...
beeman's user avatar
  • 1,062
2 votes
Accepted

Add spl-token balance to wallet balance context provider

You can easily add any token to your existing context. There are various ways to do this. I am using the most basic (using spl-token library): First import spl-token library: import * as token from &...
0xShuk's user avatar
  • 1,991
2 votes
Accepted

src.toArrayLike is not a function

The parameter that you are passing, which is 0.005, must be of BigNumber type. Import BN class from anchor and put the number inside it, that will fix your problem. It should look like: import { BN } ...
Syed Aabis Akhtar's user avatar
1 vote
Accepted

TypeError: Cannot read properties of undefined (reading 'size')

The problem could be related to incorrect IDL loading. Then it's good to verify the contents of your ./id.json file. While based on the discussion, it seems this isn't the issue. Then, I encountered a ...
chalda's user avatar
  • 1,657
1 vote

anchor build not working for my project

Could you try clearing your $HOME/.cache/solana as suggested by this answer https://solana.stackexchange.com/a/3378/1708
Jimii's user avatar
  • 7,712
1 vote

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

It looks like you might be missing some dependencies. According to https://github.com/anza-xyz/wallet-adapter/blob/master/APP.md#quick-setup-using-react-ui, you should run: yarn add \ @solana/...
Jon C's user avatar
  • 19.6k
1 vote

TypeError: off is not a from solanaWalletAdapter

I have experienced this when using the OKX wallet. Removing/disabling the wallet the issue is fixed.
Ladi's user avatar
  • 33
1 vote
Accepted

Cannot use solana TS packages on CommonJS module

Ok, this is the tsconfig.json that solved my problem: { "compilerOptions": { "baseUrl": ".", "target": "es5", "lib&...
Seto's user avatar
  • 141
1 vote

umi functions causing Application error: a client-side exception has occurred

When fetching a candy machine account, the type of candyMachine.itemsRedeemed will always be a bigint. Therefore: (candyMachine.itemsRedeemed === 500 as BigIntInput) is strictly comparing a number ...
Loris Leiva's user avatar
1 vote

How to update items available count on candy machine UI after someone mints? Next app using umi

The presented code does refresh after mint occurs, the problem is with "candyMachine.data.itemsAvailable" It shows the total amount inserted into the candyMachine. Use candyMachine....
Miles Donald's user avatar
1 vote

How to dynamically import clusterApiUrl in next js

this is the typescript signature of next.js dynamic function dynamic<P = {}>(dynamicOptions: DynamicOptions<P> | Loader<P>, options?: DynamicOptions<P>) // ...
Yilmaz's user avatar
  • 1,264
1 vote

How to dynamically import clusterApiUrl in next js

You can use the same principle to import external libraries using import() at the point where that module is needed. Architect your code such that clusterApiUrl is only needed in a codepath that's ...
steveluscher's user avatar
  • 3,153
1 vote

Transaction working locally and with ngrok (https), but not working when deploying to aws amplify

In the next.config.js Remove the swcMinify: true Worked!
Kob3Bryant's user avatar
1 vote

Phantom: WalletSendTransactionError: Something went wrong nextjs

Solution File: next.config.js Remove: swcMinify: true It works for me
Yaryna Gushuley's user avatar
1 vote
Accepted

Conditional rendering with Solana Wallet Adapter & NextJS

I think the Backend API Protection should be there for sure and better bring in the AdminList from the backend and then validate. I would suggest to make the publickey validation more secure better ...
Pratik.js's user avatar
  • 1,682
1 vote
Accepted

Detect account switching in Phantom Wallet?

From the docs: establishing-a-connection#changing-accounts There are different methods to detect the provider. provider.on('accountChanged', (publicKey) => { if (publicKey) { // Set new ...
Yilmaz's user avatar
  • 1,264
1 vote
Accepted

How do I use WalletPovider for a function outside of return()?

You need to move the providers a level up in the component tree. The provider and consumer cannot be defined in the same component. This is less about WalletProvider specifically and more of a general ...
sohrab's user avatar
  • 1,851

Only top scored, non community-wiki answers of a minimum length are eligible