From 04e6c99d1e36382904676903f5f9c7102d95a33d Mon Sep 17 00:00:00 2001 From: Kirill Klimenko Date: Tue, 23 Jan 2024 23:18:04 +0100 Subject: [PATCH] Remove infura and Alchemy providers, use publicnode.com providers --- .env | 2 -- .github/workflows/release-netlify-dev.yaml | 1 - .github/workflows/release-netlify-prod.yaml | 1 - .github/workflows/release-netlify-staging.yaml | 1 - src/providers/NetworkConfig/rainbow-kit.config.ts | 15 ++++++++++----- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.env b/.env index d461586f17..81103c661d 100644 --- a/.env +++ b/.env @@ -1,5 +1,3 @@ -# wallet providers (* required for local dev) -NEXT_PUBLIC_ALCHEMY_API_KEY="" # automated testing workflows NEXT_PUBLIC_ALCHEMY_TESTING_API_KEY="" # ABI selector (*) diff --git a/.github/workflows/release-netlify-dev.yaml b/.github/workflows/release-netlify-dev.yaml index 3ac2bb85cd..7c226f8894 100644 --- a/.github/workflows/release-netlify-dev.yaml +++ b/.github/workflows/release-netlify-dev.yaml @@ -23,5 +23,4 @@ jobs: env: NEXT_PUBLIC_ALCHEMY_TESTING_API_KEY: ${{ secrets.NEXT_PUBLIC_ALCHEMY_TESTING_API_KEY }} NEXT_PUBLIC_INFURA_API_KEY: ${{ secrets.NEXT_PUBLIC_INFURA_API_KEY }} - NEXT_PUBLIC_ALCHEMY_API_KEY: ${{ secrets.NEXT_PUBLIC_ALCHEMY_API_KEY }} NEXT_PUBLIC_SITE_URL: ${{ secrets.NEXT_PUBLIC_SITE_URL }} \ No newline at end of file diff --git a/.github/workflows/release-netlify-prod.yaml b/.github/workflows/release-netlify-prod.yaml index a25b264353..105004f307 100644 --- a/.github/workflows/release-netlify-prod.yaml +++ b/.github/workflows/release-netlify-prod.yaml @@ -22,5 +22,4 @@ jobs: NETLIFY_DEPLOY_TO_PROD: true NEXT_PUBLIC_ALCHEMY_TESTING_API_KEY: ${{ secrets.NEXT_PUBLIC_ALCHEMY_TESTING_API_KEY }} NEXT_PUBLIC_INFURA_API_KEY: ${{ secrets.NEXT_PUBLIC_INFURA_API_KEY }} - NEXT_PUBLIC_ALCHEMY_API_KEY: ${{ secrets.NEXT_PUBLIC_ALCHEMY_API_KEY }} NEXT_PUBLIC_SITE_URL: ${{ secrets.NEXT_PUBLIC_SITE_URL }} \ No newline at end of file diff --git a/.github/workflows/release-netlify-staging.yaml b/.github/workflows/release-netlify-staging.yaml index dfb76b447c..3b28978a95 100644 --- a/.github/workflows/release-netlify-staging.yaml +++ b/.github/workflows/release-netlify-staging.yaml @@ -21,5 +21,4 @@ jobs: NETLIFY_DEPLOY_TO_PROD: true NEXT_PUBLIC_ALCHEMY_TESTING_API_KEY: ${{ secrets.NEXT_PUBLIC_ALCHEMY_TESTING_API_KEY }} NEXT_PUBLIC_INFURA_API_KEY: ${{ secrets.NEXT_PUBLIC_INFURA_API_KEY }} - NEXT_PUBLIC_ALCHEMY_API_KEY: ${{ secrets.NEXT_PUBLIC_ALCHEMY_API_KEY }} NEXT_PUBLIC_SITE_URL: ${{ secrets.NEXT_PUBLIC_SITE_URL }} \ No newline at end of file diff --git a/src/providers/NetworkConfig/rainbow-kit.config.ts b/src/providers/NetworkConfig/rainbow-kit.config.ts index 3026ab30c9..db6c2d6ff6 100644 --- a/src/providers/NetworkConfig/rainbow-kit.config.ts +++ b/src/providers/NetworkConfig/rainbow-kit.config.ts @@ -7,10 +7,9 @@ import { metaMaskWallet, walletConnectWallet, } from '@rainbow-me/rainbowkit/wallets'; -import { configureChains, createClient, createStorage } from 'wagmi'; +import { Chain, configureChains, createClient, createStorage, mainnet } from 'wagmi'; import { hardhat } from 'wagmi/chains'; -import { alchemyProvider } from 'wagmi/providers/alchemy'; -import { infuraProvider } from 'wagmi/providers/infura'; +import { jsonRpcProvider } from 'wagmi/providers/jsonRpc'; import { publicProvider } from 'wagmi/providers/public'; import { APP_NAME } from '../../constants/common'; import { supportedChains } from './NetworkConfigProvider'; @@ -24,8 +23,14 @@ if (process.env.NEXT_PUBLIC_TESTING_ENVIRONMENT) { } export const { chains, provider } = configureChains(supportedWagmiChains, [ - infuraProvider({ apiKey: process.env.NEXT_PUBLIC_INFURA_API_KEY! }), - alchemyProvider({ apiKey: process.env.NEXT_PUBLIC_ALCHEMY_API_KEY! }), + jsonRpcProvider({ + rpc: (chain: Chain) => { + const networkUrl = `${ + chain.id === mainnet.id ? 'ethereum' : 'ethereum-' + chain.name + }.publicnode.com`; + return { http: `https://${networkUrl}`, webSocket: `wss://${networkUrl}` }; + }, + }), publicProvider(), ]);