+
Skip to content

Please make a migration docs. #402

Open
@dellwatson

Description

@dellwatson

Motivation

As a developer migrating from web3.js v1 to @solana/kit (v2), I've found a significant documentation issue regarding with the migration, some features are unknown here now in v2. Such as, there's no clear guidance on how to migrate code that uses PublicKey.findProgramAddressSync(), which is one of the most common operations when interacting with Solana programs.

The current documentation extensively covers RPC calls, transactions, and keys, but does not adequately address this critical function for deriving PDAs in client-side code. Without this, migration efforts are stalled as developers cannot determine the equivalent API in the new library.

Example use case

In web3.js v1:

import { PublicKey } from '@solana/web3.js';

const PROGRAM_ID = new PublicKey('2CDCG8yMM1wUJgS74HgZn8BvRjnK3rruiie77ErvrSx2');
const SEED = 'player-state';

// Derive a PDA
const [playerStatePDA, bump] = PublicKey.findProgramAddressSync(
  [Buffer.from(SEED)],
  PROGRAM_ID
);

console.log(`PDA: ${playerStatePDA.toBase58()}, Bump: ${bump}`);

Desired @solana/kit equivalent:

import { /* what do I import? */ } from '@solana/kit';

const PROGRAM_ID = address('2CDCG8yMM1wUJgS74HgZn8BvRjnK3rruiie77ErvrSx2');
const SEED = 'player-state';

// How do I derive the same PDA in @solana/kit?
const [playerStatePDA, bump] = /* what function replaces findProgramAddressSync? */(
  [Buffer.from(SEED)],
  PROGRAM_ID
);

console.log(`PDA: ${playerStatePDA}, Bump: ${bump}`);

Details

The documentation should:

  1. Provide the equivalent function to PublicKey.findProgramAddressSync() in @solana/kit
  2. Explain any differences in behavior or usage
  3. Show examples of common PDA derivation patterns
  4. Document the types and return values
  5. Explain if there are both synchronous and asynchronous options

If there are program-specific helpers (like the findAddressLookupTablePda seen in the docs), the documentation should clarify when to use these vs. a general-purpose PDA finder.

This is especially important as PDAs are fundamental to Solana's programming model, and their derivation is a prerequisite for almost any interaction with on-chain programs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载