Skip to content

Add asset support (display, detail page, caching)#10

Open
Kukks wants to merge 46 commits intomasterfrom
assets
Open

Add asset support (display, detail page, caching)#10
Kukks wants to merge 46 commits intomasterfrom
assets

Conversation

@Kukks
Copy link
Collaborator

@Kukks Kukks commented Feb 16, 2026

Summary

  • Asset detail page at /asset/:assetId showing supply, metadata, ticker, decimals, and control asset link
  • Asset display on VTXOs — individual VTXOs show their associated assets with badge + formatted amount
  • Per-asset balance aggregation in AddressStats — active balance and total received per asset
  • Asset info on transaction outputs via VTXO data fallback
  • Two-tier caching (session storage + react-query staleTime: Infinity) for asset metadata
  • Shared UI components: AssetBadge (compact linked badge with icon + ticker) and AssetAmountDisplay (decimal-aware formatting using metadata)
  • SDK upgraded from 0.3.10 to 0.3.13; asset types defined locally until SDK publishes them natively

Security & correctness

  • Icon URLs validated (HTTPS + data:image/* only) before rendering
  • String-based decimal placement avoids floating-point precision loss
  • encodeURIComponent on assetId in API calls

Deferred

  • OP_RETURN asset packet parsing in transaction detail view (waiting for SDK Packet class)

Test plan

  • Navigate to an address with asset-bearing VTXOs — verify assets appear on individual VTXOs and in the aggregated balance section
  • Click an asset badge — verify it navigates to /asset/:assetId and shows correct details
  • View a transaction with asset outputs — verify asset info displays on relevant outputs
  • Check dark mode — verify all asset-related text uses correct theme colors
  • Reload page after viewing an asset — verify session storage cache serves data instantly

Design for integrating Arkade asset support into the explorer,
targeting ts-sdk PR #279 types. Covers new asset page, VTXO asset
display, transaction packet parsing, and session-cached metadata.
10-task plan covering SDK upgrade, asset cache hook, UI components
(AssetBadge, AssetAmountDisplay, AssetPage), integration into
VtxoList/AddressStats/TransactionDetails, and verification steps.
…mponents

- useAssetDetails: two-tier cache (session storage + react-query) for asset metadata
- AssetBadge: compact inline badge linking to asset page
- AssetAmountDisplay: metadata-aware amount formatting with decimals/ticker
- AssetDetailsCard: shows name, asset ID (copyable), ticker, decimals,
  supply, control asset link, and raw metadata debug toggle
- AssetPage: route handler with loading/error states
- Route: /asset/:assetId added to App.tsx
- VtxoList: show AssetBadge + AssetAmountDisplay for each asset on VTXOs
- AddressStats: aggregate asset balances across VTXOs with active/total breakdown
Display AssetBadge and AssetAmountDisplay on arkade transaction outputs
that carry assets. Uses VTXO data as the source; OP_RETURN packet
parsing will be added when the SDK publishes the Packet class.
- Validate metadata icon URLs (HTTPS only) before rendering
- Replace floating-point division with string-based decimal formatting
- URL-encode assetId in API calls
- Extract shared isVtxoActive helper, remove `as any` casts
- Consolidate duplicated formatAssetAmount into shared utility
- Fix dark mode for Asset Balances heading in AddressStats
- Remove unused getAssetDetailsFromCache export
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 16, 2026

Deploying arkade-explorer with  Cloudflare Pages  Cloudflare Pages

Latest commit: d1da1cf
Status: ✅  Deploy successful!
Preview URL: https://4256096a.arkade-explorer.pages.dev
Branch Preview URL: https://assets.arkade-explorer.pages.dev

View logs

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 16, 2026

Deploying mutinynet-arkade-explorer with  Cloudflare Pages  Cloudflare Pages

Latest commit: d1da1cf
Status: ✅  Deploy successful!
Preview URL: https://1d6ebf22.mutinynet-arkade-explorer.pages.dev
Branch Preview URL: https://assets.mutinynet-arkade-explorer.pages.dev

View logs

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 16, 2026

Deploying short-arkade-explorer with  Cloudflare Pages  Cloudflare Pages

Latest commit: d1da1cf
Status: ✅  Deploy successful!
Preview URL: https://460b0ed9.short-arkade-explorer.pages.dev
Branch Preview URL: https://assets.short-arkade-explorer.pages.dev

View logs

Kukks added 18 commits February 19, 2026 14:49
SDK now natively provides:
- VirtualCoin with assets?: Asset[]
- RestIndexerProvider.getVtxos() with asset parsing
- RestIndexerProvider.getAssetDetails() with metadata decoding

Removed ~230 lines: AssetIndexerClient override, raw API types,
converter functions, VtxoWithAssets type alias.

Kept KnownMetadata/AssetMetadata/AssetDetails locally as they are
not yet exported from the SDK top-level.
- Replace npm with pnpm; fetch @arkade-os/sdk from git
- Multi-stage Dockerfile (pnpm install + build, nginx serve)
- GitHub Actions workflow pushes to ghcr.io on push to master
- Click any asset icon to expand it in a fullscreen lightbox overlay
- Remove duplicate asset badge+amount in VtxoList; keep AssetAmountDisplay
  with purple border instead
- Parse OP_RETURN output on tx page to show asset packet info (groups,
  inputs, outputs, issuance detection) via SDK Packet class
- Add Genesis TX link on asset detail page, extracted from assetId
- Mark OP_RETURN outputs with "OP_RETURN · Asset Packet" label
- For issuance groups where assetId is null, derive it from txid + group
  index (matching the assetId format: genesis txid + 4-char hex index)
When VTXO data doesn't include assets, use the decoded asset packet to
match group outputs by vout index and display the asset info inline on
each output box.
Kukks added 15 commits February 20, 2026 14:09
…indexer URL

ARK_URL now falls back to INDEXER_URL instead of independently defaulting
to https://arkade.computer, so the event stream uses VITE_INDEXER_URL.
Asset IDs (65+ hex chars) are now recognized and routed to /asset/:id.
Recent searches track asset lookups with a blue "Asset" badge.
AssetPage also records visits in search history.
Use subdued text-arkade-gray style with truncated script hex,
matching anchor output appearance for protocol metadata outputs.
Stack text and badges vertically, reduce padding and font size.
Badges stay on their own row so nothing wraps awkwardly.
Return null early when script doesn't match P2TR or OP_RETURN patterns
instead of passing the raw script bytes to ArkAddress constructor,
which expects exactly 32 bytes.
Use grid-cols-2/sm:grid-cols-4 for both aggregate asset balance
cards and per-VTXO asset pills to reduce vertical clutter.
Center-align asset balance cards and reduce spacing so they fit
properly in a 2-col/4-col grid. Reverts unintended VtxoList change.
OP_RETURN outputs are not spendable UTXOs, so fetching VTXO data
for them is unnecessary and can cause errors.
Only skip VTXO fetch for actual asset packet outputs, not all
OP_RETURN outputs.
One card with rows per asset: badge on left, Balance and Received
columns on right. Much cleaner than separate cards per asset.
Add hideUnit prop to AssetAmountDisplay to show only the formatted
number (with decimals) without icon/ticker. Asset badge in the row
already identifies the asset. Card capped at max-w-md.
Column headers appear once above all rows instead of repeating
per asset row.
@arkanaai
Copy link

arkanaai bot commented Feb 25, 2026

PR Review: Add asset support (display, detail page, caching)

Overview

This PR adds comprehensive asset support to the Arkade Explorer, including asset detail pages, asset display on VTXOs and transactions, and session-cached metadata.


✅ Security Review

Icon URL Validation

Good implementation of URL validation before rendering:

// Icon URLs validated (HTTPS + data:image/* only) before rendering

This prevents XSS via malicious icon URLs. ✅

String-based Decimal Handling

// String-based decimal placement avoids floating-point precision loss

Correct approach for handling financial amounts. ✅

AssetId Encoding in URLs

encodeURIComponent(assetId)

Properly encodes assetId in API calls. ✅


🟢 Protocol Correctness

Asset Types

  • Asset: {assetId, amount} on VirtualCoin.assets
  • AssetDetails: {assetId, supply, metadata, controlAssetId}
  • KnownMetadata: {name, ticker, decimals, icon}

These align with the ts-sdk asset types.

Two-tier Caching Strategy

  1. Session storage — keyed by asset-details:${assetId}
  2. React-queryqueryKey: ['asset-details', assetId], staleTime: Infinity

This is a good approach for immutable metadata.


📋 Cross-Repo Impact

  • ts-sdk: PR depends on SDK PR #279 for asset types
  • arkd: Requires indexer support for getAssetDetails(assetId) RPC
  • wallet: Similar asset display patterns could be shared

🧪 Testing Checklist

The PR includes a comprehensive test plan. Recommend verifying:

  • Asset page loads correctly for assets with/without metadata
  • VTXO asset display shows correct amounts with decimal formatting
  • Transaction asset packet parsing works (when SDK Packet class is ready)
  • Session cache persists across page navigation

Summary

This is a well-structured PR with good security practices for handling external data (icons). The caching strategy is appropriate for immutable asset metadata. The deferred OP_RETURN packet parsing is reasonable given SDK dependencies.

Approve — Ready for merge once ts-sdk PR #279 is merged.

@louisinger louisinger mentioned this pull request Feb 26, 2026
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.

2 participants