Skip to content

chore: rework IDL card and simplify IDL resolution#1115

Merged
Woody4618 merged 4 commits into
solana-foundation:masterfrom
hoodieshq:chore/idl-cleanup
Jun 30, 2026
Merged

chore: rework IDL card and simplify IDL resolution#1115
Woody4618 merged 4 commits into
solana-foundation:masterfrom
hoodieshq:chore/idl-cleanup

Conversation

@askov

@askov askov commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Description

Reworks the program IDL card to a single, source-agnostic view, adds an at-a-glance metadata block under the badge, and removes the PMP feature flags.

  • The card no longer renders one tab per IDL source. It shows the latest Program Metadata (PMP) IDL, falling back to the program's on-chain Anchor IDL — flagged with a warning badge + tooltip — only when no PMP IDL exists.
  • The badge shows the IDL standard and its format (encoding) version — Codama's root version or Anchor's metadata.spec: Codama (version 1.5.1), Anchor 0.30.1 (version 0.1.0), or Anchor (legacy).
  • A metadata block under the badge surfaces, for the displayed IDL:
    • Address — the on-chain account it was read from (PMP metadata account / Anchor IDL PDA), linked + copyable via the shared AddressLink.
    • SourcePMP or Anchor.
    • Program Version — the program's own semver (program.version for Codama, metadata.version / legacy top-level version for Anchor), kept distinct from the format version shown in the badge.
  • Adds an IDL history link in the card header to the standalone IDL explorer (idl.solana.com) for the full history across all sources.
  • Removes the NEXT_PUBLIC_PMP_IDL_ENABLED and NEXT_PUBLIC_PMP_SECURITY_TXT_ENABLED feature flags — PMP IDL and security.txt resolution are now always on (the security.txt path keeps its Neodyme ELF fallback).
  • Simplifies the IDL resolution layer: drops the includeAnchor/includePmp options and the preferredVariant field, merges the duplicate result types into one ProgramIdlPair (now also carrying each source's storage-account address, threaded from @solana/idl — which already returns it — through the resolver, the /api/idl-latest route, and useProgramIdls), moves useProgramIdls into the idl entity so the card, the Anchor tx-decoder, and the program-name label share one cached resolution, and removes the now-redundant useIdlFromAnchorProgramSeed hook plus dead exports.

Net ~250 fewer lines; the tx-inspector routes drop ~10 kB First Load JS (one fewer IDL hook on the decoder path — see bench/BUILD.md).

Type of change

  • New feature
  • Other: UI rework + refactor — removes feature flags and simplifies IDL resolution (no new protocol)

Screenshots

localhost_3000_address_BUYuxRfhCMWavaUWxhGtPP3ksKEDZxCD5gzknk3JfAya_idl localhost_3000_address_JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4_idl localhost_3000_address_AXcxp15oz1L4YYtqZo6Qt6EkUj1jtLR6wXYqaJvn4oye_idl_cluster=devnet

Testing

Automated: pnpm lint, pnpm typecheck, pnpm build, and pnpm test pass locally; IDL card / resolver / hook specs added or updated — including the badge label, the program-version accessor, and the storage-address threading through the resolver and the /api/idl-latest route.

Manual (Vercel preview):

Related Issues

Closes HOO-711

Checklist

  • My code follows the project's style guidelines
  • I have added tests that prove my fix/feature works
  • All checks pass locally (pnpm test, pnpm lint, pnpm typecheck)
  • I have run build:info script to update build information

@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown

@askov is attempting to deploy a commit to the Solana Foundation Team on Vercel.

A member of the Team first needs to authorize it.

@askov askov changed the title chore: rework IDL card and simplify IDL resolution (HOO-711) chore: rework IDL card and simplify IDL resolution Jun 26, 2026
@greptile-apps

greptile-apps Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR reworks the program IDL view and simplifies shared IDL resolution. The main changes are:

  • A single IDL card that prefers Program Metadata and falls back to Anchor.
  • IDL metadata rows for storage address, source, and program version.
  • Shared IDL fetching for the card, transaction decoder, and program-name label.
  • Removal of PMP IDL and security.txt feature flags.
  • Updated security.txt and IDL API routes, tests, and build-size notes.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
app/entities/idl/api/resolve-program-idls.ts Simplifies IDL resolution to return both sources and their storage addresses.
app/api/idl-latest/route.ts Returns the unified IDL response shape from the shared resolver.
app/entities/idl/model/use-program-idls.ts Provides one shared cached IDL resolution path for consumers.
app/features/idl/ui/IdlCard.tsx Replaces source tabs with a single displayed IDL and metadata block.
app/api/security-txt/route.ts Removes the feature flag and always uses the unified security.txt fetch path.
app/features/security-txt/api/load-fetch-security-txt.ts Matches custom-cluster security.txt fetching to the route behavior.

Reviews (5): Last reviewed commit: "chore: reconcile IDL rework with master ..." | Re-trigger Greptile

@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
explorer Ready Ready Preview, Comment Jun 30, 2026 11:59am

Request Review

Comment thread app/entities/idl/model/use-idl-from-anchor-program-seed.ts
Comment thread app/entities/idl/model/anchor/anchor-provider.ts
Comment thread app/entities/idl/model/use-program-idls.ts
Comment thread app/features/idl/ui/__tests__/IdlCard.spec.tsx Outdated
Comment thread app/entities/idl/api/resolve-program-idls.ts Outdated
askov added 4 commits June 30, 2026 18:33
- Replace per-source IDL tabs with a single view: the latest PMP IDL,
  falling back to the on-chain Anchor IDL (flagged via a tooltip) only
  when no PMP IDL exists.
- Remove the NEXT_PUBLIC_PMP_IDL_ENABLED and NEXT_PUBLIC_PMP_SECURITY_TXT_ENABLED
  feature flags (PMP resolution is always on).
- Add an "IDL history" link to idl.solana.com in the card header.
- Simplify resolution: drop the includeAnchor/includePmp args and the
  preferredVariant field, and merge the duplicate result types into ProgramIdlPair.
- Move useProgramIdls into the idl entity and share it across the card,
  the Anchor tx decoder (useAnchorProgram), and the program-name label;
  delete the now-redundant useIdlFromAnchorProgramSeed hook.
- Trim dead barrel/server exports and the unused cluster @x/program-metadata slice.
- Add a metadata block under the badge: the IDL storage account
  (linked + copyable via the shared AddressLink), the source
  (PMP / Anchor), and the program's own version.
- Surface the IDL storage-account address — already returned by
  @solana/idl but previously discarded — through the resolver, the
  /api/idl-latest route, the fetch/client resolvers, and useProgramIdls.
- Rework the badge to show the IDL standard + format (encoding) version:
  "Codama (version 1.5.1)", "Anchor 0.30.1 (version 0.1.0)", or
  "Anchor (legacy)". Add getIdlBadgeLabel + getIdlProgramVersion (the
  program semver, distinct from the spec/era label getIdlVersion returns).
- Add an `info` slot to IdlSection for the metadata block.
- Unify ResolvedProgramIdls/ProgramIdlPair via a ProgramIdlSources<IdlContent>
  generic; relocate resolution shapes to api/types.ts and the foundational IDL
  aliases to lib/types.ts, giving a clean model -> api -> lib dependency flow.
- Group the entity's Anchor-standard modules under model/anchor/.
- Add a useProgramIdls test for the MainnetBeta + localhost direct-RPC path.
- Add a gen.vanityAddress() fixture helper and use it in IdlCard.spec.
- Drop a stale unicorn/no-null exclude for the deleted seed hook.
Rebasing the IDL cleanup onto master surfaced two reconciliation points
with solana-foundation#1119 (program-metadata instruction parsing + idl-latest retry):

- Re-export getProvider from the @entities/idl barrel. The rework moved it
  into model/anchor/anchor-provider.ts and dropped it from the barrel as
  dead, but solana-foundation#1119 added a cross-feature consumer
  (features/decode-instruction-with-idl), so it is public API again.
- Adapt solana-foundation#1119's two idl-latest retry tests (premature-close, nested cause)
  to the simplified resolver shape — drop the removed preferredVariant /
  IdlVariant from their mock payloads. The retry wrapper itself is kept.
@askov askov force-pushed the chore/idl-cleanup branch from 49d7d39 to 507335c Compare June 30, 2026 11:56
@Woody4618 Woody4618 merged commit 32f885a into solana-foundation:master Jun 30, 2026
9 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.

4 participants