Client for communicating with the Midnight indexer service.
npm install @midnight-ntwrk/wallet-sdk-indexer-clientThis package provides a GraphQL-based client for interacting with the Midnight indexer service. The indexer aggregates blockchain data and provides efficient access to:
-
Subscriptions for real-time event streaming:
- Shielded transactions (Zswap)
- Unshielded transactions
- Zswap events
- Dust ledger events
-
Queries for fetching blockchain data:
- Block information (height, hash, timestamp)
- Ledger parameters (including cost model)
- Connection management
Subscribe to real-time events from the indexer:
import {
ShieldedTransactions,
UnshieldedTransactions,
ZswapEvents,
DustLedgerEvents,
} from '@midnight-ntwrk/wallet-sdk-indexer-client';
// Subscribe to shielded transaction events
// Subscribe to unshielded transaction events
// Subscribe to Zswap events
// Subscribe to dust ledger eventsQuery blockchain data:
import { BlockHash } from '@midnight-ntwrk/wallet-sdk-indexer-client';
// Query block information including:
// - Block height
// - Block hash
// - Ledger parameters (cost model, etc.)
// - Timestamp- GraphQL queries:
Connect,Disconnect,BlockHash - GraphQL subscriptions:
ShieldedTransactions,UnshieldedTransactions,ZswapEvents,DustLedgerEvents - Generated GraphQL types
Effect.ts-based implementation for functional programming patterns:
import {
Query,
Subscription,
QueryClient,
SubscriptionClient,
HttpQueryClient,
WsSubscriptionClient,
} from '@midnight-ntwrk/wallet-sdk-indexer-client/effect';Apache-2.0