Skip to content

feat(browser-playground): migrate Solana connection#240

Closed
wenfix wants to merge 10 commits into
mainfrom
am/wapi-1303
Closed

feat(browser-playground): migrate Solana connection#240
wenfix wants to merge 10 commits into
mainfrom
am/wapi-1303

Conversation

@wenfix

@wenfix wenfix commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

Explanation

The Solana Foundation is actively moving dapp connection infrastructure to @solana/react-hooks (part of framework-kit), built on web3.js v2. Most major Solana apps are converging on this library. The playground should reflect the recommended integration path so we validate the MetaMask Connect Solana integration against what consumers will actually use.

  • Replaces @solana/wallet-adapter-react and @solana/wallet-adapter-react-ui with @solana/react-hooks + @solana/kit (web3.js v2) in the browser playground
  • Rewrites SolanaProvider.tsx to use <SolanaProvider> from framework-kit, eliminating the manual ConnectionProvider / WalletProvider / WalletModalProvider stack and built-in autoConnect wiring
  • Migrates SolanaWalletCard.tsx from wallet-adapter hook shapes to framework-kit hooks (useWalletSession, useDisconnectWallet, useSolanaClient) and replaces all @solana/web3.js v1 transaction primitives with @solana/kit v2 equivalents (createTransactionMessage, pipe, compileTransaction, createNoopSigner, getTransferSolInstruction)
  • Updates App.tsx to use useWalletConnection().connect(connectorId) instead of wallets.find(...) + select(name), and wires useDisconnectWallet into the "Disconnect All" button

Dependency Changes

Removed Added
@solana/wallet-adapter-react (patched 0.15.39) @solana/react-hooks@^1.4.1
@solana/wallet-adapter-react-ui@^0.9.35 @solana/kit@^6.5.0
@solana/wallet-standard-chains@^1.1.1 @solana-program/system@^0.12.0

@solana/web3.js is retained — it is still used by solana-method-signatures.ts (out of scope).

Key API Differences

Concern wallet-adapter (removed) framework-kit (new)
Provider ConnectionProvider + WalletProvider + WalletModalProvider <SolanaProvider config={{ endpoint }}>
Wallet state useWallet() → flat fields useWalletSession() → session object or undefined
Public key publicKey.toBase58() (v1 PublicKey) session.account.address (branded string)
Connect wallets.find(...) + select(name) useWalletConnection().connect(connectorId)
Disconnect disconnect() from useWallet() useDisconnectWallet()
RPC useConnection()Connection (v1) useSolanaClient().runtime.rpc (v2)
Sign message signMessage(bytes) from useWallet() session.signMessage(bytes)
Sign tx signTransaction(v1Tx) session.signTransaction(compiledTx)
Send tx sendTransaction(v1Tx, connection) session.sendTransaction(compiledTx)
Pre-built UI WalletMultiButton Custom button using useWalletConnection().connectors

References

Fixes WAPI-1303

Recording

solana-kit-migration.mov

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed, highlighting breaking changes as necessary
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

@wenfix wenfix requested a review from a team as a code owner March 23, 2026 14:34
@socket-security

socket-security Bot commented Mar 23, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​solana/​react-hooks@​1.4.17710010091100
Added@​solana-program/​system@​0.12.0931008393100
Addedws@​8.20.09810010091100
Added@​solana/​kit@​6.5.09910010096100

View full report

@socket-security

socket-security Bot commented Mar 23, 2026

Copy link
Copy Markdown

All alerts resolved. Learn more about Socket for GitHub.

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

Ignoring alerts on:

  • @solana/promises@6.5.0
  • @solana/promises@5.5.1
  • @solana/transaction-messages@6.5.0
  • @solana/transaction-messages@5.5.1
  • @solana/transactions@6.5.0
  • @solana/transactions@5.5.1
  • @solana/addresses@5.5.1
  • @solana/addresses@6.5.0
  • @solana/instructions@5.5.1
  • @solana/instructions@6.5.0
  • @solana/keys@5.5.1
  • @solana/keys@6.5.0
  • @solana/offchain-messages@5.5.1
  • @solana/offchain-messages@6.5.0
  • @solana/signers@5.5.1
  • @solana/signers@6.5.0
  • @solana/assertions@5.5.1
  • @solana/assertions@6.5.0
  • @solana/nominal-types@5.5.1
  • @solana/nominal-types@6.5.0
  • @solana/codecs-data-structures@5.5.1
  • @solana/codecs-data-structures@6.5.0
  • @solana/functional@5.5.1
  • @solana/functional@6.5.0
  • @solana/rpc-types@5.5.1
  • @solana/rpc-types@6.5.0
  • @solana-program/compute-budget@0.11.0
  • @solana-program/stake@0.5.0
  • @solana-program/token-2022@0.7.0
  • @solana/rpc@5.5.1
  • @solana/rpc@6.5.0
  • @solana/rpc-subscriptions@5.5.1
  • @solana/rpc-subscriptions@6.5.0
  • @solana/fast-stable-stringify@5.5.1
  • @solana/fast-stable-stringify@6.5.0
  • @solana/rpc-api@5.5.1
  • @solana/rpc-api@6.5.0
  • @solana/rpc-spec@5.5.1
  • @solana/rpc-spec@6.5.0
  • @solana/rpc-spec-types@5.5.1
  • @solana/rpc-spec-types@6.5.0
  • @solana/rpc-transformers@5.5.1
  • @solana/rpc-transformers@6.5.0
  • @solana/rpc-transport-http@5.5.1
  • @solana/rpc-transport-http@6.5.0
  • @solana/rpc-subscriptions-api@5.5.1
  • @solana/rpc-subscriptions-api@6.5.0
  • @solana/rpc-subscriptions-channel-websocket@5.5.1
  • @solana/rpc-subscriptions-channel-websocket@6.5.0
  • @solana/rpc-subscriptions-spec@5.5.1
  • @solana/rpc-subscriptions-spec@6.5.0
  • @solana/subscribable@5.5.1
  • @solana/subscribable@6.5.0
  • @solana/rpc-parsed-types@5.5.1
  • @solana/rpc-parsed-types@6.5.0
  • @solana/kit@6.5.0
  • @solana/kit@5.5.1
  • @solana/codecs@6.5.0
  • @solana/codecs@5.5.1
  • @solana/transaction-confirmation@6.5.0
  • @solana/transaction-confirmation@5.5.1
  • @solana-program/system@0.12.0
  • @solana-program/system@0.10.0
  • @solana/react-hooks@1.4.1
  • @solana/accounts@6.5.0
  • @solana/accounts@5.5.1
  • @solana/instruction-plans@6.5.0
  • @solana/instruction-plans@5.5.1
  • @solana/plugin-core@6.5.0
  • @solana/plugin-core@5.5.1
  • @solana/plugin-interfaces@6.5.0
  • @solana/program-client-core@6.5.0
  • @solana/programs@6.5.0
  • @solana/programs@5.5.1
  • @solana/sysvars@6.5.0
  • @solana/sysvars@5.5.1
  • @solana/options@6.5.0
  • @solana/options@5.5.1
  • @solana/client@1.7.0
  • swr@2.4.1
  • @solana-program/address-lookup-table@0.10.0
  • @solana-program/token@0.9.0
  • dequal@2.0.3
  • ws@8.20.0
  • undici-types@7.24.5
  • zustand@5.0.12
  • @react-native-async-storage/async-storage@3.0.1
  • commander@14.0.3
  • commander@14.0.2
  • @solana/codecs-numbers@5.5.1
  • @solana/codecs-numbers@6.5.0
  • @solana/codecs-core@5.5.1
  • @solana/codecs-core@6.5.0
  • @solana/errors@5.5.1
  • @solana/errors@6.5.0
  • @solana/codecs-strings@6.5.0
  • @solana/codecs-strings@5.5.1

View full report

@wenfix

wenfix commented Mar 24, 2026

Copy link
Copy Markdown
Contributor Author

@SocketSecurity ignore-all

All flagged dependencies are necessary as part of this migration.
https://socket.dev/npm/user/joncinque is a maintainer of multiple Solana libraries.

"@metamask/utils": "^11.8.1",
"@open-rpc/meta-schema": "^1.14.9",
"@open-rpc/schema-utils-js": "^2.0.5",
"@solana/wallet-adapter-react": "patch:@solana/wallet-adapter-react@npm%3A0.15.39#~/.yarn/patches/@solana-wallet-adapter-react-npm-0.15.39-86277fdcc0.patch",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried testing if the bug that this patch fixed exists in the new libraries or not, but got blocked on Initializing Solana not going away for MWP. Still need to verify this.

.yarn/patches/@solana-wallet-adapter-react-npm-0.15.39-86277fdcc0.patch should be deleted though

@wenfix wenfix closed this Jun 25, 2026
@wenfix

wenfix commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

We've gotten mixed signals from the Solana Foundation about the direction we should take this so we're gonna wait until a clear signal.

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