fix: uses Decimal to convert denom to udenom value#2318
Conversation
WalkthroughRefactored denomination conversion to use CosmJS Decimal for atomic conversions and updated callers; added the Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
b037883 to
a136641
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (3)
apps/deploy-web/package.json(1 hunks)apps/deploy-web/src/utils/mathHelpers.ts(2 hunks)apps/deploy-web/src/utils/priceUtils.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.{ts,tsx,js}: Never use typeanyor cast to typeany. Always define the proper TypeScript types.
Never use deprecated methods from libraries.
Don't add unnecessary comments to the code.
Files:
apps/deploy-web/src/utils/priceUtils.tsapps/deploy-web/src/utils/mathHelpers.ts
🧬 Code graph analysis (1)
apps/deploy-web/src/utils/priceUtils.ts (1)
apps/deploy-web/src/utils/mathHelpers.ts (1)
denomToUdenom(34-36)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: test-build
- GitHub Check: test-build
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (3)
apps/deploy-web/package.json (1)
37-40: Add @cosmjs/math aligned with other CosmJS packagesThe new
@cosmjs/mathdependency at~0.36.1is consistent with the other CosmJS packages already pinned to~0.36.1, so the addition looks correct and cohesive.Please confirm
npm install/npm teston this app to ensure there are no peer/version mismatches involving@cosmjs/math.apps/deploy-web/src/utils/priceUtils.ts (1)
19-27: Use of string amount in coinToUDenom correctly leverages Decimal pathPassing
coin.amountdirectly as a string intodenomToUdenomavoids an intermediate JS floating‑point parse and lets the Decimal-based conversion handle precision, which is exactly what we want here.apps/deploy-web/src/utils/mathHelpers.ts (1)
1-1: Decimal import matches new precise conversion logicImporting
Decimalfrom@cosmjs/mathis appropriate here and matches the newdenomToUdenomimplementation and the added runtime dependency inpackage.json.Please ensure this file is compiled with the same
@cosmjs/mathversion (~0.36.1) declared inapps/deploy-web/package.jsonto avoid type/runtime drift.
Why
Because in JS
Fixes #2229
Summary by CodeRabbit
Bug Fixes
Chores
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.