Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughAdds an asset refresh notifier interface and wires ActivationManager to trigger a refresh after activating custom tokens. AssetManager now implements the notifier and refactors custom-token refresh/filtering. Custom token history serialization switches to protocol config. UI icon resolver standardizes custom icon cache keys to lowercase. Bootstrap updated to pass the notifier. Changes
Sequence Diagram(s)sequenceDiagram
participant UI
participant ActivationManager
participant IAssetRefreshNotifier as AssetRefreshNotifier
participant AssetManager
Note over ActivationManager: Activation group completes
ActivationManager->>ActivationManager: Detect activated assets
alt Any custom tokens activated
ActivationManager->>AssetRefreshNotifier: notifyCustomTokensChanged()
note right of AssetRefreshNotifier: Implemented by AssetManager
AssetRefreshNotifier-->>ActivationManager: return
AssetRefreshNotifier->>AssetManager: refresh custom tokens
else No custom tokens
ActivationManager-->>ActivationManager: No notifier call
end
sequenceDiagram
participant AssetManager
participant Auth
participant WalletAPI as Wallet Assets
participant Filter as FilterStrategy
participant Store as In-memory Coins
AssetManager->>AssetManager: notifyCustomTokensChanged()
AssetManager->>Auth: isSignedIn?
alt Not signed in
AssetManager-->>AssetManager: Return (debug log)
else Signed in
AssetManager->>WalletAPI: fetch wallet assets
WalletAPI-->>AssetManager: assets (custom tokens)
AssetManager->>Filter: apply filter on tokens
Filter-->>AssetManager: filtered tokens
AssetManager->>Store: insert/update ordered coins
Store-->>AssetManager: done
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks (3 passed)✅ Passed checks (3 passed)
Poem
✨ Finishing touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Pull Request Overview
This PR fixes custom token import functionality by implementing lowercase asset ID handling and refreshing the asset list when new custom tokens are imported.
- Implements lowercase normalization for custom token asset IDs to ensure consistent matching
- Adds automatic asset list refresh when custom tokens are imported through activation
- Refactors asset manager to support proper filtering and refresh of custom tokens
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/komodo_ui/lib/src/defi/asset/asset_icon.dart | Adds lowercase normalization for custom token asset IDs |
| packages/komodo_defi_sdk/lib/src/bootstrap.dart | Passes asset manager as refresh notifier to activation manager |
| packages/komodo_defi_sdk/lib/src/assets/custom_asset_history_storage.dart | Switches to protocol config for asset storage to fix serialization issues |
| packages/komodo_defi_sdk/lib/src/assets/asset_manager.dart | Implements refresh notification interface and adds custom token filtering |
| packages/komodo_defi_sdk/lib/src/assets/asset_lookup.dart | Adds asset refresh notifier interface |
| packages/komodo_defi_sdk/lib/src/activation/activation_manager.dart | Integrates refresh notification when custom tokens are activated |
Comments suppressed due to low confidence (1)
packages/komodo_defi_sdk/lib/src/bootstrap.dart:1
- The same
assetManagerinstance is passed twice as consecutive parameters. This appears to be a duplicate parameter that should be reviewed to ensure the correct dependencies are being injected.
// ignore_for_file: cascade_invocations
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (5)
packages/komodo_defi_sdk/lib/src/assets/custom_asset_history_storage.dart (1)
24-31: Consider stronger de-duplication on insertManual ID check avoids duplicates, but Set still depends on equality elsewhere. Optionally normalize by ID and re-store to ensure a canonical set.
packages/komodo_defi_sdk/lib/src/bootstrap.dart (1)
105-113: Constructor wiring looks correct; prefer named args for clarityPassing
assetManagertwice (as lookup and notifier) is valid, but easy to misorder. Consider switchingActivationManagerto named parameters to prevent future mix-ups.packages/komodo_defi_sdk/lib/src/activation/activation_manager.dart (2)
44-46: Timeout behavior is fineThrowing inside
onTimeoutis acceptable; alternatively rely on the defaultTimeoutExceptionto simplify.
78-82: Parent resolution hints grouping fragilityNeeding to resolve
parentAssethere suggests_groupByPrimarycan produce a child asprimary. Consider fixing grouping to always use the top-level parent asprimaryto simplify downstream logic.packages/komodo_defi_sdk/lib/src/assets/asset_manager.dart (1)
266-274: LGTM: async refresh with error loggingConsider debouncing if high-frequency notifications become an issue.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
packages/komodo_defi_sdk/lib/src/activation/activation_manager.dart(6 hunks)packages/komodo_defi_sdk/lib/src/assets/asset_lookup.dart(1 hunks)packages/komodo_defi_sdk/lib/src/assets/asset_manager.dart(9 hunks)packages/komodo_defi_sdk/lib/src/assets/custom_asset_history_storage.dart(1 hunks)packages/komodo_defi_sdk/lib/src/bootstrap.dart(1 hunks)packages/komodo_ui/lib/src/defi/asset/asset_icon.dart(2 hunks)
⏰ 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). (4)
- GitHub Check: Cursor Bugbot
- GitHub Check: Cursor Bugbot
- GitHub Check: build_and_preview_playground_preview
- GitHub Check: Flutter tests (all packages)
🔇 Additional comments (16)
packages/komodo_ui/lib/src/defi/asset/asset_icon.dart (2)
55-64: LGTM: minor layout cleanupNo functional change here.
241-272: LGTM: retrieval path matches canonical lowercase keyBuild-time lookup uses
_sanitizedId, consistent with the write-key change.packages/komodo_defi_sdk/lib/src/assets/asset_lookup.dart (1)
29-34: Simple, clear notifier interfaceGood separation of concerns and minimal surface.
packages/komodo_defi_sdk/lib/src/bootstrap.dart (1)
65-81: Cycle avoidance checkUsing
ValueGetter<ActivationManager>breaks the hard cycle—nice. Verify no early calls to_activationManager()happen duringAssetManager.init().packages/komodo_defi_sdk/lib/src/activation/activation_manager.dart (4)
22-23: LGTM: notifier dependency addedConstructor and field addition are coherent with the new notifier flow.
137-144: LGTM: enabled-coins resolution via config IDsMapping RPC tickers to assets through
findAssetsByConfigIdis consistent with the new strategy-based filtering.
209-212: Good: notify refresh only when custom tokens were activatedPrevents unnecessary refresh churn.
238-245: LGTM: active assets aggregationMatches the status check logic above.
packages/komodo_defi_sdk/lib/src/assets/asset_manager.dart (8)
1-4: LGTM: targeted importsBringing in
unawaitedanddebugPrintis appropriate.
46-46: LGTM: implements notifier on the managerRight place to centralize refresh behavior.
118-123: LGTM: strategy change also refreshes custom tokensGood to keep custom tokens aligned with current filter.
170-175: LGTM: defensive error on use-before-initClear message aids callers.
181-182: LGTM: unmodifiable viewPrevents external mutation.
215-218: LGTM: defensive copy to avoid concurrent modificationAppropriate safeguard.
231-238: LGTM: child lookup uses defensive copyConsistent with the above; avoids iteration invalidation.
281-288: LGTM: strategy-based filtering for custom tokensUsing
token.protocol.configaligns with the rest of the PR.
packages/komodo_defi_sdk/lib/src/assets/custom_asset_history_storage.dart
Show resolved
Hide resolved
CharlVS
left a comment
There was a problem hiding this comment.
TYSM.
Please use .of instead of .from
Done in fad851b |
Enum values are a mix of ticker, formatted, and token suffix values,
Summary by CodeRabbit