Add confirmation condition to all connections being created.#241
Add confirmation condition to all connections being created.#241BrainyZombie wants to merge 1 commit into
Conversation
| import { Connection, clusterApiUrl } from "@solana/web3.js"; | ||
|
|
||
| const connection = new Connection(clusterApiUrl("devnet")); | ||
| const connection = new Connection(clusterApiUrl("devnet"), "confirmed"); |
There was a problem hiding this comment.
@mikemaccana I haven't checked in a minute, but is this necessary for these code snippets to work?
There was a problem hiding this comment.
Will do a quick check...
There was a problem hiding this comment.
@mikemaccana The first time this causes an issue is in Module 2-1, where it throws a TokenAccountNotFoundError for subsequent requests. I have made a related issue here.
Unboxed-Software/solana-token-client#2
There was a problem hiding this comment.
Sorry for the wait over the holidays @BrainyZombie. This seems a little odd - per the web3.js docs
If commitment configuration is not provided, the node will default to "finalized" commitment
Which is more final than confirmed is.
You mentioned module 2, lesson 1 was failing - there's a lot of code in that lesson (we're trying to do smaller chunks these days) - could you please provide an isolated reproduction case so we can investigate and fix this?
There was a problem hiding this comment.
@mikemaccana I believe this code reproduces the issue.
https://codesandbox.io/p/devbox/solana-reproduction-4h6skq
I am running it in a loop since it doesn't break every time when running once. The loop can be removed and it will break once every few times it's run.
This may be a bug with solana's JS api. Adding 'confirmed' makes it work though.
solana-labs/solana-program-library#3326
https://stackoverflow.com/questions/76445810/tokenaccountnotfounderror-encountered-while-trying-to-create-token-account
There was a problem hiding this comment.
it's useful, i resolved by this method, but if it's production envoriment, add "confirmed" state is ok?
|
@mikemaccana is my reproduction of the issue not sufficient? I know this is more of a bug with the JS library, but as a beginner trying to learn solana this was a big pain point for this course to me. |
|
Sorry I missed your replied after I closed the issue. I'm going to try and recreate on the current web3.js and if it still fails I'll file an issue there. |
Add confirmation condition to all connections being created. Also added an explanation for this when connection creation is introduced.
#240