Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughThis PR introduces UI infrastructure for displaying AMM (Automated Market Maker) configuration details. It adds React components, custom hooks, TypeScript types, and network configuration support for managing AMM config IDs across different networks, along with a legacy query parameter cleanup. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant AmmConfigCard as AmmConfigCard<br/>(Component)
participant ViewModel as useAmmConfigCardViewModel<br/>(Hook)
participant ResolvedId as useResolvedAmmConfigId<br/>(Hook)
participant Overview as useAmmConfigOverview<br/>(Hook)
participant Network as Network Config<br/>(Context)
participant API as API Layer<br/>(getAmmConfigOverview)
participant View as AmmConfigCardView<br/>(Presentational)
User->>AmmConfigCard: Mount component
AmmConfigCard->>ViewModel: useAmmConfigCardViewModel()
ViewModel->>ResolvedId: useResolvedAmmConfigId()
ResolvedId->>Network: useNetworkVariable(AMM_CONFIG_VARIABLE_NAME)
Network-->>ResolvedId: rawAmmConfigId
ResolvedId-->>ViewModel: resolvedAmmConfigId
ViewModel->>Overview: useAmmConfigOverview(ammConfigId)
Overview->>API: getAmmConfigOverview(ammConfigId, suiClient)
API-->>Overview: ammConfig data
Overview-->>ViewModel: { status, ammConfig, error }
ViewModel->>ViewModel: resolveContentState(status, ammConfig)
ViewModel-->>AmmConfigCard: viewModel
AmmConfigCard->>View: AmmConfigCardView(viewModel)
View-->>User: Render AMM config display
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/ui/src/app/hooks/useNetworkConfig.tsx (1)
75-82: Consider: Custom networks lack AMM config ID support.Custom networks default to
AMM_CONFIG_ID_NOT_DEFINED. If custom networks need AMM functionality, consider extending the custom network configuration to accept anammConfigIdproperty.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/ui/src/app/hooks/useNetworkConfig.tsx` around lines 75 - 82, The code always assigns AMM_CONFIG_ID_NOT_DEFINED to AMM_CONFIG_VARIABLE_NAME for custom networks; update the network config type (the network object used in useNetworkConfig) to optionally include ammConfigId and change the accumulator assignment in useNetworkConfig (where accumulator[network.networkKey] is built) to set [AMM_CONFIG_VARIABLE_NAME]: network.ammConfigId ?? AMM_CONFIG_ID_NOT_DEFINED so custom networks can provide an ammConfigId when available; also update any related types/interfaces and tests that construct network fixtures to include the optional ammConfigId.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/ui/src/app/components/AmmConfigCardView.tsx`:
- Around line 91-123: AmmConfigCardView currently drops the computed
networkLabel so the card never shows which network the values belong to; update
the TAmmConfigCardViewModel to include networkLabel (string), accept it in the
AmmConfigCardView props, and render it in the card header (for example next to
or below the description/h2) with the same small-uppercase styling used
elsewhere so users can see the environment; keep a sensible fallback like
"unknown network" when networkLabel is missing and do not change renderContent
or CopyableId behavior.
---
Nitpick comments:
In `@packages/ui/src/app/hooks/useNetworkConfig.tsx`:
- Around line 75-82: The code always assigns AMM_CONFIG_ID_NOT_DEFINED to
AMM_CONFIG_VARIABLE_NAME for custom networks; update the network config type
(the network object used in useNetworkConfig) to optionally include ammConfigId
and change the accumulator assignment in useNetworkConfig (where
accumulator[network.networkKey] is built) to set [AMM_CONFIG_VARIABLE_NAME]:
network.ammConfigId ?? AMM_CONFIG_ID_NOT_DEFINED so custom networks can provide
an ammConfigId when available; also update any related types/interfaces and
tests that construct network fixtures to include the optional ammConfigId.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f2270ceb-bd0c-402c-a371-2f25d7d41689
📒 Files selected for processing (12)
packages/ui/.env.exemplepackages/ui/README.mdpackages/ui/src/app/components/AmmConfigCard.tsxpackages/ui/src/app/components/AmmConfigCardView.tsxpackages/ui/src/app/config/network.tspackages/ui/src/app/hooks/useAmmConfigCardViewModel.tspackages/ui/src/app/hooks/useAmmConfigOverview.tspackages/ui/src/app/hooks/useNetworkConfig.tsxpackages/ui/src/app/hooks/useResolvedAmmConfigId.tspackages/ui/src/app/page.tsxpackages/ui/src/app/providers/NetworkUrlSync.tsxpackages/ui/src/app/types/TAmmConfigCard.ts
bidzyyys
left a comment
There was a problem hiding this comment.
I do not have UI/Frontend knowledge, so just leaving my approval. Make sure to solve all CodeRabbitAI comments please.
Parts of #21
Summary
Adds the AMM dashboard card in the UI with on-chain config read support.
Scope