create-ponder 0.1.1 → 0.1.3
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.1.
|
|
19
|
+
version: "0.1.3",
|
|
20
20
|
type: "module",
|
|
21
21
|
description: "A CLI tool to create Ponder apps",
|
|
22
22
|
license: "MIT",
|
|
@@ -411,7 +411,11 @@ async function notifyUpdate({ options }) {
|
|
|
411
411
|
const updateMessage = packageManager === "bun" ? "bun install --global create-ponder" : packageManager === "pnpm" ? "pnpm add -g create-ponder" : packageManager === "npm" ? "npm install -g create-ponder" : "yarn global add create-ponder";
|
|
412
412
|
log(
|
|
413
413
|
pico2.bold(
|
|
414
|
-
pico2.yellow(
|
|
414
|
+
`${pico2.yellow(
|
|
415
|
+
"A new version of `create-ponder` is available!"
|
|
416
|
+
)}
|
|
417
|
+
You can update by running: ${pico2.cyan(updateMessage)}
|
|
418
|
+
`
|
|
415
419
|
)
|
|
416
420
|
);
|
|
417
421
|
}
|
|
@@ -421,8 +425,8 @@ async function notifyUpdate({ options }) {
|
|
|
421
425
|
}
|
|
422
426
|
|
|
423
427
|
// src/helpers/validate.ts
|
|
424
|
-
import fs from "fs-extra";
|
|
425
428
|
import path2 from "path";
|
|
429
|
+
import fs from "fs-extra";
|
|
426
430
|
import pico3 from "picocolors";
|
|
427
431
|
import validatePackageName from "validate-npm-package-name";
|
|
428
432
|
async function validateProjectName({
|
|
@@ -460,7 +464,7 @@ async function validateTemplateName({
|
|
|
460
464
|
if (isNameRequired && !templateId)
|
|
461
465
|
return {
|
|
462
466
|
valid: false,
|
|
463
|
-
message:
|
|
467
|
+
message: "\u{1F648} no template provided.",
|
|
464
468
|
problems: "\u{1F449} select a template or provide one using --template."
|
|
465
469
|
};
|
|
466
470
|
if (templateId && !templates2.find((template) => template.id === templateId))
|
|
@@ -562,7 +566,7 @@ async function run({
|
|
|
562
566
|
projectPath = args[0].trim();
|
|
563
567
|
const splitPath = projectPath.split("/");
|
|
564
568
|
projectName = splitPath[splitPath.length - 1]?.trim() || "";
|
|
565
|
-
log2(pico4.green("\u2714"), pico4.bold(
|
|
569
|
+
log2(pico4.green("\u2714"), pico4.bold("Using project name:"), projectName);
|
|
566
570
|
} else {
|
|
567
571
|
const res = await prompts({
|
|
568
572
|
initial: "my-app",
|
|
@@ -588,6 +592,8 @@ async function run({
|
|
|
588
592
|
});
|
|
589
593
|
if (!nameValidation.valid)
|
|
590
594
|
throw new ValidationError(nameValidation);
|
|
595
|
+
if (options.etherscanContractLink && !templateId)
|
|
596
|
+
templateId = "etherscan";
|
|
591
597
|
if (!templateId) {
|
|
592
598
|
templateId = (await prompts({
|
|
593
599
|
name: "templateId",
|
|
@@ -640,7 +646,7 @@ async function run({
|
|
|
640
646
|
import { createConfig${Object.values(config.contracts).some((c) => Array.isArray(c.abi)) ? ", mergeAbis" : ""} } from "@ponder/core";
|
|
641
647
|
import { http } from "viem";
|
|
642
648
|
|
|
643
|
-
${Object.values(config.contracts).
|
|
649
|
+
${Object.values(config.contracts).flatMap((c) => c.abi).map(
|
|
644
650
|
(abi) => `import {${abi.name}} from "${abi.dir.slice(
|
|
645
651
|
0,
|
|
646
652
|
abi.dir.length - 3
|
|
@@ -657,7 +663,7 @@ async function run({
|
|
|
657
663
|
(acc, [name, c]) => {
|
|
658
664
|
acc[name] = {
|
|
659
665
|
...c,
|
|
660
|
-
abi: Array.isArray(c.abi) ? `mergeAbis(${c.abi.map((a) => a.name).join(",")})` : c.abi.name
|
|
666
|
+
abi: Array.isArray(c.abi) ? `mergeAbis([${c.abi.map((a) => a.name).join(",")}])` : c.abi.name
|
|
661
667
|
};
|
|
662
668
|
return acc;
|
|
663
669
|
},
|
package/package.json
CHANGED
|
@@ -10,9 +10,10 @@ ponder.on("FriendtechSharesV1:Trade", async ({ event, context }) => {
|
|
|
10
10
|
|
|
11
11
|
const subjectId = event.args.subject;
|
|
12
12
|
const traderId = event.args.trader;
|
|
13
|
-
const shareId = event.args.subject
|
|
14
|
-
const tradeEventId =
|
|
15
|
-
event.transaction.hash
|
|
13
|
+
const shareId = `${event.args.subject}-${event.args.trader}`;
|
|
14
|
+
const tradeEventId = `${
|
|
15
|
+
event.transaction.hash
|
|
16
|
+
}-${event.log.logIndex.toString()}`;
|
|
16
17
|
|
|
17
18
|
const feeAmount = event.args.protocolEthAmount + event.args.subjectEthAmount;
|
|
18
19
|
|