// You can import any library supported by Deno.
import type { Block } from "https://esm.sh/@apibara/indexer/starknet";
import { hash, uint256 } from "https://esm.run/starknet";
import { formatUnits } from "https://esm.run/viem";
import { filter, eventToTableRow } from "./utils";
const DECIMALS = 18;
// Define what data to stream and where to store the result.
export const config = {
network: "starknet",
filter,
sinkType: "postgres",
sinkOptions: {
tableName: "transfers",
},
};
// Transform data using Typescript or Javascript.
export default function decodeTransfersInBlock({ header, events }: Block) {
const { blockNumber, blockHash, timestamp } = header;
return events.map(({ event, receipt }) => {
const { transactionHash } = receipt;
const row = eventToTableRow(event)
return {
...row,
transactionHash
};
});
}
Stream.Transform.Integrate.
Apibara is the fastest platform to build production-grade indexers that connect onchain data to web2 services.
Apibara is open source. View on GitHub.Apibara is blazing fast
Apibara provides Direct Node Access (DNA): your application streams data directly from the node. The DNA approach has lower overhead, resulting in lower latency and higher throughput.
Traditional ETL Pipeline
Data is extracted from the node using JSON-RPC and then goes through multiple steps in an expensive Big Data pipeline before it’s delivered to your application.
Direct Node Access
The node reads data from its database and sends it directly to your application through gRPC, a fast and efficient binary protocol.
Deploy your way
Apibara is open-source so you can run it anywhere, from your local development environment to geo-distributed production clusters.
Command Line Tool
Run Apibara from your terminal, perfect for local development and devnets.
Open Source DNA
Connect Apibara DNA to any network you choose, perfect for appchains and RaaS.
Hosted Service
Deploy managed indexers on Apibara Cloud in just a few clicks.
Build dapps that feel alive
Add real-time onchain data to your application in just a few steps. We automatically mirror onchain data to your application so that you can focus on building the next big thing.
Streaming
Ship more often by spending less time waiting for your indexer to sync. Our efficient streaming protocol can push data up to gigabytes per second.
Latency <0ms
Reduce the latency visible to your users to 0 by implementing optimistic updates. We push data to you before it's confirmed on-chain!
Integrations you love
We integrate with the best developer tools on the market so that you will feel right at home! Do we need your favourite? It's fast to add a new integration with our SDK.