Migration guide 🚧
This page is under construction.
0.1.0
Config
- In general,
ponder.config.ts
now has much more static validation using TypeScript. This includes network names incontracts
, ABI event names for the contractevent
andfactory
options, and more. - The
networks
andcontracts
fields were changed from an array to an object. The network or contract name is now specified using an object property name. Thename
field for both networks and contracts was removed. - The
filter
field has been removed. To index all events matching a specific signature across all contract addresses, add a contract that specifies theevent
field without specifying anaddress
. - The
abi
field now requires an ABI object that has been asserted as const (cannot use a file path). See the ABIType documentation for more details.
Schema
- The schema definition API was rebuilt from scratch to use a TypeScript file
ponder.schema.ts
instead ofschema.graphql
. Theponder.schema.ts
file has static validation using TypeScript. - Note that it is possible to convert a
schema.graphql
file into aponder.schema.ts
file without introducing any breaking changes to the autogenerated GraphQL API schema. - Please see the
design your schema
guide for an overview of the new API.
Indexing functions
event.params
was renamed toevent.args
to better match Ethereum terminology norms.- If a contract uses the
event
option, only the specified events will be available for registration. Before, all events in the ABI were available. context.models
was renamed tocontext.db
- Now, a read-only Viem client is available at
context.client
. This client uses the same transport you specify inponder.config.ts
, except all method are cached to speed up subsequent indexing. - The
context.contracts
object now contains the contract addresses and ABIs specified inponder.config.ts
, typed as strictly as possible. (You should not need to copy addresses and ABIs around anymore, just usecontext.contracts
). - A new
context.network
object was added which contains the network name and chain ID that the current event is from.
Multi-chain indexing
- The contract
network
fieldponder.config.ts
was upgraded to support an object of network-specific overrides. This is a much better DX for indexing the same contract on multiple chains. - The options that you can specify per-network are
address
,event
,startBlock
,endBlock
, andfactory
. - When you add a contract on multiple networks, Ponder will sync the contract on each network you specify. Any indexing functions you register for the contract will now process events across all networks.
- The
context.network
object is typed according to the networks that the current contract runs on, so you can write network-specific logic likeif (context.network.name === “optimism”) { …
Vite
- Ponder now uses Vite to transform and load your code. This means you can import files from outside the project root directory.
- Vite’s module graph makes it possible to invalidate project files granularly, only reloading the specific parts of your app that need to be updated when a specific file changes. For example, if you save a change to one of your ABI files,
ponder.config.ts
will reload because it imports that file, but your schema will not reload. - This update also unblocks a path towards concurrent indexing and granular caching of indexing function results.