diff --git a/docs/pages/docs/constants/rpcs.en-US.mdx b/docs/pages/docs/constants/rpcs.en-US.mdx index 78f5397a04..0ca3bfbbb5 100644 --- a/docs/pages/docs/constants/rpcs.en-US.mdx +++ b/docs/pages/docs/constants/rpcs.en-US.mdx @@ -13,6 +13,18 @@ import { alchemyRpcUrls } from 'wagmi' // alchemyRpcUrls.polygon ``` +## ankrRpcUrls + +RPC URLs supported by [Ankr](https://ankr.com). + +```ts +import { ankrRpcUrls } from 'wagmi' + +// ankrRpcUrls.mainnet +// ankrRpcUrls.arbitrum +// ankrRpcUrls.polygon +``` + ## infuraRpcUrls RPC URLs supported by [Infura](https://infura.io). diff --git a/packages/core/src/constants/index.ts b/packages/core/src/constants/index.ts index 2635ff8919..79e6da93ad 100644 --- a/packages/core/src/constants/index.ts +++ b/packages/core/src/constants/index.ts @@ -11,7 +11,7 @@ export { defaultL2Chains, } from './chains' -export { alchemyRpcUrls, infuraRpcUrls } from './rpcs' +export { alchemyRpcUrls, ankrRpcUrls, infuraRpcUrls } from './rpcs' export type { RpcProviderName } from './rpcs' export { units } from './units' diff --git a/packages/core/src/constants/rpcs.ts b/packages/core/src/constants/rpcs.ts index bd05af4c0f..49fdf7d35d 100644 --- a/packages/core/src/constants/rpcs.ts +++ b/packages/core/src/constants/rpcs.ts @@ -3,7 +3,7 @@ import { ChainName } from './chains' export const defaultAlchemyId = '_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC' export const defaultInfuraId = '84842078b09946638c03157f83405213' -export type RpcProviderName = 'alchemy' | 'infura' +export type RpcProviderName = 'alchemy' | 'ankr' | 'infura' type AlchemyChains = Extract< ChainName, @@ -60,3 +60,16 @@ export const infuraRpcUrls: Record = { arbitrum: 'https://arbitrum-mainnet.infura.io/v3', arbitrumRinkeby: 'https://arbitrum-rinkeby.infura.io/v3', } as const + +type AnkrChains = Extract< + ChainName, + 'mainnet' | 'ropsten' | 'rinkeby' | 'goerli' | 'polygon' | 'arbitrum' +> +export const ankrRpcUrls: Record = { + mainnet: 'https://rpc.ankr.com/eth', + ropsten: 'htps://rpc.ankr.com/eth_ropsten', + rinkeby: 'https://rpc.ankr.com/eth_rinkeby', + goerli: 'https://rpc.ankr.com/eth_goerli', + polygon: 'https://rpc.ankr.com/polygon', + arbitrum: 'https://rpc.ankr.com/arbitrum', +} as const diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 2a0400ffbd..390c60d415 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -98,6 +98,7 @@ export type { ConnectorData, ConnectorEvents } from './connectors' export { alchemyRpcUrls, allChains, + ankrRpcUrls, chain, chainId, defaultChains, diff --git a/packages/react/src/index.ts b/packages/react/src/index.ts index 7854e2288f..eaf0c1e263 100644 --- a/packages/react/src/index.ts +++ b/packages/react/src/index.ts @@ -47,6 +47,7 @@ export { WagmiClient, alchemyRpcUrls, allChains, + ankrRpcUrls, chain, chainId, createStorage,