Skip to content

Commit

Permalink
fix: move away from public Alchemy RPC URLs (#1176)
Browse files Browse the repository at this point in the history
* fix: change public rpc urls

* chore: changeset

* chore: update snapshots

* refactor: use ankr for goerli

* chore: update snapshot
  • Loading branch information
jxom authored Oct 28, 2022
1 parent 196a458 commit 389765f
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 49 deletions.
6 changes: 6 additions & 0 deletions .changeset/rude-dolphins-trade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@wagmi/core': patch
'wagmi': patch
---

Migrate away from Alchemy RPC URLs in the public RPC URL list
40 changes: 20 additions & 20 deletions packages/core/src/actions/accounts/getNetwork.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ describe('getNetwork', () => {
"network": "homestead",
"rpcUrls": {
"alchemy": "https://eth-mainnet.alchemyapi.io/v2",
"default": "https://eth-mainnet.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"default": "https://cloudflare-eth.com",
"infura": "https://mainnet.infura.io/v3",
"public": "https://eth-mainnet.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"public": "https://cloudflare-eth.com",
},
},
{
Expand Down Expand Up @@ -121,9 +121,9 @@ describe('getNetwork', () => {
"network": "ropsten",
"rpcUrls": {
"alchemy": "https://eth-ropsten.alchemyapi.io/v2",
"default": "https://eth-ropsten.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"default": "https://rpc.ankr.com/eth_ropsten",
"infura": "https://ropsten.infura.io/v3",
"public": "https://eth-ropsten.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"public": "https://rpc.ankr.com/eth_ropsten",
},
"testnet": true,
},
Expand Down Expand Up @@ -155,9 +155,9 @@ describe('getNetwork', () => {
"network": "rinkeby",
"rpcUrls": {
"alchemy": "https://eth-rinkeby.alchemyapi.io/v2",
"default": "https://eth-rinkeby.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"default": "https://rpc.ankr.com/eth_rinkeby",
"infura": "https://rinkeby.infura.io/v3",
"public": "https://eth-rinkeby.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"public": "https://rpc.ankr.com/eth_rinkeby",
},
"testnet": true,
},
Expand Down Expand Up @@ -189,9 +189,9 @@ describe('getNetwork', () => {
"network": "goerli",
"rpcUrls": {
"alchemy": "https://eth-goerli.alchemyapi.io/v2",
"default": "https://eth-goerli.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"default": "https://rpc.ankr.com/eth_goerli",
"infura": "https://goerli.infura.io/v3",
"public": "https://eth-goerli.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"public": "https://rpc.ankr.com/eth_goerli",
},
"testnet": true,
},
Expand Down Expand Up @@ -220,9 +220,9 @@ describe('getNetwork', () => {
"network": "kovan",
"rpcUrls": {
"alchemy": "https://eth-kovan.alchemyapi.io/v2",
"default": "https://eth-kovan.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"default": "https://kovan.infura.io/v3/84842078b09946638c03157f83405213",
"infura": "https://kovan.infura.io/v3",
"public": "https://eth-kovan.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"public": "https://kovan.infura.io/v3/84842078b09946638c03157f83405213",
},
"testnet": true,
},
Expand Down Expand Up @@ -303,9 +303,9 @@ describe('getNetwork', () => {
"network": "homestead",
"rpcUrls": {
"alchemy": "https://eth-mainnet.alchemyapi.io/v2",
"default": "https://eth-mainnet.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"default": "https://cloudflare-eth.com",
"infura": "https://mainnet.infura.io/v3",
"public": "https://eth-mainnet.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"public": "https://cloudflare-eth.com",
},
},
{
Expand Down Expand Up @@ -336,9 +336,9 @@ describe('getNetwork', () => {
"network": "ropsten",
"rpcUrls": {
"alchemy": "https://eth-ropsten.alchemyapi.io/v2",
"default": "https://eth-ropsten.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"default": "https://rpc.ankr.com/eth_ropsten",
"infura": "https://ropsten.infura.io/v3",
"public": "https://eth-ropsten.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"public": "https://rpc.ankr.com/eth_ropsten",
},
"testnet": true,
},
Expand Down Expand Up @@ -370,9 +370,9 @@ describe('getNetwork', () => {
"network": "rinkeby",
"rpcUrls": {
"alchemy": "https://eth-rinkeby.alchemyapi.io/v2",
"default": "https://eth-rinkeby.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"default": "https://rpc.ankr.com/eth_rinkeby",
"infura": "https://rinkeby.infura.io/v3",
"public": "https://eth-rinkeby.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"public": "https://rpc.ankr.com/eth_rinkeby",
},
"testnet": true,
},
Expand Down Expand Up @@ -404,9 +404,9 @@ describe('getNetwork', () => {
"network": "goerli",
"rpcUrls": {
"alchemy": "https://eth-goerli.alchemyapi.io/v2",
"default": "https://eth-goerli.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"default": "https://rpc.ankr.com/eth_goerli",
"infura": "https://goerli.infura.io/v3",
"public": "https://eth-goerli.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"public": "https://rpc.ankr.com/eth_goerli",
},
"testnet": true,
},
Expand Down Expand Up @@ -435,9 +435,9 @@ describe('getNetwork', () => {
"network": "kovan",
"rpcUrls": {
"alchemy": "https://eth-kovan.alchemyapi.io/v2",
"default": "https://eth-kovan.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"default": "https://kovan.infura.io/v3/84842078b09946638c03157f83405213",
"infura": "https://kovan.infura.io/v3",
"public": "https://eth-kovan.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"public": "https://kovan.infura.io/v3/84842078b09946638c03157f83405213",
},
"testnet": true,
},
Expand Down
44 changes: 22 additions & 22 deletions packages/core/src/actions/accounts/watchNetwork.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ describe('watchNetwork', () => {
"network": "rinkeby",
"rpcUrls": {
"alchemy": "https://eth-rinkeby.alchemyapi.io/v2",
"default": "https://eth-rinkeby.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"default": "https://rpc.ankr.com/eth_rinkeby",
"infura": "https://rinkeby.infura.io/v3",
"public": "https://eth-rinkeby.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"public": "https://rpc.ankr.com/eth_rinkeby",
},
"testnet": true,
"unsupported": false,
Expand Down Expand Up @@ -86,9 +86,9 @@ describe('watchNetwork', () => {
"network": "homestead",
"rpcUrls": {
"alchemy": "https://eth-mainnet.alchemyapi.io/v2",
"default": "https://eth-mainnet.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"default": "https://cloudflare-eth.com",
"infura": "https://mainnet.infura.io/v3",
"public": "https://eth-mainnet.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"public": "https://cloudflare-eth.com",
},
},
{
Expand Down Expand Up @@ -119,9 +119,9 @@ describe('watchNetwork', () => {
"network": "ropsten",
"rpcUrls": {
"alchemy": "https://eth-ropsten.alchemyapi.io/v2",
"default": "https://eth-ropsten.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"default": "https://rpc.ankr.com/eth_ropsten",
"infura": "https://ropsten.infura.io/v3",
"public": "https://eth-ropsten.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"public": "https://rpc.ankr.com/eth_ropsten",
},
"testnet": true,
},
Expand Down Expand Up @@ -153,9 +153,9 @@ describe('watchNetwork', () => {
"network": "rinkeby",
"rpcUrls": {
"alchemy": "https://eth-rinkeby.alchemyapi.io/v2",
"default": "https://eth-rinkeby.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"default": "https://rpc.ankr.com/eth_rinkeby",
"infura": "https://rinkeby.infura.io/v3",
"public": "https://eth-rinkeby.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"public": "https://rpc.ankr.com/eth_rinkeby",
},
"testnet": true,
},
Expand Down Expand Up @@ -187,9 +187,9 @@ describe('watchNetwork', () => {
"network": "goerli",
"rpcUrls": {
"alchemy": "https://eth-goerli.alchemyapi.io/v2",
"default": "https://eth-goerli.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"default": "https://rpc.ankr.com/eth_goerli",
"infura": "https://goerli.infura.io/v3",
"public": "https://eth-goerli.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"public": "https://rpc.ankr.com/eth_goerli",
},
"testnet": true,
},
Expand Down Expand Up @@ -218,9 +218,9 @@ describe('watchNetwork', () => {
"network": "kovan",
"rpcUrls": {
"alchemy": "https://eth-kovan.alchemyapi.io/v2",
"default": "https://eth-kovan.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"default": "https://kovan.infura.io/v3/84842078b09946638c03157f83405213",
"infura": "https://kovan.infura.io/v3",
"public": "https://eth-kovan.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"public": "https://kovan.infura.io/v3/84842078b09946638c03157f83405213",
},
"testnet": true,
},
Expand Down Expand Up @@ -287,9 +287,9 @@ describe('watchNetwork', () => {
"network": "homestead",
"rpcUrls": {
"alchemy": "https://eth-mainnet.alchemyapi.io/v2",
"default": "https://eth-mainnet.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"default": "https://cloudflare-eth.com",
"infura": "https://mainnet.infura.io/v3",
"public": "https://eth-mainnet.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"public": "https://cloudflare-eth.com",
},
},
{
Expand Down Expand Up @@ -320,9 +320,9 @@ describe('watchNetwork', () => {
"network": "ropsten",
"rpcUrls": {
"alchemy": "https://eth-ropsten.alchemyapi.io/v2",
"default": "https://eth-ropsten.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"default": "https://rpc.ankr.com/eth_ropsten",
"infura": "https://ropsten.infura.io/v3",
"public": "https://eth-ropsten.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"public": "https://rpc.ankr.com/eth_ropsten",
},
"testnet": true,
},
Expand Down Expand Up @@ -354,9 +354,9 @@ describe('watchNetwork', () => {
"network": "rinkeby",
"rpcUrls": {
"alchemy": "https://eth-rinkeby.alchemyapi.io/v2",
"default": "https://eth-rinkeby.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"default": "https://rpc.ankr.com/eth_rinkeby",
"infura": "https://rinkeby.infura.io/v3",
"public": "https://eth-rinkeby.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"public": "https://rpc.ankr.com/eth_rinkeby",
},
"testnet": true,
},
Expand Down Expand Up @@ -388,9 +388,9 @@ describe('watchNetwork', () => {
"network": "goerli",
"rpcUrls": {
"alchemy": "https://eth-goerli.alchemyapi.io/v2",
"default": "https://eth-goerli.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"default": "https://rpc.ankr.com/eth_goerli",
"infura": "https://goerli.infura.io/v3",
"public": "https://eth-goerli.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"public": "https://rpc.ankr.com/eth_goerli",
},
"testnet": true,
},
Expand Down Expand Up @@ -419,9 +419,9 @@ describe('watchNetwork', () => {
"network": "kovan",
"rpcUrls": {
"alchemy": "https://eth-kovan.alchemyapi.io/v2",
"default": "https://eth-kovan.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"default": "https://kovan.infura.io/v3/84842078b09946638c03157f83405213",
"infura": "https://kovan.infura.io/v3",
"public": "https://eth-kovan.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"public": "https://kovan.infura.io/v3/84842078b09946638c03157f83405213",
},
"testnet": true,
},
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/constants/rpcs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ type PublicChains = Extract<
| 'arbitrumGoerli'
>
export const publicRpcUrls: Record<PublicChains, string> = {
mainnet: `${alchemyRpcUrls.mainnet}/${defaultAlchemyApiKey}`,
ropsten: `${alchemyRpcUrls.ropsten}/${defaultAlchemyApiKey}`,
rinkeby: `${alchemyRpcUrls.rinkeby}/${defaultAlchemyApiKey}`,
goerli: `${alchemyRpcUrls.goerli}/${defaultAlchemyApiKey}`,
kovan: `${alchemyRpcUrls.kovan}/${defaultAlchemyApiKey}`,
mainnet: 'https://cloudflare-eth.com',
ropsten: 'https://rpc.ankr.com/eth_ropsten',
rinkeby: 'https://rpc.ankr.com/eth_rinkeby',
goerli: 'https://rpc.ankr.com/eth_goerli',
kovan: `${infuraRpcUrls.kovan}/${defaultInfuraApiKey}`,
sepolia: 'https://rpc.sepolia.org',
optimism: 'https://mainnet.optimism.io',
optimismKovan: 'https://kovan.optimism.io',
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/providers/alchemy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { defaultAlchemyApiKey } from '../constants'
import { ChainProviderFn, FallbackProviderConfig } from '../types'

export type AlchemyProviderConfig = FallbackProviderConfig & {
// TODO: Make `apiKey` required in next minor version (v0.8).
apiKey?: string
}

Expand Down
1 change: 1 addition & 0 deletions packages/core/src/providers/infura.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { defaultInfuraApiKey } from '../constants/rpcs'
import { ChainProviderFn, FallbackProviderConfig } from '../types'

export type InfuraProviderConfig = FallbackProviderConfig & {
// TODO: Make `apiKey` required in next minor version (v0.8).
apiKey?: string
}

Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/hooks/accounts/useSwitchNetwork.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,9 @@ describe('useSwitchNetwork', () => {
"network": "rinkeby",
"rpcUrls": {
"alchemy": "https://eth-rinkeby.alchemyapi.io/v2",
"default": "https://eth-rinkeby.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"default": "https://rpc.ankr.com/eth_rinkeby",
"infura": "https://rinkeby.infura.io/v3",
"public": "https://eth-rinkeby.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",
"public": "https://rpc.ankr.com/eth_rinkeby",
},
"testnet": true,
}
Expand Down

1 comment on commit 389765f

@vercel
Copy link

@vercel vercel bot commented on 389765f Oct 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.