Skip to content

[feature] Support @solana/kit (web3.js 2.x) types in Solana adapter #5436

@PaulRBerg

Description

@PaulRBerg

What problem does this new feature solve?

The Solana adapter currently uses @solana/web3.js 1.x types (PublicKey class, Transaction/VersionedTransaction classes). Modern Solana libraries are migrating to @solana/kit (web3.js 2.x), which uses:

  • Address - branded string type from @solana/addresses
  • Transaction & TransactionWithLifetime - functional transaction types from @solana/transactions

This creates type incompatibility when integrating AppKit with Effect-TS based Solana libraries or other modern tooling built on the 2.x SDK.

Specific pain points:

  1. publicKey: PublicKey cannot be assigned to publicKey: Address without manual conversion
  2. signTransaction<T extends AnyTransaction> uses legacy types, incompatible with <T extends Transaction & TransactionWithLifetime>
  3. No clean way to bridge between the two type systems

Describe the solution you'd like

Add support for @solana/kit types alongside the existing @solana/web3.js types. Options:

  1. Dual exports: Provide both legacy and modern typed interfaces

    // Existing
    export interface Provider {
      publicKey?: PublicKey;
      signTransaction<T extends AnyTransaction>(tx: T): Promise<T>;
    }
    
    // New
    export interface ModernProvider {
      publicKey: Address | null;
      signTransaction<T extends Transaction & TransactionWithLifetime>(tx: T): Promise<T>;
    }
  2. Conversion utilities: Export helpers to convert between SDK generations

    export function toModernAddress(pk: PublicKey): Address;
    export function toLegacyPublicKey(addr: Address): PublicKey;
  3. Full migration to @solana/kit with backwards compatibility shims

The Solana ecosystem is gradually moving to 2.x - supporting it now would future-proof AppKit for this transition.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions