Skip to content
This repository was archived by the owner on Aug 13, 2024. It is now read-only.

Add confirmation condition to all connections being created.#241

Closed
BrainyZombie wants to merge 1 commit into
Unboxed-Software:draftfrom
BrainyZombie:draft
Closed

Add confirmation condition to all connections being created.#241
BrainyZombie wants to merge 1 commit into
Unboxed-Software:draftfrom
BrainyZombie:draft

Conversation

@BrainyZombie

@BrainyZombie BrainyZombie commented Oct 8, 2023

Copy link
Copy Markdown

Add confirmation condition to all connections being created. Also added an explanation for this when connection creation is introduced.

#240

import { Connection, clusterApiUrl } from "@solana/web3.js";

const connection = new Connection(clusterApiUrl("devnet"));
const connection = new Connection(clusterApiUrl("devnet"), "confirmed");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mikemaccana I haven't checked in a minute, but is this necessary for these code snippets to work?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do a quick check...

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@BrainyZombie BrainyZombie Jan 21, 2024

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's useful, i resolved by this method, but if it's production envoriment, add "confirmed" state is ok?

@mikemaccana mikemaccana left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See conversation.

@mikemaccana
mikemaccana deleted the branch Unboxed-Software:draft February 2, 2024 21:30
@mikemaccana mikemaccana closed this Feb 2, 2024
@BrainyZombie

Copy link
Copy Markdown
Author

@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.

@BrainyZombie
BrainyZombie deleted the draft branch April 22, 2024 13:21
@mikemaccana

Copy link
Copy Markdown
Contributor

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants