Releases: ponder-sh/ponder
@ponder/[email protected]
Patch Changes
-
#69
1d6b777
Thanks @0xOlias! - BREAKING Changed the way Ponder expects handlers to be registered.- Source files must be located in
src/
instead ofhandlers/
- Handlers are registered using an
EventEmitter
-like pattern (see below) - Any
*.ts
file insidesrc/
can register event handlers this way. Small projects might only need one file insrc
(e.g.src/app.ts
orsrc/{SourceName}.ts
)
import { ponder } from "../generated"; ponder.on("SourceName:EventName", async ({ event, context }) => { // same handler function body as before! }); ponder.on("SourceName:EventName2", async ({ event, context }) => { // ... }); ponder.on("AnotherSourceName:EventName", async ({ event, context }) => { // ... });
Updated
create-ponder
to use this pattern for newly generated projects - Source files must be located in
-
#71
e90c241
Thanks @0xOlias! - Added two options to Source (in ponder.ts):source.endBlock
andsource.isIndexed
.source.endBlock
is an optional field (default: undefined). If specified, Ponder will only fetch & process events up to the provided block number. Alongsidesource.startBlock
, it can be used to only index a specific block range for a contract.source.isIndexed
is an optional field (default:true
). Iffalse
, Ponder will not fetch any events for this contract, and the user will not be able to define event handlers for events coming from this contract. This contract will still be available oncontext.contracts
for other event handlers in your project. Use this field if you're only using a contract to call it, and don't care about processing events emitted by it. -
#72
df3ec60
Thanks @0xOlias! - BREAKING Changes ponder config naming.- The ponder config file was changed (back) to
ponder.config.ts
. - The
sources
field inponder.config.ts
was changes tocontracts
.
- The ponder config file was changed (back) to
[email protected]
[email protected]
@ponder/[email protected]
Patch Changes
- Updated dependencies [
46c72f0
]:- @ponder/[email protected]
@ponder/[email protected]
[email protected]
[email protected]
@ponder/[email protected]
Patch Changes
- Updated dependencies [
3f358dd
]:- @ponder/[email protected]
@ponder/[email protected]
Patch Changes
-
#57
3f358dd
Thanks @0xOlias! - BREAKING! Updated ponder config to support typescript and to be calledponder.ts
by default.ponder.ts
must export a variable namedconfig
that is of the typeimport { PonderConfig } from "@ponder/core"
. Thedatabase
field in ponder config is now optional. By default, it usesSQLite
with a filename of./.ponder/cache.db
. If the environment variableDATABASE_URL
is detected, it usesPostgres
with that value as theconnectionString
.New sample
ponder.ts
file:// ponder.ts import type { PonderConfig } from "@ponder/core"; import { graphqlPlugin } from "@ponder/graphql"; export const config: PonderConfig = { networks: [ { name: "mainnet", chainId: 1, rpcUrl: process.env.PONDER_RPC_URL_1, }, ], sources: [ { name: "ArtGobblers", network: "mainnet", abi: "./abis/ArtGobblers.json", address: "0x60bb1e2aa1c9acafb4d34f71585d7e959f387769", startBlock: 15863321, }, ], plugins: [graphqlPlugin()], };
The exported value can also be a function, and it can return a Promise:
// ponder.ts import type { PonderConfig } from "@ponder/core"; export const config: PonderConfig = async () => { return { networks: [ /* ... */ ], sources: [ /* ... */ ], }; };
@ponder/[email protected]
Patch Changes
- Updated dependencies [
39b3e00
]:- @ponder/[email protected]