create-ponder 0.4.15 → 0.4.16
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/dist/index.js +6 -1
- package/package.json +1 -1
- package/templates/feature-blocks/_dot_env.local +5 -0
- package/templates/feature-blocks/_dot_eslintrc.json +3 -0
- package/templates/feature-blocks/_dot_gitignore +18 -0
- package/templates/feature-blocks/package.json +26 -0
- package/templates/feature-blocks/ponder-env.d.ts +27 -0
- package/templates/feature-blocks/ponder.config.ts +18 -0
- package/templates/feature-blocks/ponder.schema.ts +8 -0
- package/templates/feature-blocks/src/index.ts +17 -0
- package/templates/feature-blocks/tsconfig.json +26 -0
package/dist/index.js
CHANGED
|
@@ -16,7 +16,7 @@ import { default as prompts } from "prompts";
|
|
|
16
16
|
// package.json
|
|
17
17
|
var package_default = {
|
|
18
18
|
name: "create-ponder",
|
|
19
|
-
version: "0.4.
|
|
19
|
+
version: "0.4.16",
|
|
20
20
|
type: "module",
|
|
21
21
|
description: "A CLI tool to create Ponder apps",
|
|
22
22
|
license: "MIT",
|
|
@@ -630,6 +630,11 @@ var templates = [
|
|
|
630
630
|
title: "Feature - Custom event filter",
|
|
631
631
|
description: "A Ponder app using an event filter"
|
|
632
632
|
},
|
|
633
|
+
{
|
|
634
|
+
id: "feature-blocks",
|
|
635
|
+
title: "Feature - Block filter",
|
|
636
|
+
description: "A Ponder app using a block filter"
|
|
637
|
+
},
|
|
633
638
|
{
|
|
634
639
|
id: "feature-multichain",
|
|
635
640
|
title: "Feature - Multichain contract",
|
package/package.json
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ponder-examples-feature-blocks",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "ponder dev",
|
|
7
|
+
"start": "ponder start",
|
|
8
|
+
"codegen": "ponder codegen",
|
|
9
|
+
"serve": "ponder serve",
|
|
10
|
+
"lint": "eslint .",
|
|
11
|
+
"typecheck": "tsc"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@ponder/core": "workspace:*",
|
|
15
|
+
"viem": "^1.19.9"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/node": "^20.10.0",
|
|
19
|
+
"eslint": "^8.54.0",
|
|
20
|
+
"eslint-config-ponder": "workspace:*",
|
|
21
|
+
"typescript": "^5.3.2"
|
|
22
|
+
},
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=18.14"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// This file enables type checking and editor autocomplete for this Ponder project.
|
|
2
|
+
// After upgrading, you may find that changes have been made to this file.
|
|
3
|
+
// If this happens, please commit the changes. Do not manually edit this file.
|
|
4
|
+
// See https://ponder.sh/docs/guides/typescript for more information.
|
|
5
|
+
|
|
6
|
+
declare module "@/generated" {
|
|
7
|
+
import type { Virtual } from "@ponder/core";
|
|
8
|
+
|
|
9
|
+
type config = typeof import("./ponder.config.ts").default;
|
|
10
|
+
type schema = typeof import("./ponder.schema.ts").default;
|
|
11
|
+
|
|
12
|
+
export const ponder: Virtual.Registry<config, schema>;
|
|
13
|
+
|
|
14
|
+
export type EventNames = Virtual.EventNames<config>;
|
|
15
|
+
export type Event<name extends EventNames = EventNames> = Virtual.Event<
|
|
16
|
+
config,
|
|
17
|
+
name
|
|
18
|
+
>;
|
|
19
|
+
export type Context<name extends EventNames = EventNames> = Virtual.Context<
|
|
20
|
+
config,
|
|
21
|
+
schema,
|
|
22
|
+
name
|
|
23
|
+
>;
|
|
24
|
+
export type IndexingFunctionArgs<name extends EventNames = EventNames> =
|
|
25
|
+
Virtual.IndexingFunctionArgs<config, schema, name>;
|
|
26
|
+
export type Schema = Virtual.Schema<schema>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createConfig } from "@ponder/core";
|
|
2
|
+
import { http, Abi } from "viem";
|
|
3
|
+
|
|
4
|
+
export default createConfig({
|
|
5
|
+
networks: {
|
|
6
|
+
mainnet: {
|
|
7
|
+
chainId: 1,
|
|
8
|
+
transport: http(process.env.PONDER_RPC_URL_1),
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
blocks: {
|
|
12
|
+
ChainlinkPriceOracle: {
|
|
13
|
+
network: "mainnet",
|
|
14
|
+
startBlock: 19_750_000,
|
|
15
|
+
interval: 5, // every minute
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ponder } from "@/generated";
|
|
2
|
+
import { parseAbi } from "viem";
|
|
3
|
+
|
|
4
|
+
ponder.on("ChainlinkPriceOracle:block", async ({ event, context }) => {
|
|
5
|
+
const price = await context.client.readContract({
|
|
6
|
+
address: "0xD10aBbC76679a20055E167BB80A24ac851b37056",
|
|
7
|
+
abi: parseAbi(["function latestAnswer() external view returns (int256)"]),
|
|
8
|
+
functionName: "latestAnswer",
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
await context.db.ChainlinkPrice.create({
|
|
12
|
+
id: event.block.timestamp,
|
|
13
|
+
data: {
|
|
14
|
+
price: Number(price) / 10 ** 8,
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
// Type checking
|
|
4
|
+
"strict": true,
|
|
5
|
+
"noUncheckedIndexedAccess": true,
|
|
6
|
+
|
|
7
|
+
// Interop constraints
|
|
8
|
+
"verbatimModuleSyntax": false,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"isolatedModules": true,
|
|
11
|
+
"allowSyntheticDefaultImports": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
|
|
14
|
+
// Language and environment
|
|
15
|
+
"moduleResolution": "bundler",
|
|
16
|
+
"module": "ESNext",
|
|
17
|
+
"noEmit": true,
|
|
18
|
+
"lib": ["ES2022"],
|
|
19
|
+
"target": "ES2022",
|
|
20
|
+
|
|
21
|
+
// Skip type checking for node modules
|
|
22
|
+
"skipLibCheck": true
|
|
23
|
+
},
|
|
24
|
+
"include": ["./**/*.ts"],
|
|
25
|
+
"exclude": ["node_modules"]
|
|
26
|
+
}
|