Pure TypeScript Solana library. Zero-dependency drop-in replacement for @solana/web3.js v1.
Perry-compatible. No native modules, no WebAssembly, no Node-specific APIs in the core library.
@solana/web3.js@1 pulls in 17 MB and 15+ transitive dependencies including native modules (jayson, rpc-websockets, bufferutil) that break alternative TypeScript compilers and runtimes. solkit replaces it with ~2,300 lines of self-contained TypeScript and zero runtime dependencies.
@solana/web3.js |
@skelpo/solkit |
|
|---|---|---|
Size in node_modules |
~17 MB | ~100 KB |
| Dependencies | 15+ (including native) | 0 |
| Perry-compatible | No | Yes |
npm install @skelpo/solkitimport {
Connection,
Keypair,
PublicKey,
Transaction,
SystemProgram,
LAMPORTS_PER_SOL,
} from '@skelpo/solkit';
const connection = new Connection('https://api.mainnet-beta.solana.com/');
const keypair = Keypair.generate();
const tx = new Transaction();
tx.recentBlockhash = (await connection.getLatestBlockhash()).blockhash;
tx.add(SystemProgram.transfer({
fromPubkey: keypair.publicKey,
toPubkey: new PublicKey('...'),
lamports: LAMPORTS_PER_SOL,
}));
tx.sign(keypair);
await connection.sendRawTransaction(tx.serialize());Replace the import path. The API surface is identical for all supported features:
- import { Connection, Keypair, PublicKey } from '@solana/web3.js';
+ import { Connection, Keypair, PublicKey } from '@skelpo/solkit';No other code changes required.
| Class | Description |
|---|---|
PublicKey |
32-byte Solana address. Construct from base58 string, Uint8Array, or number[]. Methods: toBase58(), toBuffer(), toBytes(), equals(), toString(), toJSON(). Static: findProgramAddressSync(), findProgramAddress(), createProgramAddressSync(). |
Keypair |
Ed25519 keypair. Static: generate(), fromSecretKey(Uint8Array), fromSeed(Uint8Array). Properties: publicKey, secretKey. |
Transaction |
Legacy transaction. Methods: add(), sign(), partialSign(), serialize(), compileMessage(). Static: from(). |
VersionedTransaction |
Version-aware transaction (legacy + V0). Methods: sign(), serialize(). Static: deserialize(). |
Message |
Legacy transaction message. Methods: serialize(). Static: from(), compile(). |
MessageV0 |
V0 transaction message with address table lookups. Methods: serialize(), getAccountKeys(). Static: deserialize(). |
TransactionInstruction |
Single instruction with keys, programId, and data. |
Connection |
JSON-RPC + WebSocket client. See methods below. |
Queries:
getAccountInfo, getMultipleAccountsInfo, getBalance, getLatestBlockhash, getSlot, getBlockHeight, getVersion, getTransaction, getSignatureStatus, getSignatureStatuses, getTokenAccountBalance, getFeeForMessage, getMinimumBalanceForRentExemption
Transactions:
sendRawTransaction, sendTransaction, confirmTransaction, requestAirdrop
WebSocket Subscriptions:
onAccountChange / removeAccountChangeListener,
onProgramAccountChange / removeProgramAccountChangeListener,
onLogs / removeOnLogsListener
The Connection constructor accepts the same arguments as @solana/web3.js:
new Connection(endpoint: string, commitment?: Commitment)
new Connection(endpoint: string, config?: ConnectionConfig)ConnectionConfig supports commitment, wsEndpoint, httpHeaders, fetch, and WebSocket (pass a custom WebSocket constructor for Node.js environments, e.g. the ws package).
SystemProgram -- transfer(), createAccount(), assign()
SystemProgram.transfer({
fromPubkey: sender.publicKey,
toPubkey: recipient,
lamports: 1_000_000,
});ComputeBudgetProgram -- setComputeUnitPrice(), setComputeUnitLimit()
ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 50_000 });
ComputeBudgetProgram.setComputeUnitLimit({ units: 200_000 });Secp256k1Program -- programId only.
| Constant | Value |
|---|---|
LAMPORTS_PER_SOL |
1_000_000_000 |
TOKEN_PROGRAM_ID |
TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA |
ASSOCIATED_TOKEN_PROGRAM_ID |
ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL |
SYSVAR_CLOCK_PUBKEY |
SysvarC1ock11111111111111111111111111111111 |
SYSVAR_RENT_PUBKEY |
SysvarRent111111111111111111111111111111111 |
SYSVAR_RECENT_BLOCKHASHES_PUBKEY |
SysvarRecentB1ockHashes11111111111111111111 |
SYSVAR_INSTRUCTIONS_PUBKEY |
Sysvar1nstructions1111111111111111111111111 |
clusterApiUrl(cluster) returns the RPC URL for 'mainnet-beta', 'devnet', or 'testnet'.
All types are exported and match @solana/web3.js signatures:
Commitment, ConnectionConfig, AccountInfo<T>, Context, RpcResponseAndContext<T>, SignatureStatus, SignatureResult, TokenAmount, Logs, LogsInfo, TransactionResponse, BlockhashWithExpiryBlockHeight, SendOptions, ConfirmOptions, AccountMeta, MessageHeader, CompiledInstruction, AccountChangeCallback, ProgramAccountChangeCallback, LogsCallback
All cryptographic primitives are pure TypeScript with no external dependencies:
- Ed25519 -- sign, verify, getPublicKey, isOnCurve. Used for transaction signing and PDA validation.
- SHA-256 -- used for PDA derivation (
createProgramAddressSync). - SHA-512 -- used internally by Ed25519.
- Base58 -- Bitcoin/Solana alphabet encode/decode.
npm test75 unit tests covering all modules. The test suite includes byte-for-byte comparison against @solana/web3.js (dev dependency) for PublicKey, Keypair, PDA derivation, transaction serialization, and program instruction encoding.