eslint-config-ponder 0.0.87 → 0.0.89
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/CHANGELOG.md +4 -0
- package/README.md +178 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# eslint-config-ponder
|
|
2
|
+
|
|
3
|
+
[![CI status][ci-badge]][ci-url]
|
|
4
|
+
[![Version][version-badge]][version-url]
|
|
5
|
+
|
|
6
|
+
[![Telegram chat][tg-badge]][tg-url]
|
|
7
|
+
[![License][license-badge]][license-url]
|
|
8
|
+
|
|
9
|
+
Ponder is an open-source framework for blockchain application backends.
|
|
10
|
+
|
|
11
|
+
## Documentation
|
|
12
|
+
|
|
13
|
+
Visit [ponder.sh](https://ponder.sh) for documentation, guides, and the API reference.
|
|
14
|
+
|
|
15
|
+
## Support
|
|
16
|
+
|
|
17
|
+
Join [Ponder's telegram chat](https://t.me/ponder_sh) for support, feedback, and general chatter.
|
|
18
|
+
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
✅ Local development server with hot reloading<br/>
|
|
22
|
+
✅ `create-ponder` CLI tool to get started from an Etherscan link or Graph Protocol subgraph<br/>
|
|
23
|
+
✅ End-to-end type safety using [viem](https://viem.sh) and [ABIType](https://github.com/wagmi-dev/abitype)<br/>
|
|
24
|
+
✅ Autogenerated GraphQL API<br/>
|
|
25
|
+
✅ Easy to deploy anywhere using Node.js/Docker<br/>
|
|
26
|
+
✅ Supports all Ethereum-based blockchains, including test nodes like [Anvil](https://book.getfoundry.sh/anvil)<br/>
|
|
27
|
+
✅ Index events from multiple chains in the same app<br/>
|
|
28
|
+
✅ Reconciles chain reorganization<br/>
|
|
29
|
+
🏗️ Transaction call event handlers<br/>
|
|
30
|
+
🏗️ Support for factory contracts like Uniswap V2/V3<br/>
|
|
31
|
+
|
|
32
|
+
## Quickstart
|
|
33
|
+
|
|
34
|
+
### 1. Run `create-ponder`
|
|
35
|
+
|
|
36
|
+
You will be asked for a project name, and if you are using an Etherscan or Graph Protocol [template](https://ponder.sh/api-reference/create-ponder) (recommended).
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm init ponder@latest
|
|
40
|
+
# or
|
|
41
|
+
pnpm create ponder
|
|
42
|
+
# or
|
|
43
|
+
yarn create ponder
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 2. Start the development server
|
|
47
|
+
|
|
48
|
+
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.
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm run dev
|
|
52
|
+
# or
|
|
53
|
+
pnpm dev
|
|
54
|
+
# or
|
|
55
|
+
yarn dev
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 3. Add contracts & networks
|
|
59
|
+
|
|
60
|
+
Ponder fetches event logs for the contracts added to `ponder.config.ts`, and passes those events to the handler functions you write.
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
// ponder.config.ts
|
|
64
|
+
|
|
65
|
+
export const config = {
|
|
66
|
+
networks: [
|
|
67
|
+
{
|
|
68
|
+
name: "mainnet",
|
|
69
|
+
chainId: 1,
|
|
70
|
+
rpcUrl: "https://eth-mainnet.g.alchemy.com/v2/...",
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
contracts: [
|
|
74
|
+
{
|
|
75
|
+
name: "BaseRegistrar",
|
|
76
|
+
network: "mainnet",
|
|
77
|
+
abi: "./abis/BaseRegistrar.json",
|
|
78
|
+
address: "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85",
|
|
79
|
+
startBlock: 9380410,
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
};
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 4. Define your schema
|
|
86
|
+
|
|
87
|
+
The `schema.graphql` file specifies the shape of your application's data.
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
// schema.graphql
|
|
91
|
+
|
|
92
|
+
type EnsName @entity {
|
|
93
|
+
id: String!
|
|
94
|
+
name: String!
|
|
95
|
+
owner: String!
|
|
96
|
+
registeredAt: Int!
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### 5. Write event handlers
|
|
101
|
+
|
|
102
|
+
Use event handler functions to convert raw blockchain events into application data.
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
// src/BaseRegistrar.ts
|
|
106
|
+
|
|
107
|
+
import { ponder } from "@/generated";
|
|
108
|
+
|
|
109
|
+
ponder.on("BaseRegistrar:NameRegistered", async ({ event, context }) => {
|
|
110
|
+
const { EnsName } = context.entities;
|
|
111
|
+
const { name, owner } = event.params;
|
|
112
|
+
|
|
113
|
+
await EnsName.create({
|
|
114
|
+
id: `${name}-${owner}`,
|
|
115
|
+
data: {
|
|
116
|
+
name: name,
|
|
117
|
+
owner: owner,
|
|
118
|
+
registeredAt: event.block.timestamp,
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### 6. Query the GraphQL API
|
|
125
|
+
|
|
126
|
+
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.
|
|
127
|
+
|
|
128
|
+
```ts
|
|
129
|
+
{
|
|
130
|
+
ensNames(first: 2) {
|
|
131
|
+
name
|
|
132
|
+
owner
|
|
133
|
+
registeredAt
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
```json
|
|
139
|
+
{
|
|
140
|
+
"ensNames": [
|
|
141
|
+
{
|
|
142
|
+
"name": "vitalik.eth",
|
|
143
|
+
"owner": "0x0904Dac3347eA47d208F3Fd67402D039a3b99859",
|
|
144
|
+
"registeredAt": 1580345271
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"name": "joe.eth",
|
|
148
|
+
"owner": "0x6109DD117AA5486605FC85e040ab00163a75c662",
|
|
149
|
+
"registeredAt": 1580754710
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
That's it! Visit [ponder.sh](https://ponder.sh) for documentation, guides for deploying to production, and the API reference.
|
|
156
|
+
|
|
157
|
+
## Contributing
|
|
158
|
+
|
|
159
|
+
If you're interested in contributing to Ponder, please read the [contribution guide](/.github/CONTRIBUTING.md).
|
|
160
|
+
|
|
161
|
+
## Packages
|
|
162
|
+
|
|
163
|
+
- `@ponder/core`
|
|
164
|
+
- `create-ponder`
|
|
165
|
+
- `eslint-config-ponder`
|
|
166
|
+
|
|
167
|
+
## About
|
|
168
|
+
|
|
169
|
+
Ponder is MIT-licensed open-source software.
|
|
170
|
+
|
|
171
|
+
[ci-badge]: https://github.com/0xOlias/ponder/actions/workflows/main.yml/badge.svg
|
|
172
|
+
[ci-url]: https://github.com/0xOlias/ponder/actions/workflows/main.yml
|
|
173
|
+
[tg-badge]: https://img.shields.io/endpoint?color=neon&logo=telegram&label=Chat&url=https%3A%2F%2Fmogyo.ro%2Fquart-apis%2Ftgmembercount%3Fchat_id%3Dponder_sh
|
|
174
|
+
[tg-url]: https://t.me/ponder_sh
|
|
175
|
+
[license-badge]: https://img.shields.io/npm/l/@ponder/core?label=License
|
|
176
|
+
[license-url]: https://github.com/0xOlias/ponder/blob/main/LICENSE
|
|
177
|
+
[version-badge]: https://img.shields.io/npm/v/@ponder/core
|
|
178
|
+
[version-url]: https://github.com/0xOlias/ponder/releases
|