From 7454c8fee2b611cd0388c768f3a03a71ca9f9c2e Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Tue, 20 Jun 2023 17:46:25 +0530 Subject: [PATCH] remove alchemyProvider and use jsonRpcProvider with alchemy key --- packages/nextjs/package.json | 2 +- .../nextjs/services/web3/wagmiConnectors.tsx | 16 +++++++++++----- yarn.lock | 4 ++-- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/packages/nextjs/package.json b/packages/nextjs/package.json index 296f93a8c..d3ebc76a6 100644 --- a/packages/nextjs/package.json +++ b/packages/nextjs/package.json @@ -31,7 +31,7 @@ "react-hot-toast": "^2.4.0", "use-debounce": "^8.0.4", "usehooks-ts": "^2.7.2", - "wagmi": "^0.12.13", + "wagmi": "^0.12.15", "zustand": "^4.1.2" }, "devDependencies": { diff --git a/packages/nextjs/services/web3/wagmiConnectors.tsx b/packages/nextjs/services/web3/wagmiConnectors.tsx index 3f77d0269..343dd784b 100644 --- a/packages/nextjs/services/web3/wagmiConnectors.tsx +++ b/packages/nextjs/services/web3/wagmiConnectors.tsx @@ -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"; @@ -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, diff --git a/yarn.lock b/yarn.lock index 02fd48b31..bdcefaff7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1786,7 +1786,7 @@ __metadata: use-debounce: ^8.0.4 usehooks-ts: ^2.7.2 vercel: ^28.15.1 - wagmi: ^0.12.13 + wagmi: ^0.12.15 zustand: ^4.1.2 languageName: unknown linkType: soft @@ -12987,7 +12987,7 @@ __metadata: languageName: node linkType: hard -"wagmi@npm:^0.12.13": +"wagmi@npm:^0.12.15": version: 0.12.16 resolution: "wagmi@npm:0.12.16" dependencies: