create-ponder 0.4.38 → 0.4.40
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
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.40",
|
|
20
20
|
type: "module",
|
|
21
21
|
description: "A CLI tool to create Ponder apps",
|
|
22
22
|
license: "MIT",
|
|
@@ -25,10 +25,7 @@ var package_default = {
|
|
|
25
25
|
url: "https://github.com/ponder-sh/ponder",
|
|
26
26
|
directory: "packages/create-ponder"
|
|
27
27
|
},
|
|
28
|
-
files: [
|
|
29
|
-
"dist",
|
|
30
|
-
"templates"
|
|
31
|
-
],
|
|
28
|
+
files: ["dist", "templates"],
|
|
32
29
|
bin: {
|
|
33
30
|
"create-ponder": "./dist/index.js"
|
|
34
31
|
},
|
|
@@ -190,7 +187,9 @@ var fromEtherscan = async ({
|
|
|
190
187
|
abiAbsolutePath,
|
|
191
188
|
await prettier.format(
|
|
192
189
|
`export const ${contractName2}Abi = ${JSON.stringify(abi)} as const`,
|
|
193
|
-
{
|
|
190
|
+
{
|
|
191
|
+
parser: "typescript"
|
|
192
|
+
}
|
|
194
193
|
)
|
|
195
194
|
);
|
|
196
195
|
if (abis.length === 1) {
|
|
@@ -266,7 +265,7 @@ var getTxBlockNumber = async (txHash, apiUrl, apiKey) => {
|
|
|
266
265
|
searchParams.append("apikey", apiKey);
|
|
267
266
|
const data = await fetchEtherscan(`${apiUrl}?${searchParams.toString()}`);
|
|
268
267
|
const hexBlockNumber = data.result.blockNumber;
|
|
269
|
-
return parseInt(hexBlockNumber.slice(2), 16);
|
|
268
|
+
return Number.parseInt(hexBlockNumber.slice(2), 16);
|
|
270
269
|
};
|
|
271
270
|
var getContractAbiAndName = async (contractAddress, apiUrl, apiKey) => {
|
|
272
271
|
const searchParams = new URLSearchParams({
|
|
@@ -401,7 +400,7 @@ You can update by running: ${pico3.cyan(updateMessage)}
|
|
|
401
400
|
}
|
|
402
401
|
|
|
403
402
|
// src/helpers/validate.ts
|
|
404
|
-
import path2 from "path";
|
|
403
|
+
import path2 from "node:path";
|
|
405
404
|
import { pathExists } from "fs-extra";
|
|
406
405
|
import pico4 from "picocolors";
|
|
407
406
|
import validatePackageName from "validate-npm-package-name";
|
|
@@ -430,10 +429,7 @@ async function validateProjectPath({
|
|
|
430
429
|
if (await pathExists(projectPath))
|
|
431
430
|
return {
|
|
432
431
|
valid: false,
|
|
433
|
-
message: `\u{1F648} the directory "${path2.relative(
|
|
434
|
-
process.cwd(),
|
|
435
|
-
projectPath
|
|
436
|
-
)}" already exists.`,
|
|
432
|
+
message: `\u{1F648} the directory "${path2.relative(process.cwd(), projectPath)}" already exists.`,
|
|
437
433
|
problems: "\u{1F449} choose another name or delete the directory."
|
|
438
434
|
};
|
|
439
435
|
return {
|
|
@@ -555,7 +551,9 @@ var fromSubgraphId = async ({
|
|
|
555
551
|
abiPath,
|
|
556
552
|
await prettier2.format(
|
|
557
553
|
`export const ${abi.name}Abi = ${abiContent} as const`,
|
|
558
|
-
{
|
|
554
|
+
{
|
|
555
|
+
parser: "typescript"
|
|
556
|
+
}
|
|
559
557
|
)
|
|
560
558
|
);
|
|
561
559
|
abis[abi.name] = JSON.parse(abiContent);
|
|
@@ -587,9 +585,7 @@ var fromSubgraphId = async ({
|
|
|
587
585
|
contractsObject[pc.name] = pc;
|
|
588
586
|
networksObject[pc.network] = {
|
|
589
587
|
chainId: getGraphProtocolChainId(pc.network),
|
|
590
|
-
transport: `http(process.env.PONDER_RPC_URL_${getGraphProtocolChainId(
|
|
591
|
-
pc.network
|
|
592
|
-
)})`
|
|
588
|
+
transport: `http(process.env.PONDER_RPC_URL_${getGraphProtocolChainId(pc.network)})`
|
|
593
589
|
};
|
|
594
590
|
contractsObject[pc.name].name = void 0;
|
|
595
591
|
});
|
|
@@ -805,9 +801,7 @@ async function run({
|
|
|
805
801
|
etherscanApiKey: options.etherscanApiKey
|
|
806
802
|
}),
|
|
807
803
|
{
|
|
808
|
-
text: `Fetching contract metadata from ${pico5.bold(
|
|
809
|
-
host
|
|
810
|
-
)}. This may take a few seconds.`,
|
|
804
|
+
text: `Fetching contract metadata from ${pico5.bold(host)}. This may take a few seconds.`,
|
|
811
805
|
failText: "Failed to fetch contract metadata.",
|
|
812
806
|
successText: `Fetched contract metadata from ${pico5.bold(host)}.`
|
|
813
807
|
}
|
|
@@ -839,10 +833,7 @@ async function run({
|
|
|
839
833
|
${Object.values(config.contracts).flatMap((c) => c.abi).filter(
|
|
840
834
|
(tag, index, array) => array.findIndex((t) => t.dir === tag.dir) === index
|
|
841
835
|
).map(
|
|
842
|
-
(abi) => `import {${abi.name}} from "${abi.dir.slice(
|
|
843
|
-
0,
|
|
844
|
-
abi.dir.length - 3
|
|
845
|
-
)}"`
|
|
836
|
+
(abi) => `import {${abi.name}} from "${abi.dir.slice(0, abi.dir.length - 3)}"`
|
|
846
837
|
).join("\n")}
|
|
847
838
|
|
|
848
839
|
export default createConfig({
|
|
@@ -918,9 +909,7 @@ async function run({
|
|
|
918
909
|
}
|
|
919
910
|
}),
|
|
920
911
|
{
|
|
921
|
-
text: `Installing packages with ${pico5.bold(
|
|
922
|
-
packageManager
|
|
923
|
-
)}. This may take a few seconds.`,
|
|
912
|
+
text: `Installing packages with ${pico5.bold(packageManager)}. This may take a few seconds.`,
|
|
924
913
|
failText: "Failed to install packages.",
|
|
925
914
|
successText: `Installed packages with ${pico5.bold(packageManager)}.`
|
|
926
915
|
}
|
|
@@ -956,9 +945,9 @@ async function run({
|
|
|
956
945
|
log2("\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015");
|
|
957
946
|
log2();
|
|
958
947
|
log2(
|
|
959
|
-
`${pico5.green("Success!")} Created ${pico5.bold(
|
|
960
|
-
|
|
961
|
-
)}
|
|
948
|
+
`${pico5.green("Success!")} Created ${pico5.bold(projectName)} at ${pico5.green(
|
|
949
|
+
path4.resolve(projectPath)
|
|
950
|
+
)}`
|
|
962
951
|
);
|
|
963
952
|
log2();
|
|
964
953
|
log2(
|
package/package.json
CHANGED
|
@@ -11,9 +11,7 @@ ponder.on("FriendtechSharesV1:Trade", async ({ event, context }) => {
|
|
|
11
11
|
const subjectId = event.args.subject;
|
|
12
12
|
const traderId = event.args.trader;
|
|
13
13
|
const shareId = `${event.args.subject}-${event.args.trader}`;
|
|
14
|
-
const tradeEventId = `${
|
|
15
|
-
event.transaction.hash
|
|
16
|
-
}-${event.log.logIndex.toString()}`;
|
|
14
|
+
const tradeEventId = `${event.transaction.hash}-${event.log.logIndex.toString()}`;
|
|
17
15
|
|
|
18
16
|
const feeAmount = event.args.protocolEthAmount + event.args.subjectEthAmount;
|
|
19
17
|
|