create-ponder 0.0.11 → 0.0.13
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.
|
@@ -2,20 +2,66 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getNetworkByEtherscanHostname = void 0;
|
|
4
4
|
const networkByEtherscanHostname = {
|
|
5
|
-
"etherscan.io": {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
5
|
+
"etherscan.io": {
|
|
6
|
+
name: "mainnet",
|
|
7
|
+
chainId: 1,
|
|
8
|
+
apiUrl: "https://api.etherscan.io/api",
|
|
9
|
+
},
|
|
10
|
+
"ropsten.etherscan.io": {
|
|
11
|
+
name: "ropsten",
|
|
12
|
+
chainId: 3,
|
|
13
|
+
apiUrl: "https://api-ropsten.etherscan.io//api",
|
|
14
|
+
},
|
|
15
|
+
"rinkeby.etherscan.io": {
|
|
16
|
+
name: "rinkeby",
|
|
17
|
+
chainId: 4,
|
|
18
|
+
apiUrl: "https://api-rinkeby.etherscan.io/api",
|
|
19
|
+
},
|
|
20
|
+
"goerli.etherscan.io": {
|
|
21
|
+
name: "goerli",
|
|
22
|
+
chainId: 5,
|
|
23
|
+
apiUrl: "https://api-goerli.etherscan.io/api",
|
|
24
|
+
},
|
|
25
|
+
"kovan.etherscan.io": {
|
|
26
|
+
name: "kovan",
|
|
27
|
+
chainId: 42,
|
|
28
|
+
apiUrl: "https://api-kovan.etherscan.io/api",
|
|
29
|
+
},
|
|
30
|
+
"sepolia.etherscan.io": {
|
|
31
|
+
name: "sepolia",
|
|
32
|
+
chainId: 11155111,
|
|
33
|
+
apiUrl: "https://api-sepolia.etherscan.io/api",
|
|
34
|
+
},
|
|
35
|
+
"optimistic.etherscan.io": {
|
|
36
|
+
name: "optimism",
|
|
37
|
+
chainId: 10,
|
|
38
|
+
apiUrl: "https://api-optimistic.etherscan.io/api",
|
|
39
|
+
},
|
|
40
|
+
"goerli-optimism.etherscan.io": {
|
|
41
|
+
name: "optimism-goerli",
|
|
42
|
+
chainId: 420,
|
|
43
|
+
apiUrl: "https://api-goerli-optimistic.etherscan.io/api",
|
|
44
|
+
},
|
|
45
|
+
"polygonscan.com": {
|
|
46
|
+
name: "polygon",
|
|
47
|
+
chainId: 137,
|
|
48
|
+
apiUrl: "https://api.polygonscan.com/api",
|
|
49
|
+
},
|
|
50
|
+
"mumbai.polygonscan.com": {
|
|
51
|
+
name: "polygon-mumbai",
|
|
52
|
+
chainId: 80001,
|
|
53
|
+
apiUrl: "https://api-testnet.polygonscan.com/api",
|
|
54
|
+
},
|
|
55
|
+
"arbiscan.io": {
|
|
56
|
+
name: "arbitrum",
|
|
57
|
+
chainId: 42161,
|
|
58
|
+
apiUrl: "https://api.arbiscan.io/api",
|
|
59
|
+
},
|
|
60
|
+
"goerli.arbiscan.io": {
|
|
61
|
+
name: "arbitrum-goerli",
|
|
62
|
+
chainId: 421613,
|
|
63
|
+
apiUrl: "https://api-goerli.arbiscan.io/api",
|
|
64
|
+
},
|
|
19
65
|
};
|
|
20
66
|
const getNetworkByEtherscanHostname = (hostname) => {
|
|
21
67
|
return networkByEtherscanHostname[hostname];
|
package/dist/src/index.js
CHANGED
|
@@ -73,23 +73,18 @@ const run = async (options, overrides = {}) => {
|
|
|
73
73
|
}
|
|
74
74
|
`;
|
|
75
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.
|
|
77
|
-
const finalPonderConfig = `
|
|
76
|
+
// Write the ponder.ts file.
|
|
77
|
+
const finalPonderConfig = `
|
|
78
|
+
import type { PonderConfig } from "@ponder/core";
|
|
79
|
+
import { graphqlPlugin } from "@ponder/graphql";
|
|
78
80
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
},
|
|
87
|
-
networks: ${JSON.stringify(ponderConfig.networks).replaceAll(/"process.env.PONDER_RPC_URL_(.*?)"/g, "process.env.PONDER_RPC_URL_$1")},
|
|
88
|
-
sources: ${JSON.stringify(ponderConfig.sources)},
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
module.exports = ponderConfig;`;
|
|
92
|
-
(0, node_fs_1.writeFileSync)(node_path_1.default.join(ponderRootDir, "ponder.config.js"), prettier_1.default.format(finalPonderConfig, { parser: "babel" }));
|
|
81
|
+
export const config: PonderConfig = {
|
|
82
|
+
plugins: [graphqlPlugin()],
|
|
83
|
+
networks: ${JSON.stringify(ponderConfig.networks).replaceAll(/"process.env.PONDER_RPC_URL_(.*?)"/g, "process.env.PONDER_RPC_URL_$1")},
|
|
84
|
+
sources: ${JSON.stringify(ponderConfig.sources)},
|
|
85
|
+
};
|
|
86
|
+
`;
|
|
87
|
+
(0, node_fs_1.writeFileSync)(node_path_1.default.join(ponderRootDir, "ponder.ts"), prettier_1.default.format(finalPonderConfig, { parser: "babel" }));
|
|
93
88
|
// Write the .env.local file.
|
|
94
89
|
const uniqueChainIds = Array.from(new Set(ponderConfig.networks.map((n) => n.chainId)));
|
|
95
90
|
const envLocal = `${uniqueChainIds.map((chainId) => `PONDER_RPC_URL_${chainId}=""\n`)}`;
|
|
@@ -22,7 +22,7 @@ const fromEtherscan = async (options) => {
|
|
|
22
22
|
if (!network) {
|
|
23
23
|
throw new Error(`Unrecognized etherscan hostname: ${url.hostname}`);
|
|
24
24
|
}
|
|
25
|
-
const apiUrl =
|
|
25
|
+
const { name, chainId, apiUrl } = network;
|
|
26
26
|
const contractAddress = url.pathname.slice(1).split("/")[1];
|
|
27
27
|
const txHash = await getContractCreationTxn(contractAddress, apiUrl, apiKey);
|
|
28
28
|
if (!apiKey) {
|
|
@@ -56,15 +56,15 @@ const fromEtherscan = async (options) => {
|
|
|
56
56
|
},
|
|
57
57
|
networks: [
|
|
58
58
|
{
|
|
59
|
-
name:
|
|
60
|
-
chainId:
|
|
61
|
-
rpcUrl: `process.env.PONDER_RPC_URL_${
|
|
59
|
+
name: name,
|
|
60
|
+
chainId: chainId,
|
|
61
|
+
rpcUrl: `process.env.PONDER_RPC_URL_${chainId}`,
|
|
62
62
|
},
|
|
63
63
|
],
|
|
64
64
|
sources: [
|
|
65
65
|
{
|
|
66
66
|
name: contractName,
|
|
67
|
-
network:
|
|
67
|
+
network: name,
|
|
68
68
|
abi: abiRelativePath,
|
|
69
69
|
address: contractAddress,
|
|
70
70
|
startBlock: blockNumber,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-ponder",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"description": "Tool to bootstrap a Ponder project",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "olias.eth",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"jest": "^29.3.1",
|
|
30
30
|
"tsconfig-replace-paths": "^0.0.11",
|
|
31
31
|
"typescript": "^4.5.5",
|
|
32
|
-
"@ponder/core": "0.0.
|
|
32
|
+
"@ponder/core": "0.0.24"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "rm -rf dist && tsc && tsconfig-replace-paths --src . && mv dist/src/bin/create-ponder.js dist/src/bin/create-ponder",
|