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

feat(*): migrate to algosdk v3.0.0 #314

Merged
merged 3 commits into from
Nov 16, 2024
Merged

feat(*): migrate to algosdk v3.0.0 #314

merged 3 commits into from
Nov 16, 2024

Conversation

drichar
Copy link
Collaborator

@drichar drichar commented Nov 12, 2024

Description

This PR initiates the v4.0.0 release by migrating from algosdk v2 to v3. This is a breaking change that requires updates to transaction handling across all packages, establishing the foundation for additional v4 changes.

See the official migration guide for details about the underlying SDK changes.

⚠️ Important: Projects consuming this library will need to update their algosdk dependency to ^3.0.0 as it is a required peer dependency for compatibility with v4.

Details

  • Update package.json dependencies to algosdk@3.0.0 across all packages
  • Refactor transaction creation to use new type-based construction API
  • Update transaction property access (from -> sender, firstRound -> firstValid)
  • Modify transaction signing and verification logic for v3 compatibility
  • Update test suites to use new transaction format and API
  • Update all example projects to use new transaction parameter names

BREAKING CHANGE: Update transaction handling to support algosdk v3.x API
- Transaction properties renamed (from -> sender, firstRound -> firstValid)
- New transaction construction format using type and params objects
- Modified transaction signing and verification logic

- Update all package.json files to use algosdk v3.0.0
- Refactor transaction creation and handling across all wallet implementations
- Update test cases to use new transaction format and API
Update transaction parameter names in all example projects to match algosdk v3:
- Rename 'from' to 'sender'
- Rename 'to' to 'receiver'

Affects examples in Next.js, Nuxt, React, Solid, Vue, and vanilla TS
@drichar
Copy link
Collaborator Author

drichar commented Nov 12, 2024

Reviews welcome! I'll leave this PR open for ~24-48 hours, which is hopefully enough time to get some eyeballs on it before merging.

Tagging a few contributors but anyone is welcome to submit a review.

@SilentRhetoric
@PhearZero
@acfunk
@kieranroneill
@gabrielkuettel

After merging, I'll publish pre-release packages so developers can test v4's breaking changes in their projects.

Thanks! 🙏

@@ -139,6 +139,7 @@ export class LiquidWallet extends BaseWallet {
this.logger.debug('Signing transactions...', { txnGroup, indexesToSign })

const authClient = this.authClient || (await this.initializeClient())
// @ts-expect-error - TODO: update liquid-auth-use-wallet-client to use algosdk v3
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@HashMapsData2Value The liquid-auth-use-wallet-client package will need to support algosdk v3 in the next major release. The Transaction interfaces are incompatible between v2 + v3.

Copy link
Contributor

@kieranroneill kieranroneill left a comment

Choose a reason for hiding this comment

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

This is my first look into v3 and I am liking it. From the Kibisis side, I didn't see any problems jump out, migration looks fine to me!

If there are any problems, I am more than happy to debug. I am giving an approval.

Copy link
Contributor

@PhearZero PhearZero left a comment

Choose a reason for hiding this comment

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

Tested in a few fresh vite projects and everything works as expected. The v3-sdk hooks library was able to use this build as well. I will try to use the latest algokit-utils this evening with it.

LGTM

Copy link
Contributor

@acfunk acfunk left a comment

Choose a reason for hiding this comment

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

As you know @drichar, I went through this process a few months ago here. These changes look pretty much the same, but more thorough. Great job! Looking forward to using algosdk@3 in my apps as the responses are typed!

@@ -67,7 +67,10 @@ export class LuteWallet extends BaseWallet {

private async getGenesisId(): Promise<string> {
const algodClient = this.getAlgodClient()
const genesis = await algodClient.genesis().do()
const genesisStr = await algodClient.genesis().do()
Copy link
Contributor

Choose a reason for hiding this comment

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

This got way uglier--4 lines from 1?

Copy link
Contributor

@acfunk acfunk Nov 14, 2024

Choose a reason for hiding this comment

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

Yes, like everything else this method used to return Promise<Record<string, any>> which was parsable as JSON, but now returns Promise<string> and so must be deserialized first.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unfortunately, yes 😅

@drichar drichar merged commit 80a0de0 into v4 Nov 16, 2024
1 check passed
@drichar drichar deleted the feat/migrate-to-algosdk-v3 branch November 16, 2024 08:03
@drichar
Copy link
Collaborator Author

drichar commented Nov 16, 2024

The first beta release of v4.0.0 is now available! 🎉

To test the new version in your project, upgrade the appropriate framework adapter using the "beta" tag, e.g.,

npm install @txnlab/use-wallet@beta
yarn upgrade @txnlab/use-wallet@beta
pnpm update @txnlab/use-wallet@beta
bun update @txnlab/use-wallet@beta

Obviously, make sure you have algosdk v3.0.0 installed as it's now a required peer dependency. Please try it out and let me know if you encounter any issues! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants