Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pinax-network/firehose-js
Firehose JS SDK
https://github.com/pinax-network/firehose-js
Last synced: 4 days ago
JSON representation
Firehose JS SDK
- Host: GitHub
- URL: https://github.com/pinax-network/firehose-js
- Owner: pinax-network
- License: mit
- Created: 2025-01-08T20:55:50.000Z (16 days ago)
- Default Branch: main
- Last Pushed: 2025-01-08T20:57:44.000Z (16 days ago)
- Last Synced: 2025-01-08T22:08:08.428Z (16 days ago)
- Language: TypeScript
- Size: 25.4 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ⚠️ ⁉️ ACTIVE DEVELOPMENT ⚠️ ⁉️
# Firehose JS SDK
## Quickstart
> Get Firehose API Key from https://pinax.network
```js
import { Blocks } from "@pinax/firehose";// auth API token
// https://app.streamingfast.io/
// https://app.pinax.network/
if (!process.env.SUBSTREAMS_API_KEY) {
throw new Error("SUBSTREAMS_API_KEY is require");
}// Create client
const client = new firehose.Stream(
"solana.firehose.pinax.network:443",
grpc.credentials.createSsl(),
{
"grpc.keepalive_time_ms": 30000,
"grpc.max_receive_message_length": 50241867,
}
);// gRPC Metadata
const metadata = new grpc.Metadata();
metadata.add("X-User-Agent", "@pinax/firehose");
metadata.add("X-Api-Key", process.env.SUBSTREAMS_API_KEY);// NodeJS Events
const request = { start_block_num: -100 };
const emitter = new client.Blocks(request, metadata);// Stream Blocks
emitter.on("data", (response) => {
console.dir(response);
});// End of Stream
emitter.on("close", (error) => {
if (error) {
console.error(error);
}
console.timeEnd("🆗 close");
});
```