You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browse filesBrowse the repository at this point in the historyBrowse files
authored
feat(nft-meta-data-pointer): migrate frontend to @solana/kit (#673)
* feat(nft-meta-data-pointer): migrate frontend to @solana/kit
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.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix: commit refilled energy back to player state
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>
* fix: clear energy countdown once max energy is reached
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>
* fix(nft-meta-data-pointer): consolidate RPC config and replace DAS client 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.
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: amilz <85324096+amilz@users.noreply.github.com>
Copy file name to clipboardExpand all lines: tokens/token-2022/nft-meta-data-pointer/app/README.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,11 @@
1
1
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
2
2
3
+
## Solana client stack
4
+
5
+
The on-chain client is [`@solana/kit`](https://github.com/anza-xyz/kit), generated from `idl/extension_nft.json` via [Codama](https://github.com/codama-idl/codama) (`pnpm generate-client`, wired as a `predev`/`prebuild` step) into a gitignored `generated/` directory — see `scripts/generate-client.ts`. Wallet connection is [`@solana/connector`](https://www.npmjs.com/package/@solana/connector) (wallet-standard, no per-wallet adapter packages).
6
+
7
+
One legacy pocket remains: the session-key feature (`@magicblock-labs/gum-react-sdk`) is pinned to `@solana/web3.js` and `@solana/wallet-adapter-react` in its own published API and predates kit. Rather than run a second, separately-connected wallet-adapter-react instance alongside the kit-native wallet connection, `contexts/SessionProvider.tsx` and `utils/legacyBridge.ts` bridge the single kit-connected wallet into the `AnchorWallet` shape gum-sdk needs. `@solana/web3.js` and `@solana/wallet-adapter-react` stay in `package.json`, but only for that one boundary — nothing else in the app touches them.
0 commit comments