@solsdk/jito-ts
v4.2.2
Published
## What is it and why do you need it?
Downloads
211
Maintainers
Readme
jito-ts — TypeScript SDK for Jito Block Engine, Relayer, and Geyser
What is it and why do you need it?
jito-ts is a TypeScript SDK for interacting with the Jito infrastructure on Solana: Block Engine (MEV bundles), Relayer, and Geyser (data streaming). It allows you to:
- Form and send MEV bundles to the Jito Block Engine
- Subscribe to bundle processing results
- Get information about leaders, tip accounts, etc.
- Work with the Geyser API for streaming account, program, and block updates
- Simulate bundle execution via RPC
The SDK is intended for developers who want to integrate Jito infrastructure into their services, bots, research utilities, or analytics tools.
Main components and architecture
- Block Engine SDK — work with bundles, sending, subscribing to results, getting information about leaders and tip accounts.
- Geyser SDK — subscribe to account, program, and block updates (real-time Solana event streaming).
- RPC extension — extended Solana RPC connection class with bundle simulation support.
- Authorization — JWT/Access Token support for protected methods (Block Engine, Geyser).
How to use the SDK
1. Installation and setup
- Requires Node.js 20+, yarn >=1.22
- Install dependencies:
yarn - For gRPC protocol support, proto files must be generated (usually already in the repo, but if changed — use scripts from
scripts/)
2. Authorization
- Access to Block Engine and Geyser requires keys and/or access token.
- For Block Engine: use a Solana Keypair (file or object).
- For Geyser: access token (issued via Jito admin or support).
3. Main usage scenarios
Block Engine
- Forming and sending bundles: use the
Bundleclass to create atomic sets of transactions, send viaSearcherClient.sendBundle. - Getting information: methods
getTipAccounts,getConnectedLeaders,getNextScheduledLeader. - Subscribing to results:
onBundleResult— allows you to receive the result of processed bundles. - Asynchronous result streaming:
bundleResults— async generator for receiving bundle results in for-await-of style (alternative to onBundleResult, convenient for async logic integration).
Geyser
- Subscribe to account updates:
onAccountUpdate - Subscribe to program updates:
onProgramUpdate - Subscribe to new blocks:
onProcessedBlock - Get heartbeat interval:
getHeartbeatIntervalMillis
RPC
- Bundle simulation: use the
JitoRpcConnectionclass and thesimulateBundlemethod to check how a bundle will execute without sending it to the network.
Main methods and classes
Block Engine
SearcherClient.sendBundle(bundle)— send an MEV bundleSearcherClient.getTipAccounts()— get the list of tip accountsSearcherClient.getConnectedLeaders()— get the list of validator leadersSearcherClient.getNextScheduledLeader()— get the next leaderSearcherClient.onBundleResult(cb, errCb)— subscribe to bundle processing resultsSearcherClient.bundleResults(onError)— async generator for streaming bundle results (used with for-await-of)Bundle.addTransactions(...txs)— add transactions to a bundleBundle.addTipTx(keypair, lamports, tipAccount, blockhash)— add a tip transaction
Geyser
GeyserClient.onAccountUpdate(accounts, cb, errCb)— subscribe to account updatesGeyserClient.onProgramUpdate(programs, cb, errCb)— subscribe to program updatesGeyserClient.onProcessedBlock(cb, errCb)— subscribe to new blocksGeyserClient.getHeartbeatIntervalMillis()— get the heartbeat interval
RPC
JitoRpcConnection.simulateBundle(bundle, config?)— simulate bundle execution
How authorization works
- For Block Engine, a Solana Keypair is used: the SDK performs challenge-response and obtains JWT tokens for gRPC.
- For Geyser, an access token is required (issued separately).
- Authorization happens automatically when creating a client if the required parameters are provided.
Where to find examples
src/examples/simple_bundle— example of sending a simple bundle with memo and tipsrc/examples/geyser— example of subscribing to account, program, and block updates via Geyser
Typical scenarios (without code)
- Send an MEV bundle: create a Bundle, add transactions, add a tip, send via SearcherClient.
- Subscribe to results: use onBundleResult or bundleResults to get the bundle processing status.
- Receive account/program/block updates: create a GeyserClient, subscribe to the required events.
- Simulate bundle execution: use JitoRpcConnection and simulateBundle for dry-run checking.
FAQ and tips
- For gRPC to work, you need proper access to Jito endpoints (sometimes VPN or IP whitelisting is required).
- If you encounter authorization errors — check the validity of your keys/tokens.
- For production use, it is recommended to handle stream errors and re-subscribe on connection loss.
- For testing, use devnet endpoints if available.
Links and support
If you want to add your own example or extend the SDK — see the structure in the src/sdk/ folder and follow the existing patterns. Questions and bugs — via Discord or GitHub Issues.
