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

Remove dependency on @solana/spl-token v0.1.8 #130

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

0xnetfox
Copy link

@0xnetfox 0xnetfox commented Feb 25, 2023

I was having difficulties using the gem-farm app as the wallet adapter kept complaining about getMinBalanceRentForExemptMint not existing when trying to mint a test token, using @gemworks/gem-farm-ts v0.26.4. Digging a bit I found out that the wallet adapters have a dependency on @solana/spl-token v0.1.8, which is a version from 2 years ago, so I've done a bit of refactoring in order to remove that dependency.

The change consists mostly about deleting old imports and re-importing the correct functions, with correct parameters and correct types from the newest version of the spl-token library, and fixing the tests that complained.

The change ended up being bigger than I expected, so I may have fucked up something :D the tests all pass correctly and as far as I tried, the app wallet adapter works correctly now when pointed to the local version of the library.

Let me know if the change is ok or anything needs to be modified :)

`spl-token` field's `getAccount().amount` is now a BigInt, instead of a BN. Due to this, some tests needed to be updated as there is no implicit equality comparison between BN and BigInt.

The only way I found to compare them was to first turn the BN number to string and then initialise a new BigInt from it. It's kinda ugly but I couldn't find a better way.
@netlify
Copy link

netlify bot commented Feb 25, 2023

Deploy Preview for pensive-hamilton-d73c94 canceled.

Name Link
🔨 Latest commit a19310d
🔍 Latest deploy log https://app.netlify.com/sites/pensive-hamilton-d73c94/deploys/63fa4fe1af764300087ea8df

@0xnetfox
Copy link
Author

0xnetfox commented Mar 3, 2023

If you end up merging this lmk if you would mind a few more PRs :) I've been cleaning up a bit since I needed to use it for smth, changes for now are:

  • cleaned up typescript errors (mostly missing casts)
  • split claim into claim and buildClaim like the rest of calls
  • (soon) removed dependency to @metaplex/js as it's deprecated

@peterschwarzdev
Copy link

Does this fix the current ongoing issue @0xnetfox ?

@0xnetfox
Copy link
Author

0xnetfox commented Apr 9, 2023

@peterschwarzdev sorry, just seen the comment

This PR isn't related to that issue. My uneducated guess is that the linked issue is related to the changes that ilmoi did to accommodate programmable NFTs at the end of January. Those changes shouldn't break existing farms as far as I know so I'd bet the issue resides on the SDK library.

If updating the @gemworks/gem-farm-ts library to the latest version (0.26.4) doesn't fix the issue, someone will need to dig exactly why it is happening and if it is fixable :)

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.

2 participants