Skip to content

Commit

Permalink
Merge pull request #1330 from decent-dao/fix/use-publicnode-instead-o…
Browse files Browse the repository at this point in the history
…f-infura-and-alchemy

Sse publicnode instead of infura and alchemy
  • Loading branch information
mudrila authored Jan 23, 2024
2 parents 97f0ae2 + f3edd99 commit 6fcd73f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 0 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -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 (*)
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release-netlify-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
1 change: 0 additions & 1 deletion .github/workflows/release-netlify-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
1 change: 0 additions & 1 deletion .github/workflows/release-netlify-staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
15 changes: 10 additions & 5 deletions src/providers/NetworkConfig/rainbow-kit.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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(),
]);

Expand Down

0 comments on commit 6fcd73f

Please sign in to comment.