Skip to main content
Best practices and recommended patterns for agents using the Helius TypeScript SDK. For installation and getting started, see the overview.

Recommendations for Agents

Use getTransactionsForAddress instead of two-step lookup

getTransactionsForAddress combines signature lookup and transaction fetching into a single call with server-side filtering. It supports time/slot ranges, token account filtering, and pagination.

Use sendSmartTransaction for standard sends

It automatically simulates, estimates compute units, fetches priority fees, and confirms. Do not manually build ComputeBudget instructions — the SDK adds them automatically.

Use Helius Sender for ultra-low latency

For time-sensitive transactions (arbitrage, sniping, liquidations), use sendTransactionWithSender. It routes through Helius’s multi-region infrastructure and Jito.

Use getAssetBatch for multiple assets

When fetching more than one asset, batch them. Do not call getAsset in a loop.

Use webhooks or WebSockets instead of polling

Do not poll getTransactionsForAddress in a loop. Use webhooks for server-to-server notifications or WebSockets for real-time client-side streaming.

Pagination

The SDK uses different pagination strategies depending on the method.

Token/Cursor-Based (RPC V2 Methods)

Page-Based (DAS API)

tokenAccounts Filter

When querying getTransactionsForAddress, the tokenAccounts filter controls whether token account activity is included:

changedSinceSlot — Incremental Account Fetching

changedSinceSlot returns only accounts modified after a given slot. Useful for syncing or indexing workflows. Supported by getProgramAccountsV2, getTokenAccountsByOwnerV2, getAccountInfo, getMultipleAccounts, getProgramAccounts, and getTokenAccountsByOwner.

Common Mistakes

  1. transactionDetails: "full" is not the default — By default, getTransactionsForAddress returns signatures only. Set transactionDetails: "full" to get full transaction data.
  2. Do not add ComputeBudget instructions with sendSmartTransaction — The SDK adds them automatically. Adding your own causes duplicate instructions and transaction failure.
  3. Priority fees are in microlamports per compute unit — Not lamports. Values from getPriorityFeeEstimate are already in the correct unit for SetComputeUnitPrice.
  4. DAS pagination is 1-indexedpage: 1 is the first page, not page: 0.
  5. blockTime is Unix seconds, not milliseconds — Use Math.floor(Date.now() / 1000) when filtering by blockTime.
  6. getAsset hides fungible tokens by default — Pass options: { showFungible: true } to include them.
  7. WebSocket streams need cleanup — Always use an AbortController signal and call helius.ws.close() when done to avoid connection leaks.

Error Handling and Retries

The SDK throws native Error objects with the HTTP status code embedded in the message string (e.g., "API error (429): ..."). There is no .status property on the error object, so status detection requires message parsing.