From 2f1afdb0b348473f1efdd48f2297be36d4287e26 Mon Sep 17 00:00:00 2001 From: Kirill Klimenko Date: Thu, 25 Jan 2024 12:15:50 +0100 Subject: [PATCH] Update rainbow-kit config to use Aclhemy provider through custom json RPC on mainnet, update release workflows --- .github/workflows/release-netlify-dev.yaml | 3 ++- .github/workflows/release-netlify-prod.yaml | 1 + .github/workflows/release-netlify-staging.yaml | 1 + src/providers/NetworkConfig/rainbow-kit.config.ts | 15 +++++++++++---- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-netlify-dev.yaml b/.github/workflows/release-netlify-dev.yaml index 7c226f8894..fe24ca9b52 100644 --- a/.github/workflows/release-netlify-dev.yaml +++ b/.github/workflows/release-netlify-dev.yaml @@ -23,4 +23,5 @@ 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_SITE_URL: ${{ secrets.NEXT_PUBLIC_SITE_URL }} \ No newline at end of file + NEXT_PUBLIC_SITE_URL: ${{ secrets.NEXT_PUBLIC_SITE_URL }} + NEXT_PUBLIC_ALCHEMY_API_KEY: ${{ secrets.NEXT_PUBLIC_ALCHEMY_API_KEY }} \ No newline at end of file diff --git a/.github/workflows/release-netlify-prod.yaml b/.github/workflows/release-netlify-prod.yaml index 105004f307..a25b264353 100644 --- a/.github/workflows/release-netlify-prod.yaml +++ b/.github/workflows/release-netlify-prod.yaml @@ -22,4 +22,5 @@ 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 3b28978a95..dfb76b447c 100644 --- a/.github/workflows/release-netlify-staging.yaml +++ b/.github/workflows/release-netlify-staging.yaml @@ -21,4 +21,5 @@ 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 4eab2805ee..7d1c5864dd 100644 --- a/src/providers/NetworkConfig/rainbow-kit.config.ts +++ b/src/providers/NetworkConfig/rainbow-kit.config.ts @@ -24,10 +24,17 @@ if (process.env.NEXT_PUBLIC_TESTING_ENVIRONMENT) { export const { chains, provider } = configureChains(supportedWagmiChains, [ jsonRpcProvider({ rpc: (chain: Chain) => { - const networkUrl = `${ - chain.id === mainnet.id ? 'ethereum' : 'ethereum-' + chain.name - }.publicnode.com`; - return { http: `https://${networkUrl}`, webSocket: `wss://${networkUrl}` }; + const publicNodeNetworkUrl = `ethereum-${chain.name}.publicnode.com`; + if (chain.id === mainnet.id) { + return { + http: `https://eth-mainnet.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_ALCHEMY_API_KEY}`, + webSocket: `wss://eth-mainnet.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_ALCHEMY_API_KEY}`, + }; + } + return { + http: `https://${publicNodeNetworkUrl}`, + webSocket: `wss://${publicNodeNetworkUrl}`, + }; }, }), ]);