← Back to Pull requests

feat(kit/react-vite): migrate wallet starter to Kit 8 plugins #491

Open
SrMessiSOL opened this pull request with 1816 lines diff across 13 files
View on GitHub
SrMessiSOL SrMessiSOL commented on Oct 04, 2026 02:36 UTC
Author

Summary


Updates the React + Vite wallet starter to Kit 8 wallet/RPC plugins and @solana/react, replacing @solana/client and @solana/react-hooks.

Changes


  • Create a shared devnet client and update the React provider.

  • Synchronize the displayed address with wallet account changes.

  • Handle loading states, rejected connections, and connection/disconnection error recovery.

  • Add four regression tests covering wallet lifecycle, error recovery, and transaction planning with the selected account.

  • Require Node 24 and update the CI matrix exclusions.

  • Approve esbuild's required build script for standalone pnpm installation.

  • Explicitly declare the test dependency required by Yarn.

  • Update documentation, generated metadata, and the scoped workspace lockfile while preserving unrelated importers.
  • Validation


  • Fresh local scaffolds created with create-solana-dapp.

  • npm, pnpm, and Yarn installations and complete CI checks passed.

  • Frozen workspace installation and complete CI checks passed.

  • Production build, TypeScript, lint, formatting, and all four regression tests passed.

  • Metadata generation, validation, template-structure checks, and diff checks passed.

  • Manual browser checks passed for rejection/retry, account switching, reload restoration, disconnect, and remaining disconnected after reload.
  • Diff: 1816 lines (+1750 / -66) across 13 files Reviewer: greptile-apps[bot] Review duration: 22m
    All Vouch review confidence checks passed
    Residual risk 0.43 = Change Risk (0.84) × (1 − Review Confidence (0.49)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.84 · 1816 lines diff across 13 files
    0.84
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.48 · 4 substantive comment(s)
    0.48
    Model 3 · Review Timing & Attention
    Session adequacy: 49% · Reviewer familiarity: 35%
    49%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.400
    Sensitive Paths sensitive_paths
    0.084
    Real PR Conversation Timeline
    5 items
    greptile-apps[bot] greptile-apps[bot] commented on Oct 04, 2026 02:38 UTC
    Bot

    <!-- greptile_summary -->

    <h2><a href="https://app.greptile.com/api/retrigger?id=74238440"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img alt="Retrigger" src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2" align="right"></picture></a>Confidence Score: 4/5</h2>

    [Medium risk] Updates wallet starter template to Kit 8 plugins\.

    The PR appears safe to merge, with non-blocking wallet-identity, dependency-alignment, and restoration-test improvements.

    <h2>Findings</h2>

    1. <img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9" align="top">&nbsp;Duplicate names misidentify wallets <a href="https://github.com/solana-foundation/templates/pull/491#discussion_r4175866264">▶</a>
    2. <img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9" align="top">&nbsp;React peer versions conflict <a href="https://github.com/solana-foundation/templates/pull/491#discussion_r4175866266">▶</a>
    3. <img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9" align="top">&nbsp;Wallet restoration lacks coverage <a href="https://github.com/solana-foundation/templates/pull/491#discussion_r4175866270">▶</a>

    <h3>Summary</h3>

    Migrates the React + Vite wallet starter to Kit 8 wallet/RPC plugins and @solana/react, adds wallet lifecycle tests, and updates its runtime requirement and catalog metadata.

  • Wallet selection now follows plugin state and displays connection errors.

  • The new tests run as part of the generated starter’s CI command.
  • <!-- greptile_confidence_score:4 -->

    <sub>Reviews (1) · Last reviewed commit: "feat(kit/react-vite): migrate wallet sta..."</sub>

    greptile-apps[bot] greptile-apps[bot] commented on code on Oct 04, 2026 02:38 UTC
    Code Review
    kit/react-vite/src/App.tsx:1
    @@ -110,44 +134,66 @@ export default function App() {
               </div>
     
               <div className="grid gap-3 sm:grid-cols-2">
    -            {connectors.map((connector) => (
    -              <button
    -                key={connector.id}
    -                onClick={() => connect(connector.id)}
    -                disabled={status === "connecting"}
    -                className="group flex items-center justify-between rounded-xl border border-border-low bg-card px-4 py-3 text-left text-sm font-medium transition hover:-translate-y-0.5 hover:shadow-sm cursor-pointer disabled:cursor-not-allowed disabled:opacity-60"
    -              >
    -                <span className="flex flex-col">
    -                  <span className="text-base">{connector.name}</span>
    -                  <span className="text-xs text-muted">
    -                    {status === "connecting"
    -                      ? "Connecting…"
    -                      : status === "connected" &&
    -                          wallet?.connector.id === connector.id
    -                        ? "Active"
    -                        : "Tap to connect"}
    +            {!isWalletReady ? (
    +              <p className="text-sm text-muted">Restoring wallet...</p>
    +            ) : wallets.length === 0 ? (
    +              <p className="text-sm text-muted">No wallets detected.</p>
    +            ) : (
    +              wallets.map((candidate) => (
    +                <button
    +                  key={candidate.name}
    +                  onClick={() => {
    +                    resetDisconnect();
    +                    void connect(candidate).catch(() => {});
    +                  }}
    +                  disabled={isBusy}
    +                  className="group flex cursor-pointer items-center justify-between rounded-xl border border-border-low bg-card px-4 py-3 text-left text-sm font-medium transition hover:-translate-y-0.5 hover:shadow-sm disabled:cursor-not-allowed disabled:opacity-60"
    +                >
    +                  <span className="flex flex-col">
    +                    <span className="text-base">{candidate.name}</span>
    +                    <span className="text-xs text-muted">
    +                      {isConnecting
    +                        ? "Connecting…"
    +                        : status === "connected" &&
    +                            connectedWallet?.wallet.name === candidate.name
    +                          ? "Active"

    <a href="#"><img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9" align="top"></a> Duplicate names misidentify wallets. If two discovered wallets share a name, both buttons say “Active” when either is connected. The buttons also use that name as their React key, which can cause rendering warnings. Compare wallet identity rather than its display name so users can tell which wallet is connected.

    greptile-apps[bot] greptile-apps[bot] commented on code on Oct 04, 2026 02:38 UTC
    Code Review
    kit/react-vite/package.json:1
    @@ -22,36 +22,47 @@
       "version": "0.0.0",
       "private": true,
       "type": "module",
    +  "engines": {
    +    "node": ">=24"
    +  },
       "scripts": {
         "build": "tsc -b && vite build",
    -    "ci": "npm run build && npm run lint && npm run format:check",
    +    "ci": "npm run build && npm run lint && npm run format:check && npm run test",
         "dev": "vite",
         "format": "prettier --write .",
         "format:check": "prettier --check .",
         "lint": "eslint .",
    -    "preview": "vite preview"
    +    "preview": "vite preview",
    +    "test": "vitest run"
       },
       "dependencies": {
    -    "@solana/client": "^1.0.0-rc.2",
    -    "@solana/react-hooks": "^1.0.0-rc.3",
    +    "@solana/kit": "^8.3.0",
    +    "@solana/kit-plugin-rpc": "^0.19.0",
    +    "@solana/kit-plugin-wallet": "^0.20.0",
    +    "@solana/react": "^8.2.0",
         "@tailwindcss/vite": "^4",
         "react": "^19.2.0",

    <a href="#"><img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9" align="top"></a> React peer versions conflict. The new wallet plugin requires React ^19.2.8, but the committed workspace resolution installs React 19.2.3. Strict peer checks can reject that installation. Align the React minimum and resolved version with the plugin’s requirement.

    greptile-apps[bot] greptile-apps[bot] commented on code on Oct 04, 2026 02:38 UTC
    Code Review
    kit/react-vite/tests/wallet.test.tsx:1
    @@ -0,0 +1,166 @@
    +import { address, getAddressDecoder } from "@solana/kit";
    +import { ClientProvider } from "@solana/react";
    +import { registerWallet } from "@wallet-standard/wallet";
    +import {
    +  act,
    +  cleanup,
    +  fireEvent,
    +  render,
    +  screen,
    +  waitFor,
    +} from "@testing-library/react";
    +import { afterEach, expect, test } from "vitest";
    +import App from "../src/App";
    +import { client } from "../src/solana-client";
    +
    +const account = (lastByte: number) => {
    +  const publicKey = new Uint8Array(32);
    +  publicKey[31] = lastByte;
    +  return {
    +    address: getAddressDecoder().decode(publicKey),
    +    publicKey,
    +    chains: ["solana:devnet"] as const,
    +    features: ["solana:signTransaction"] as const,
    +  };
    +};
    +const first = account(1);
    +const second = account(2);
    +let accounts: readonly ReturnType<typeof account>[] = [];
    +let rejectConnection = false;
    +let rejectDisconnection = false;
    +const listeners = new Set<(change: { accounts: typeof accounts }) => void>();
    +function changeAccounts(next: typeof accounts) {
    +  accounts = next;
    +  for (const listener of listeners) listener({ accounts });
    +}
    +const wallet = {
    +  name: "Test Wallet",
    +  version: "1.0.0" as const,
    +  icon: "data:image/png;base64," as const,
    +  chains: ["solana:devnet"] as const,
    +  get accounts() {
    +    return accounts;
    +  },
    +  features: {
    +    "solana:signTransaction": {
    +      version: "1.0.0" as const,
    +      supportedTransactionVersions: ["legacy", 0, 1] as const,
    +      signTransaction: async () => {
    +        throw new Error(
    +          "This test wallet must not submit or sign transactions"
    +        );
    +      },
    +    },
    +    "standard:connect": {
    +      version: "1.0.0" as const,
    +      connect: async () => {
    +        if (rejectConnection) throw new Error("Connection rejected by user");
    +        changeAccounts([first]);
    +        return { accounts };
    +      },
    +    },
    +    "standard:disconnect": {
    +      version: "1.0.0" as const,
    +      disconnect: async () => {
    +        if (rejectDisconnection) throw new Error("Disconnection failed");
    +        changeAccounts([]);
    +      },
    +    },
    +    "standard:events": {
    +      version: "1.0.0" as const,
    +      on: (
    +        _event: "change",
    +        listener: (change: { accounts: typeof accounts }) => void
    +      ) => {
    +        listeners.add(listener);
    +        return () => listeners.delete(listener);
    +      },
    +    },
    +  },
    +};
    +registerWallet(wallet);
    +afterEach(() => {
    +  cleanup();
    +  act(() => changeAccounts([]));
    +  rejectConnection = false;
    +  rejectDisconnection = false;
    +  localStorage.clear();
    +});
    +function mount() {
    +  render(
    +    <ClientProvider client={client}>
    +      <App />
    +    </ClientProvider>
    +  );
    +}
    +async function connect() {
    +  const button = await screen.findByRole("button", { name: /Test Wallet/ });
    +  await waitFor(() =>
    +    expect((button as HTMLButtonElement).disabled).toBe(false)
    +  );
    +  fireEvent.click(button);
    +}
    +test("connects, updates the selected account, and disconnects", async () => {

    <a href="#"><img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9" align="top"></a> Wallet restoration lacks coverage. The new tests cover account switching and button-driven disconnect, but none remounts a connected client to check restoration. A regression in this new lifecycle path would pass the starter’s CI suite; please add a restoration test.

    Knowledge Base Used: Solana Kit templates

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

    Assignees
    SrMessiSOL SrMessiSOL
    Labels
    risk: medium confidence: 49.2% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 83.8% (HIGH) · Higher = larger blast radius
    83.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 49.2% · Lower = rushed or shallow review
    49.2%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 42.6% · Moderate risk
    42.6%