Skip to content

Conversation

@abk404
Copy link

@abk404 abk404 commented Jan 6, 2026

Ticket: CSI-1548

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Summary

Optimizes createBulkWalletShare to fetch the wallet keychain only once instead of once per user, drastically reducing API calls and preventing rate limiting (HTTP 429) errors during bulk wallet sharing.

Problem

When sharing a wallet with multiple users via createBulkWalletShare, the SDK was fetching the wallet keychain (v2.key.get) for each user in the share list.

For example, sharing 26 wallets with 15 users each resulted in 390 API calls (26 × 15), causing rate limiting errors and failures with the message: "Failed to process wallet shares after retrying with single requests."
Check the support ticket : CSI-1569

Solution

Refactored the code to:

  1. Extract common logic into two new helper methods:

    • getDecryptedKeychainForSharing() - Fetches and decrypts the keychain once
    • encryptPrvForUser() - Encrypts the private key for a specific user (no API calls)
  2. Optimize createBulkWalletShare() to fetch the keychain once before the loop, then reuse it for all users

@abk404 abk404 requested review from a team as code owners January 6, 2026 12:07
@abk404 abk404 changed the title feat: fetch keychain per wallet once fix(wallet-key-share): Optimize createBulkWalletShare to Fetch Keychain Once and Prevent Rate Limiting Jan 6, 2026
@Marzooqa Marzooqa requested review from zahin-mohammad and removed request for pranavjain97 January 9, 2026 13:09
@abk404 abk404 requested a review from zahin-mohammad January 15, 2026 13:21
@abk404
Copy link
Author

abk404 commented Jan 15, 2026

Created this ticket to handle the cleanup task.

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