-
Notifications
You must be signed in to change notification settings - Fork 33
Feat/add human readable function in token #387
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
…dable in Token class
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 introduces a function in the Token class to convert chain formatted values into human readable values.
- Added tests for human_readable_value conversion in test_token.py
- Bumped the version in pyproject.toml from 1.11.0-rc5 to 1.11.0-rc6
- Implemented human_readable_value in Token to perform the conversion
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/core/test_token.py | Added a new test case for human readable value conversion |
| pyproject.toml | Updated version number |
| pyinjective/core/token.py | Introduced the human_readable_value method for value conversion |
Comments suppressed due to low confidence (1)
pyinjective/core/token.py:29
- Consider adding a docstring for the human_readable_value method to explain its purpose, input parameters, and return value.
def human_readable_value(self, chain_formatted_value: Decimal) -> Decimal:
WalkthroughA new method, Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Token
User->>Token: human_readable_value(chain_formatted_value)
Token-->>User: Returns human-readable Decimal value
Poem
📜 Recent review detailsConfiguration used: .coderabbit.yaml ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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
Documentation and Community
|
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: 1
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
pyinjective/core/token.py(1 hunks)pyproject.toml(1 hunks)tests/core/test_token.py(1 hunks)
🧰 Additional context used
🪛 Ruff (0.11.9)
tests/core/test_token.py
15-15: Redefinition of unused inj_token from line 3
(F811)
🪛 Flake8 (7.2.0)
tests/core/test_token.py
[error] 15-15: redefinition of unused 'inj_token' from line 3
(F811)
🪛 GitHub Actions: pre-commit
pyinjective/core/token.py
[error] 25-25: Pre-commit hook 'trailing-whitespace' failed. Trailing whitespace was found and fixed in this file. Run 'pre-commit run --all-files' locally to reproduce.
🔇 Additional comments (3)
pyproject.toml (1)
3-3: LGTM! Appropriate version bump for the new feature.The version increment from rc5 to rc6 is appropriate for adding the new
human_readable_valuemethod to the Token class.pyinjective/core/token.py (1)
29-30: LGTM! Correct implementation of the inverse conversion.The
human_readable_valuemethod correctly performs the inverse operation ofchain_formatted_valueby dividing the chain-formatted value by 10^decimals. This provides a clean API for bidirectional conversion between human-readable and chain-formatted token values.tests/core/test_token.py (1)
15-21: LGTM! Comprehensive test for the new method.The test correctly verifies that
human_readable_valueperforms the inverse conversion ofchain_formatted_value. The test follows the same pattern as the existing test and uses appropriate test data.Note: The static analysis warnings about
inj_tokenredefinition are false positives -inj_tokenis a pytest fixture parameter, not an unused import.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Summary by CodeRabbit