-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
234 additions
and
246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { EvmStream } from "@apibara/evm"; | ||
import { defineIndexer } from "@apibara/indexer"; | ||
import { encodeEventTopics, parseAbi } from "viem"; | ||
|
||
const abi = parseAbi([ | ||
"event Transfer(address indexed from, address indexed to, uint256 value)", | ||
]); | ||
|
||
export default defineIndexer(EvmStream)({ | ||
streamUrl: "https://sepolia.ethereum.a5a.ch", | ||
finality: "accepted", | ||
startingCursor: { | ||
orderKey: 5_000_000n, | ||
}, | ||
filter: { | ||
logs: [ | ||
{ | ||
strict: true, | ||
topics: encodeEventTopics({ | ||
abi, | ||
eventName: "Transfer", | ||
args: { from: null, to: null }, | ||
}) as `0x${string}`[], | ||
}, | ||
], | ||
}, | ||
async transform({ block: { header } }) { | ||
return [header]; | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { EvmStream } from "@apibara/evm"; | ||
import { defineIndexer } from "@apibara/indexer"; | ||
import { encodeEventTopics, parseAbi } from "viem"; | ||
|
||
const abi = parseAbi([ | ||
"event Transfer(address indexed from, address indexed to, uint256 value)", | ||
]); | ||
|
||
// TODO: `runtimeConfig` type should come from the generated types file | ||
export default function indexer(runtimeConfig: unknown) { | ||
console.log("runtimeConfig", runtimeConfig); | ||
return defineIndexer(EvmStream)({ | ||
streamUrl: "https://sepolia.ethereum.a5a.ch", | ||
finality: "accepted", | ||
startingCursor: { | ||
orderKey: 5_000_000n, | ||
}, | ||
filter: { | ||
logs: [ | ||
{ | ||
strict: true, | ||
topics: encodeEventTopics({ | ||
abi, | ||
eventName: "Transfer", | ||
args: { from: null, to: null }, | ||
}) as `0x${string}`[], | ||
}, | ||
], | ||
}, | ||
async transform({ block: { header } }) { | ||
return [header]; | ||
}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { defineBuildConfig } from "unbuild"; | ||
import { fileURLToPath } from "node:url"; | ||
import { resolve } from "pathe"; | ||
|
||
const modules = [ | ||
"cli", | ||
"config", | ||
"core", | ||
"rollup", | ||
"types", | ||
]; | ||
|
||
const srcDir = fileURLToPath(new URL("src", import.meta.url)); | ||
|
||
export default defineBuildConfig({ | ||
entries: [ | ||
{ input: "./src/cli/index.ts" }, | ||
{ input: "./src/config/index.ts" }, | ||
{ input: "./src/core/index.ts" }, | ||
{ input: "./src/rollup/index.ts" }, | ||
], | ||
clean: true, | ||
outDir: "./dist", | ||
declaration: true, | ||
alias: { | ||
...Object.fromEntries( | ||
modules.map((module) => [ | ||
`apibara/${module}`, | ||
resolve(srcDir, `${module}/index.ts`), | ||
]) | ||
), | ||
}, | ||
externals: [ | ||
...modules.map((module) => `apibara/${module}`), | ||
], | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.