Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serialialize-instruction-data-frontend more changes (was refactor(): replace deprecated findProgramAddress with findProgramAddressSync) #346

Conversation

EmekaManuel
Copy link
Contributor

fix: replace deprecated findProgramAddress with findProgramAddressSync

Problem

The method 'web3.PublicKey.findProgramAddress' is deprecated and may lead to compatibility issues.

Summary of Changes

  • Replaced the deprecated findProgramAddress method with the recommended findProgramAddressSync method for more reliable and up-to-date usage.

…ressSync

The signature '(seeds: (Buffer | Uint8Array)[], programId: PublicKey): Promise<[PublicKey, number]>' of 'web3.PublicKey.findProgramAddress' is deprecated.

Updated the code to use the recommended 'findProgramAddressSync' method for better compatibility.
@mikemaccana
Copy link
Collaborator

mikemaccana commented Aug 26, 2024

Thanks @EmekaManuel ! This is a good start, but there's still a little more you can do here - including use await instead of .then(), linting the code, and using full names instead of tx - see https://github.com/solana-foundation/developer-content/blob/main/CONTRIBUTING.md. Can you also make the code import Connection etc from web3, rather than importing all of web3? It's a little more efficient and also stops people from having to type web3. all the time.

Can you also please use https://github.com/solana-developers/create-solana-dapp (as mentioned in the bounty) to make the frontend app?

I saw your comment on Superteam Earn:

I rebuilt the buggy and outdated movie review app used to explain serialization, deserialization, pagination and sorting using the latest version of technology: Nextjs, typescript, tailwind, and web3js. The repo is here : https://github.com/EmekaManuel/Solana-Movie-Review-Frontend

Excellent! Likewise, please use https://github.com/solana-developers/create-solana-dapp to make this (your code should just work as-is, we just want to make sure we are using the same code as our own tutorials).

After that we should be able to get this PR merged.

Copy link
Collaborator

@mikemaccana mikemaccana left a comment

Choose a reason for hiding this comment

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

There's still a few more things that need updating here, see the comment above.

…@solana/web3.js instead of importing the entire package.

- Replaced .then() with await for better readability and async handling.
- Applied linting to maintain code consistency and clarity.
- Replaced abbreviations like tx  with more descriptive variable names for better code readability.
- Enhanced error handling using trycatch.
@EmekaManuel
Copy link
Contributor Author

hello Mike, I have made the necessary changes :

  • Imported specific modules instead of the entire package from web3js
  • Replaced .then() with await for better readability and async handling.
  • Applied linting to maintain code consistency and clarity.
  • Replaced abbreviations like tx with more descriptive variable names for better code readability.
  • Enhanced error handling using trycatch.

@mikemaccana
Copy link
Collaborator

mikemaccana commented Sep 6, 2024

Move this work into #369. We don't want to split a person's updates over multiple PRs and we need to keep the conversation in one place.

In #369 I previously asked to add the images to that PR (ie, #369).

@mikemaccana mikemaccana changed the title refactor(): replace deprecated findProgramAddress with findProgramAddressSync serialialize-instruction-data-frontend more changes (was refactor(): replace deprecated findProgramAddress with findProgramAddressSync) Sep 6, 2024
Copy link
Collaborator

@mikemaccana mikemaccana left a comment

Choose a reason for hiding this comment

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

Move into your other PR.

@EmekaManuel
Copy link
Contributor Author

Move into your other PR.

Just merged into #369. Please note that these PR's focus on two courses which are update-program-state-management and the serialize-instruction-data-frontend

@mikemaccana
Copy link
Collaborator

Closing as will review in #369

@mikemaccana mikemaccana closed this Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants