Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/0xSplits/openindex/blob/main/.github/openindex-dark.svg">
<img alt="OpenIndex logo" src="https://github.com/0xSplits/openindex/blob/main/.github/openindex-light.svg" width="auto" height="200">
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/0xSplits/openindex/main/.github/openindex-dark.svg">
<img alt="OpenIndex logo" src="https://raw.githubusercontent.com/0xSplits/openindex/main/.github/openindex-light.svg" width="auto" height="200">
</picture>
</p>

Expand Down
14 changes: 0 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,6 @@
}
}
},
"pnpm": {
"overrides": {
"@microsoft/api-extractor>typescript": "^5.5.4",
"hono@<4.2.7": ">=4.2.7",
"ws@>=8.0.0 <8.17.1": ">=8.17.1",
"hono@<4.5.8": ">=4.5.8",
"micromatch@<4.0.8": ">=4.0.8",
"webpack@>=5.0.0-alpha.0 <5.94.0": ">=5.94.0",
"rollup@>=4.0.0 <4.22.4": ">=4.22.4",
"hono@<4.6.5": ">=4.6.5",
"es-module-lexer": "1.7.0"
},
"patchedDependencies": {}
},
"size-limit": [
{
"name": "import * from 'openindex'",
Expand Down
10 changes: 10 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,13 @@ packages:
- site
- src
trustPolicy: no-downgrade
overrides:
"@microsoft/api-extractor>typescript": "^5.5.4"
"hono@<4.2.7": ">=4.2.7"
"ws@>=8.0.0 <8.17.1": ">=8.17.1"
"hono@<4.5.8": ">=4.5.8"
"micromatch@<4.0.8": ">=4.0.8"
"webpack@>=5.0.0-alpha.0 <5.94.0": ">=5.94.0"
"rollup@>=4.0.0 <4.22.4": ">=4.22.4"
"hono@<4.6.5": ">=4.6.5"
"es-module-lexer": "1.7.0"
11 changes: 2 additions & 9 deletions site/vocs.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { defineConfig } from 'vocs/config'
import pkg from '../src/package.json'
import { sidebar, topNav } from './config-generated'
import { sidebar } from './config-generated'

export default defineConfig({
baseUrl:
Expand Down Expand Up @@ -41,15 +41,9 @@ export default defineConfig({
{
text: 'API Reference',
collapsed: true,
items: [
{
text: 'Core',
link: '/api',
},
],
items: sidebar['/api'].items,
},
],
...sidebar,
},
socials: [
{
Expand All @@ -62,7 +56,6 @@ export default defineConfig({
},
],
topNav: [
...topNav,
{
text: pkg.version,
items: [
Expand Down
57 changes: 49 additions & 8 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/0xSplits/openindex/blob/main/.github/openindex-dark.svg">
<img alt="OpenIndex logo" src="https://github.com/0xSplits/openindex/blob/main/.github/openindex-light.svg" width="auto" height="200">
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/0xSplits/openindex/main/.github/openindex-dark.svg">
<img alt="OpenIndex logo" src="https://raw.githubusercontent.com/0xSplits/openindex/main/.github/openindex-light.svg" width="auto" height="200">
</picture>
</p>

<p align="center">
Easier indexing for Ethereum.
<p>

<p align="center">
<a href="https://www.npmjs.com/package/openindex">
<picture>
Expand All @@ -30,13 +34,50 @@

## Overview

OpenIndex is a TypeScript library. <!-- TODO: describe what OpenIndex actually does -->
OpenIndex is a lightweight, type-safe EVM indexer built on [viem](https://viem.sh). It turns a viem `PublicClient` into a live event indexer: you describe the events you care about with an ABI, write a handler, and OpenIndex watches new blocks and dispatches matching logs to your handler in real time.

Handlers are imperative, so you keep full control over event filters, transforms, and storage — index into a database, a queue, memory, or anywhere else you like.

## Install

```bash
pnpm add openindex viem
```

```bash
npm install openindex viem
```

```bash
bun add openindex viem
```

## Example

Index `Transfer` events on Ethereum mainnet:

```ts
import { createPublicClient, http, parseAbiItem } from 'viem'
import { mainnet } from 'viem/chains'
import { EventHandler, Indexer } from 'openindex'

const client = createPublicClient({ chain: mainnet, transport: http() })

const transfer = parseAbiItem(
'event Transfer(address indexed from, address indexed to, uint256 value)',
)

const handler = EventHandler.from([transfer], (logs) => {
for (const log of logs) {
console.log(log.args.from, '→', log.args.to, log.args.value)
}
})

## Documentation
Indexer.start(client, [handler])
```

[Head to the documentation](https://openindex.dev) to read and learn more about OpenIndex.
The `logs` passed to your handler are fully typed from the ABI you provide.

## Community
## License

- Follow [@0xSplits](https://x.com/0xSplits) on X for project updates
- Join the [discussions on GitHub](https://github.com/0xSplits/openindex/discussions)
[MIT](https://github.com/0xSplits/openindex/blob/main/LICENSE) License
Loading