Skip to content

Commit

Permalink
fix: sepolia and wc2 (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
rin-st authored Aug 7, 2023
1 parent c5d88b4 commit 59cf596
Show file tree
Hide file tree
Showing 4 changed files with 494 additions and 908 deletions.
4 changes: 2 additions & 2 deletions packages/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@ethersproject/networks": "^5.7.1",
"@ethersproject/web": "^5.7.1",
"@heroicons/react": "^2.0.11",
"@rainbow-me/rainbowkit": "^0.11.0",
"@rainbow-me/rainbowkit": "^0.12.15",
"@uniswap/sdk": "^3.0.3",
"daisyui": "^2.31.0",
"ethers": "^5.0.0",
Expand All @@ -30,7 +30,7 @@
"react-hot-toast": "^2.4.0",
"use-debounce": "^8.0.4",
"usehooks-ts": "^2.7.2",
"wagmi": "^0.11.6",
"wagmi": "^0.12.15",
"zustand": "^4.1.2"
},
"devDependencies": {
Expand Down
7 changes: 7 additions & 0 deletions packages/nextjs/scaffold.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export type ScaffoldConfig = {
targetNetwork: chains.Chain;
pollingInterval: number;
alchemyApiKey: string;
walletConnectProjectId: string;
burnerWallet: {
enabled: boolean;
onlyLocal: boolean;
Expand All @@ -25,6 +26,12 @@ const scaffoldConfig = {
// .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",

// This is ours WalletConnect's default project ID.
// You can get your own at https://cloud.walletconnect.com
// 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.
walletConnectProjectId: process.env.NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID || "3a8170812b534d0ff9d794f19a901d64",

// Burner Wallet configuration
burnerWallet: {
// Set it to false to completely remove burner wallet from all networks
Expand Down
29 changes: 18 additions & 11 deletions packages/nextjs/services/web3/wagmiConnectors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from "@rainbow-me/rainbowkit/wallets";
import { configureChains } from "wagmi";
import * as chains from "wagmi/chains";
import { alchemyProvider } from "wagmi/providers/alchemy";
import { jsonRpcProvider } from "wagmi/providers/jsonRpc";
import { publicProvider } from "wagmi/providers/public";
import scaffoldConfig from "~~/scaffold.config";
import { burnerWalletConfig } from "~~/services/web3/wagmi-burner/burnerWalletConfig";
Expand All @@ -28,11 +28,17 @@ const enabledChains =
export const appChains = configureChains(
enabledChains,
[
alchemyProvider({
apiKey: scaffoldConfig.alchemyApiKey,
priority: 0,
jsonRpcProvider({
rpc: chain => {
if (chain.rpcUrls.alchemy?.http[0]) {
return {
http: `${chain.rpcUrls.alchemy.http[0]}/${scaffoldConfig.alchemyApiKey}`,
};
}
return null;
},
}),
publicProvider({ priority: 1 }),
publicProvider(),
],
{
stallTimeout: 3_000,
Expand All @@ -45,13 +51,14 @@ export const appChains = configureChains(
},
);

const walletsOptions = { chains: appChains.chains, projectId: scaffoldConfig.walletConnectProjectId };
const wallets = [
metaMaskWallet({ chains: appChains.chains, shimDisconnect: true }),
walletConnectWallet({ chains: appChains.chains }),
ledgerWallet({ chains: appChains.chains }),
braveWallet({ chains: appChains.chains }),
coinbaseWallet({ appName: "scaffold-eth-2", chains: appChains.chains }),
rainbowWallet({ chains: appChains.chains }),
metaMaskWallet({ ...walletsOptions, shimDisconnect: true }),
walletConnectWallet(walletsOptions),
ledgerWallet(walletsOptions),
braveWallet(walletsOptions),
coinbaseWallet({ ...walletsOptions, appName: "scaffold-eth-2" }),
rainbowWallet(walletsOptions),
];

/**
Expand Down
Loading

0 comments on commit 59cf596

Please sign in to comment.