Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/foundry-deps-update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"create-eth": patch
---

foundry: update JS deps in `packages/foundry` (dotenv 18, prettier 3, qrcode 1.5.4, toml 5, shx 0.4, viem instead of ethers), drop unused `envfile`. `checkAccountBalance.js` now uses a viem public client; `generateTsAbis.js` awaits `prettier.format`. Rename `.prettier.json` to `.prettierrc.json` so the intended config applies and format `scripts-js` with it. `foundry.toml`: live mainnet Alchemy host, `polygonAmoy` and `polygonZkEvmCardona` instead of the dead Mumbai / zkEVM testnet endpoints, PGN removed.

Remove `challenge-state-channels`, `challenge-multisig` and `challenge-svg-nft` from the extensions list: these branches no longer exist in `scaffold-eth/se-2-challenges`, so `-e <name>` failed.
18 changes: 0 additions & 18 deletions src/extensions/challenges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,6 @@ export const challenges: Extension[] = [
repository: "https://github.com/scaffold-eth/se-2-challenges",
branch: "challenge-dex",
},
{
extensionFlagValue: "challenge-state-channels",
description: "Speedrun Ethereum Challenge: A State Channel Application.",
repository: "https://github.com/scaffold-eth/se-2-challenges",
branch: "challenge-state-channels",
},
{
extensionFlagValue: "challenge-multisig",
description: "Speedrun Ethereum Challenge: Multisig Wallet.",
repository: "https://github.com/scaffold-eth/se-2-challenges",
branch: "challenge-multisig",
},
{
extensionFlagValue: "challenge-svg-nft",
description: "Speedrun Ethereum Challenge: SVG NFT.",
repository: "https://github.com/scaffold-eth/se-2-challenges",
branch: "challenge-svg-nft",
},
{
extensionFlagValue: "challenge-oracles",
description: "Speedrun Ethereum Challenge: Oracles.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,28 @@ ${extraProfileDefaults.filter(Boolean).join("\n")}
[rpc_endpoints]
default_network = "http://127.0.0.1:8545"

mainnet = "https://eth-mainnet.alchemyapi.io/v2/\${ALCHEMY_API_KEY}"
mainnet = "https://eth-mainnet.g.alchemy.com/v2/\${ALCHEMY_API_KEY}"
sepolia = "https://eth-sepolia.g.alchemy.com/v2/\${ALCHEMY_API_KEY}"
arbitrum = "https://arb-mainnet.g.alchemy.com/v2/\${ALCHEMY_API_KEY}"
arbitrumSepolia = "https://arb-sepolia.g.alchemy.com/v2/\${ALCHEMY_API_KEY}"
optimism = "https://opt-mainnet.g.alchemy.com/v2/\${ALCHEMY_API_KEY}"
optimismSepolia = "https://opt-sepolia.g.alchemy.com/v2/\${ALCHEMY_API_KEY}"
polygon = "https://polygon-mainnet.g.alchemy.com/v2/\${ALCHEMY_API_KEY}"
polygonMumbai = "https://polygon-mumbai.g.alchemy.com/v2/\${ALCHEMY_API_KEY}"
polygonAmoy = "https://polygon-amoy.g.alchemy.com/v2/\${ALCHEMY_API_KEY}"
polygonZkEvm = "https://zkevm-rpc.com"
polygonZkEvmTestnet = "https://rpc.public.zkevm-test.net"
polygonZkEvmCardona = "https://rpc.cardona.zkevm-rpc.com"
gnosis = "https://rpc.gnosischain.com"
chiado = "https://rpc.chiadochain.net"
base = "https://mainnet.base.org"
baseSepolia = "https://sepolia.base.org"
scrollSepolia = "https://sepolia-rpc.scroll.io"
scroll = "https://rpc.scroll.io"
pgn = "https://rpc.publicgoods.network"
pgnTestnet = "https://sepolia.publicgoods.network"
${extraRpcEndpoints.filter(Boolean).join("\n")}

localhost = "http://127.0.0.1:8545"

[etherscan]
polygonMumbai = { key = "\${ETHERSCAN_API_KEY}" }
polygonAmoy = { key = "\${ETHERSCAN_API_KEY}" }
sepolia = { key = "\${ETHERSCAN_API_KEY}" }
${extraEthercsanConfig.filter(Boolean).join("\n")}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@
"postinstall": "shx cp -n .env.example .env"
},
"dependencies": {
"dotenv": "~16.3.1",
"envfile": "~6.18.0",
"ethers": "~5.7.1",
"prettier": "~2.8.8",
"qrcode": "~1.5.3",
"toml": "~3.0.0"
"dotenv": "~18.0.5",
"prettier": "~3.9.9",
"qrcode": "~1.5.4",
"toml": "~5.0.0",
"viem": "~2.57.3"
},
"devDependencies": {
"shx": "^0.3.4"
"shx": "^0.4.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ import { fileURLToPath } from "url";
import { toString } from "qrcode";
import { readFileSync } from "fs";
import { parse } from "toml";
import { ethers } from "ethers";
import { createPublicClient, formatEther, http } from "viem";

const ALCHEMY_API_KEY =
process.env.ALCHEMY_API_KEY || "IZYEU2cWBgnFmgiTAgpWD";
const ALCHEMY_API_KEY = process.env.ALCHEMY_API_KEY || "IZYEU2cWBgnFmgiTAgpWD";

// Load environment variables
const __filename = fileURLToPath(import.meta.url);
Expand Down Expand Up @@ -41,18 +40,18 @@ async function getBalanceForEachNetwork(address) {
console.log(`\n--${networkName}-- 📡`);

try {
const provider = new ethers.providers.JsonRpcProvider(networkUrl);
const client = createPublicClient({ transport: http(networkUrl, { retryCount: 0 }) });

// Get balance and format it
const balance = await provider.getBalance(address);
const formattedBalance = +ethers.utils.formatUnits(balance);
const balance = await client.getBalance({ address });
const formattedBalance = +formatEther(balance);

console.log(" Balance:", formattedBalance);
console.log(" Nonce:", await provider.getTransactionCount(address));
console.log(" Nonce:", await client.getTransactionCount({ address }));
} catch (e) {
console.log(
` ❌ Can't connect to network ${networkName}: ${e.message}`
);
// viem errors: HTTP failures carry a status, RPC/network errors carry a one-line reason in details
const reason = e.status ? `HTTP ${e.status}` : (e.details || e.shortMessage || e.message).split("\n")[0];
console.log(` ❌ Can't connect to network ${networkName}: ${reason}`);
}
}
} catch (error) {
Expand All @@ -65,7 +64,7 @@ async function checkAccountBalance() {
// Step 1: List accounts and let user select one
console.log("📋 Listing available accounts...");
const selectedKeystore = await listKeystores(
"Select a keystore to display its balance (enter the number, e.g., 1): "
"Select a keystore to display its balance (enter the number, e.g., 1): ",
);

if (!selectedKeystore) {
Expand Down Expand Up @@ -95,10 +94,10 @@ async function checkAccountBalance() {

// Run the function if this script is called directly
if (process.argv[1] === fileURLToPath(import.meta.url)) {
checkAccountBalance().catch((error) => {
checkAccountBalance().catch(error => {
console.error(error);
process.exit(1);
});
}

export { checkAccountBalance };
export { checkAccountBalance };
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,13 @@ async function createKeystore() {
});

if (newWalletResult.error || newWalletResult.status !== 0) {
console.error(
"\n❌ Error generating new wallet:",
newWalletResult.stderr || newWalletResult.error
);
console.error("\n❌ Error generating new wallet:", newWalletResult.stderr || newWalletResult.error);
process.exit(1);
}

const privateKey = newWalletResult.stdout
.split("\n")
.find((line) => line.includes("Private key:"))
.find(line => line.includes("Private key:"))
?.split(":")[1]
?.trim();

Expand All @@ -35,29 +32,23 @@ async function createKeystore() {
process.exit(1);
}

const keystoreName = await new Promise((resolve) => {
const keystoreName = await new Promise(resolve => {
rl.question("\nEnter name for new keystore: ", resolve);
});

// Close readline before spawning process with inherited stdio
rl.close();

return new Promise((resolve, reject) => {
const importProcess = spawn(
"cast",
["wallet", "import", keystoreName, "--private-key", privateKey],
{
stdio: "inherit",
}
);
const importProcess = spawn("cast", ["wallet", "import", keystoreName, "--private-key", privateKey], {
stdio: "inherit",
});

importProcess.on("close", (code) => {
importProcess.on("close", code => {
if (code === 0) {
console.log("\n💰 Fund the address and re-run the deploy command to use this keystore.");
console.log(
"\n💰 Fund the address and re-run the deploy command to use this keystore."
);
console.log(
`\nTIP: Use \`yarn account\` and select \`${keystoreName}\` keystore to check if the address is funded.`
`\nTIP: Use \`yarn account\` and select \`${keystoreName}\` keystore to check if the address is funded.`,
);
process.exit(0);
} else {
Expand All @@ -78,13 +69,13 @@ async function createKeystore() {
// Run the function if this script is called directly
if (process.argv[1] === fileURLToPath(import.meta.url)) {
createKeystore()
.then((keystoreName) => {
.then(keystoreName => {
process.exit(0);
})
.catch((error) => {
.catch(error => {
console.error(error);
process.exit(1);
});
}

export { createKeystore };
export { createKeystore };
Loading
Loading