Overview
@lazorkit/sdk — the LazorKit client for @solana/kit (web3.js v2). Release candidate, protocol v2.
@lazorkit/sdk is the LazorKit client for Solana Kit (@solana/kit, formerly
@solana/web3.js v2). It has the same high-level client as
@lazorkit/sdk-legacy — LazorKit (aliased LazorKitClient) — with kit
types (Address, Instruction, Rpc) and tree-shakable module functions, and produces
the same transactions.
Release candidate, protocol v2 only
- Current release 1.0.0-rc.6, on both the
latestandnextnpm tags. Its surface is complete for protocol v2 and covered by unit tests and a local-validator suite; three public paths are not covered by tests yet (revokeSession, the one-shottransferOwnership,signWithSecp256r1). - It speaks protocol v2 only, which runs on devnet today; the v2 mainnet program is
not deployed yet. For mainnet today, use
@lazorkit/sdk-legacy0.3.x (protocol v1). See Networks & versions. - v1 wallets are not usable from it, except to move them: it has
findV1WalletsByOwnerandmigrateV1Wallet(Migrating from v1).
Install
npm install @lazorkit/sdk @solana/kit@solana/kit ^6.9 is a peer dependency. No Node polyfills are needed in a browser or React
Native bundle.
Quick start
import { createSolanaRpc, generateKeyPairSigner } from '@solana/kit';
import { LazorKit, PROGRAM_ID_DEVNET, ed25519 } from '@lazorkit/sdk';
const rpc = createSolanaRpc('https://api.devnet.solana.com');
const lk = new LazorKit(rpc, PROGRAM_ID_DEVNET); // the program id is always explicit
const payer = await generateKeyPairSigner(); // your fee payer
const owner = await generateKeyPairSigner(); // an Ed25519 owner
const userSeed = crypto.getRandomValues(new Uint8Array(32));
const { instructions, walletPda, vaultPda } = await lk.createWallet({
payer: payer.address,
userSeed,
owner: { type: 'ed25519', publicKey: owner.address },
});
// send `instructions` with your kit transaction pipeline, signed by payer
// Later: run instructions from the vault, signed by the owner key.
const { instructions: exec } = await lk.execute({
payer: payer.address,
walletPda,
signer: ed25519(owner.address),
instructions: [/* kit Instructions that move funds from vaultPda */],
});
console.log(vaultPda, exec.length);Unlike @lazorkit/sdk-legacy, the constructor does not infer the program id from the RPC
URL: pass PROGRAM_ID_DEVNET (or PROGRAM_ID_MAINNET once v2 is deployed there). The
rpc must support getAccountInfo, getMultipleAccounts, getProgramAccounts,
getSlot and getTokenAccountsByOwner; createSolanaRpc(url) does.
What is the same as @lazorkit/sdk-legacy 1.x
- Every instruction, PDA seed (
lk2:) and account layout; a parity suite checks both SDKs against the same golden vectors the program asserts against. - Passkey signing with
prepare*/finalize*, and the challenge-read optionsminContextSlot(aSlot, i.e.bigint, here) andcommitment— see Passkey signing. - Finding a returning user's wallet:
findOwnPasskeyWallet,createTaggedOwnershipChallenge(rc.6+; withOWNERSHIP_PROOF_DOMAIN),verifyOwnershipProof,pickOwnWallet,resolvePasskeyPublicKey.createOwnershipChallenge()is unchanged (32 random bytes) and deprecated as a passkey challenge; proofs over either form verify. - The message challenge (rc.6+):
signedMessageChallenge,SIGNED_MESSAGE_DOMAIN,SignedMessageInput, the same bytes as sdk-legacy 1.4.0 and the wallet packages. See Passkey signing › Messages and ownership proofs. - Sessions (no actions throws without
unrestricted: true), Delegate policies, deferred execution (executor,feePayer), protocol fees with automaticRegisterPayer. A policy names what may leave the vault: from the v2 program release that adds errors 3037 and 3038 (not deployed yet), nothing it does not name may (What a policy bounds). MinContextSlotNotReachedErrorand the error codes on Errors.
What is different
- Smaller surface: no
parseActions,findAuthoritiesByWalletorgetRecoveryStatusyet, and noERROR_NAMEStable — use@lazorkit/sdk-legacyfor those. - More low-level builders are exported, including
createCloseExpiredSessionIx(close an expired session and keep its rent) andcreateMigrateWalletIx. - Account decoders:
decodeWalletAccount,decodeAuthorityAccount,decodeSessionAccount. - Addresses are kit
Addressstrings, and PDA helpers areasync.
Full reference: the package README.