Upgrade @solana/spl-token to "0.4.9" #3447
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is created to fix #3446
all the tests in git action workflow are passed: the running result based latest code can be seen in my folked project of
anchor
https://github.com/yanCode/anchor/actions/runs/12459231512What has been done:
Apart from the fixes described in the issue below refactory is made.
The deprecated
findProgramAddress
method is replaced withfindProgramAddressSync
in the code affected by this PR. but there are still many other parts code containingfindProgramAddress
in the whole project , including the core packagets/packages/anchor
, which i think we might need to add an interfaceidlAddressSync
to deprecated the sync one.https://github.com/coral-xyz/anchor/blob/master/ts/packages/anchor/src/idl.ts#L275-L278
I will track & fix them after this PR is resolved.
Replaced the lamports unit from
10000000000
to10 * LAMPORTS_PER_SOL
, to make it a little bit better human readble.As required by latest version of
@solana/spl-token
,typescript
as a dependency of it, is also required to upgrade to version 5, that's why I upgraded"typescript": "^5.7.2"
. alsotsconfig.json
in the sub projects is simplified to extend from a parenttsconfig.json
located intests/
to avoid violatingDon't Repeat Yourself
rule.Another improvement when creating many
mint
accounts together, I usedPromise.all
to sumbit them to the chain concurrently. Because solana blockchain can support concurrent execution of transactions on batch. (This is one of the reasons why solana is faster).After calling the instruction handler, it needs to pass in the accounts used in this intruction. There are methods inlcuding
accountsPartial
andaccounts
. If you check the doc, it saysaccount
method only accepts accounts that cannot be resolved. but in current logic, the account parameters of many parts include some resolvable accounts likeSystemProgram.programId
andPDA
. after upgrading to typescript5
,npx tsc --noEmit
command from the workflow can detect and complain about this kind of issue. so I repaced it withaccountsPartial
which is more inclusive thanaccounts
method when any resolvable accounts are in the account parameter.What hasn't been done:
tests/auction-house
, current logic is based on an old version of"@metaplex/js": "^4.4.1"
, to upgrade@solana/spl-token
, it also should be upgraded. to avoid the scope of this PR is too big. I keep this project using the old version of dependencies intests/auction-house/package.json
.I take a note here, I will track and fix it after this PR is resolved.
In
tests/ido-pool
, it usesetTimeout
to stop the execution of logic to ensure previous transaction is done. this can waste much more time than necessary, which breaches the fact: solana is faster. Actually, javascript/typescript is full async and event-driven. so it only need to async await the execution of the transction, with thecommitment
level to beconfirmed
.The projects are execulded from github workflow is not changed and tested.