create-ponder 0.0.9 → 0.0.11
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/src/bin/create-ponder +25 -30
- package/dist/src/bin/create-ponder.d.ts +7 -0
- package/dist/src/helpers/detectPackageManager.d.ts +5 -0
- package/dist/src/helpers/detectPackageManager.js +65 -96
- package/dist/src/helpers/getEtherscanChainId.d.ts +4 -0
- package/dist/src/helpers/getEtherscanChainId.js +18 -46
- package/dist/src/helpers/getGraphProtocolChainId.d.ts +2 -0
- package/dist/src/helpers/getGraphProtocolChainId.js +36 -66
- package/dist/src/helpers/validateGraphProtocolSource.d.ts +27 -0
- package/dist/src/helpers/validateGraphProtocolSource.js +4 -32
- package/dist/src/index.d.ts +26 -0
- package/dist/src/index.js +92 -216
- package/dist/src/templates/basic.d.ts +3 -0
- package/dist/src/templates/basic.js +41 -86
- package/dist/src/templates/etherscan.d.ts +3 -0
- package/dist/src/templates/etherscan.js +102 -151
- package/dist/src/templates/subgraph.d.ts +3 -0
- package/dist/src/templates/subgraph.js +81 -136
- package/package.json +9 -18
package/dist/src/index.js
CHANGED
|
@@ -1,98 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
4
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
(target = mod != null ? __create(__getProtoOf(mod)) : {}),
|
|
25
|
-
__copyProps(
|
|
26
|
-
isNodeMode || !mod || !mod.__esModule
|
|
27
|
-
? __defProp(target, "default", { value: mod, enumerable: true })
|
|
28
|
-
: target,
|
|
29
|
-
mod
|
|
30
|
-
)
|
|
31
|
-
);
|
|
32
|
-
var __toCommonJS = (mod) =>
|
|
33
|
-
__copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
34
|
-
var src_exports = {};
|
|
35
|
-
__export(src_exports, {
|
|
36
|
-
run: () => run,
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(src_exports);
|
|
39
|
-
var import_ethers = require("ethers");
|
|
40
|
-
var import_node_child_process = require("node:child_process");
|
|
41
|
-
var import_node_fs = require("node:fs");
|
|
42
|
-
var import_node_path = __toESM(require("node:path"));
|
|
43
|
-
var import_picocolors = __toESM(require("picocolors"));
|
|
44
|
-
var import_prettier = __toESM(require("prettier"));
|
|
45
|
-
var import_detectPackageManager = require("./helpers/detectPackageManager");
|
|
46
|
-
var import_basic = require("./templates/basic");
|
|
47
|
-
var import_etherscan = require("./templates/etherscan");
|
|
48
|
-
var import_subgraph = require("./templates/subgraph");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.run = void 0;
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
const node_child_process_1 = require("node:child_process");
|
|
9
|
+
const node_fs_1 = require("node:fs");
|
|
10
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
11
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
12
|
+
const prettier_1 = __importDefault(require("prettier"));
|
|
13
|
+
const detectPackageManager_1 = require("./helpers/detectPackageManager");
|
|
14
|
+
const basic_1 = require("./templates/basic");
|
|
15
|
+
const etherscan_1 = require("./templates/etherscan");
|
|
16
|
+
const subgraph_1 = require("./templates/subgraph");
|
|
49
17
|
const run = async (options, overrides = {}) => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
{ recursive: true }
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const handlers = eventNames.map((eventName) => {
|
|
85
|
-
const eventBaseName = eventName.split("(")[0];
|
|
86
|
-
const handlerFunctionType = `${eventBaseName}Handler`;
|
|
87
|
-
const handlerFunctionName = `handle${eventBaseName}`;
|
|
88
|
-
return {
|
|
89
|
-
handlerFunctionType,
|
|
90
|
-
handlerFunction: `const ${handlerFunctionName}: ${handlerFunctionType} = async (event, context) => { return }
|
|
91
|
-
`,
|
|
92
|
-
handlerExport: `${eventBaseName}: ${handlerFunctionName}`,
|
|
93
|
-
};
|
|
94
|
-
});
|
|
95
|
-
const handlerFileContents = `
|
|
18
|
+
const { ponderRootDir } = options;
|
|
19
|
+
// Create required directories.
|
|
20
|
+
(0, node_fs_1.mkdirSync)(node_path_1.default.join(ponderRootDir, "abis"), { recursive: true });
|
|
21
|
+
(0, node_fs_1.mkdirSync)(node_path_1.default.join(ponderRootDir, "handlers"), { recursive: true });
|
|
22
|
+
let ponderConfig;
|
|
23
|
+
if (options.fromSubgraph) {
|
|
24
|
+
console.log(picocolors_1.default.cyan("[create-ponder] ") + `Bootstrapping from subgraph`);
|
|
25
|
+
ponderConfig = (0, subgraph_1.fromSubgraph)(options);
|
|
26
|
+
}
|
|
27
|
+
else if (options.fromEtherscan) {
|
|
28
|
+
console.log(picocolors_1.default.cyan("[create-ponder] ") + `Bootstrapping from Etherscan`);
|
|
29
|
+
ponderConfig = await (0, etherscan_1.fromEtherscan)(options);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
ponderConfig = (0, basic_1.fromBasic)(options);
|
|
33
|
+
}
|
|
34
|
+
// Write the handler ts files.
|
|
35
|
+
ponderConfig.sources.forEach((source) => {
|
|
36
|
+
const abi = (0, node_fs_1.readFileSync)(node_path_1.default.join(ponderRootDir, source.abi), {
|
|
37
|
+
encoding: "utf-8",
|
|
38
|
+
});
|
|
39
|
+
const abiInterface = new ethers_1.ethers.utils.Interface(abi);
|
|
40
|
+
const eventNames = Object.keys(abiInterface.events);
|
|
41
|
+
const handlers = eventNames.map((eventName) => {
|
|
42
|
+
const eventBaseName = eventName.split("(")[0];
|
|
43
|
+
const handlerFunctionType = `${eventBaseName}Handler`;
|
|
44
|
+
const handlerFunctionName = `handle${eventBaseName}`;
|
|
45
|
+
return {
|
|
46
|
+
handlerFunctionType,
|
|
47
|
+
handlerFunction: `const ${handlerFunctionName}: ${handlerFunctionType} = async (event, context) => { return }\n`,
|
|
48
|
+
handlerExport: `${eventBaseName}: ${handlerFunctionName}`,
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
const handlerFileContents = `
|
|
96
52
|
import { ${handlers.map((h) => h.handlerFunctionType).join(",")} }
|
|
97
53
|
from '../generated/handlers'
|
|
98
54
|
|
|
@@ -102,20 +58,13 @@ const run = async (options, overrides = {}) => {
|
|
|
102
58
|
${handlers.map((h) => h.handlerExport).join(",")}
|
|
103
59
|
}
|
|
104
60
|
`;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
),
|
|
110
|
-
import_prettier.default.format(handlerFileContents, {
|
|
111
|
-
parser: "typescript",
|
|
112
|
-
})
|
|
113
|
-
);
|
|
114
|
-
});
|
|
115
|
-
const handlerIndexFileContents = `
|
|
61
|
+
(0, node_fs_1.writeFileSync)(node_path_1.default.join(ponderRootDir, `./handlers/${source.name}.ts`), prettier_1.default.format(handlerFileContents, { parser: "typescript" }));
|
|
62
|
+
});
|
|
63
|
+
// Write the handler index.ts file.
|
|
64
|
+
const handlerIndexFileContents = `
|
|
116
65
|
${ponderConfig.sources
|
|
117
|
-
|
|
118
|
-
|
|
66
|
+
.map((source) => `import { ${source.name} } from "./${source.name}"`)
|
|
67
|
+
.join("\n")}
|
|
119
68
|
|
|
120
69
|
export default {
|
|
121
70
|
${ponderConfig.sources
|
|
@@ -123,13 +72,9 @@ const run = async (options, overrides = {}) => {
|
|
|
123
72
|
.join(",")}
|
|
124
73
|
}
|
|
125
74
|
`;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
parser: "typescript",
|
|
130
|
-
})
|
|
131
|
-
);
|
|
132
|
-
const finalPonderConfig = `const { graphqlPlugin } = require("@ponder/graphql");
|
|
75
|
+
(0, node_fs_1.writeFileSync)(node_path_1.default.join(ponderRootDir, `./handlers/index.ts`), prettier_1.default.format(handlerIndexFileContents, { parser: "typescript" }));
|
|
76
|
+
// Write the ponder.config.js file.
|
|
77
|
+
const finalPonderConfig = `const { graphqlPlugin } = require("@ponder/graphql");
|
|
133
78
|
|
|
134
79
|
/**
|
|
135
80
|
* @type {import('@ponder/core').PonderConfig}
|
|
@@ -139,30 +84,18 @@ const ponderConfig = {
|
|
|
139
84
|
database: {
|
|
140
85
|
kind: "sqlite",
|
|
141
86
|
},
|
|
142
|
-
networks: ${JSON.stringify(ponderConfig.networks).replaceAll(
|
|
143
|
-
/"process.env.PONDER_RPC_URL_(.*?)"/g,
|
|
144
|
-
"process.env.PONDER_RPC_URL_$1"
|
|
145
|
-
)},
|
|
87
|
+
networks: ${JSON.stringify(ponderConfig.networks).replaceAll(/"process.env.PONDER_RPC_URL_(.*?)"/g, "process.env.PONDER_RPC_URL_$1")},
|
|
146
88
|
sources: ${JSON.stringify(ponderConfig.sources)},
|
|
147
89
|
};
|
|
148
90
|
|
|
149
91
|
module.exports = ponderConfig;`;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
const envLocal = `${uniqueChainIds.map(
|
|
158
|
-
(chainId) => `PONDER_RPC_URL_${chainId}=""
|
|
159
|
-
`
|
|
160
|
-
)}`;
|
|
161
|
-
(0, import_node_fs.writeFileSync)(
|
|
162
|
-
import_node_path.default.join(ponderRootDir, ".env.local"),
|
|
163
|
-
envLocal
|
|
164
|
-
);
|
|
165
|
-
const packageJson = `
|
|
92
|
+
(0, node_fs_1.writeFileSync)(node_path_1.default.join(ponderRootDir, "ponder.config.js"), prettier_1.default.format(finalPonderConfig, { parser: "babel" }));
|
|
93
|
+
// Write the .env.local file.
|
|
94
|
+
const uniqueChainIds = Array.from(new Set(ponderConfig.networks.map((n) => n.chainId)));
|
|
95
|
+
const envLocal = `${uniqueChainIds.map((chainId) => `PONDER_RPC_URL_${chainId}=""\n`)}`;
|
|
96
|
+
(0, node_fs_1.writeFileSync)(node_path_1.default.join(ponderRootDir, ".env.local"), envLocal);
|
|
97
|
+
// Write the package.json file.
|
|
98
|
+
const packageJson = `
|
|
166
99
|
{
|
|
167
100
|
"private": true,
|
|
168
101
|
"scripts": {
|
|
@@ -182,11 +115,9 @@ module.exports = ponderConfig;`;
|
|
|
182
115
|
}
|
|
183
116
|
}
|
|
184
117
|
`;
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
);
|
|
189
|
-
const tsConfig = `
|
|
118
|
+
(0, node_fs_1.writeFileSync)(node_path_1.default.join(ponderRootDir, "package.json"), prettier_1.default.format(packageJson, { parser: "json" }));
|
|
119
|
+
// Write the tsconfig.json file.
|
|
120
|
+
const tsConfig = `
|
|
190
121
|
{
|
|
191
122
|
"compilerOptions": {
|
|
192
123
|
"target": "esnext",
|
|
@@ -199,83 +130,28 @@ module.exports = ponderConfig;`;
|
|
|
199
130
|
"exclude": ["node_modules"]
|
|
200
131
|
}
|
|
201
132
|
`;
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
`
|
|
209
|
-
.
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
.
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
env: node
|
|
226
|
-
buildCommand: ${packageManager} install
|
|
227
|
-
startCommand: ${runCommand} start
|
|
228
|
-
envVars:
|
|
229
|
-
- key: DATABASE_URL
|
|
230
|
-
fromDatabase:
|
|
231
|
-
name: ponder-db
|
|
232
|
-
property: connectionString
|
|
233
|
-
${ponderConfig.networks
|
|
234
|
-
.map(
|
|
235
|
-
(n) => ` - key: PONDER_RPC_URL_${n.chainId}
|
|
236
|
-
sync: false`
|
|
237
|
-
)
|
|
238
|
-
.join("\n")}
|
|
239
|
-
|
|
240
|
-
databases:
|
|
241
|
-
- name: ponder-db
|
|
242
|
-
postgresMajorVersion: 14
|
|
243
|
-
`;
|
|
244
|
-
(0, import_node_fs.writeFileSync)(
|
|
245
|
-
import_node_path.default.join(ponderRootDir, "render.yaml"),
|
|
246
|
-
import_prettier.default.format(renderYaml, { parser: "yaml" })
|
|
247
|
-
);
|
|
248
|
-
console.log(
|
|
249
|
-
import_picocolors.default.cyan("[create-ponder] ") +
|
|
250
|
-
`Installing using ${packageManager}`
|
|
251
|
-
);
|
|
252
|
-
const installCommand = overrides.installCommand
|
|
253
|
-
? overrides.installCommand
|
|
254
|
-
: `${packageManager} install`;
|
|
255
|
-
(0, import_node_child_process.execSync)(installCommand, {
|
|
256
|
-
cwd: ponderRootDir,
|
|
257
|
-
stdio: "inherit",
|
|
258
|
-
});
|
|
259
|
-
console.log(
|
|
260
|
-
import_picocolors.default.cyan("[create-ponder] ") + `Generating types`
|
|
261
|
-
);
|
|
262
|
-
(0, import_node_child_process.execSync)(
|
|
263
|
-
`${runCommand} --silent codegen --silent`,
|
|
264
|
-
{
|
|
265
|
-
cwd: ponderRootDir,
|
|
266
|
-
stdio: "inherit",
|
|
267
|
-
}
|
|
268
|
-
);
|
|
269
|
-
console.log(
|
|
270
|
-
import_picocolors.default.cyan("[create-ponder] ") +
|
|
271
|
-
import_picocolors.default.green("Done! ") +
|
|
272
|
-
`To get started run ${import_picocolors.default.yellow(
|
|
273
|
-
`${runCommand} dev`
|
|
274
|
-
)}`
|
|
275
|
-
);
|
|
133
|
+
(0, node_fs_1.writeFileSync)(node_path_1.default.join(ponderRootDir, "tsconfig.json"), prettier_1.default.format(tsConfig, { parser: "json" }));
|
|
134
|
+
// Write the .gitignore file.
|
|
135
|
+
(0, node_fs_1.writeFileSync)(node_path_1.default.join(ponderRootDir, ".gitignore"), `node_modules/\n.DS_Store\n\n.env.local\n.ponder/\ngenerated/`);
|
|
136
|
+
const packageManager = await (0, detectPackageManager_1.detect)();
|
|
137
|
+
const runCommand = packageManager === "npm" ? `${packageManager} run` : packageManager;
|
|
138
|
+
// Install packages.
|
|
139
|
+
console.log(picocolors_1.default.cyan("[create-ponder] ") + `Installing using ${packageManager}`);
|
|
140
|
+
const installCommand = overrides.installCommand
|
|
141
|
+
? overrides.installCommand
|
|
142
|
+
: `${packageManager} install`;
|
|
143
|
+
(0, node_child_process_1.execSync)(installCommand, {
|
|
144
|
+
cwd: ponderRootDir,
|
|
145
|
+
stdio: "inherit",
|
|
146
|
+
});
|
|
147
|
+
// Run codegen.
|
|
148
|
+
console.log(picocolors_1.default.cyan("[create-ponder] ") + `Generating types`);
|
|
149
|
+
(0, node_child_process_1.execSync)(`${runCommand} --silent codegen --silent`, {
|
|
150
|
+
cwd: ponderRootDir,
|
|
151
|
+
stdio: "inherit",
|
|
152
|
+
});
|
|
153
|
+
console.log(picocolors_1.default.cyan("[create-ponder] ") +
|
|
154
|
+
picocolors_1.default.green("Done! ") +
|
|
155
|
+
`To get started run ${picocolors_1.default.yellow(`${runCommand} dev`)}`);
|
|
276
156
|
};
|
|
277
|
-
|
|
278
|
-
0 &&
|
|
279
|
-
(module.exports = {
|
|
280
|
-
run,
|
|
281
|
-
});
|
|
157
|
+
exports.run = run;
|
|
@@ -1,54 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
4
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
get: () => from[key],
|
|
18
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
return to;
|
|
22
|
-
};
|
|
23
|
-
var __toESM = (mod, isNodeMode, target) => (
|
|
24
|
-
(target = mod != null ? __create(__getProtoOf(mod)) : {}),
|
|
25
|
-
__copyProps(
|
|
26
|
-
isNodeMode || !mod || !mod.__esModule
|
|
27
|
-
? __defProp(target, "default", { value: mod, enumerable: true })
|
|
28
|
-
: target,
|
|
29
|
-
mod
|
|
30
|
-
)
|
|
31
|
-
);
|
|
32
|
-
var __toCommonJS = (mod) =>
|
|
33
|
-
__copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
34
|
-
var basic_exports = {};
|
|
35
|
-
__export(basic_exports, {
|
|
36
|
-
fromBasic: () => fromBasic,
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(basic_exports);
|
|
39
|
-
var import_node_fs = require("node:fs");
|
|
40
|
-
var import_node_path = __toESM(require("node:path"));
|
|
41
|
-
var import_prettier = __toESM(require("prettier"));
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.fromBasic = void 0;
|
|
7
|
+
const node_fs_1 = require("node:fs");
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const prettier_1 = __importDefault(require("prettier"));
|
|
42
10
|
const fromBasic = (options) => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
);
|
|
50
|
-
(0, import_node_fs.writeFileSync)(abiAbsolutePath, abiFileContents);
|
|
51
|
-
const schemaGraphqlFileContents = `
|
|
11
|
+
const { ponderRootDir } = options;
|
|
12
|
+
const abiFileContents = `[]`;
|
|
13
|
+
const abiRelativePath = "./abis/ExampleContract.json";
|
|
14
|
+
const abiAbsolutePath = node_path_1.default.join(ponderRootDir, abiRelativePath);
|
|
15
|
+
(0, node_fs_1.writeFileSync)(abiAbsolutePath, abiFileContents);
|
|
16
|
+
const schemaGraphqlFileContents = `
|
|
52
17
|
type ExampleToken @entity {
|
|
53
18
|
id: ID!
|
|
54
19
|
tokenId: Int!
|
|
@@ -59,42 +24,32 @@ const fromBasic = (options) => {
|
|
|
59
24
|
BAD
|
|
60
25
|
}
|
|
61
26
|
`;
|
|
62
|
-
|
|
63
|
-
ponderRootDir,
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
abi: abiRelativePath,
|
|
90
|
-
startBlock: 1234567,
|
|
91
|
-
},
|
|
92
|
-
],
|
|
93
|
-
};
|
|
94
|
-
return ponderConfig;
|
|
27
|
+
// Generate the schema.graphql file.
|
|
28
|
+
const ponderSchemaFilePath = node_path_1.default.join(ponderRootDir, "schema.graphql");
|
|
29
|
+
(0, node_fs_1.writeFileSync)(ponderSchemaFilePath, prettier_1.default.format(schemaGraphqlFileContents, { parser: "graphql" }));
|
|
30
|
+
// Build the partial ponder config.
|
|
31
|
+
const ponderConfig = {
|
|
32
|
+
plugins: ["graphqlPlugin()"],
|
|
33
|
+
database: {
|
|
34
|
+
kind: "sqlite",
|
|
35
|
+
},
|
|
36
|
+
networks: [
|
|
37
|
+
{
|
|
38
|
+
name: "mainnet",
|
|
39
|
+
chainId: 1,
|
|
40
|
+
rpcUrl: `process.env.PONDER_RPC_URL_1`,
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
sources: [
|
|
44
|
+
{
|
|
45
|
+
name: "ExampleContract",
|
|
46
|
+
network: "mainnet",
|
|
47
|
+
address: "0x0",
|
|
48
|
+
abi: abiRelativePath,
|
|
49
|
+
startBlock: 1234567,
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
};
|
|
53
|
+
return ponderConfig;
|
|
95
54
|
};
|
|
96
|
-
|
|
97
|
-
0 &&
|
|
98
|
-
(module.exports = {
|
|
99
|
-
fromBasic,
|
|
100
|
-
});
|
|
55
|
+
exports.fromBasic = fromBasic;
|