Skip to content

Commit

Permalink
Merge pull request #1339 from decent-dao/fix/alchemy-for-mainnet
Browse files Browse the repository at this point in the history
Use Alchemy provider on mainnet
  • Loading branch information
mudrila authored Jan 25, 2024
2 parents 4770c34 + 2f1afdb commit 8e32a3c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/release-netlify-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
NEXT_PUBLIC_SITE_URL: ${{ secrets.NEXT_PUBLIC_SITE_URL }}
NEXT_PUBLIC_ALCHEMY_API_KEY: ${{ secrets.NEXT_PUBLIC_ALCHEMY_API_KEY }}
1 change: 1 addition & 0 deletions .github/workflows/release-netlify-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
1 change: 1 addition & 0 deletions .github/workflows/release-netlify-staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
15 changes: 11 additions & 4 deletions src/providers/NetworkConfig/rainbow-kit.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
};
},
}),
]);
Expand Down

0 comments on commit 8e32a3c

Please sign in to comment.