A lightweight JavaScript/TypeScript SDK (v4.6.9+, semver) that connects to Blocknative's Ethereum backend via WebSocket to provide real-time transaction monitoring and address notifications. It supports both Node.js and browser environments, requires an API key, and ships with TypeScript types. Key differentiators: uses Blocknative's prediction engine for early tx status (pending, confirmed, failed), event-based architecture (txPool, txConfirmed, all), and an account watcher. Alternatives like ethers.js or web3.js only provide lower-level event polling.
npm install bnc-sdkNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initializes Blocknative SDK with WebSocket, monitors a transaction hash for pool and confirmation events.
Use import BlocknativeSdk from 'bnc-sdk' (ESM) or switch to dynamic import if needed.
Install 'ws' and pass it as 'ws' option: { ws: WebSocket }Always provide a valid Blocknative API key in options.dappId.
Remove transactionHandlers and attach event listeners via emitter.on('txPool', ...) etc.Install 'ws' and pass it: import WebSocket from 'ws'; { ws: WebSocket }Provide a valid Blocknative API key: { dappId: 'your-key' }Use import syntax or dynamic import: const sdk = await import('bnc-sdk')