{"_id":"@anypay/blockbook","_rev":"1-e0cd52a51b24a246373800aa48d335a4","name":"@anypay/blockbook","dist-tags":{"latest":"1.0.0"},"versions":{"0.1.0":{"name":"@anypay/blockbook","version":"0.1.0","_id":"@anypay/blockbook@0.1.0","maintainers":[{"name":"anypayops","email":"ops@anypayx.com"},{"name":"stevenzeiler","email":"me@stevenzeiler.com"}],"bin":{"blockbook":"dist/bin/blockbook.js"},"dist":{"shasum":"57c3a926d2c3ee50f42bb21356f06d59fc751774","tarball":"https://registry.npmjs.org/@anypay/blockbook/-/blockbook-0.1.0.tgz","fileCount":14,"integrity":"sha512-nCPqGJ/W0iSP7V1ssS6SdkG789iZYU/3U8D8VD7oczAZdOBwUFHLjGVrKdSLdFI+T8IUuDV+1glTruab2QntcQ==","signatures":[{"sig":"MEUCICrNUQkjzDBoeAKKHK+kICfGAt9pzCQH19JfxZa0Xa+JAiEA5MgvqlqooRQz6sXOWHJjFEDj1FZhQ7KkZEtbOIBoKPM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":10815},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"fcee2cd02f4c5121a7e8c1d7a717a3945c07030b","private":false,"scripts":{"dev":"ts-node-dev src/bin/blockbook.ts","test":"jest","build":"tsc","start":"ts-node src/bin/blockbook.ts"},"_npmUser":{"name":"anypayops","email":"ops@anypayx.com"},"_npmVersion":"10.9.0","description":"Blockbook websocket client for transaction confirmations","directories":{},"_nodeVersion":"22.12.0","dependencies":{"ws":"^8.16.0","axios":"^1.6.7","dotenv":"^16.4.1","commander":"^12.0.0"},"_hasShrinkwrap":false,"devDependencies":{"ts-node":"^10.9.2","@types/ws":"^8.5.10","typescript":"^5.3.3","@types/node":"^20.11.16","ts-node-dev":"^2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/blockbook_0.1.0_1740302213847_0.9750058952962906","host":"s3://npm-registry-packages-npm-production"}},"1.0.0":{"name":"@anypay/blockbook","private":false,"version":"1.0.0","description":"Blockbook websocket client for transaction confirmations","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc","start":"ts-node src/bin/blockbook.ts","dev":"ts-node-dev src/bin/blockbook.ts","test":"jest"},"dependencies":{"axios":"^1.6.7","commander":"^12.0.0","dotenv":"^16.4.1","ws":"^8.16.0"},"devDependencies":{"@types/node":"^20.11.16","@types/ws":"^8.5.10","ts-node":"^10.9.2","ts-node-dev":"^2.0.0","typescript":"^5.3.3"},"bin":{"blockbook":"dist/bin/blockbook.js"},"_id":"@anypay/blockbook@1.0.0","gitHead":"fcee2cd02f4c5121a7e8c1d7a717a3945c07030b","_nodeVersion":"22.12.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-dByORrMcVZ9Poz0vBVhcWqge/QFZQbDwS3P9ZdlxgiBiC9d5BkrvxkXhakoG4dw6LJxgegG26BYH+Sye9nLY6A==","shasum":"4347f93b5d730deef2bcb826c441dd75f49e0960","tarball":"https://registry.npmjs.org/@anypay/blockbook/-/blockbook-1.0.0.tgz","fileCount":15,"unpackedSize":20824,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHabbkY7Vm9xZGhxMohntnaX/ic1DaclgC5ra9e8Iay/AiEA56GxY34RNQp0Fc8qLDv55lL8F4iw0uH4XqZfpne8S80="}]},"_npmUser":{"name":"anypayops","email":"ops@anypayx.com"},"directories":{},"maintainers":[{"name":"anypayops","email":"ops@anypayx.com"},{"name":"stevenzeiler","email":"me@stevenzeiler.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/blockbook_1.0.0_1740304019413_0.12048780019148153"},"_hasShrinkwrap":false}},"time":{"created":"2025-02-23T09:16:53.780Z","modified":"2025-02-23T09:46:59.812Z","0.1.0":"2025-02-23T09:16:54.019Z","1.0.0":"2025-02-23T09:46:59.603Z"},"description":"Blockbook websocket client for transaction confirmations","maintainers":[{"name":"anypayops","email":"ops@anypayx.com"},{"name":"stevenzeiler","email":"me@stevenzeiler.com"}],"readme":"# @anypay/blockbook\n\nA Node.js client for Blockbook's WebSocket and HTTP APIs. This package provides real-time block notifications and transaction lookups from Blockbook instances.\n\n## Installation\n\n```bash\nnpm install @anypay/blockbook\n```\n\n## Usage\n\n### As a library\n\n```typescript\nimport { BlockbookClient } from '@anypay/blockbook';\n\nconst client = new BlockbookClient({\n  wsUrl: 'wss://btcbook.nownodes.io/wss',\n  httpUrl: 'https://btcbook.nownodes.io/api', \n  apiKey: 'your-api-key'\n});\n\n// Listen for events\nclient.on('connected', () => console.log('Connected to Blockbook'));\nclient.on('disconnected', () => console.log('Disconnected from Blockbook'));\n\n// New block notifications\nclient.on('block', (block) => {\n  console.log('New block:', {\n    hash: block.hash,\n    height: block.height\n  });\n});\n\n// Block with transaction IDs\nclient.on('blockTxids', ({ block, txids }) => {\n  console.log('Block transactions:', {\n    hash: block.hash,\n    height: block.height,\n    txCount: txids.length,\n    txids\n  });\n});\n\n// Handle errors\nclient.on('error', console.error);\n\n// Connect to Blockbook\nawait client.connect();\n\n// Graceful shutdown\nawait client.disconnect();\n```\n\n### As a CLI tool\n\n```bash\n# Using environment variables\nexport BLOCKBOOK_WS_URL=wss://btcbook.nownodes.io/wss\nexport BLOCKBOOK_HTTP_URL=https://btcbook.nownodes.io/api\nexport BLOCKBOOK_API_KEY=your-api-key\n\n# Watch for new blocks\nnpx @anypay/blockbook watch\n\n# Process a specific block\nnpx @anypay/blockbook process-block <block-hash>\n\n# Or using command line arguments\nnpx @anypay/blockbook \\\n  --ws-url=wss://btcbook.nownodes.io/wss \\\n  --http-url=https://btcbook.nownodes.io/api \\\n  --api-key=your-api-key\n```\n\n## Events\n\nThe BlockbookClient emits the following events:\n\n- `connected`: When successfully connected to Blockbook\n- `disconnected`: When disconnected from Blockbook\n- `reconnecting`: When attempting to reconnect\n- `block`: When a new block is detected (includes block hash and height)\n- `blockTxids`: When block transactions are fetched (includes block info and txids)\n- `error`: When an error occurs\n- `raw_message`: Raw messages from the WebSocket connection\n- `websocket_error`: WebSocket-specific errors\n- `reconnection_failed`: When a reconnection attempt fails\n\n## Configuration\n\nThe client requires three configuration parameters:\n\n- `wsUrl`: WebSocket URL for the Blockbook instance\n- `httpUrl`: HTTP URL for the Blockbook API\n- `apiKey`: API key for authentication\n\n## Development\n\n```bash\n# Install dependencies\nnpm install\n\n# Build the package\nnpm run build\n\n# Run tests\nnpm test\n\n# Start in development mode\nnpm run dev\n```\n\n## License\n\nISC\n\n## Contributing\n\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n","readmeFilename":"README.md"}