create-ponder 0.16.3 → 0.16.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -32
- package/dist/index.js +6 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# create-ponder
|
|
2
2
|
|
|
3
3
|
[![CI status][ci-badge]][ci-url]
|
|
4
4
|
[![Version][version-badge]][version-url]
|
|
5
5
|
[![Telegram chat][tg-badge]][tg-url]
|
|
6
6
|
[![License][license-badge]][license-url]
|
|
7
7
|
|
|
8
|
-
Ponder is an open-source framework for
|
|
8
|
+
Ponder is an open-source TypeScript framework for EVM data indexing.
|
|
9
9
|
|
|
10
10
|
## Documentation
|
|
11
11
|
|
|
@@ -17,47 +17,45 @@ Join [Ponder's telegram chat](https://t.me/pondersh) for support, feedback, and
|
|
|
17
17
|
|
|
18
18
|
## Features
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
✅ Supports all Ethereum-based blockchains, including test nodes like [Anvil](https://book.getfoundry.sh/anvil)<br/>
|
|
26
|
-
✅ Index events from multiple chains in the same app<br/>
|
|
27
|
-
✅ Reconciles chain reorganization<br/>
|
|
28
|
-
✅ Factory contracts<br/>
|
|
29
|
-
✅ Process transactions calls (in addition to logs)<br/>
|
|
30
|
-
🏗️ Run effects (e.g. send an API request) in indexing code<br/>
|
|
20
|
+
* Index any contract or account on any EVM-compatible chain
|
|
21
|
+
* Write indexed data to Postgres
|
|
22
|
+
* Query indexed data over HTTP using GraphQL or SQL
|
|
23
|
+
* Build rapidly with a powerful local development server
|
|
24
|
+
* Deploy anywhere that runs Node.js or Bun
|
|
31
25
|
|
|
32
26
|
## Quickstart
|
|
33
27
|
|
|
34
28
|
### 1. Run `create-ponder`
|
|
35
29
|
|
|
36
|
-
You will be asked for a project name, and if you are using a [template](https://ponder.sh/docs/api-reference/create-ponder#templates) (recommended).
|
|
30
|
+
You will be asked for a project name, and if you are using a [template](https://ponder.sh/docs/api-reference/create-ponder#templates) (recommended).
|
|
31
|
+
|
|
32
|
+
After the prompts, the CLI will create a project directory, install dependencies, and initialize a git repository.
|
|
37
33
|
|
|
38
34
|
```bash
|
|
39
|
-
|
|
35
|
+
bun create ponder
|
|
40
36
|
# or
|
|
41
37
|
pnpm create ponder
|
|
42
38
|
# or
|
|
43
|
-
|
|
39
|
+
npm init ponder@latest
|
|
44
40
|
```
|
|
45
41
|
|
|
46
42
|
### 2. Start the development server
|
|
47
43
|
|
|
48
|
-
|
|
44
|
+
Ponder has a development server that automatically reloads when you save changes in any project file. It also prints `console.log` statements and errors encountered while running your code.
|
|
45
|
+
|
|
46
|
+
First, `cd` into your project directory, then start the server.
|
|
49
47
|
|
|
50
48
|
```bash
|
|
51
|
-
|
|
49
|
+
bun dev
|
|
52
50
|
# or
|
|
53
51
|
pnpm dev
|
|
54
52
|
# or
|
|
55
|
-
|
|
53
|
+
npm run dev
|
|
56
54
|
```
|
|
57
55
|
|
|
58
|
-
### 3.
|
|
56
|
+
### 3. Specify contracts & chains
|
|
59
57
|
|
|
60
|
-
Ponder fetches event logs for the contracts
|
|
58
|
+
Ponder fetches event logs for the contracts in `ponder.config.ts`, and passes those events to the indexing functions you write.
|
|
61
59
|
|
|
62
60
|
```ts
|
|
63
61
|
// ponder.config.ts
|
|
@@ -85,7 +83,7 @@ export default createConfig({
|
|
|
85
83
|
|
|
86
84
|
### 4. Define your schema
|
|
87
85
|
|
|
88
|
-
The `ponder.schema.ts` file
|
|
86
|
+
The `ponder.schema.ts` file specifies the database schema, which should match the shape of your application's data model.
|
|
89
87
|
|
|
90
88
|
```ts
|
|
91
89
|
// ponder.schema.ts
|
|
@@ -101,7 +99,7 @@ export const ensName = onchainTable("ens_name", (t) => ({
|
|
|
101
99
|
|
|
102
100
|
### 5. Write indexing functions
|
|
103
101
|
|
|
104
|
-
Files in the `src/` directory contain **indexing functions**, which are TypeScript functions that process a contract event. The purpose of these functions is to
|
|
102
|
+
Files in the `src/` directory contain **indexing functions**, which are TypeScript functions that process a contract event. The purpose of these functions is to write indexed data to the database.
|
|
105
103
|
|
|
106
104
|
```ts
|
|
107
105
|
// src/BaseRegistrar.ts
|
|
@@ -120,11 +118,9 @@ ponder.on("BaseRegistrar:NameRegistered", async ({ event, context }) => {
|
|
|
120
118
|
});
|
|
121
119
|
```
|
|
122
120
|
|
|
123
|
-
See the [create & update records](https://ponder.sh/docs/indexing/write) docs for a detailed guide on writing indexing functions.
|
|
124
|
-
|
|
125
121
|
### 6. Query the GraphQL API
|
|
126
122
|
|
|
127
|
-
Ponder automatically generates a
|
|
123
|
+
Ponder automatically generates a GraphQL API based on your `ponder.schema.ts` file. The API serves data that you inserted in your indexing functions.
|
|
128
124
|
|
|
129
125
|
```ts
|
|
130
126
|
{
|
|
@@ -165,12 +161,12 @@ If you're interested in contributing to Ponder, please read the [contribution gu
|
|
|
165
161
|
|
|
166
162
|
## Packages
|
|
167
163
|
|
|
168
|
-
- `ponder`
|
|
169
|
-
- `@ponder/client`
|
|
170
|
-
- `@ponder/react`
|
|
171
|
-
- `@ponder/utils`
|
|
172
|
-
- `create-ponder`
|
|
173
|
-
- `eslint-config-ponder`
|
|
164
|
+
- [`ponder`](https://www.npmjs.com/package/ponder)
|
|
165
|
+
- [`@ponder/client`](https://www.npmjs.com/package/@ponder/client)
|
|
166
|
+
- [`@ponder/react`](https://www.npmjs.com/package/@ponder/react)
|
|
167
|
+
- [`@ponder/utils`](https://www.npmjs.com/package/@ponder/utils)
|
|
168
|
+
- [`create-ponder`](https://www.npmjs.com/package/create-ponder)
|
|
169
|
+
- [`eslint-config-ponder`](https://www.npmjs.com/package/eslint-config-ponder)
|
|
174
170
|
|
|
175
171
|
## About
|
|
176
172
|
|
package/dist/index.js
CHANGED
|
@@ -16,16 +16,19 @@ import { default as prompts } from "prompts";
|
|
|
16
16
|
// package.json
|
|
17
17
|
var package_default = {
|
|
18
18
|
name: "create-ponder",
|
|
19
|
-
version: "0.16.
|
|
19
|
+
version: "0.16.4",
|
|
20
20
|
type: "module",
|
|
21
|
-
description: "
|
|
21
|
+
description: "CLI tool to create Ponder projects",
|
|
22
22
|
license: "MIT",
|
|
23
23
|
repository: {
|
|
24
24
|
type: "git",
|
|
25
25
|
url: "https://github.com/ponder-sh/ponder",
|
|
26
26
|
directory: "packages/create-ponder"
|
|
27
27
|
},
|
|
28
|
-
files: [
|
|
28
|
+
files: [
|
|
29
|
+
"dist",
|
|
30
|
+
"templates"
|
|
31
|
+
],
|
|
29
32
|
bin: {
|
|
30
33
|
"create-ponder": "./dist/index.js"
|
|
31
34
|
},
|
package/package.json
CHANGED