Skip to content

Conversation

@GuiBibeau
Copy link
Collaborator

@GuiBibeau GuiBibeau commented Jan 5, 2026

Summary

Complete drop-in replacement for @solana/web3.js Connection class, powered by @solana/client and @solana/kit.

Key Features

  • Full API Compatibility: 73 methods (59 async RPC + 8 subscription + 6 remove listener)
  • Migration Path: connection.client getter provides access to SolanaClient for gradual adoption of @solana/client features
  • Automatic Type Conversion: bigint-to-number conversion for seamless web3.js compatibility
  • WebSocket Subscriptions: Full support for all subscription types (onAccountChange, onProgramAccountChange, onSignature, onSlotChange, etc.)

API Coverage

  • Core queries: getBalance, getAccountInfo, getMultipleAccountsInfo, getSlot, getBlockHeight
  • Transactions: sendTransaction, sendRawTransaction, confirmTransaction, simulateTransaction
  • Token operations: getTokenAccountsByOwner, getTokenAccountBalance, getTokenSupply
  • Block & history: getBlock, getBlockTime, getTransaction, getSignaturesForAddress
  • Parsed methods: getParsedAccountInfo, getParsedTransaction, getParsedBlock
  • Cluster info: getVersion, getClusterNodes, getEpochInfo, getGenesisHash

Migration to @solana/client

import { Connection } from "@solana/web3-compat";

const connection = new Connection("https://api.devnet.solana.com");

// Get the SolanaClient instance for modern features
const client = connection.client;
await client.actions.connectWallet("phantom");

Testing

  • 277 unit tests passing
  • 24 devnet integration tests with pre-funded account
  • CI workflow for devnet tests (TEST_PRIVATE_KEY secret required)

Changes in This PR

  • Implement full Connection class with all 73 methods
  • Refactor to use SolanaClient instead of SolanaRpcClient
  • Add connection.client getter for migration path
  • Fix confirmTransaction to accept object strategy and poll for confirmation
  • Fix getSignatureStatuses parameter issue
  • Add devnet integration tests with CI workflow
  • Revamp README with example-focused documentation

GuiBibeau and others added 5 commits January 5, 2026 23:20
Transform @solana/web3-compat into a complete drop-in replacement for
@solana/web3.js Connection class, powered by @solana/client and @solana/kit.

Implementation includes:
- 73 total methods (59 async RPC + 8 subscription + 6 remove listener)
- Phase 1: Core high-frequency methods (getMultipleAccountsInfo,
  getTokenAccountsByOwner, sendTransaction, getTransaction, etc.)
- Phase 2: Block and transaction history (getBlock, getBlockTime,
  getBlockHeight, isBlockhashValid, getFeeForMessage, etc.)
- Phase 3: Parsed methods with jsonParsed encoding (getParsedAccountInfo,
  getParsedTransaction, getParsedBlock, etc.)
- Phase 4-7: Slot, epoch, cluster, stake, inflation, and misc methods
- WebSocket subscriptions (onAccountChange, onProgramAccountChange,
  onSignature, onSlotChange, onRootChange, onLogs, etc.)

All methods follow strict web3.js API compatibility with automatic
bigint-to-number conversion for seamless migration.

Tests: 253 passing (12 new tests for Phase 3 and WebSocket subscriptions)
- Refactor Connection to use SolanaClient instead of SolanaRpcClient
- Add `connection.client` getter for gradual migration to @solana/client
- Fix confirmTransaction to accept object strategy and poll for confirmation
- Fix getSignatureStatuses (commitment param not supported by RPC)
- Revamp README with example-focused documentation
- Add devnet integration tests with CI workflow
- Remove experimental language from READMEs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Base58 encoded blockhashes and signatures have variable length
(43-44 chars for hashes, 86-88 for signatures). Updated tests
to use range checks instead of exact length assertions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Devnet integration tests are run in a dedicated CI job with TEST_PRIVATE_KEY.
E2E tests require Playwright which is not installed in the base test environment.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@catmcgee
Copy link
Contributor

catmcgee commented Jan 8, 2026

tested on a few examples and works well! worth having more eyes for testing complex projects

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