Skip to main content
Use @thru/thru-sdk when you want a single TypeScript client for querying Thru data, sending transactions, and working with the SDK’s domain models.

Install

npm install @thru/thru-sdk

Entry Points

ImportWhat it provides
@thru/thru-sdkGrouped modules for accounts, blocks, chain, consensus, events, height, keys, node, proofs, slots, streaming, and transactions, plus the core domain classes and helpers.
@thru/thru-sdk/clientcreateThruClient, ThruClientConfig, and the bound Thru client interface.

Start Here

Create a client with your RPC base URL, then call the grouped helpers on the returned thru object:
import { createThruClient } from "@thru/thru-sdk/client";

const thru = createThruClient({
  baseUrl: "https://grpc-web.alphanet.thruput.org",
});

const chainId = await thru.chain.getChainId();
const latestHeight = await thru.blocks.getBlockHeight();
const latestBlock = await thru.blocks.get({ slot: latestHeight.finalized });
The bound client exposes the same shape across the major workflows:
  • accounts.get, accounts.list, accounts.create, and accounts.stream
  • blocks.get, blocks.getRaw, blocks.list, blocks.getBlockHeight, and blocks.stream
  • transactions.get, transactions.list, transactions.build, transactions.buildAndSign, transactions.send, transactions.sendAndTrack, transactions.track, and transactions.stream
  • events.get, events.list, and events.stream
  • slots.getMetrics, slots.listMetrics, and slots.streamMetrics
  • proofs.generate and proofs.getStateRoots
  • node.getPubkey, node.getRecords, and node.streamRecords
  • chain.getChainInfo and chain.getChainId
  • version.get
  • consensus helpers for version-context selection and status formatting

When to use it

Use @thru/thru-sdk as your default app-facing SDK when you want one package for reads, writes, streams, and domain models. Use @thru/thru-sdk/client when you want the bound client setup flow. Reach for @thru/proto, @thru/token-program, or @thru/bridge-sdk only when you need a lower-level message, token, or bridge-specific layer.

Core Models

The root package also exports the domain types you usually want to keep in your application layer:
  • Account
  • Block
  • ChainEvent
  • Transaction
  • TransactionStatusSnapshot
  • StateProof
  • HeightSnapshot
  • VersionInfo
  • Pubkey
  • Signature
  • TransactionBuilder

Common Helpers

The root package includes grouped helper utilities for the most common SDK tasks:
  • deriveAddress and deriveProgramAddress
  • collectStream, firstStreamValue, and forEachStreamValue
  • accounts, blocks, events, transactions, and the other namespace modules for direct function-level access