create-ponder 0.0.37 → 0.0.39
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.d.ts → create-ponder.d.ts} +0 -1
- package/dist/create-ponder.js +862 -0
- package/dist/create-ponder.js.map +1 -0
- package/dist/create-ponder.mjs +839 -0
- package/dist/create-ponder.mjs.map +1 -0
- package/package.json +9 -8
- package/dist/src/bin/create-ponder.js +0 -103
- package/dist/src/common.d.ts +0 -22
- package/dist/src/common.js +0 -10
- package/dist/src/helpers/detectPackageManager.d.ts +0 -5
- package/dist/src/helpers/detectPackageManager.js +0 -78
- package/dist/src/helpers/getEtherscanChainId.d.ts +0 -5
- package/dist/src/helpers/getEtherscanChainId.js +0 -69
- package/dist/src/helpers/getGraphProtocolChainId.d.ts +0 -2
- package/dist/src/helpers/getGraphProtocolChainId.js +0 -41
- package/dist/src/helpers/git.d.ts +0 -1
- package/dist/src/helpers/git.js +0 -55
- package/dist/src/helpers/validateGraphProtocolSource.d.ts +0 -27
- package/dist/src/helpers/validateGraphProtocolSource.js +0 -7
- package/dist/src/helpers/wait.d.ts +0 -1
- package/dist/src/helpers/wait.js +0 -5
- package/dist/src/index.d.ts +0 -23
- package/dist/src/index.js +0 -154
- package/dist/src/templates/basic.d.ts +0 -4
- package/dist/src/templates/basic.js +0 -50
- package/dist/src/templates/etherscan.d.ts +0 -6
- package/dist/src/templates/etherscan.js +0 -112
- package/dist/src/templates/subgraphId.d.ts +0 -5
- package/dist/src/templates/subgraphId.js +0 -72
- package/dist/src/templates/subgraphRepo.d.ts +0 -5
- package/dist/src/templates/subgraphRepo.js +0 -80
|
@@ -0,0 +1,862 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
18
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
19
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
20
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
21
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
22
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
23
|
+
mod
|
|
24
|
+
));
|
|
25
|
+
|
|
26
|
+
// src/bin/create-ponder.ts
|
|
27
|
+
var import_cac = require("cac");
|
|
28
|
+
var import_node_path6 = __toESM(require("path"));
|
|
29
|
+
var import_prompts = __toESM(require("prompts"));
|
|
30
|
+
|
|
31
|
+
// src/index.ts
|
|
32
|
+
var import_ethers = require("ethers");
|
|
33
|
+
var import_node_child_process = require("child_process");
|
|
34
|
+
var import_node_fs5 = require("fs");
|
|
35
|
+
var import_node_path5 = __toESM(require("path"));
|
|
36
|
+
var import_picocolors = __toESM(require("picocolors"));
|
|
37
|
+
var import_prettier4 = __toESM(require("prettier"));
|
|
38
|
+
|
|
39
|
+
// src/helpers/detectPackageManager.ts
|
|
40
|
+
var import_execa = __toESM(require("execa"));
|
|
41
|
+
var import_fs = require("fs");
|
|
42
|
+
var import_path = require("path");
|
|
43
|
+
async function pathExists(p) {
|
|
44
|
+
try {
|
|
45
|
+
await import_fs.promises.access(p);
|
|
46
|
+
return true;
|
|
47
|
+
} catch {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
var cache = /* @__PURE__ */ new Map();
|
|
52
|
+
function hasGlobalInstallation(pm) {
|
|
53
|
+
const key = `has_global_${pm}`;
|
|
54
|
+
if (cache.has(key)) {
|
|
55
|
+
return Promise.resolve(cache.get(key));
|
|
56
|
+
}
|
|
57
|
+
return (0, import_execa.default)(pm, ["--version"]).then((res) => {
|
|
58
|
+
return /^\d+.\d+.\d+$/.test(res.stdout);
|
|
59
|
+
}).then((value) => {
|
|
60
|
+
cache.set(key, value);
|
|
61
|
+
return value;
|
|
62
|
+
}).catch(() => false);
|
|
63
|
+
}
|
|
64
|
+
function getTypeofLockFile(cwd = ".") {
|
|
65
|
+
const key = `lockfile_${cwd}`;
|
|
66
|
+
if (cache.has(key)) {
|
|
67
|
+
return Promise.resolve(cache.get(key));
|
|
68
|
+
}
|
|
69
|
+
return Promise.all([
|
|
70
|
+
pathExists((0, import_path.resolve)(cwd, "yarn.lock")),
|
|
71
|
+
pathExists((0, import_path.resolve)(cwd, "package-lock.json")),
|
|
72
|
+
pathExists((0, import_path.resolve)(cwd, "pnpm-lock.yaml"))
|
|
73
|
+
]).then(([isYarn, isNpm, isPnpm]) => {
|
|
74
|
+
let value = null;
|
|
75
|
+
if (isYarn) {
|
|
76
|
+
value = "yarn";
|
|
77
|
+
} else if (isPnpm) {
|
|
78
|
+
value = "pnpm";
|
|
79
|
+
} else if (isNpm) {
|
|
80
|
+
value = "npm";
|
|
81
|
+
}
|
|
82
|
+
cache.set(key, value);
|
|
83
|
+
return value;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
var detect = async ({ cwd } = {}) => {
|
|
87
|
+
const type = await getTypeofLockFile(cwd);
|
|
88
|
+
if (type) {
|
|
89
|
+
return type;
|
|
90
|
+
}
|
|
91
|
+
const [hasYarn, hasPnpm] = await Promise.all([
|
|
92
|
+
hasGlobalInstallation("yarn"),
|
|
93
|
+
hasGlobalInstallation("pnpm")
|
|
94
|
+
]);
|
|
95
|
+
if (hasPnpm) {
|
|
96
|
+
return "pnpm";
|
|
97
|
+
}
|
|
98
|
+
if (hasYarn) {
|
|
99
|
+
return "yarn";
|
|
100
|
+
}
|
|
101
|
+
return "npm";
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
// src/helpers/git.ts
|
|
105
|
+
var import_child_process = require("child_process");
|
|
106
|
+
var import_path2 = __toESM(require("path"));
|
|
107
|
+
var import_rimraf = __toESM(require("rimraf"));
|
|
108
|
+
function isInGitRepository() {
|
|
109
|
+
try {
|
|
110
|
+
(0, import_child_process.execSync)("git rev-parse --is-inside-work-tree", { stdio: "ignore" });
|
|
111
|
+
return true;
|
|
112
|
+
} catch (_) {
|
|
113
|
+
}
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
function isInMercurialRepository() {
|
|
117
|
+
try {
|
|
118
|
+
(0, import_child_process.execSync)("hg --cwd . root", { stdio: "ignore" });
|
|
119
|
+
return true;
|
|
120
|
+
} catch (_) {
|
|
121
|
+
}
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
function tryGitInit(root) {
|
|
125
|
+
let didInit = false;
|
|
126
|
+
try {
|
|
127
|
+
(0, import_child_process.execSync)("git --version", { stdio: "ignore" });
|
|
128
|
+
if (isInGitRepository() || isInMercurialRepository()) {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
(0, import_child_process.execSync)("git init", { stdio: "ignore" });
|
|
132
|
+
didInit = true;
|
|
133
|
+
(0, import_child_process.execSync)("git checkout -b main", { stdio: "ignore" });
|
|
134
|
+
(0, import_child_process.execSync)("git add -A", { stdio: "ignore" });
|
|
135
|
+
(0, import_child_process.execSync)('git commit -m "chore: initial commit from create-ponder"', {
|
|
136
|
+
stdio: "ignore"
|
|
137
|
+
});
|
|
138
|
+
return true;
|
|
139
|
+
} catch (e) {
|
|
140
|
+
if (didInit) {
|
|
141
|
+
try {
|
|
142
|
+
import_rimraf.default.sync(import_path2.default.join(root, ".git"));
|
|
143
|
+
} catch (_) {
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// src/templates/basic.ts
|
|
151
|
+
var import_node_fs = require("fs");
|
|
152
|
+
var import_node_path = __toESM(require("path"));
|
|
153
|
+
var import_prettier = __toESM(require("prettier"));
|
|
154
|
+
var fromBasic = ({ rootDir }) => {
|
|
155
|
+
const abiFileContents = `[]`;
|
|
156
|
+
const abiRelativePath = "./abis/ExampleContract.json";
|
|
157
|
+
const abiAbsolutePath = import_node_path.default.join(rootDir, abiRelativePath);
|
|
158
|
+
(0, import_node_fs.writeFileSync)(abiAbsolutePath, abiFileContents);
|
|
159
|
+
const schemaGraphqlFileContents = `
|
|
160
|
+
type ExampleToken @entity {
|
|
161
|
+
id: ID!
|
|
162
|
+
tokenId: Int!
|
|
163
|
+
trait: TokenTrait!
|
|
164
|
+
}
|
|
165
|
+
enum TokenTrait {
|
|
166
|
+
GOOD
|
|
167
|
+
BAD
|
|
168
|
+
}
|
|
169
|
+
`;
|
|
170
|
+
const ponderSchemaFilePath = import_node_path.default.join(rootDir, "schema.graphql");
|
|
171
|
+
(0, import_node_fs.writeFileSync)(
|
|
172
|
+
ponderSchemaFilePath,
|
|
173
|
+
import_prettier.default.format(schemaGraphqlFileContents, { parser: "graphql" })
|
|
174
|
+
);
|
|
175
|
+
const ponderConfig = {
|
|
176
|
+
networks: [
|
|
177
|
+
{
|
|
178
|
+
name: "mainnet",
|
|
179
|
+
chainId: 1,
|
|
180
|
+
rpcUrl: `process.env.PONDER_RPC_URL_1`
|
|
181
|
+
}
|
|
182
|
+
],
|
|
183
|
+
contracts: [
|
|
184
|
+
{
|
|
185
|
+
name: "ExampleContract",
|
|
186
|
+
network: "mainnet",
|
|
187
|
+
address: "0x0",
|
|
188
|
+
abi: abiRelativePath,
|
|
189
|
+
startBlock: 1234567
|
|
190
|
+
}
|
|
191
|
+
]
|
|
192
|
+
};
|
|
193
|
+
return ponderConfig;
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
// src/templates/etherscan.ts
|
|
197
|
+
var import_node_fs2 = require("fs");
|
|
198
|
+
var import_node_path2 = __toESM(require("path"));
|
|
199
|
+
var import_node_fetch = __toESM(require("node-fetch"));
|
|
200
|
+
var import_prettier2 = __toESM(require("prettier"));
|
|
201
|
+
|
|
202
|
+
// src/helpers/getEtherscanChainId.ts
|
|
203
|
+
var networkByEtherscanHostname = {
|
|
204
|
+
"etherscan.io": {
|
|
205
|
+
name: "mainnet",
|
|
206
|
+
chainId: 1,
|
|
207
|
+
apiUrl: "https://api.etherscan.io/api"
|
|
208
|
+
},
|
|
209
|
+
"ropsten.etherscan.io": {
|
|
210
|
+
name: "ropsten",
|
|
211
|
+
chainId: 3,
|
|
212
|
+
apiUrl: "https://api-ropsten.etherscan.io/api"
|
|
213
|
+
},
|
|
214
|
+
"rinkeby.etherscan.io": {
|
|
215
|
+
name: "rinkeby",
|
|
216
|
+
chainId: 4,
|
|
217
|
+
apiUrl: "https://api-rinkeby.etherscan.io/api"
|
|
218
|
+
},
|
|
219
|
+
"goerli.etherscan.io": {
|
|
220
|
+
name: "goerli",
|
|
221
|
+
chainId: 5,
|
|
222
|
+
apiUrl: "https://api-goerli.etherscan.io/api"
|
|
223
|
+
},
|
|
224
|
+
"kovan.etherscan.io": {
|
|
225
|
+
name: "kovan",
|
|
226
|
+
chainId: 42,
|
|
227
|
+
apiUrl: "https://api-kovan.etherscan.io/api"
|
|
228
|
+
},
|
|
229
|
+
"sepolia.etherscan.io": {
|
|
230
|
+
name: "sepolia",
|
|
231
|
+
chainId: 11155111,
|
|
232
|
+
apiUrl: "https://api-sepolia.etherscan.io/api"
|
|
233
|
+
},
|
|
234
|
+
"optimistic.etherscan.io": {
|
|
235
|
+
name: "optimism",
|
|
236
|
+
chainId: 10,
|
|
237
|
+
apiUrl: "https://api-optimistic.etherscan.io/api"
|
|
238
|
+
},
|
|
239
|
+
"goerli-optimism.etherscan.io": {
|
|
240
|
+
name: "optimism-goerli",
|
|
241
|
+
chainId: 420,
|
|
242
|
+
apiUrl: "https://api-goerli-optimistic.etherscan.io/api"
|
|
243
|
+
},
|
|
244
|
+
"polygonscan.com": {
|
|
245
|
+
name: "polygon",
|
|
246
|
+
chainId: 137,
|
|
247
|
+
apiUrl: "https://api.polygonscan.com/api"
|
|
248
|
+
},
|
|
249
|
+
"mumbai.polygonscan.com": {
|
|
250
|
+
name: "polygon-mumbai",
|
|
251
|
+
chainId: 80001,
|
|
252
|
+
apiUrl: "https://api-testnet.polygonscan.com/api"
|
|
253
|
+
},
|
|
254
|
+
"arbiscan.io": {
|
|
255
|
+
name: "arbitrum",
|
|
256
|
+
chainId: 42161,
|
|
257
|
+
apiUrl: "https://api.arbiscan.io/api"
|
|
258
|
+
},
|
|
259
|
+
"goerli.arbiscan.io": {
|
|
260
|
+
name: "arbitrum-goerli",
|
|
261
|
+
chainId: 421613,
|
|
262
|
+
apiUrl: "https://api-goerli.arbiscan.io/api"
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
var getNetworkByEtherscanHostname = (hostname) => {
|
|
266
|
+
return networkByEtherscanHostname[hostname];
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
// src/helpers/wait.ts
|
|
270
|
+
var wait = (ms) => new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
271
|
+
|
|
272
|
+
// src/templates/etherscan.ts
|
|
273
|
+
var fromEtherscan = async ({
|
|
274
|
+
rootDir,
|
|
275
|
+
etherscanLink,
|
|
276
|
+
etherscanApiKey
|
|
277
|
+
}) => {
|
|
278
|
+
const apiKey = etherscanApiKey || process.env.ETHERSCAN_API_KEY;
|
|
279
|
+
const url = new URL(etherscanLink);
|
|
280
|
+
const network = getNetworkByEtherscanHostname(url.hostname);
|
|
281
|
+
if (!network) {
|
|
282
|
+
throw new Error(`Unrecognized etherscan hostname: ${url.hostname}`);
|
|
283
|
+
}
|
|
284
|
+
const { name, chainId, apiUrl } = network;
|
|
285
|
+
const contractAddress = url.pathname.slice(1).split("/")[1];
|
|
286
|
+
const txHash = await getContractCreationTxn(contractAddress, apiUrl, apiKey);
|
|
287
|
+
if (!apiKey) {
|
|
288
|
+
console.log("\n(1/2) Waiting 5 seconds for Etherscan API rate limit");
|
|
289
|
+
await wait(5e3);
|
|
290
|
+
}
|
|
291
|
+
const blockNumber = await getTxBlockNumber(txHash, apiUrl, apiKey);
|
|
292
|
+
if (!apiKey) {
|
|
293
|
+
console.log("(2/2) Waiting 5 seconds for Etherscan API rate limit");
|
|
294
|
+
await wait(5e3);
|
|
295
|
+
}
|
|
296
|
+
const { abi, contractName } = await getContractAbiAndName(
|
|
297
|
+
contractAddress,
|
|
298
|
+
apiUrl,
|
|
299
|
+
apiKey
|
|
300
|
+
);
|
|
301
|
+
const abiRelativePath = `./abis/${contractName}.json`;
|
|
302
|
+
const abiAbsolutePath = import_node_path2.default.join(rootDir, abiRelativePath);
|
|
303
|
+
(0, import_node_fs2.writeFileSync)(abiAbsolutePath, import_prettier2.default.format(abi, { parser: "json" }));
|
|
304
|
+
const schemaGraphqlFileContents = `
|
|
305
|
+
type ExampleEntity @entity {
|
|
306
|
+
id: ID!
|
|
307
|
+
name: String!
|
|
308
|
+
}
|
|
309
|
+
`;
|
|
310
|
+
const ponderSchemaFilePath = import_node_path2.default.join(rootDir, "schema.graphql");
|
|
311
|
+
(0, import_node_fs2.writeFileSync)(
|
|
312
|
+
ponderSchemaFilePath,
|
|
313
|
+
import_prettier2.default.format(schemaGraphqlFileContents, { parser: "graphql" })
|
|
314
|
+
);
|
|
315
|
+
const ponderConfig = {
|
|
316
|
+
networks: [
|
|
317
|
+
{
|
|
318
|
+
name,
|
|
319
|
+
chainId,
|
|
320
|
+
rpcUrl: `process.env.PONDER_RPC_URL_${chainId}`
|
|
321
|
+
}
|
|
322
|
+
],
|
|
323
|
+
contracts: [
|
|
324
|
+
{
|
|
325
|
+
name: contractName,
|
|
326
|
+
network: name,
|
|
327
|
+
abi: abiRelativePath,
|
|
328
|
+
address: contractAddress,
|
|
329
|
+
startBlock: blockNumber
|
|
330
|
+
}
|
|
331
|
+
]
|
|
332
|
+
};
|
|
333
|
+
return ponderConfig;
|
|
334
|
+
};
|
|
335
|
+
var fetchEtherscan = async (url) => {
|
|
336
|
+
const response = await (0, import_node_fetch.default)(url);
|
|
337
|
+
const data = await response.json();
|
|
338
|
+
if (data.status === "0") {
|
|
339
|
+
throw new Error(`Etherscan API error: ${data.result}`);
|
|
340
|
+
}
|
|
341
|
+
return data;
|
|
342
|
+
};
|
|
343
|
+
var getContractCreationTxn = async (contractAddress, apiUrl, apiKey) => {
|
|
344
|
+
const searchParams = new URLSearchParams({
|
|
345
|
+
module: "contract",
|
|
346
|
+
action: "getcontractcreation",
|
|
347
|
+
contractaddresses: contractAddress
|
|
348
|
+
});
|
|
349
|
+
if (apiKey)
|
|
350
|
+
searchParams.append("apikey", apiKey);
|
|
351
|
+
const data = await fetchEtherscan(`${apiUrl}?${searchParams.toString()}`);
|
|
352
|
+
return data.result[0].txHash;
|
|
353
|
+
};
|
|
354
|
+
var getTxBlockNumber = async (txHash, apiUrl, apiKey) => {
|
|
355
|
+
const searchParams = new URLSearchParams({
|
|
356
|
+
module: "proxy",
|
|
357
|
+
action: "eth_getTransactionByHash",
|
|
358
|
+
txhash: txHash
|
|
359
|
+
});
|
|
360
|
+
if (apiKey)
|
|
361
|
+
searchParams.append("apikey", apiKey);
|
|
362
|
+
const data = await fetchEtherscan(`${apiUrl}?${searchParams.toString()}`);
|
|
363
|
+
const hexBlockNumber = data.result.blockNumber;
|
|
364
|
+
return parseInt(hexBlockNumber.slice(2), 16);
|
|
365
|
+
};
|
|
366
|
+
var getContractAbiAndName = async (contractAddress, apiUrl, apiKey) => {
|
|
367
|
+
const searchParams = new URLSearchParams({
|
|
368
|
+
module: "contract",
|
|
369
|
+
action: "getsourcecode",
|
|
370
|
+
address: contractAddress
|
|
371
|
+
});
|
|
372
|
+
if (apiKey)
|
|
373
|
+
searchParams.append("apikey", apiKey);
|
|
374
|
+
const data = await fetchEtherscan(`${apiUrl}?${searchParams.toString()}`);
|
|
375
|
+
const abi = data.result[0].ABI;
|
|
376
|
+
const contractName = data.result[0].ContractName;
|
|
377
|
+
return { abi, contractName };
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
// src/templates/subgraphId.ts
|
|
381
|
+
var import_node_fs3 = require("fs");
|
|
382
|
+
var import_node_path3 = __toESM(require("path"));
|
|
383
|
+
var import_node_fetch2 = __toESM(require("node-fetch"));
|
|
384
|
+
var import_prettier3 = __toESM(require("prettier"));
|
|
385
|
+
var import_yaml = require("yaml");
|
|
386
|
+
|
|
387
|
+
// src/helpers/getGraphProtocolChainId.ts
|
|
388
|
+
var chainIdByGraphNetwork = {
|
|
389
|
+
mainnet: 1,
|
|
390
|
+
kovan: 42,
|
|
391
|
+
rinkeby: 4,
|
|
392
|
+
ropsten: 3,
|
|
393
|
+
goerli: 5,
|
|
394
|
+
"poa-core": 99,
|
|
395
|
+
"poa-sokol": 77,
|
|
396
|
+
xdai: 100,
|
|
397
|
+
matic: 137,
|
|
398
|
+
mumbai: 80001,
|
|
399
|
+
fantom: 250,
|
|
400
|
+
"fantom-testnet": 4002,
|
|
401
|
+
bsc: 56,
|
|
402
|
+
chapel: -1,
|
|
403
|
+
clover: 0,
|
|
404
|
+
avalanche: 43114,
|
|
405
|
+
fuji: 43113,
|
|
406
|
+
celo: 42220,
|
|
407
|
+
"celo-alfajores": 44787,
|
|
408
|
+
fuse: 122,
|
|
409
|
+
moonbeam: 1284,
|
|
410
|
+
moonriver: 1285,
|
|
411
|
+
mbase: -1,
|
|
412
|
+
"arbitrum-one": 42161,
|
|
413
|
+
"arbitrum-rinkeby": 421611,
|
|
414
|
+
optimism: 10,
|
|
415
|
+
"optimism-kovan": 69,
|
|
416
|
+
aurora: 1313161554,
|
|
417
|
+
"aurora-testnet": 1313161555
|
|
418
|
+
};
|
|
419
|
+
var getGraphProtocolChainId = (networkName) => {
|
|
420
|
+
return chainIdByGraphNetwork[networkName];
|
|
421
|
+
};
|
|
422
|
+
var subgraphYamlFileNames = ["subgraph.yaml"].concat(
|
|
423
|
+
Object.keys(chainIdByGraphNetwork).map((n) => `subgraph-${n}.yaml`)
|
|
424
|
+
);
|
|
425
|
+
|
|
426
|
+
// src/helpers/validateGraphProtocolSource.ts
|
|
427
|
+
var validateGraphProtocolSource = (source) => {
|
|
428
|
+
return source;
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
// src/templates/subgraphId.ts
|
|
432
|
+
var fetchIpfsFile = async (cid) => {
|
|
433
|
+
const url = `https://ipfs.network.thegraph.com/api/v0/cat?arg=${cid}`;
|
|
434
|
+
const response = await (0, import_node_fetch2.default)(url);
|
|
435
|
+
const contentRaw = await response.text();
|
|
436
|
+
return contentRaw;
|
|
437
|
+
};
|
|
438
|
+
var fromSubgraphId = async ({
|
|
439
|
+
rootDir,
|
|
440
|
+
subgraphId
|
|
441
|
+
}) => {
|
|
442
|
+
const ponderNetworks = [];
|
|
443
|
+
let ponderContracts = [];
|
|
444
|
+
const manifestRaw = await fetchIpfsFile(subgraphId);
|
|
445
|
+
const manifest = (0, import_yaml.parse)(manifestRaw);
|
|
446
|
+
const schemaCid = manifest.schema.file["/"].slice(6);
|
|
447
|
+
const schemaRaw = await fetchIpfsFile(schemaCid);
|
|
448
|
+
const ponderSchemaFilePath = import_node_path3.default.join(rootDir, "schema.graphql");
|
|
449
|
+
(0, import_node_fs3.writeFileSync)(
|
|
450
|
+
ponderSchemaFilePath,
|
|
451
|
+
import_prettier3.default.format(schemaRaw, { parser: "graphql" })
|
|
452
|
+
);
|
|
453
|
+
const dataSources = manifest.dataSources.map(
|
|
454
|
+
validateGraphProtocolSource
|
|
455
|
+
);
|
|
456
|
+
const abiFiles = dataSources.map((source) => source.mapping.abis).flat().filter(
|
|
457
|
+
(source, idx, arr) => arr.findIndex((s) => s.name === source.name) === idx
|
|
458
|
+
);
|
|
459
|
+
await Promise.all(
|
|
460
|
+
abiFiles.map(async (abi) => {
|
|
461
|
+
const abiContent = await fetchIpfsFile(abi.file["/"].slice(6));
|
|
462
|
+
const abiPath = import_node_path3.default.join(rootDir, `./abis/${abi.name}.json`);
|
|
463
|
+
(0, import_node_fs3.writeFileSync)(abiPath, import_prettier3.default.format(abiContent, { parser: "json" }));
|
|
464
|
+
})
|
|
465
|
+
);
|
|
466
|
+
ponderContracts = dataSources.map((source) => {
|
|
467
|
+
const network = source.network || "mainnet";
|
|
468
|
+
const chainId = getGraphProtocolChainId(network);
|
|
469
|
+
if (!chainId || chainId === -1) {
|
|
470
|
+
throw new Error(`Unhandled network name: ${network}`);
|
|
471
|
+
}
|
|
472
|
+
if (!ponderNetworks.map((n) => n.name).includes(network)) {
|
|
473
|
+
ponderNetworks.push({
|
|
474
|
+
name: network,
|
|
475
|
+
chainId,
|
|
476
|
+
rpcUrl: `process.env.PONDER_RPC_URL_${chainId}`
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
const abiRelativePath = `./abis/${source.source.abi}.json`;
|
|
480
|
+
return {
|
|
481
|
+
name: source.name,
|
|
482
|
+
network,
|
|
483
|
+
address: source.source.address,
|
|
484
|
+
abi: abiRelativePath,
|
|
485
|
+
startBlock: source.source.startBlock
|
|
486
|
+
};
|
|
487
|
+
});
|
|
488
|
+
const ponderConfig = {
|
|
489
|
+
networks: ponderNetworks,
|
|
490
|
+
contracts: ponderContracts
|
|
491
|
+
};
|
|
492
|
+
return ponderConfig;
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
// src/templates/subgraphRepo.ts
|
|
496
|
+
var import_node_fs4 = require("fs");
|
|
497
|
+
var import_node_path4 = __toESM(require("path"));
|
|
498
|
+
var import_yaml2 = require("yaml");
|
|
499
|
+
var fromSubgraphRepo = ({
|
|
500
|
+
rootDir,
|
|
501
|
+
subgraphPath
|
|
502
|
+
}) => {
|
|
503
|
+
const subgraphRootDir = import_node_path4.default.resolve(subgraphPath);
|
|
504
|
+
const ponderNetworks = [];
|
|
505
|
+
let ponderContracts = [];
|
|
506
|
+
const subgraphRootDirPath = import_node_path4.default.resolve(subgraphRootDir);
|
|
507
|
+
let subgraphYamlRaw = "";
|
|
508
|
+
for (const subgraphYamlFileName of subgraphYamlFileNames) {
|
|
509
|
+
try {
|
|
510
|
+
subgraphYamlRaw = (0, import_node_fs4.readFileSync)(
|
|
511
|
+
import_node_path4.default.join(subgraphRootDirPath, subgraphYamlFileName),
|
|
512
|
+
{
|
|
513
|
+
encoding: "utf-8"
|
|
514
|
+
}
|
|
515
|
+
);
|
|
516
|
+
break;
|
|
517
|
+
} catch (e) {
|
|
518
|
+
continue;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
if (subgraphYamlRaw === "") {
|
|
522
|
+
throw new Error(`subgraph.yaml file not found`);
|
|
523
|
+
}
|
|
524
|
+
const subgraphYaml = (0, import_yaml2.parse)(subgraphYamlRaw);
|
|
525
|
+
const subgraphSchemaFilePath = import_node_path4.default.join(
|
|
526
|
+
subgraphRootDirPath,
|
|
527
|
+
subgraphYaml.schema.file
|
|
528
|
+
);
|
|
529
|
+
const ponderSchemaFilePath = import_node_path4.default.join(rootDir, "schema.graphql");
|
|
530
|
+
(0, import_node_fs4.copyFileSync)(subgraphSchemaFilePath, ponderSchemaFilePath);
|
|
531
|
+
ponderContracts = subgraphYaml.dataSources.map(validateGraphProtocolSource).map((source) => {
|
|
532
|
+
const abiPath = source.mapping.abis.find(
|
|
533
|
+
(abi) => abi.name === source.name
|
|
534
|
+
)?.file;
|
|
535
|
+
if (!abiPath) {
|
|
536
|
+
throw new Error(`ABI path not found for source: ${source.name}`);
|
|
537
|
+
}
|
|
538
|
+
const network = source.network || "mainnet";
|
|
539
|
+
const chainId = getGraphProtocolChainId(network);
|
|
540
|
+
if (!chainId || chainId === -1) {
|
|
541
|
+
throw new Error(`Unhandled network name: ${network}`);
|
|
542
|
+
}
|
|
543
|
+
if (!ponderNetworks.map((n) => n.name).includes(network)) {
|
|
544
|
+
ponderNetworks.push({
|
|
545
|
+
name: network,
|
|
546
|
+
chainId,
|
|
547
|
+
rpcUrl: `process.env.PONDER_RPC_URL_${chainId}`
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
const abiAbsolutePath = import_node_path4.default.join(subgraphRootDirPath, abiPath);
|
|
551
|
+
const abiFileName = import_node_path4.default.basename(abiPath);
|
|
552
|
+
const ponderAbiRelativePath = `./abis/${abiFileName}`;
|
|
553
|
+
const ponderAbiAbsolutePath = import_node_path4.default.join(rootDir, ponderAbiRelativePath);
|
|
554
|
+
(0, import_node_fs4.copyFileSync)(abiAbsolutePath, ponderAbiAbsolutePath);
|
|
555
|
+
return {
|
|
556
|
+
name: source.name,
|
|
557
|
+
network,
|
|
558
|
+
address: source.source.address,
|
|
559
|
+
abi: ponderAbiRelativePath,
|
|
560
|
+
startBlock: source.source.startBlock
|
|
561
|
+
};
|
|
562
|
+
});
|
|
563
|
+
const ponderConfig = {
|
|
564
|
+
networks: ponderNetworks,
|
|
565
|
+
contracts: ponderContracts
|
|
566
|
+
};
|
|
567
|
+
return ponderConfig;
|
|
568
|
+
};
|
|
569
|
+
|
|
570
|
+
// src/index.ts
|
|
571
|
+
var run = async (options, overrides = {}) => {
|
|
572
|
+
const { rootDir } = options;
|
|
573
|
+
(0, import_node_fs5.mkdirSync)(import_node_path5.default.join(rootDir, "abis"), { recursive: true });
|
|
574
|
+
(0, import_node_fs5.mkdirSync)(import_node_path5.default.join(rootDir, "src"), { recursive: true });
|
|
575
|
+
let ponderConfig;
|
|
576
|
+
console.log(
|
|
577
|
+
`
|
|
578
|
+
Creating a new Ponder app in ${import_picocolors.default.bold(import_picocolors.default.green(rootDir))}.`
|
|
579
|
+
);
|
|
580
|
+
switch (options.template?.kind) {
|
|
581
|
+
case 1 /* ETHERSCAN */: {
|
|
582
|
+
console.log(`
|
|
583
|
+
Using ${import_picocolors.default.cyan("Etherscan contract link")} template.`);
|
|
584
|
+
ponderConfig = await fromEtherscan({
|
|
585
|
+
rootDir,
|
|
586
|
+
etherscanLink: options.template.link,
|
|
587
|
+
etherscanApiKey: options.etherscanApiKey
|
|
588
|
+
});
|
|
589
|
+
break;
|
|
590
|
+
}
|
|
591
|
+
case 2 /* SUBGRAPH_ID */: {
|
|
592
|
+
console.log(`
|
|
593
|
+
Using ${import_picocolors.default.cyan("Subgraph ID")} template.`);
|
|
594
|
+
ponderConfig = await fromSubgraphId({
|
|
595
|
+
rootDir,
|
|
596
|
+
subgraphId: options.template.id
|
|
597
|
+
});
|
|
598
|
+
break;
|
|
599
|
+
}
|
|
600
|
+
case 3 /* SUBGRAPH_REPO */: {
|
|
601
|
+
console.log(`
|
|
602
|
+
Using ${import_picocolors.default.cyan("Subgraph repository")} template.`);
|
|
603
|
+
ponderConfig = fromSubgraphRepo({
|
|
604
|
+
rootDir,
|
|
605
|
+
subgraphPath: options.template.path
|
|
606
|
+
});
|
|
607
|
+
break;
|
|
608
|
+
}
|
|
609
|
+
default: {
|
|
610
|
+
ponderConfig = fromBasic({ rootDir });
|
|
611
|
+
break;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
ponderConfig.contracts.forEach((contract) => {
|
|
615
|
+
const abi = (0, import_node_fs5.readFileSync)(import_node_path5.default.join(rootDir, contract.abi), {
|
|
616
|
+
encoding: "utf-8"
|
|
617
|
+
});
|
|
618
|
+
const abiInterface = new import_ethers.ethers.utils.Interface(abi);
|
|
619
|
+
const eventNames = Object.keys(abiInterface.events).map(
|
|
620
|
+
(signature) => signature.slice(0, signature.indexOf("("))
|
|
621
|
+
);
|
|
622
|
+
const eventNamesToWrite = eventNames.slice(0, 2);
|
|
623
|
+
const handlerFileContents = `
|
|
624
|
+
import { ponder } from '../generated'
|
|
625
|
+
|
|
626
|
+
${eventNamesToWrite.map(
|
|
627
|
+
(eventName) => `
|
|
628
|
+
ponder.on("${contract.name}:${eventName}", async ({ event, context }) => {
|
|
629
|
+
console.log(event.params)
|
|
630
|
+
})`
|
|
631
|
+
).join("\n")}
|
|
632
|
+
`;
|
|
633
|
+
(0, import_node_fs5.writeFileSync)(
|
|
634
|
+
import_node_path5.default.join(rootDir, `./src/${contract.name}.ts`),
|
|
635
|
+
import_prettier4.default.format(handlerFileContents, { parser: "typescript" })
|
|
636
|
+
);
|
|
637
|
+
});
|
|
638
|
+
const finalPonderConfig = `
|
|
639
|
+
import type { PonderConfig } from "@ponder/core";
|
|
640
|
+
|
|
641
|
+
export const config: PonderConfig = {
|
|
642
|
+
networks: ${JSON.stringify(ponderConfig.networks).replaceAll(
|
|
643
|
+
/"process.env.PONDER_RPC_URL_(.*?)"/g,
|
|
644
|
+
"process.env.PONDER_RPC_URL_$1"
|
|
645
|
+
)},
|
|
646
|
+
contracts: ${JSON.stringify(ponderConfig.contracts)},
|
|
647
|
+
};
|
|
648
|
+
`;
|
|
649
|
+
(0, import_node_fs5.writeFileSync)(
|
|
650
|
+
import_node_path5.default.join(rootDir, "ponder.config.ts"),
|
|
651
|
+
import_prettier4.default.format(finalPonderConfig, { parser: "babel" })
|
|
652
|
+
);
|
|
653
|
+
const uniqueChainIds = Array.from(
|
|
654
|
+
new Set(ponderConfig.networks.map((n) => n.chainId))
|
|
655
|
+
);
|
|
656
|
+
const envLocal = `${uniqueChainIds.map(
|
|
657
|
+
(chainId) => `PONDER_RPC_URL_${chainId}=""
|
|
658
|
+
`
|
|
659
|
+
)}`;
|
|
660
|
+
(0, import_node_fs5.writeFileSync)(import_node_path5.default.join(rootDir, ".env.local"), envLocal);
|
|
661
|
+
const packageJson = `
|
|
662
|
+
{
|
|
663
|
+
"private": true,
|
|
664
|
+
"scripts": {
|
|
665
|
+
"dev": "ponder dev",
|
|
666
|
+
"start": "ponder start",
|
|
667
|
+
"codegen": "ponder codegen"
|
|
668
|
+
},
|
|
669
|
+
"dependencies": {
|
|
670
|
+
"@ponder/core": "latest"
|
|
671
|
+
},
|
|
672
|
+
"devDependencies": {
|
|
673
|
+
"@types/node": "^18.11.18",
|
|
674
|
+
"ethers": "^5.6.9"
|
|
675
|
+
},
|
|
676
|
+
"engines": {
|
|
677
|
+
"node": ">=16.0.0 <19.0.0"
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
`;
|
|
681
|
+
(0, import_node_fs5.writeFileSync)(
|
|
682
|
+
import_node_path5.default.join(rootDir, "package.json"),
|
|
683
|
+
import_prettier4.default.format(packageJson, { parser: "json" })
|
|
684
|
+
);
|
|
685
|
+
const tsConfig = `
|
|
686
|
+
{
|
|
687
|
+
"compilerOptions": {
|
|
688
|
+
"target": "esnext",
|
|
689
|
+
"module": "esnext",
|
|
690
|
+
"esModuleInterop": true,
|
|
691
|
+
"strict": true,
|
|
692
|
+
"moduleResolution": "node"
|
|
693
|
+
},
|
|
694
|
+
"include": ["./**/*.ts"],
|
|
695
|
+
"exclude": ["node_modules"]
|
|
696
|
+
}
|
|
697
|
+
`;
|
|
698
|
+
(0, import_node_fs5.writeFileSync)(
|
|
699
|
+
import_node_path5.default.join(rootDir, "tsconfig.json"),
|
|
700
|
+
import_prettier4.default.format(tsConfig, { parser: "json" })
|
|
701
|
+
);
|
|
702
|
+
(0, import_node_fs5.writeFileSync)(
|
|
703
|
+
import_node_path5.default.join(rootDir, ".gitignore"),
|
|
704
|
+
`node_modules/
|
|
705
|
+
.DS_Store
|
|
706
|
+
|
|
707
|
+
.env.local
|
|
708
|
+
.ponder/
|
|
709
|
+
generated/`
|
|
710
|
+
);
|
|
711
|
+
const packageManager = await detect();
|
|
712
|
+
const runCommand = packageManager === "npm" ? `${packageManager} run` : packageManager;
|
|
713
|
+
console.log(import_picocolors.default.bold(`
|
|
714
|
+
Installing with ${packageManager}.`));
|
|
715
|
+
const installCommand = overrides.installCommand ? overrides.installCommand : `${packageManager} install`;
|
|
716
|
+
(0, import_node_child_process.execSync)(installCommand, {
|
|
717
|
+
cwd: rootDir,
|
|
718
|
+
stdio: "inherit"
|
|
719
|
+
});
|
|
720
|
+
process.chdir(rootDir);
|
|
721
|
+
tryGitInit(rootDir);
|
|
722
|
+
console.log(`
|
|
723
|
+
Initialized a git repository.`);
|
|
724
|
+
(0, import_node_child_process.execSync)(`${runCommand} --silent codegen --silent`, {
|
|
725
|
+
cwd: rootDir,
|
|
726
|
+
stdio: "inherit"
|
|
727
|
+
});
|
|
728
|
+
console.log(`
|
|
729
|
+
Generated types.`);
|
|
730
|
+
console.log(
|
|
731
|
+
import_picocolors.default.green("\nSuccess! ") + `Created ${options.projectName} at ${rootDir}`
|
|
732
|
+
);
|
|
733
|
+
};
|
|
734
|
+
|
|
735
|
+
// package.json
|
|
736
|
+
var package_default = {
|
|
737
|
+
name: "create-ponder",
|
|
738
|
+
version: "0.0.39",
|
|
739
|
+
description: "Tool to bootstrap a Ponder project",
|
|
740
|
+
license: "MIT",
|
|
741
|
+
author: "olias.eth",
|
|
742
|
+
files: [
|
|
743
|
+
"dist"
|
|
744
|
+
],
|
|
745
|
+
bin: {
|
|
746
|
+
"create-ponder": "dist/create-ponder.js"
|
|
747
|
+
},
|
|
748
|
+
scripts: {
|
|
749
|
+
build: "tsup-node",
|
|
750
|
+
test: "export $(grep -v '^#' .env.local | xargs) && vitest --no-threads",
|
|
751
|
+
"test:ci": "vitest --no-threads",
|
|
752
|
+
typecheck: "tsc --noEmit"
|
|
753
|
+
},
|
|
754
|
+
dependencies: {
|
|
755
|
+
"@ethersproject/abi": "^5.6.4",
|
|
756
|
+
"@ethersproject/providers": "^5.6.8",
|
|
757
|
+
cac: "^6.7.14",
|
|
758
|
+
ethers: "^5.6.9",
|
|
759
|
+
execa: "5",
|
|
760
|
+
"node-fetch": "^2.6.7",
|
|
761
|
+
picocolors: "^1.0.0",
|
|
762
|
+
prettier: "^2.6.2",
|
|
763
|
+
prompts: "^2.4.2",
|
|
764
|
+
rimraf: "^4.1.2",
|
|
765
|
+
yaml: "^2.1.1"
|
|
766
|
+
},
|
|
767
|
+
devDependencies: {
|
|
768
|
+
"@ponder/core": "workspace:*",
|
|
769
|
+
"@types/node": "^18.7.8",
|
|
770
|
+
"@types/node-fetch": "2",
|
|
771
|
+
"@types/prettier": "^2.7.1",
|
|
772
|
+
"@types/prompts": "^2.4.2",
|
|
773
|
+
"tsconfig-replace-paths": "^0.0.11",
|
|
774
|
+
tsup: "^6.6.3",
|
|
775
|
+
typescript: "^4.5.5",
|
|
776
|
+
vitest: "^0.29.2"
|
|
777
|
+
}
|
|
778
|
+
};
|
|
779
|
+
|
|
780
|
+
// src/bin/create-ponder.ts
|
|
781
|
+
var createPonder = async () => {
|
|
782
|
+
const cli = (0, import_cac.cac)(package_default.name).version(package_default.version).usage("[options]").help().option("--dir [path]", "Path to directory for generated project").option("--from-subgraph-id [id]", "Subgraph deployment ID").option("--from-subgraph-repo [path]", "Path to subgraph repository").option("--from-etherscan [url]", "Link to etherscan contract page").option("--etherscan-api-key [key]", "Etherscan API key");
|
|
783
|
+
const parsed = cli.parse(process.argv);
|
|
784
|
+
const options = parsed.options;
|
|
785
|
+
if (options.help) {
|
|
786
|
+
process.exit(0);
|
|
787
|
+
}
|
|
788
|
+
const { fromEtherscan: fromEtherscan2, fromSubgraphId: fromSubgraphId2, fromSubgraphRepo: fromSubgraphRepo2 } = options;
|
|
789
|
+
if (fromSubgraphId2 && fromSubgraphRepo2 || fromSubgraphId2 && fromEtherscan2 || fromSubgraphRepo2 && fromEtherscan2) {
|
|
790
|
+
throw new Error(
|
|
791
|
+
`Cannot specify more than one "--from" option:
|
|
792
|
+
--from-subgraph
|
|
793
|
+
--from-etherscan-id
|
|
794
|
+
--from-etherscan-repo`
|
|
795
|
+
);
|
|
796
|
+
}
|
|
797
|
+
const { projectName } = await (0, import_prompts.default)({
|
|
798
|
+
type: "text",
|
|
799
|
+
name: "projectName",
|
|
800
|
+
message: "What is your project named?",
|
|
801
|
+
initial: "my-app"
|
|
802
|
+
});
|
|
803
|
+
let template = void 0;
|
|
804
|
+
if (fromEtherscan2) {
|
|
805
|
+
template = { kind: 1 /* ETHERSCAN */, link: fromEtherscan2 };
|
|
806
|
+
}
|
|
807
|
+
if (fromSubgraphId2) {
|
|
808
|
+
template = { kind: 2 /* SUBGRAPH_ID */, id: fromSubgraphId2 };
|
|
809
|
+
}
|
|
810
|
+
if (fromSubgraphRepo2) {
|
|
811
|
+
template = { kind: 3 /* SUBGRAPH_REPO */, path: fromSubgraphRepo2 };
|
|
812
|
+
}
|
|
813
|
+
if (!fromSubgraphId2 && !fromSubgraphRepo2 && !fromEtherscan2) {
|
|
814
|
+
const { template: templateKind } = await (0, import_prompts.default)({
|
|
815
|
+
type: "select",
|
|
816
|
+
name: "template",
|
|
817
|
+
message: "Would you like to use a template for this project?",
|
|
818
|
+
choices: [
|
|
819
|
+
{ title: "None" },
|
|
820
|
+
{ title: "Etherscan contract link" },
|
|
821
|
+
{ title: "Subgraph ID" },
|
|
822
|
+
{ title: "Subgraph repository" }
|
|
823
|
+
]
|
|
824
|
+
});
|
|
825
|
+
if (templateKind === 1 /* ETHERSCAN */) {
|
|
826
|
+
const { link } = await (0, import_prompts.default)({
|
|
827
|
+
type: "text",
|
|
828
|
+
name: "link",
|
|
829
|
+
message: "Enter an Etherscan contract link",
|
|
830
|
+
initial: "https://etherscan.io/address/0x97..."
|
|
831
|
+
});
|
|
832
|
+
template = { kind: 1 /* ETHERSCAN */, link };
|
|
833
|
+
}
|
|
834
|
+
if (templateKind === 2 /* SUBGRAPH_ID */) {
|
|
835
|
+
const { id } = await (0, import_prompts.default)({
|
|
836
|
+
type: "text",
|
|
837
|
+
name: "id",
|
|
838
|
+
message: "Enter a subgraph deployment ID",
|
|
839
|
+
initial: "QmNus..."
|
|
840
|
+
});
|
|
841
|
+
template = { kind: 2 /* SUBGRAPH_ID */, id };
|
|
842
|
+
}
|
|
843
|
+
if (templateKind === 3 /* SUBGRAPH_REPO */) {
|
|
844
|
+
const { path: path8 } = await (0, import_prompts.default)({
|
|
845
|
+
type: "text",
|
|
846
|
+
name: "path",
|
|
847
|
+
message: "Enter a path to a subgraph repository",
|
|
848
|
+
initial: "../subgraph"
|
|
849
|
+
});
|
|
850
|
+
template = { kind: 3 /* SUBGRAPH_REPO */, path: path8 };
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
const validatedOptions = {
|
|
854
|
+
projectName,
|
|
855
|
+
rootDir: import_node_path6.default.resolve(".", options.dir ? options.dir : projectName),
|
|
856
|
+
template,
|
|
857
|
+
etherscanApiKey: options.etherscanApiKey
|
|
858
|
+
};
|
|
859
|
+
await run(validatedOptions);
|
|
860
|
+
};
|
|
861
|
+
createPonder();
|
|
862
|
+
//# sourceMappingURL=create-ponder.js.map
|