-
Notifications
You must be signed in to change notification settings - Fork 47
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
fix: typescript sdk: use cursor when accumulating accounts for transfer #1171
Merged
sergeytimoshin
merged 6 commits into
main
from
sergey/ts-tsdk-accumulate-accounts-for-transfer-with-cursor
Sep 9, 2024
Merged
fix: typescript sdk: use cursor when accumulating accounts for transfer #1171
sergeytimoshin
merged 6 commits into
main
from
sergey/ts-tsdk-accumulate-accounts-for-transfer-with-cursor
Sep 9, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Handle report_work transaction errors gracefully in Epoch Manager
Filter out accounts with zero balances in 'system.ts'. Update 'GetCompressedAccountsByOwnerConfig' to include optional cursor and limit properties. Enhance the transfer action to batch fetch compressed accounts with positive balances.
sergeytimoshin
requested review from
ananas-block and
vadorovsky
as code owners
September 8, 2024 15:58
Replaced the do-while loop with a while loop to ensure accumulated lamports threshold is met. Removed redundant filtering and directly added accounts until the required balance is reached, with an error throw if the balance is insufficient.
The redundant condition checking 'accumulatedLamports' was removed from the loop that compresses accounts. This ensures the loop processes all eligible accounts without prematurely exiting once the lamports threshold is met.
ananas-block
approved these changes
Sep 8, 2024
SwenSchaeferjohann
requested changes
Sep 8, 2024
@@ -664,7 +664,7 @@ export class Rpc extends Connection implements CompressionApiInterface { | |||
*/ | |||
async getCompressedAccountsByOwner( | |||
owner: PublicKey, | |||
config?: GetCompressedAccountsByOwnerConfig, | |||
config?: GetCompressedAccountsByOwnerConfig | undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can remove undefined
, ?
already takes care of it
js/stateless.js/src/rpc-interface.ts
Outdated
@@ -40,7 +40,7 @@ export interface LatestNonVotingSignatures { | |||
export interface GetCompressedAccountsByOwnerConfig { | |||
filters?: GetCompressedAccountsFilter[]; | |||
dataSlice?: DataSlice; | |||
cursor?: string; | |||
cursor: string | null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why replace undefined
with null
? this makes the interface inconsistent
Updated the `cursor` property in `GetCompressedAccountsByOwnerConfig` to be optional and modified associated methods to streamline `cursor` management. Adjusted `_config` handling in test-rpc methods for consistency.
SwenSchaeferjohann
approved these changes
Sep 8, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
If we have > than 1000 accounts with 0 balance, we need to fetch accounts with cursor.