-
Notifications
You must be signed in to change notification settings - Fork 300
feat(sdk-api): Add support for passing constants to the SDK as an optional parameter #7097
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
Conversation
0045af8 to
aea1004
Compare
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.
Pull Request Overview
This PR adds support for passing client constants to the BitGoAPI constructor, allowing developers to provide constants that override server-fetched values. This enables more flexible configuration and testing scenarios.
- Adds an optional
clientConstantsparameter to the BitGoAPI constructor options - Modifies
fetchConstants()method to handle caching logic and merge client/server constants - Updates test files to use the new client constants parameter instead of complex mocking
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| modules/sdk-api/src/types.ts | Adds Constants type and clientConstants property to BitGoAPIOptions interface |
| modules/sdk-api/src/bitgoAPI.ts | Implements client constants storage in constructor and updates fetchConstants caching logic |
| modules/sdk-api/test/unit/bitgoAPI.ts | Adds comprehensive unit tests for constants caching and client constants functionality |
| modules/sdk-api/test/unit/v1/wallet.ts | Replaces complex fetchConstants mocking with simpler clientConstants parameter usage |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
pranavjain97
left a comment
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.
Also, lets squash the commits please.
…ns to the sdk Ticket: WP-5538
5b849ea to
7b85881
Compare
pranavjain97
left a comment
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.
lesgo!
Added optional clientConstants parameter to the BitGoAPI constructor, allowing users to provide/pass constants that override server-fetched values to the SDK.
fetchConstants()to merge server constants with client constants (client overrides take precedence).test/unit/bitgoAPI.tspassing in a constant under this flow.Ticket: WP-5538