create-ponder 0.0.93 → 0.0.95
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 +12 -9
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/templates/basic.js +1 -1
- package/package.json +2 -2
- package/src/index.ts +3 -3
- package/src/templates/basic.ts +1 -1
package/README.md
CHANGED
|
@@ -26,14 +26,15 @@ Join [Ponder's telegram chat](https://t.me/ponder_sh) for support, feedback, and
|
|
|
26
26
|
✅ Supports all Ethereum-based blockchains, including test nodes like [Anvil](https://book.getfoundry.sh/anvil)<br/>
|
|
27
27
|
✅ Index events from multiple chains in the same app<br/>
|
|
28
28
|
✅ Reconciles chain reorganization<br/>
|
|
29
|
-
|
|
30
|
-
🏗️
|
|
29
|
+
✅ Factory contracts<br/>
|
|
30
|
+
🏗️ Process transactions calls (in addition to logs)<br/>
|
|
31
|
+
🏗️ Run effects (e.g. send an API request) in indexing code<br/>
|
|
31
32
|
|
|
32
33
|
## Quickstart
|
|
33
34
|
|
|
34
35
|
### 1. Run `create-ponder`
|
|
35
36
|
|
|
36
|
-
You will be asked for a project name, and if you are using
|
|
37
|
+
You will be asked for a project name, and if you are using a [template](https://ponder.sh/api-reference/create-ponder#templates) (recommended). Then, the CLI will create a project directory, install dependencies, and initialize a git repository.
|
|
37
38
|
|
|
38
39
|
```bash
|
|
39
40
|
npm init ponder@latest
|
|
@@ -45,7 +46,7 @@ yarn create ponder
|
|
|
45
46
|
|
|
46
47
|
### 2. Start the development server
|
|
47
48
|
|
|
48
|
-
|
|
49
|
+
Just like Next.js and Vite, 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. First, `cd` into your project directory, then start the server.
|
|
49
50
|
|
|
50
51
|
```bash
|
|
51
52
|
npm run dev
|
|
@@ -57,7 +58,7 @@ yarn dev
|
|
|
57
58
|
|
|
58
59
|
### 3. Add contracts & networks
|
|
59
60
|
|
|
60
|
-
Ponder fetches event logs for the contracts added to `ponder.config.ts`, and passes those events to the
|
|
61
|
+
Ponder fetches event logs for the contracts added to `ponder.config.ts`, and passes those events to the indexing functions you write.
|
|
61
62
|
|
|
62
63
|
```ts
|
|
63
64
|
// ponder.config.ts
|
|
@@ -85,7 +86,7 @@ export const config = {
|
|
|
85
86
|
|
|
86
87
|
### 4. Define your schema
|
|
87
88
|
|
|
88
|
-
The `schema.graphql` file
|
|
89
|
+
The `schema.graphql` file contains a model of your application data. The entity types defined here correspond to database tables.
|
|
89
90
|
|
|
90
91
|
```ts
|
|
91
92
|
// schema.graphql
|
|
@@ -98,9 +99,9 @@ type EnsName @entity {
|
|
|
98
99
|
}
|
|
99
100
|
```
|
|
100
101
|
|
|
101
|
-
### 5. Write
|
|
102
|
+
### 5. Write indexing functions
|
|
102
103
|
|
|
103
|
-
|
|
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 insert data into the entity store.
|
|
104
105
|
|
|
105
106
|
```ts
|
|
106
107
|
// src/BaseRegistrar.ts
|
|
@@ -122,9 +123,11 @@ ponder.on("BaseRegistrar:NameRegistered", async ({ event, context }) => {
|
|
|
122
123
|
});
|
|
123
124
|
```
|
|
124
125
|
|
|
126
|
+
See the [create & update entities](https://ponder.sh/guides/create-update-entities) docs for a detailed guide on writing indexing functions.
|
|
127
|
+
|
|
125
128
|
### 6. Query the GraphQL API
|
|
126
129
|
|
|
127
|
-
Ponder automatically generates a frontend-ready GraphQL API based on your project's `schema.graphql`. The API
|
|
130
|
+
Ponder automatically generates a frontend-ready GraphQL API based on your project's `schema.graphql`. The API serves the data that you inserted in your indexing functions.
|
|
128
131
|
|
|
129
132
|
```ts
|
|
130
133
|
{
|
package/dist/index.js
CHANGED
|
@@ -59,7 +59,7 @@ const run = async (options, overrides = {}) => {
|
|
|
59
59
|
break;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
// Write the
|
|
62
|
+
// Write the indexing function files.
|
|
63
63
|
config.contracts.forEach((contract) => {
|
|
64
64
|
let abi;
|
|
65
65
|
if (Array.isArray(contract.abi)) {
|
|
@@ -77,7 +77,7 @@ const run = async (options, overrides = {}) => {
|
|
|
77
77
|
}
|
|
78
78
|
const abiEvents = abi.filter((item) => item.type === "event");
|
|
79
79
|
const eventNamesToWrite = abiEvents.map((event) => event.name).slice(0, 2);
|
|
80
|
-
const
|
|
80
|
+
const indexingFunctionFileContents = `
|
|
81
81
|
import { ponder } from '@/generated'
|
|
82
82
|
|
|
83
83
|
${eventNamesToWrite
|
|
@@ -87,7 +87,7 @@ const run = async (options, overrides = {}) => {
|
|
|
87
87
|
})`)
|
|
88
88
|
.join("\n")}
|
|
89
89
|
`;
|
|
90
|
-
(0, node_fs_1.writeFileSync)(node_path_1.default.join(rootDir, `./src/${contract.name}.ts`), prettier_1.default.format(
|
|
90
|
+
(0, node_fs_1.writeFileSync)(node_path_1.default.join(rootDir, `./src/${contract.name}.ts`), prettier_1.default.format(indexingFunctionFileContents, { parser: "typescript" }));
|
|
91
91
|
});
|
|
92
92
|
// Write the ponder.config.ts file.
|
|
93
93
|
const finalConfig = `
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AACA,2DAA8C;AAC9C,qCAAiE;AACjE,0DAA6B;AAC7B,4DAA8B;AAC9B,wDAAgC;AAEhC,qCAA6D;AAC7D,mEAAgE;AAChE,uCAA2C;AAC3C,6CAA8C;AAC9C,qDAAsD;AACtD,uDAAwD;AACxD,2DAA4D;AAE5D,8DAA8D;AAC9D,6DAA6D;AAC7D,aAAa;AACb,mEAA8C;AAsBvC,MAAM,GAAG,GAAG,KAAK,EACtB,OAA4B,EAC5B,YAAyC,EAAE,EAC3C,EAAE;IACF,MAAM,aAAa,GAAG,sBAAe,CAAC,OAAO,CAAC;IAC9C,MAAM,EAAE,OAAO,EAAE,GAAG,O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AAC,GAAG,cAAc,WAClE,UAAU,CAAC;IACX,IAAA,6BAAQ,EAAC,UAAU,EAAE;QACnB,GAAG,EAAE,OAAO;QACZ,KAAK,EAAE,SAAS;KACjB,CAAC,CAAC;IACH,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAElC,OAAO,CAAC,GAAG,CACT,oBAAI,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,WAAW,OAAO,CAAC,WAAW,OAAO,OAAO,EAAE,CAC3E,CAAC;AACJ,CAAC,CAAC;AAlOW,QAAA,GAAG,OAkOd"}
|
package/dist/templates/basic.js
CHANGED
|
@@ -14,7 +14,7 @@ const fromBasic = ({ rootDir }) => {
|
|
|
14
14
|
(0, node_fs_1.writeFileSync)(abiAbsolutePath, abiFileContents);
|
|
15
15
|
const schemaGraphqlFileContents = `
|
|
16
16
|
# The entity types defined below map to database tables.
|
|
17
|
-
# The functions you write
|
|
17
|
+
# The functions you write in the \`src/\` directory are responsible for creating and updating records in these tables.
|
|
18
18
|
# Your schema will be more flexible and powerful if it accurately models the logical relationships in your application's domain.
|
|
19
19
|
# Visit the [documentation](https://ponder.sh/guides/design-your-schema) or the [\`examples/\`](https://github.com/0xOlias/ponder/tree/main/examples) directory for further guidance on designing your schema.
|
|
20
20
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-ponder",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.95",
|
|
4
4
|
"description": "A CLI tool to create Ponder apps",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"tsc-alias": "^1.8.2",
|
|
37
37
|
"typescript": "^5.1.3",
|
|
38
38
|
"vitest": "^0.29.2",
|
|
39
|
-
"@ponder/core": "0.0.
|
|
39
|
+
"@ponder/core": "0.0.95"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"build": "pnpm clean && tsc --project tsconfig.build.json && tsc-alias --project tsconfig.build.json",
|
package/src/index.ts
CHANGED
|
@@ -88,7 +88,7 @@ export const run = async (
|
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
// Write the
|
|
91
|
+
// Write the indexing function files.
|
|
92
92
|
config.contracts.forEach((contract) => {
|
|
93
93
|
let abi: Abi;
|
|
94
94
|
if (Array.isArray(contract.abi)) {
|
|
@@ -110,7 +110,7 @@ export const run = async (
|
|
|
110
110
|
|
|
111
111
|
const eventNamesToWrite = abiEvents.map((event) => event.name).slice(0, 2);
|
|
112
112
|
|
|
113
|
-
const
|
|
113
|
+
const indexingFunctionFileContents = `
|
|
114
114
|
import { ponder } from '@/generated'
|
|
115
115
|
|
|
116
116
|
${eventNamesToWrite
|
|
@@ -125,7 +125,7 @@ export const run = async (
|
|
|
125
125
|
|
|
126
126
|
writeFileSync(
|
|
127
127
|
path.join(rootDir, `./src/${contract.name}.ts`),
|
|
128
|
-
prettier.format(
|
|
128
|
+
prettier.format(indexingFunctionFileContents, { parser: "typescript" })
|
|
129
129
|
);
|
|
130
130
|
});
|
|
131
131
|
|
package/src/templates/basic.ts
CHANGED
|
@@ -13,7 +13,7 @@ export const fromBasic = ({ rootDir }: { rootDir: string }) => {
|
|
|
13
13
|
|
|
14
14
|
const schemaGraphqlFileContents = `
|
|
15
15
|
# The entity types defined below map to database tables.
|
|
16
|
-
# The functions you write
|
|
16
|
+
# The functions you write in the \`src/\` directory are responsible for creating and updating records in these tables.
|
|
17
17
|
# Your schema will be more flexible and powerful if it accurately models the logical relationships in your application's domain.
|
|
18
18
|
# Visit the [documentation](https://ponder.sh/guides/design-your-schema) or the [\`examples/\`](https://github.com/0xOlias/ponder/tree/main/examples) directory for further guidance on designing your schema.
|
|
19
19
|
|