Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backmerge latest #169

Merged
merged 8 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
5 changes: 5 additions & 0 deletions .changeset/eighty-ducks-tease.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-eth": patch
---

reverse rpc fallback order (https://github.com/scaffold-eth/scaffold-eth-2/pull/1010)
4 changes: 2 additions & 2 deletions templates/base/packages/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"react-dom": "~18.3.1",
"react-hot-toast": "~2.4.0",
"usehooks-ts": "~3.1.0",
"viem": "2.21.32",
"wagmi": "2.12.23",
"viem": "2.21.54",
"wagmi": "2.13.4",
"zustand": "~5.0.0"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export type ScaffoldConfig = {
onlyLocalBurnerWallet: boolean;
};

export const DEFAULT_ALCHEMY_API_KEY = "oKxs-03sij-U_N0iOlrSsZFr29-IqbuF";

const scaffoldConfig = {
// The networks on which your DApp is live
targetNetworks: [${chainName.map(chain => `chains.${chain}`).join(', ')}],
Expand All @@ -23,7 +25,7 @@ const scaffoldConfig = {
// You can get your own at https://dashboard.alchemyapi.io
// It's recommended to store it in an env variable:
// .env.local for local testing, and in the Vercel/system env config for live apps.
alchemyApiKey: process.env.NEXT_PUBLIC_ALCHEMY_API_KEY || "oKxs-03sij-U_N0iOlrSsZFr29-IqbuF",
alchemyApiKey: process.env.NEXT_PUBLIC_ALCHEMY_API_KEY || DEFAULT_ALCHEMY_API_KEY,

// This is ours WalletConnect's default project ID.
// You can get your own at https://cloud.walletconnect.com
Expand Down
10 changes: 8 additions & 2 deletions templates/base/packages/nextjs/services/web3/wagmiConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { wagmiConnectors } from "./wagmiConnectors";
import { Chain, createClient, fallback, http } from "viem";
import { hardhat, mainnet } from "viem/chains";
import { createConfig } from "wagmi";
import scaffoldConfig from "~~/scaffold.config";
import scaffoldConfig, { DEFAULT_ALCHEMY_API_KEY } from "~~/scaffold.config";
import { getAlchemyHttpUrl } from "~~/utils/scaffold-eth";

const { targetNetworks } = scaffoldConfig;
Expand All @@ -17,8 +17,14 @@ export const wagmiConfig = createConfig({
connectors: wagmiConnectors,
ssr: true,
client({ chain }) {
let rpcFallbacks = [http()];

const alchemyHttpUrl = getAlchemyHttpUrl(chain.id);
const rpcFallbacks = alchemyHttpUrl ? [http(), http(alchemyHttpUrl)] : [http()];
if (alchemyHttpUrl) {
const isUsingDefaultKey = scaffoldConfig.alchemyApiKey === DEFAULT_ALCHEMY_API_KEY;
// If using default Scaffold-ETH 2 API key, we prioritize the default RPC
rpcFallbacks = isUsingDefaultKey ? [http(), http(alchemyHttpUrl)] : [http(alchemyHttpUrl), http()];
}

return createClient({
chain,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ contract DeployScript is ScaffoldETHDeploy {
}`;

export default withDefaults(content, {
deploymentsScriptsImports: "",
deploymentsLogic: "",
deploymentsScriptsImports: `import { DeployYourContract } from "./DeployYourContract.s.sol";`,
deploymentsLogic: `
DeployYourContract deployYourContract = new DeployYourContract();
deployYourContract.run();
`,
});
Loading