Skip to content

Pirc - #19

Merged
Junman140 merged 9 commits into
mainfrom
PIRC
Jun 28, 2026
Merged

Pirc#19
Junman140 merged 9 commits into
mainfrom
PIRC

Conversation

@Junman140

@Junman140 Junman140 commented Jun 28, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • Added richer token details across the app, including token icons and more market stats where available.
    • Improved token search and browsing with load-more pagination and clearer empty/error states.
    • Added trustline-aware token actions, including an option to add a trustline before swapping.
    • Updated the dashboard and token pages to show more useful holding, price, and trade information.
  • Bug Fixes

    • Improved token and price handling for more consistent balances and pricing across screens.

@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 00967fc0-8a17-4fad-8b7e-6ebd43ffaccd

📥 Commits

Reviewing files that changed from the base of the PR and between d4b568a and cb65c31.

⛔ Files ignored due to path filters (8)
  • public/android-chrome-192x192 (1).png is excluded by !**/*.png
  • public/android-chrome-512x512.png is excluded by !**/*.png
  • public/apple-touch-icon.png is excluded by !**/*.png
  • public/favicon-16x16.png is excluded by !**/*.png
  • public/favicon-32x32.png is excluded by !**/*.png
  • public/favicon.ico is excluded by !**/*.ico
  • public/logo.jpg is excluded by !**/*.jpg
  • public/pi.png is excluded by !**/*.png
📒 Files selected for processing (26)
  • app/dashboard/page.tsx
  • app/explore/page.tsx
  • app/layout.tsx
  • app/my-tokens/page.tsx
  • app/page.tsx
  • app/profile/page.tsx
  • app/swap/page.tsx
  • app/token/[code]/page.tsx
  • app/trustlines/page.tsx
  • components/navbar.tsx
  • components/providers/pool-price-provider.tsx
  • components/send/send-form.tsx
  • components/swap/swap-card.tsx
  • components/swap/token-select.tsx
  • components/token-icon.tsx
  • hooks/useAvailableTokens.ts
  • hooks/useCheckTrustline.ts
  • hooks/useNetworkTokens.ts
  • hooks/usePiPrice.ts
  • hooks/useTokenMarketData.ts
  • hooks/useTokenMetadataMap.ts
  • hooks/useTokenPrice.ts
  • lib/api/orderbook.ts
  • lib/api/tokens.ts
  • public/site (1).webmanifest
  • validation-key.txt

📝 Walkthrough

Walkthrough

This PR introduces pool-based token pricing via PoolPriceProvider, a shared TokenIcon component, a TokenSelect UI, and a useNetworkTokens paginated discovery hook. It wires these into the home, explore, trustlines, token-detail, swap, send, dashboard, and my-tokens pages, adds trustline gating and 24h market data to token detail, and refactors useTokenPrice with a reserves fallback.

Changes

Token Metadata, Pricing, and Discovery

Layer / File(s) Summary
API contracts: listed assets, token metadata, orderbook types
lib/api/tokens.ts, lib/api/orderbook.ts
TokenRecord gains image/supply/holders/toml fields and lookupTokenMetadata; ListedAsset/ListAssetsResponse types and fetchListedAssets are added; AssetSearchResult.balances becomes any with optional toml_url.
Token metadata caching hook
hooks/useTokenMetadataMap.ts
Introduces TokenLookup interface and useTokenMetadataMap with synchronous lookup, async fetchMetadata backed by cross-instance pendingRequests deduplication, and registry-seeded tokenMap.
PoolPriceProvider: pool-based pricing context
components/providers/pool-price-provider.tsx, app/layout.tsx
Adds PoolPriceProvider with module-level globalCache, two-pass pool price computation (direct + one-hop), stablecoin USD-peg handling, periodic refresh, and usePoolPrice hook; wired into the app provider tree.
useTokenPrice refactor with reserves fallback
hooks/useTokenPrice.ts
Adds tokenKey/toQuoteDescriptor/priceFromReserves helpers; refactors useTokenPrice and useTokenPrices to use quote + reserves fallback; normalizes getPrice key lookup.
useTokenMarketData and useCheckTrustline refresh
hooks/useTokenMarketData.ts, hooks/useCheckTrustline.ts
Adds useTokenMarketData that sums 24h base_volume from trade aggregations; refactors useCheckTrustline to expose a refresh callback via useCallback.
useNetworkTokens paginated discovery hook
hooks/useNetworkTokens.ts
Introduces NetworkToken interface, enrichBatch with batched metadata fetching, and useNetworkTokens with cursor pagination, search, platform merging, deduplication, and loadMore/refresh API.
AvailableToken metadata expansion
hooks/useAvailableTokens.ts
Adds image, holders, liquidityPools, totalSupply, circulatingSupply to AvailableToken; populates them and prefers tomlName/tomlDescription in platform-token construction.
TokenIcon shared component
components/token-icon.tsx
Adds TokenIcon with TokenIconProps, deterministic gradient fallbacks, image resolution from props/native path/metadata hook, async fetch effect with cancellation, and img-or-text render.
TokenSelect component and SwapCard integration
components/swap/token-select.tsx, components/swap/swap-card.tsx
Adds TokenOption interface and TokenSelect popover component with search and balance display; SwapCard builds tokenAOptions/tokenBOptions memos via useTokenMetadataMap and replaces Select dropdowns with TokenSelect.
SendForm token selector: TokenIcon
components/send/send-form.tsx
Replaces inline <span> icon in SelectItem with TokenIcon, using useTokenMetadataMap for image lookup.
Home page: HoldingItem model and pool-priced holdings
app/page.tsx
Exports HoldingItem interface; replaces useTokenPrices with usePoolPrice; builds a typed holdings list merging native PI, platform tokens, and balances with deduplication and USD pricing; renders list with TokenIcon and platform badge.
Token detail page: trustline gating and market data
app/token/[code]/page.tsx
Unwraps async params, adds trustline/metadata state, gates actions on trustline readiness, adds market data widgets (USD price, market cap, 24h volume), and conditionally renders TrustlineDialog.
Dashboard minted token enrichment
app/dashboard/page.tsx
Extends formatMintedToken and mintedSummaries memo to include image, circulating, and holders in TokenSummary.
Explore and Trustlines: network search and pagination
app/explore/page.tsx, app/trustlines/page.tsx
Both pages switch to useNetworkTokens with searchQuery/loadMore/refresh, replace token avatars with TokenIcon, and add pagination and result-count UI.
My-tokens TokenIcon, profile cleanup, SwapCard SSR, Pi price URL
app/my-tokens/page.tsx, app/profile/page.tsx, app/swap/page.tsx, hooks/usePiPrice.ts
Adds TokenIcon to my-tokens card headers; removes Holdings card from profile and adds version footer; switches SwapCard to next/dynamic with ssr: false; updates usePiPrice to api.zyrachain.org URLs with price_usd preference.
Navbar logo, manifest, validation key
components/navbar.tsx, public/site (1).webmanifest, validation-key.txt
Replaces gradient "Z" navbar logo with <img src="/logo.jpg">; populates the empty web manifest; rotates the validation key.

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related PRs

  • Pi-Defi-world/Zyradex-frontend#18: Modifies app/explore/page.tsx's "Available Tokens" section with different token filtering/display logic that this PR replaces with useNetworkTokens-backed pagination and search.

Poem

🐇 A rabbit hops through the token land,
With icons and prices close at hand,
Pool prices cached, one hop derived,
Through trustline gates the tokens thrived,
Search, paginate, discover more—
ZyraDex v1.0.0 is ready to soar! 🌟

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch PIRC

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Junman140
Junman140 merged commit 7b2fe40 into main Jun 28, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant