create-ponder 0.0.77 → 0.0.79

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.
Files changed (72) hide show
  1. package/LICENSE +1 -1
  2. package/dist/bin/create-ponder.d.ts +3 -0
  3. package/dist/bin/create-ponder.d.ts.map +1 -0
  4. package/dist/bin/create-ponder.js +105 -0
  5. package/dist/bin/create-ponder.js.map +1 -0
  6. package/dist/common.d.ts +23 -0
  7. package/dist/common.d.ts.map +1 -0
  8. package/dist/common.js +11 -0
  9. package/dist/common.js.map +1 -0
  10. package/dist/helpers/getEtherscanChainId.d.ts +6 -0
  11. package/dist/helpers/getEtherscanChainId.d.ts.map +1 -0
  12. package/dist/helpers/getEtherscanChainId.js +75 -0
  13. package/dist/helpers/getEtherscanChainId.js.map +1 -0
  14. package/dist/helpers/getGraphProtocolChainId.d.ts +3 -0
  15. package/dist/helpers/getGraphProtocolChainId.d.ts.map +1 -0
  16. package/dist/helpers/getGraphProtocolChainId.js +42 -0
  17. package/dist/helpers/getGraphProtocolChainId.js.map +1 -0
  18. package/dist/helpers/getPackageManager.d.ts +2 -0
  19. package/dist/helpers/getPackageManager.d.ts.map +1 -0
  20. package/dist/helpers/getPackageManager.js +18 -0
  21. package/dist/helpers/getPackageManager.js.map +1 -0
  22. package/dist/helpers/git.d.ts +2 -0
  23. package/dist/helpers/git.d.ts.map +1 -0
  24. package/dist/helpers/git.js +56 -0
  25. package/dist/helpers/git.js.map +1 -0
  26. package/dist/helpers/validateGraphProtocolSource.d.ts +28 -0
  27. package/dist/helpers/validateGraphProtocolSource.d.ts.map +1 -0
  28. package/dist/helpers/validateGraphProtocolSource.js +8 -0
  29. package/dist/helpers/validateGraphProtocolSource.js.map +1 -0
  30. package/dist/helpers/wait.d.ts +2 -0
  31. package/dist/helpers/wait.d.ts.map +1 -0
  32. package/dist/helpers/wait.js +6 -0
  33. package/dist/helpers/wait.js.map +1 -0
  34. package/dist/index.d.ts +24 -0
  35. package/dist/index.d.ts.map +1 -0
  36. package/dist/index.js +168 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/templates/basic.d.ts +5 -0
  39. package/dist/templates/basic.d.ts.map +1 -0
  40. package/dist/templates/basic.js +57 -0
  41. package/dist/templates/basic.js.map +1 -0
  42. package/dist/templates/etherscan.d.ts +7 -0
  43. package/dist/templates/etherscan.d.ts.map +1 -0
  44. package/dist/templates/etherscan.js +199 -0
  45. package/dist/templates/etherscan.js.map +1 -0
  46. package/dist/templates/subgraphId.d.ts +6 -0
  47. package/dist/templates/subgraphId.d.ts.map +1 -0
  48. package/dist/templates/subgraphId.js +76 -0
  49. package/dist/templates/subgraphId.js.map +1 -0
  50. package/dist/templates/subgraphRepo.d.ts +6 -0
  51. package/dist/templates/subgraphRepo.d.ts.map +1 -0
  52. package/dist/templates/subgraphRepo.js +86 -0
  53. package/dist/templates/subgraphRepo.js.map +1 -0
  54. package/package.json +15 -11
  55. package/src/bin/create-ponder.ts +127 -0
  56. package/src/common.ts +27 -0
  57. package/src/helpers/getEtherscanChainId.ts +74 -0
  58. package/src/helpers/getGraphProtocolChainId.ts +41 -0
  59. package/src/helpers/getPackageManager.ts +11 -0
  60. package/src/helpers/git.ts +51 -0
  61. package/src/helpers/validateGraphProtocolSource.ts +42 -0
  62. package/src/helpers/wait.ts +2 -0
  63. package/src/index.ts +244 -0
  64. package/src/templates/basic.ts +60 -0
  65. package/src/templates/etherscan.ts +276 -0
  66. package/src/templates/subgraphId.ts +97 -0
  67. package/src/templates/subgraphRepo.ts +116 -0
  68. package/dist/create-ponder.d.ts +0 -1
  69. package/dist/create-ponder.js +0 -937
  70. package/dist/create-ponder.js.map +0 -1
  71. package/dist/create-ponder.mjs +0 -914
  72. package/dist/create-ponder.mjs.map +0 -1
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 olias.eth
3
+ Copyright (c) 2023 Cantrip, Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=create-ponder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-ponder.d.ts","sourceRoot":"","sources":["../../src/bin/create-ponder.ts"],"names":[],"mappings":""}
@@ -0,0 +1,105 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const cac_1 = require("cac");
8
+ const node_path_1 = __importDefault(require("node:path"));
9
+ const prompts_1 = __importDefault(require("prompts"));
10
+ const common_1 = require("../common");
11
+ const index_1 = require("../index");
12
+ // NOTE: This is a workaround for tsconfig `rootDir` nonsense.
13
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
14
+ // @ts-ignore
15
+ const package_json_1 = __importDefault(require("../../package.json"));
16
+ const createPonder = async () => {
17
+ const cli = (0, cac_1.cac)(package_json_1.default.name)
18
+ .version(package_json_1.default.version)
19
+ .usage("[options]")
20
+ .help()
21
+ .option("--dir [path]", "Path to directory for generated project")
22
+ .option("--from-subgraph-id [id]", "Subgraph deployment ID")
23
+ .option("--from-subgraph-repo [path]", "Path to subgraph repository")
24
+ .option("--from-etherscan [url]", "Link to etherscan contract page")
25
+ .option("--etherscan-api-key [key]", "Etherscan API key");
26
+ const parsed = cli.parse(process.argv);
27
+ const options = parsed.options;
28
+ if (options.help) {
29
+ process.exit(0);
30
+ }
31
+ const { fromEtherscan, fromSubgraphId, fromSubgraphRepo } = options;
32
+ // Validate CLI options.
33
+ if ((fromSubgraphId && fromSubgraphRepo) ||
34
+ (fromSubgraphId && fromEtherscan) ||
35
+ (fromSubgraphRepo && fromEtherscan)) {
36
+ throw new Error(`Cannot specify more than one "--from" option:\n --from-subgraph\n --from-etherscan-id\n --from-etherscan-repo`);
37
+ }
38
+ const { projectName } = await (0, prompts_1.default)({
39
+ type: "text",
40
+ name: "projectName",
41
+ message: "What is your project named?",
42
+ initial: "my-app",
43
+ });
44
+ // Get template from options if provided.
45
+ let template = undefined;
46
+ if (fromEtherscan) {
47
+ template = { kind: common_1.TemplateKind.ETHERSCAN, link: fromEtherscan };
48
+ }
49
+ if (fromSubgraphId) {
50
+ template = { kind: common_1.TemplateKind.SUBGRAPH_ID, id: fromSubgraphId };
51
+ }
52
+ if (fromSubgraphRepo) {
53
+ template = { kind: common_1.TemplateKind.SUBGRAPH_REPO, path: fromSubgraphRepo };
54
+ }
55
+ // Get template from prompts if not provided.
56
+ if (!fromSubgraphId && !fromSubgraphRepo && !fromEtherscan) {
57
+ const { template: templateKind } = await (0, prompts_1.default)({
58
+ type: "select",
59
+ name: "template",
60
+ message: "Would you like to use a template for this project?",
61
+ choices: [
62
+ { title: "None" },
63
+ { title: "Etherscan contract link" },
64
+ { title: "Subgraph ID" },
65
+ { title: "Subgraph repository" },
66
+ ],
67
+ });
68
+ if (templateKind === common_1.TemplateKind.ETHERSCAN) {
69
+ const { link } = await (0, prompts_1.default)({
70
+ type: "text",
71
+ name: "link",
72
+ message: "Enter an Etherscan contract link",
73
+ initial: "https://etherscan.io/address/0x97...",
74
+ });
75
+ template = { kind: common_1.TemplateKind.ETHERSCAN, link };
76
+ }
77
+ if (templateKind === common_1.TemplateKind.SUBGRAPH_ID) {
78
+ const { id } = await (0, prompts_1.default)({
79
+ type: "text",
80
+ name: "id",
81
+ message: "Enter a subgraph deployment ID",
82
+ initial: "QmNus...",
83
+ });
84
+ template = { kind: common_1.TemplateKind.SUBGRAPH_ID, id };
85
+ }
86
+ if (templateKind === common_1.TemplateKind.SUBGRAPH_REPO) {
87
+ const { path } = await (0, prompts_1.default)({
88
+ type: "text",
89
+ name: "path",
90
+ message: "Enter a path to a subgraph repository",
91
+ initial: "../subgraph",
92
+ });
93
+ template = { kind: common_1.TemplateKind.SUBGRAPH_REPO, path };
94
+ }
95
+ }
96
+ const validatedOptions = {
97
+ projectName,
98
+ rootDir: node_path_1.default.resolve(".", options.dir ? options.dir : projectName),
99
+ template,
100
+ etherscanApiKey: options.etherscanApiKey,
101
+ };
102
+ await (0, index_1.run)(validatedOptions);
103
+ };
104
+ createPonder();
105
+ //# sourceMappingURL=create-ponder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-ponder.js","sourceRoot":"","sources":["../../src/bin/create-ponder.ts"],"names":[],"mappings":";;;;;;AACA,6BAA0B;AAC1B,0DAA6B;AAC7B,sDAA8B;AAE9B,qCAAuE;AACvE,mCAA8B;AAE9B,8DAA8D;AAC9D,6DAA6D;AAC7D,aAAa;AACb,sEAA6C;AAE7C,MAAM,YAAY,GAAG,KAAK,IAAI,EAAE;IAC9B,MAAM,GAAG,GAAG,IAAA,SAAG,EAAC,sBAAW,CAAC,IAAI,CAAC;SAC9B,OAAO,CAAC,sBAAW,CAAC,OAAO,CAAC;SAC5B,KAAK,CAAC,WAAW,CAAC;SAClB,IAAI,EAAE;SACN,MAAM,CAAC,cAAc,EAAE,yCAAyC,CAAC;SACjE,MAAM,CAAC,yBAAyB,EAAE,wBAAwB,CAAC;SAC3D,MAAM,CAAC,6BAA6B,EAAE,6BAA6B,CAAC;SACpE,MAAM,CAAC,wBAAwB,EAAE,iCAAiC,CAAC;SACnE,MAAM,CAAC,2BAA2B,EAAE,mBAAmB,CAAC,CAAC;IAE5D,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvC,MAAM,OAAO,GAAG,MAAM,CAAC,OAOtB,CAAC;IAEF,IAAI,OAAO,CAAC,IAAI,EAAE;QAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;IAED,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC;IAEpE,wBAAwB;IACxB,IACE,CAAC,cAAc,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,YAAY,EAAE,CAAC"}
@@ -0,0 +1,23 @@
1
+ export declare enum TemplateKind {
2
+ NONE = 0,
3
+ ETHERSCAN = 1,
4
+ SUBGRAPH_ID = 2,
5
+ SUBGRAPH_REPO = 3
6
+ }
7
+ export type Template = {
8
+ kind: TemplateKind.ETHERSCAN;
9
+ link: string;
10
+ } | {
11
+ kind: TemplateKind.SUBGRAPH_ID;
12
+ id: string;
13
+ } | {
14
+ kind: TemplateKind.SUBGRAPH_REPO;
15
+ path: string;
16
+ };
17
+ export interface CreatePonderOptions {
18
+ rootDir: string;
19
+ projectName: string;
20
+ template?: Template;
21
+ etherscanApiKey?: string;
22
+ }
23
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,oBAAY,YAAY;IACtB,IAAI,IAAA;IACJ,SAAS,IAAA;IACT,WAAW,IAAA;IACX,aAAa,IAAA;CACd;AAED,MAAM,MAAM,QAAQ,GAChB;IACE,IAAI,EAAE,YAAY,CAAC,SAAS,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;CACd,GACD;IACE,IAAI,EAAE,YAAY,CAAC,WAAW,CAAC;IAC/B,EAAE,EAAE,MAAM,CAAC;CACZ,GACD;IACE,IAAI,EAAE,YAAY,CAAC,aAAa,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEN,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B"}
package/dist/common.js ADDED
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TemplateKind = void 0;
4
+ var TemplateKind;
5
+ (function (TemplateKind) {
6
+ TemplateKind[TemplateKind["NONE"] = 0] = "NONE";
7
+ TemplateKind[TemplateKind["ETHERSCAN"] = 1] = "ETHERSCAN";
8
+ TemplateKind[TemplateKind["SUBGRAPH_ID"] = 2] = "SUBGRAPH_ID";
9
+ TemplateKind[TemplateKind["SUBGRAPH_REPO"] = 3] = "SUBGRAPH_REPO";
10
+ })(TemplateKind || (exports.TemplateKind = TemplateKind = {}));
11
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":";;;AAAA,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,+CAAI,CAAA;IACJ,yDAAS,CAAA;IACT,6DAAW,CAAA;IACX,iEAAa,CAAA;AACf,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB"}
@@ -0,0 +1,6 @@
1
+ export declare const getNetworkByEtherscanHostname: (hostname: string) => {
2
+ name: string;
3
+ chainId: number;
4
+ apiUrl: string;
5
+ } | undefined;
6
+ //# sourceMappingURL=getEtherscanChainId.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getEtherscanChainId.d.ts","sourceRoot":"","sources":["../../src/helpers/getEtherscanChainId.ts"],"names":[],"mappings":"AAuEA,eAAO,MAAM,6BAA6B,aAAc,MAAM;UArEpD,MAAM;aAAW,MAAM;YAAU,MAAM;aAuEhD,CAAC"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getNetworkByEtherscanHostname = void 0;
4
+ const networkByEtherscanHostname = {
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
+ },
65
+ "explorer.zora.energy": {
66
+ name: "zora",
67
+ chainId: 7777777,
68
+ apiUrl: "https://explorer.zora.energy/api",
69
+ },
70
+ };
71
+ const getNetworkByEtherscanHostname = (hostname) => {
72
+ return networkByEtherscanHostname[hostname];
73
+ };
74
+ exports.getNetworkByEtherscanHostname = getNetworkByEtherscanHostname;
75
+ //# sourceMappingURL=getEtherscanChainId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getEtherscanChainId.js","sourceRoot":"","sources":["../../src/helpers/getEtherscanChainId.ts"],"names":[],"mappings":";;;AAAA,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QACtB,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,OAAO;QAChB,MAAM,EAAE,kCAAkC;KAC3C;CACF,CAAC;AAEK,MAAM,6BAA6B,GAAG,CAAC,QAAgB,EAAE,EAAE;IAChE,OAAO,0BAA0B,CAAC,QAAQ,CAAC,CAAC;AAC9C,CAAC,CAAC;AAFW,QAAA,6BAA6B,iCAExC"}
@@ -0,0 +1,3 @@
1
+ export declare const getGraphProtocolChainId: (networkName: string) => number | undefined;
2
+ export declare const subgraphYamlFileNames: string[];
3
+ //# sourceMappingURL=getGraphProtocolChainId.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getGraphProtocolChainId.d.ts","sourceRoot":"","sources":["../../src/helpers/getGraphProtocolChainId.ts"],"names":[],"mappings":"AAkCA,eAAO,MAAM,uBAAuB,gBAAiB,MAAM,uBAE1D,CAAC;AAEF,eAAO,MAAM,qBAAqB,UAEjC,CAAC"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.subgraphYamlFileNames = exports.getGraphProtocolChainId = void 0;
4
+ // https://github.com/graphprotocol/graph-cli/blob/main/src/protocols/index.js#L40
5
+ // https://chainlist.org/
6
+ const chainIdByGraphNetwork = {
7
+ mainnet: 1,
8
+ kovan: 42,
9
+ rinkeby: 4,
10
+ ropsten: 3,
11
+ goerli: 5,
12
+ "poa-core": 99,
13
+ "poa-sokol": 77,
14
+ xdai: 100,
15
+ matic: 137,
16
+ mumbai: 80001,
17
+ fantom: 250,
18
+ "fantom-testnet": 4002,
19
+ bsc: 56,
20
+ chapel: -1,
21
+ clover: 0,
22
+ avalanche: 43114,
23
+ fuji: 43113,
24
+ celo: 42220,
25
+ "celo-alfajores": 44787,
26
+ fuse: 122,
27
+ moonbeam: 1284,
28
+ moonriver: 1285,
29
+ mbase: -1,
30
+ "arbitrum-one": 42161,
31
+ "arbitrum-rinkeby": 421611,
32
+ optimism: 10,
33
+ "optimism-kovan": 69,
34
+ aurora: 1313161554,
35
+ "aurora-testnet": 1313161555,
36
+ };
37
+ const getGraphProtocolChainId = (networkName) => {
38
+ return chainIdByGraphNetwork[networkName];
39
+ };
40
+ exports.getGraphProtocolChainId = getGraphProtocolChainId;
41
+ exports.subgraphYamlFileNames = ["subgraph.yaml"].concat(Object.keys(chainIdByGraphNetwork).map((n) => `subgraph-${n}.yaml`));
42
+ //# sourceMappingURL=getGraphProtocolChainId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getGraphProtocolChainId.js","sourceRoot":"","sources":["../../src/helpers/getGraphProtocolChainId.ts"],"names":[],"mappings":";;;AAAA,kFAAkF;AAClF,yBAAyB;AACzB,MAAM,qBAAqB,GAAuC;IAChE,OAAO,EAAE,CAAC;IACV,KAAK,EAAE,EAAE;IACT,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,CAAC;IACT,UAAU,EAAE,EAAE;IACd,WAAW,EAAE,EAAE;IACf,IAAI,EAAE,GAAG;IACT,KAAK,EAAE,GAAG;IACV,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,GAAG;IACX,gBAAgB,EAAE,IAAI;IACtB,GAAG,EAAE,EAAE;IACP,MAAM,EAAE,CAAC,CAAC;IACV,MAAM,EAAE,CAAC;IACT,SAAS,EAAE,KAAK;IAChB,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,gBAAgB,EAAE,KAAK;IACvB,IAAI,EAAE,GAAG;IACT,QAAQ,EAAE,IAAI;IACd,SAAS,EAAE,IAAI;IACf,KAAK,EAAE,CAAC,CAAC;IACT,cAAc,EAAE,KAAK;IACrB,kBAAkB,EAAE,MAAM;IAC1B,QAAQ,EAAE,EAAE;IACZ,gBAAgB,EAAE,EAAE;IACpB,MAAM,EAAE,UAAU;IAClB,gBAAgB,EAAE,UAAU;CAC7B,CAAC;AAEK,MAAM,uBAAuB,GAAG,CAAC,WAAmB,EAAE,EAAE;IAC7D,OAAO,qBAAqB,CAAC,WAAW,CAAC,CAAC;AAC5C,CAAC,CAAC;AAFW,QAAA,uBAAuB,2BAElC;AAEW,QAAA,qBAAqB,GAAG,CAAC,eAAe,CAAC,CAAC,MAAM,CAC3D,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CACpE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function getPackageManager(): "pnpm" | "npm" | "yarn" | Promise<import("detect-package-manager").PM>;
2
+ //# sourceMappingURL=getPackageManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPackageManager.d.ts","sourceRoot":"","sources":["../../src/helpers/getPackageManager.ts"],"names":[],"mappings":"AAEA,wBAAgB,iBAAiB,2EAQhC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPackageManager = void 0;
4
+ const detect_package_manager_1 = require("detect-package-manager");
5
+ function getPackageManager() {
6
+ const userAgent = process.env.npm_config_user_agent;
7
+ if (userAgent) {
8
+ if (userAgent.includes("pnpm"))
9
+ return "pnpm";
10
+ if (userAgent.includes("npm"))
11
+ return "npm";
12
+ if (userAgent.includes("yarn"))
13
+ return "yarn";
14
+ }
15
+ return (0, detect_package_manager_1.detect)();
16
+ }
17
+ exports.getPackageManager = getPackageManager;
18
+ //# sourceMappingURL=getPackageManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPackageManager.js","sourceRoot":"","sources":["../../src/helpers/getPackageManager.ts"],"names":[],"mappings":";;;AAAA,mEAAgD;AAEhD,SAAgB,iBAAiB;IAC/B,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC;IACpD,IAAI,SAAS,EAAE;QACb,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE,OAAO,MAAM,CAAC;QAC9C,IAAI,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;QAC5C,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE,OAAO,MAAM,CAAC;KAC/C;IACD,OAAO,IAAA,+BAAM,GAAE,CAAC;AAClB,CAAC;AARD,8CAQC"}
@@ -0,0 +1,2 @@
1
+ export declare function tryGitInit(root: string): boolean;
2
+ //# sourceMappingURL=git.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/helpers/git.ts"],"names":[],"mappings":"AAwBA,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CA0BhD"}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.tryGitInit = void 0;
7
+ /* eslint-disable no-empty */
8
+ const child_process_1 = require("child_process");
9
+ const path_1 = __importDefault(require("path"));
10
+ const rimraf_1 = __importDefault(require("rimraf"));
11
+ // File adapted from next.js
12
+ // https://github.dev/vercel/next.js/blob/9ad1f321b7902542acd2be041fb2f15f023a0ed9/packages/create-next-app/helpers/git.ts
13
+ function isInGitRepository() {
14
+ try {
15
+ (0, child_process_1.execSync)("git rev-parse --is-inside-work-tree", { stdio: "ignore" });
16
+ return true;
17
+ }
18
+ catch (_) { }
19
+ return false;
20
+ }
21
+ function isInMercurialRepository() {
22
+ try {
23
+ (0, child_process_1.execSync)("hg --cwd . root", { stdio: "ignore" });
24
+ return true;
25
+ }
26
+ catch (_) { }
27
+ return false;
28
+ }
29
+ function tryGitInit(root) {
30
+ let didInit = false;
31
+ try {
32
+ (0, child_process_1.execSync)("git --version", { stdio: "ignore" });
33
+ if (isInGitRepository() || isInMercurialRepository()) {
34
+ return false;
35
+ }
36
+ (0, child_process_1.execSync)("git init", { stdio: "ignore" });
37
+ didInit = true;
38
+ (0, child_process_1.execSync)("git checkout -b main", { stdio: "ignore" });
39
+ (0, child_process_1.execSync)("git add -A", { stdio: "ignore" });
40
+ (0, child_process_1.execSync)('git commit -m "chore: initial commit from create-ponder"', {
41
+ stdio: "ignore",
42
+ });
43
+ return true;
44
+ }
45
+ catch (e) {
46
+ if (didInit) {
47
+ try {
48
+ rimraf_1.default.sync(path_1.default.join(root, ".git"));
49
+ }
50
+ catch (_) { }
51
+ }
52
+ return false;
53
+ }
54
+ }
55
+ exports.tryGitInit = tryGitInit;
56
+ //# sourceMappingURL=git.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/helpers/git.ts"],"names":[],"mappings":";;;;;;AAAA,6BAA6B;AAC7B,iDAAyC;AACzC,gDAAwB;AACxB,oDAA4B;AAE5B,4BAA4B;AAC5B,0HAA0H;AAE1H,SAAS,iBAAiB;IACxB,IAAI;QACF,IAAA,wBAAQ,EAAC,qCAAqC,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QACrE,OAAO,IAAI,CAAC;KACb;IAAC,OAAO,CAAC,EAAE,GAAE;IACd,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,uBAAuB;IAC9B,IAAI;QACF,IAAA,wBAAQ,EAAC,iBAAiB,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QACjD,OAAO,IAAI,CAAC;KACb;IAAC,OAAO,CAAC,EAAE,GAAE;IACd,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAgB,UAAU,CAAC,IAAY;IACrC,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,IAAI;QACF,IAAA,wBAAQ,EAAC,eAAe,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC/C,IAAI,iBAAiB,EAAE,IAAI,uBAAuB,EAAE,EAAE;YACpD,OAAO,KAAK,CAAC;SACd;QAED,IAAA,wBAAQ,EAAC,UAAU,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC1C,OAAO,GAAG,IAAI,CAAC;QAEf,IAAA,wBAAQ,EAAC,sBAAsB,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QAEtD,IAAA,wBAAQ,EAAC,YAAY,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC5C,IAAA,wBAAQ,EAAC,0DAA0D,EAAE;YACnE,KAAK,EAAE,QAAQ;SAChB,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;KACb;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,OAAO,EAAE;YACX,IAAI;gBACF,gBAAM,CAAC,IAAI,CAAC,cAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;aACtC;YAAC,OAAO,CAAC,EAAE,GAAE;SACf;QACD,OAAO,KAAK,CAAC;KACd;AACH,CAAC;AA1BD,gCA0BC"}
@@ -0,0 +1,28 @@
1
+ export type GraphSource = {
2
+ kind: string;
3
+ name: string;
4
+ network: string;
5
+ source: {
6
+ address: string;
7
+ abi: string;
8
+ startBlock?: number;
9
+ };
10
+ mapping: {
11
+ kind: string;
12
+ apiVersion: string;
13
+ language: string;
14
+ entities: string[];
15
+ abis: {
16
+ name: string;
17
+ file: any;
18
+ }[];
19
+ eventHandlers?: {
20
+ event: string;
21
+ handler: string;
22
+ topic0?: string;
23
+ }[];
24
+ file: string;
25
+ };
26
+ };
27
+ export declare const validateGraphProtocolSource: (source: unknown) => GraphSource;
28
+ //# sourceMappingURL=validateGraphProtocolSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateGraphProtocolSource.d.ts","sourceRoot":"","sources":["../../src/helpers/validateGraphProtocolSource.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;QAChB,GAAG,EAAE,MAAM,CAAC;QACZ,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,IAAI,EAAE;YACJ,IAAI,EAAE,MAAM,CAAC;YACb,IAAI,EAAE,GAAG,CAAC;SACX,EAAE,CAAC;QACJ,aAAa,CAAC,EAAE;YACd,KAAK,EAAE,MAAM,CAAC;YACd,OAAO,EAAE,MAAM,CAAC;YAChB,MAAM,CAAC,EAAE,MAAM,CAAC;SACjB,EAAE,CAAC;QAYJ,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH,CAAC;AAEF,eAAO,MAAM,2BAA2B,WAAY,OAAO,KAAG,WAE7D,CAAC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateGraphProtocolSource = void 0;
4
+ const validateGraphProtocolSource = (source) => {
5
+ return source;
6
+ };
7
+ exports.validateGraphProtocolSource = validateGraphProtocolSource;
8
+ //# sourceMappingURL=validateGraphProtocolSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateGraphProtocolSource.js","sourceRoot":"","sources":["../../src/helpers/validateGraphProtocolSource.ts"],"names":[],"mappings":";;;AAuCO,MAAM,2BAA2B,GAAG,CAAC,MAAe,EAAe,EAAE;IAC1E,OAAO,MAAqB,CAAC;AAC/B,CAAC,CAAC;AAFW,QAAA,2BAA2B,+BAEtC"}
@@ -0,0 +1,2 @@
1
+ export declare const wait: (ms: number) => Promise<unknown>;
2
+ //# sourceMappingURL=wait.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait.d.ts","sourceRoot":"","sources":["../../src/helpers/wait.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,OAAQ,MAAM,qBACoB,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.wait = void 0;
4
+ const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
5
+ exports.wait = wait;
6
+ //# sourceMappingURL=wait.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait.js","sourceRoot":"","sources":["../../src/helpers/wait.ts"],"names":[],"mappings":";;;AAAO,MAAM,IAAI,GAAG,CAAC,EAAU,EAAE,EAAE,CACjC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AADvC,QAAA,IAAI,QACmC"}
@@ -0,0 +1,24 @@
1
+ import { CreatePonderOptions } from "./common";
2
+ export type Network = {
3
+ name: string;
4
+ chainId: number;
5
+ rpcUrl: string;
6
+ };
7
+ export type Contract = {
8
+ name: string;
9
+ network: string;
10
+ abi: string;
11
+ address: string;
12
+ startBlock?: number;
13
+ };
14
+ export type PartialConfig = {
15
+ database?: {
16
+ kind: string;
17
+ };
18
+ networks: Network[];
19
+ contracts: Contract[];
20
+ };
21
+ export declare const run: (options: CreatePonderOptions, overrides?: {
22
+ installCommand?: string;
23
+ }) => Promise<void>;
24
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,mBAAmB,EAAgB,MAAM,UAAU,CAAC;AAQ7D,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,EAAE;QACT,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,SAAS,EAAE,QAAQ,EAAE,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,GAAG,YACL,mBAAmB,cACjB;IAAE,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,kBA4MvC,CAAC"}