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

Token 2022 Support #85

Merged
merged 42 commits into from
Jan 25, 2024
Merged

Token 2022 Support #85

merged 42 commits into from
Jan 25, 2024

Conversation

bigearsenal
Copy link
Collaborator

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented Jan 4, 2024

Codecov Report

Attention: 269 lines in your changes are missing coverage. Please review.

Comparison is base (f6f0021) 54.93% compared to head (352b154) 59.60%.
Report is 8 commits behind head on main.

❗ Current head 352b154 differs from pull request most recent head 40bf0b0. Consider uploading reports for the commit 40bf0b0 to get more accurate results

Files Patch % Lines
...ainClient/BlockchainClientWithNativeSOLTests.swift 46.71% 154 Missing ⚠️
...olanaSwift/BlockchainClient/BlockchainClient.swift 48.07% 27 Missing ⚠️
...m/ExtensionReader/AnyToken2022ExtensionState.swift 45.65% 25 Missing ⚠️
...es/SolanaSwift/APIClient/APIClient+Extension.swift 53.19% 22 Missing ⚠️
...nMetadata/SolanaAPIClient+getAccountBalances.swift 74.28% 18 Missing ⚠️
...BlockchainClient/BlockchainClient+Extensions.swift 0.00% 6 Missing ⚠️
...Programs/Token2022Program/Token2022MintState.swift 93.33% 3 Missing ⚠️
...Client/BlockchainClientWithTokenProgramTests.swift 57.14% 3 Missing ⚠️
.../SolanaTokenMetadata/GetAccountBalancesTests.swift 97.63% 3 Missing ⚠️
...aSwift/APIClient/Networking/JSONRPCAPIClient.swift 50.00% 2 Missing ⚠️
... and 5 more

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #85      +/-   ##
==========================================
+ Coverage   54.93%   59.60%   +4.66%     
==========================================
  Files         143      159      +16     
  Lines       10530    11871    +1341     
==========================================
+ Hits         5785     7076    +1291     
- Misses       4745     4795      +50     
Flag Coverage Δ
unittests 59.60% <83.06%> (+4.66%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bigearsenal bigearsenal requested a review from TrGiLong January 11, 2024 08:20
@bigearsenal bigearsenal requested a review from lisemyon January 11, 2024 09:25
@bigearsenal bigearsenal changed the title feat: add token-2022 program Token 2022 Support Jan 12, 2024
@@ -27,19 +40,21 @@ public extension SolanaAPIClient {
try await request(method: method, params: [])
}

func getMultipleMintDatas(
func getMultipleMintDatas<M: TokenMintState>(
Copy link
Contributor

Choose a reason for hiding this comment

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

Change M to MintLayoutState or something similar

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Renamed

@@ -13,24 +13,9 @@ public extension SolanaBlockchainClient {
from owner: PublicKey,
amount: Lamports,
payer: PublicKey,
minRentExemption mre: Lamports?
minRentExemption: Lamports
Copy link
Contributor

Choose a reason for hiding this comment

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

fix docs mre: The min rent exemption (leave it nil if there is no pre-defined)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The mre can be non optional now since this info can be retrieved directly from getTokenAccountByOwners, no need to calculate it again

)

let isAssociatedTokenAddressRegistered: Bool
do {
let info: BufferInfo<SPLTokenAccountState>? = try await apiClient
.getAccountInfo(account: associatedAddress.base58EncodedString)
if info?.owner == TokenProgram.id.base58EncodedString,
if PublicKey.isSPLTokenOrToken2022ProgramId(info?.owner),
Copy link
Contributor

Choose a reason for hiding this comment

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

We can reduce into PublicKey.isSPLTokenProgram.
SPL - Solana Program Library.
Token Program and Token-2022 is a part of this library.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Renamed

@bigearsenal bigearsenal merged commit 48f98d4 into main Jan 25, 2024
1 check passed
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.

4 participants