fix(sdk): added signing_withdrawal_key_to_use to withdraw sdk call#2234
Conversation
WalkthroughThe changes in this pull request involve modifications to the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
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.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (1)
packages/rs-sdk/src/platform/transition/withdraw_from_identity.rs (1)
22-23: Clarify the Documentation CommentThe documentation can be rephrased for better clarity. Consider updating it to:
If
signing_withdrawal_key_to_useis not set, the method will attempt to use a key available for withdrawal in the signer.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- packages/rs-sdk/src/platform/transition/withdraw_from_identity.rs (4 hunks)
🧰 Additional context used
🔇 Additional comments (4)
packages/rs-sdk/src/platform/transition/withdraw_from_identity.rs (4)
6-6: ImportingIdentityPublicKeyfor New ParameterThe
IdentityPublicKeyimport is added to support the newsigning_withdrawal_key_to_useparameter introduced in the code. This is appropriate and necessary for the implementation.
30-30: Addingsigning_withdrawal_key_to_useParameter to Trait MethodThe new parameter
signing_withdrawal_key_to_use: Option<&IdentityPublicKey>is appropriately added to the trait method signature, allowing callers to specify the key used for withdrawal.
44-44: Includingsigning_withdrawal_key_to_usein ImplementationThe implementation now includes the
signing_withdrawal_key_to_useparameter, matching the updated trait definition. This ensures consistency between the trait and its implementation.
61-61: Passingsigning_withdrawal_key_to_usetotry_from_identityThe
signing_withdrawal_key_to_useparameter is correctly passed to thetry_from_identitymethod. This allows the withdrawal transition to utilize the specified signing key.
| let user_fee_increase = settings | ||
| .map(|settings| settings.user_fee_increase) | ||
| .flatten(); |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Simplify Extraction of user_fee_increase
You can simplify the extraction of user_fee_increase from settings by using and_then instead of map followed by flatten:
let user_fee_increase = settings.and_then(|settings| settings.user_fee_increase);This approach is more idiomatic and concise in Rust.
Issue being fixed or feature implemented
SDK withdrawal call did allow to specify the key to use, this is sometimes important.
What was done?
Added an option to allow to specify the key
How Has This Been Tested?
Will test.
Breaking Changes
None
Checklist:
For repository code-owners and collaborators only
Summary by CodeRabbit
New Features
Bug Fixes