0.4.14 • Published 21 hours ago

@ponder/core v0.4.14

Weekly downloads
-
License
MIT
Repository
github
Last release
21 hours ago

Ponder

Ponder is an open-source framework for blockchain application backends.

Documentation

Visit ponder.sh for documentation, guides, and an API reference.

Features

 Local development server with hot reloading create-ponder CLI tool to get started from an Etherscan link or Graph Protocol subgraph End-to-end type safety using ABIType and viem Autogenerated GraphQL API Easy to deploy anywhere using Node.js/Docker Compatible with all Ethereum-based blockchains, including test nodes like Anvil Supports multiple chains in the same app 🏗️  Gracefully handles chain reorganizations 🏗️  Handle transactions calls (in addition to logs) 🏗️  Run effects (e.g. send an API request) in event handler code

Quickstart

1. Run create-ponder

You will be asked for a project name, and if you are using an Etherscan or Graph Protocol template (recommended).

npm init ponder@latest
# or
pnpm create ponder
# or
yarn create ponder

2. Start the development server

The development server automatically reloads your app when you save changes in any project file, and prints console.log statements and errors in your code.

npm run dev
# or
pnpm dev
# or
yarn dev

3. Add contracts & networks

Ponder fetches event logs for the contracts added to ponder.config.ts, and passes those events to the handler functions you write.

// ponder.config.ts

export const config = {
  networks: [
    {
      name: "mainnet",
      chainId: 1,
      rpcUrl: "https://eth-mainnet.g.alchemy.com/v2/..."
    }
  ],
  contracts: [
    {
      name: "BaseRegistrar",
      network: "mainnet",
      abi: "./abis/BaseRegistrar.json",
      address: "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85",
      startBlock: 9380410
    }
  ]
};

4. Define your schema

The schema.graphql file specifies the shape of your application's data.

// schema.graphql

type EnsName @entity {
  id: String!
  name: String!
  owner: String!
  registeredAt: Int!
}

5. Write event handlers

Use event handler functions to convert raw blockchain events into application data.

// src/BaseRegistrar.ts

import { ponder } from "@/generated";

ponder.on("BaseRegistrar:NameRegistered", async ({ event, context }) => {
  const { EnsName } = context.entities;
  const { name, owner } = event.params;

  await EnsName.insert(`${name}-${owner}`, {
    name: name,
    owner: owner,
    registeredAt: event.block.timestamp
  });
});

6. Query the GraphQL API

Ponder automatically generates a frontend-ready GraphQL API based on your project's schema.graphql. The API will serve the data that you inserted in your event handler functions.

{
  ensNames(first: 2) {
    name
    owner
    registeredAt
  }
}
{
  "ensNames": [
    {
      "name": "vitalik.eth",
      "owner": "0x0904Dac3347eA47d208F3Fd67402D039a3b99859",
      "registeredAt": 1580345271
    },
    {
      "name": "joe.eth",
      "owner": "0x6109DD117AA5486605FC85e040ab00163a75c662",
      "registeredAt": 1580754710
    }
  ]
}

That's it! Visit ponder.sh for documentation, guides for deploying to production, and an API reference.

Contributing

If you're interested in contributing to Ponder, please read the contribution guide.

Packages

  • @ponder/core
  • create-ponder

About

Ponder is MIT-licensed open-source software.

0.4.14-next.4

21 hours ago

0.4.14-next.3

21 hours ago

0.4.14

2 days ago

0.4.14-next.2

2 days ago

0.4.14-next.1

2 days ago

0.4.13

6 days ago

0.4.11

7 days ago

0.4.12

7 days ago

0.4.10

8 days ago

0.4.9

9 days ago

0.4.8

10 days ago

0.4.7

13 days ago

0.4.6-next.1

13 days ago

0.4.5

15 days ago

0.4.6

15 days ago

0.4.4

16 days ago

0.4.3

18 days ago

0.4.0-next.6

21 days ago

0.4.0-next.5

22 days ago

0.4.1

21 days ago

0.4.0

21 days ago

0.4.2

20 days ago

0.4.0-next.4

24 days ago

0.3.11

27 days ago

0.3.10

28 days ago

0.4.0-next.2

1 month ago

0.4.0-next.3

1 month ago

0.4.0-next.1

1 month ago

0.3.9

1 month ago

0.3.8

1 month ago

0.3.7

1 month ago

0.3.6

1 month ago

0.3.5

1 month ago

0.3.4

2 months ago

0.3.3

2 months ago

0.3.0

2 months ago

0.3.2

2 months ago

0.3.1

2 months ago

0.2.18-debug.4

2 months ago

0.2.18-debug.3

2 months ago

0.2.18-debug.2

2 months ago

0.2.18

2 months ago

0.3.0-next.4

2 months ago

0.2.18-debug.1

2 months ago

0.2.16-debug.1

2 months ago

0.2.17

2 months ago

0.3.0-next.3

2 months ago

0.3.0-next.2

2 months ago

0.2.16

2 months ago

0.3.0-next.1

2 months ago

0.2.15

2 months ago

0.2.14

2 months ago

0.2.13

2 months ago

0.2.12

2 months ago

0.2.11

2 months ago

0.2.10

2 months ago

0.2.9

2 months ago

0.2.8

2 months ago

0.2.7

2 months ago

0.2.6

3 months ago

0.2.5

3 months ago

0.2.3

3 months ago

0.2.4

3 months ago

0.2.1

3 months ago

0.2.2

3 months ago

0.2.0

3 months ago

0.2.0-next.3

3 months ago

0.2.0-next.2

3 months ago

0.1.9

3 months ago

0.1.8

4 months ago

0.1.7

4 months ago

0.1.6

4 months ago

0.1.5

4 months ago

0.1.4

4 months ago

0.2.0-next.1

4 months ago

0.1.3

4 months ago

0.1.2

5 months ago

0.1.1

5 months ago

0.1.0-next.14

5 months ago

0.1.0

5 months ago

0.1.0-next.13

5 months ago

0.1.0-next.12

5 months ago

0.1.0-next.11

5 months ago

0.1.0-next.10

5 months ago

0.1.0-next.9

5 months ago

0.0.84

9 months ago

0.0.85

9 months ago

0.0.86

9 months ago

0.0.87

9 months ago

0.0.88

8 months ago

0.0.89

7 months ago

0.0.80

9 months ago

0.0.81

9 months ago

0.0.82

9 months ago

0.0.83

9 months ago

0.0.73

10 months ago

0.0.74

10 months ago

0.0.75

10 months ago

0.0.76

9 months ago

0.0.77

9 months ago

0.0.81-next.0

9 months ago

0.0.78

9 months ago

0.0.79

9 months ago

0.0.70

10 months ago

0.0.71

10 months ago

0.0.72

10 months ago

0.0.67

10 months ago

0.0.68

10 months ago

0.0.69

10 months ago

0.0.93-next.1

7 months ago

0.0.93-next.0

7 months ago

0.0.93-next.3

7 months ago

0.0.93-next.2

7 months ago

0.0.93-next.5

6 months ago

0.0.93-next.4

6 months ago

0.1.0-next.3

6 months ago

0.1.0-next.4

5 months ago

0.1.0-next.5

5 months ago

0.1.0-next.6

5 months ago

0.1.0-next.7

5 months ago

0.1.0-next.8

5 months ago

0.1.0-next.1

6 months ago

0.1.0-next.2

6 months ago

0.0.95

6 months ago

0.0.90

7 months ago

0.0.91

7 months ago

0.0.92

7 months ago

0.0.93

6 months ago

0.0.94

6 months ago

0.0.66

10 months ago

0.0.62

11 months ago

0.0.63

11 months ago

0.0.64

11 months ago

0.0.65

11 months ago

0.0.60

11 months ago

0.0.61

11 months ago

0.0.59

11 months ago

0.1.0-next.0

11 months ago

0.0.56

12 months ago

0.0.57

11 months ago

0.0.58

11 months ago

0.0.53

1 year ago

0.0.54

1 year ago

0.0.55

1 year ago

0.0.51

1 year ago

0.0.52

1 year ago

0.0.50

1 year ago

0.0.49

1 year ago

0.0.40

1 year ago

0.0.41

1 year ago

0.0.42

1 year ago

0.0.43

1 year ago

0.0.44

1 year ago

0.0.45

1 year ago

0.0.46

1 year ago

0.0.47

1 year ago

0.0.38

1 year ago

0.0.39

1 year ago

0.0.48

1 year ago

0.0.37

1 year ago

0.0.36

1 year ago

0.0.35

1 year ago

0.0.30

1 year ago

0.0.31

1 year ago

0.0.32

1 year ago

0.0.33

1 year ago

0.0.34

1 year ago

0.0.29

1 year ago

0.0.20

1 year ago

0.0.21

1 year ago

0.0.22

1 year ago

0.0.23

1 year ago

0.0.24

1 year ago

0.0.25

1 year ago

0.0.15

1 year ago

0.0.16

1 year ago

0.0.17

1 year ago

0.0.18

1 year ago

0.0.19

1 year ago

0.0.10

1 year ago

0.0.11

1 year ago

0.0.12

1 year ago

0.0.13

1 year ago

0.0.14

1 year ago

0.0.26

1 year ago

0.0.27

1 year ago

0.0.28

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago