-
Notifications
You must be signed in to change notification settings - Fork 39
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
feat(js-dapi-client): add option to request all keys #2445
base: v2.0-dev
Are you sure you want to change the base?
Conversation
WalkthroughThe changes modify the Changes
Poem
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
packages/js-dapi-client/lib/methods/platform/getIdentityKeys/getIdentityKeysFactory.js (2)
Line range hint
20-27
: Update JSDoc to reflect optional keyIds parameter.The JSDoc shows
keyIds
as required, but the implementation now treats it as optional. Please update the documentation to match the new behavior./** * Fetch the version upgrade votes status * @typedef {getIdentityKeys} * @param {Buffer} identityId - * @param {number[]} keyIds + * @param {number[]} [keyIds] - Optional. If not provided, all keys will be requested * @param {number} limit * @param {DAPIClientOptions & {prove: boolean}} [options] * @returns {Promise<GetIdentityKeysResponse>} */
33-44
: Consider reorganizing the code for better maintainability.While the logic is correct, consider moving the
identityId
validation before creating the request type for better code organization.const { GetIdentityKeysRequestV0 } = GetIdentityKeysRequest; const getIdentityKeysRequest = new GetIdentityKeysRequest(); - const requestType = new KeyRequestType(); if (Buffer.isBuffer(identityId)) { // eslint-disable-next-line no-param-reassign identityId = Buffer.from(identityId); } + const requestType = new KeyRequestType(); if (keyIds) { requestType.setSpecificKeys(new SpecificKeys().setKeyIdsList(keyIds)); } else { requestType.setAllKeys(new AllKeys()); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/js-dapi-client/lib/methods/platform/getIdentityKeys/getIdentityKeysFactory.js
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Build Docker images (Dashmate helper, dashmate-helper, dashmate-helper) / Build Dashmate helper image
- GitHub Check: Build Docker images (DAPI, dapi, dapi) / Build DAPI image
- GitHub Check: Build JS packages / Build JS
🔇 Additional comments (2)
packages/js-dapi-client/lib/methods/platform/getIdentityKeys/getIdentityKeysFactory.js (2)
7-7
: LGTM! Import added for new functionality.The
AllKeys
import is correctly added alongside other related imports from@dashevo/dapi-grpc
.
40-44
: LGTM! Clean implementation of the all keys feature.The implementation correctly handles both specific keys and all keys requests, meeting the PR objective. The request type is properly set in the final request.
Also applies to: 49-49
Issue being fixed or feature implemented
It is possible to request a an identity's all public keys in one request, but js dapi client does not allow you to do that currently.
This PR makes keyIds param of getIdentityKeys() optional
What was done?
How Has This Been Tested?
Breaking Changes
Checklist:
For repository code-owners and collaborators only
Summary by CodeRabbit