Skip to content

feat(nft-meta-data-pointer): migrate frontend to @solana/kit - #673

Open
Harsh-H-Shah wants to merge 4 commits into
solana-foundation:mainfrom
Harsh-H-Shah:feat/nft-meta-data-pointer-kit-migration
Open

feat(nft-meta-data-pointer): migrate frontend to @solana/kit#673
Harsh-H-Shah wants to merge 4 commits into
solana-foundation:mainfrom
Harsh-H-Shah:feat/nft-meta-data-pointer-kit-migration

Conversation

@Harsh-H-Shah

Copy link
Copy Markdown
Contributor

Follow-up to #657, where dev-jodee asked for web3.js to be dropped in favor of kit. Replaces @anchor-lang/core with a Codama-generated @solana/kit client (from a real anchor-build-extracted IDL, not the hand-maintained one), and @solana/wallet-adapter-react with @solana/connector for wallet connection.

@magicblock-labs/gum-react-sdk (the session-key feature) is pinned to @solana/web3.js and @solana/wallet-adapter-react in its own published API and predates kit, so full removal isn't possible while keeping that feature. That stays as a single, documented legacy boundary (utils/legacyBridge.ts, contexts/SessionProvider.tsx) bridging the one connected wallet into the shape gum-sdk needs, rather than running two separately-connected wallet instances.

Follow-up to solana-foundation#657, where dev-jodee asked for web3.js to be dropped in favor of
kit. Replaces @anchor-lang/core with a Codama-generated @solana/kit client
(from a real anchor-build-extracted IDL, not the hand-maintained one), and
@solana/wallet-adapter-react with @solana/connector for wallet connection.

@magicblock-labs/gum-react-sdk (the session-key feature) is pinned to
@solana/web3.js and @solana/wallet-adapter-react in its own published API and
predates kit, so full removal isn't possible while keeping that feature. That
stays as a single, documented legacy boundary (utils/legacyBridge.ts,
contexts/SessionProvider.tsx) bridging the one connected wallet into the shape
gum-sdk needs, rather than running two separately-connected wallet instances.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@Harsh-H-Shah
Harsh-H-Shah requested a review from dev-jodee as a code owner August 5, 2026 08:32
@greptile-apps

greptile-apps Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The follow-up updates the Kit-based game-state timer so locally refilled energy is published through provider state and the countdown is cleared at maximum energy.

  • Copies calculated energy and lastLogin values into a new player-state object.
  • Resets nextEnergyIn to zero when maximum energy has been reached.
  • Completes the fixes requested by the two previous game-state threads.

Confidence Score: 5/5

The reviewed follow-up appears safe to merge because no blocking failure remains from the previous game-state findings.

The current timer publishes refilled energy through a new player-state object and clears the countdown when energy is at maximum, so neither previously reported stale-state path remains.

Important Files Changed

Filename Overview
tokens/token-2022/nft-meta-data-pointer/app/contexts/GameStateProvider.tsx The provider now publishes simulated refill state and clears the countdown at maximum energy, resolving both previously reported stale-UI paths.
tokens/token-2022/nft-meta-data-pointer/app/components/DisplayGameState.tsx The display continues to consume the provider’s energy and countdown values without introducing a residual issue related to the prior threads.

Reviews (4): Last reviewed commit: "fix(nft-meta-data-pointer): consolidate ..." | Re-trigger Greptile

Greptile caught this on review: the refill-tick loop computed incremented
energy/lastLogin into local variables but never wrote them back to
playerState, so the displayed energy counter stayed stale between real
account-change notifications. The previous BN-based version got away with
mutating playerState.energy in place and relying on the same effects
setTimePassed/setEnergyNextIn calls to force a re-render - that trick got
dropped when the local let variables were introduced. Now commits the
computed values via setPlayerState explicitly, only when something changed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Comment thread tokens/token-2022/nft-meta-data-pointer/app/contexts/GameStateProvider.tsx Outdated
Greptile flagged this on review. Pre-existing behavior (the same early
return existed before this migration) surfaced by having Greptile look
closely at code already being touched here: once playerState.energy hits
MAX_ENERGY, the interval returned early without ever calling
setEnergyNextIn(0), so the last computed countdown stayed on screen next
to a full energy bar indefinitely. Splits the guard so the max-energy
case explicitly clears the countdown before returning.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@amilz amilz self-assigned this Aug 6, 2026
…ient with kit

Point declare_id! and Anchor.toml at the program actually deployed on devnet,
so a fresh anchor build reproduces the checked-in IDL.

Route the wallet connector and the session-key Connection through the same
RPC_URL the kit client uses, so NEXT_PUBLIC_RPC moves every cluster
connection together instead of leaving two endpoints hardcoded.

Reset playerDataPDA and check the abort signal when the signer changes, so a
click during the async PDA derivation cannot pair a new signer with the
previous wallet's player account.

Replace the axios-based WrappedConnection with a DAS client built on kit's
createJsonRpcApi, following the pattern in solana-foundation/templates
kit/nextjs-das-nfts. The DAS endpoint carries a provider credential, so it now
comes from NEXT_PUBLIC_DAS_RPC with no default and the NFT list reports when
it is unset.

Move the remaining web3.js conversions behind legacyBridge and add a
typecheck script, which needs generate-client to have run.
@amilz

amilz commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Thanks @Harsh-H-Shah -- i pushed a small commit on top of yours. Just for future reference, I wanted you to make sure you see tokens/token-2022/nft-meta-data-pointer/app/utils/das.ts which is a way to set up custom RPC handlers like DAS in kit.

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.

3 participants