-
Notifications
You must be signed in to change notification settings - Fork 0
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: fixed eror with claimable reward, add mul 100 for bounded tokens #38
Conversation
WalkthroughThe modification to the Changes
Sequence DiagramssequenceDiagram
participant Client
participant StakingService
participant Validator
Client->>StakingService: requestValidatorData(validatorAddress)
alt validatorAddress is defined
StakingService->>Validator: retrieveValidatorData(validatorAddress)
Validator-->>StakingService: data
StakingService->>Client: filteredData
else validatorAddress is not defined
StakingService->>Validator: retrieveAllValidatorData()
Validator-->>StakingService: data
StakingService->>Client: allData
end
Client->>StakingService: requestBondedTokens()
StakingService->>Validator: retrieveBondedTokensData()
Validator-->>StakingService: bondedTokensData
StakingService->>StakingService: calculatePercentage(bondedTokensData)
StakingService-->>Client: bondedTokensPercentage
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 as PR comments)
Additionally, you can add CodeRabbit Configration 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
Outside diff range and nitpick comments (1)
src/modules/staking/services/staking.service.ts (1)
Line range hint
479-479
: Consider using optional chaining to improve code safety and readability.- let pubkey = this.okp4Service.wssPubkeyToAddr(validator.consensus_pubkey.key).toUpperCase(); + let pubkey = this.okp4Service.wssPubkeyToAddr(validator.consensus_pubkey?.key)?.toUpperCase();This change guards against potential runtime errors if
consensus_pubkey
orkey
are null or undefined, making the code more robust and easier to maintain.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/modules/staking/services/staking.service.ts (2 hunks)
Additional context used
Biome
src/modules/staking/services/staking.service.ts
[error] 479-479: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
Additional comments not posted (2)
src/modules/staking/services/staking.service.ts (2)
123-125
: Refactored filter logic to include all entries whenvalidatorAddress
is not provided.This change enhances the flexibility of the method by conditionally applying the filter based on whether
validatorAddress
is provided. It's a good practice to handle optional parameters this way, ensuring that the function remains versatile.
169-172
: Updated calculation forbondedTokens
to scale the result by 100.This adjustment is crucial for presenting the
bondedTokens
in a more appropriate scale. Multiplying by 100 as per the PR’s objective correctly adjusts the value representation, aligning with the expected frontend or external system requirements.
No description provided.