Summary
We provide theuseRpcProviders
hook
that allows direct access to RPC providers for EVM & Solana.
Rpc providers can be used to make RPC calls to the blockchain while also providing convenience
methods without going through a wallet.
Each provider will use the RPC configured in the Dashboard if present,
otherwise they fall back to public RPCs urls. You can see the public URL by checking on the network in the dashboard.
Dashboard Configuration
To enter your provider url for a given network:- Go to the Chains & Networks page in your Dashboard.
- Click on the chain to open the details tab
- Click the down down arrow to expand a network
- Enter your Provider Url
- Click the test button to check url
Overriding RPC URLs in code using overrideNetworkRpcUrl
EVM
You can override the RPC url of any EVM network by using theoverrideNetworkRpcUrl
method in combination with the overrides.evmNetworks
settings.
The following example overrides the RPC url of the Ethereum mainnet and Polygon set in the dashboard with the ones set in the rpcUrlOverrides
object.
SVM (sdk v4.8.0+)
You can override the RPC url of any SVM network by using theoverrideNetworkRpcUrl
method in combination with the overrides.solNetworks
settings.
The following example overrides the RPC url of the Solana mainnet and Eclipse mainnet set in the dashboard with the ones set in the rpcUrlOverrides
object.
Fetching RPC Providers with the useRpcProviders hook
You are able to use theuseRpcProviders
hook
to obtain an object with rpc providers, and this hook expects a selector parameter
that you must use to select either EVM or Solana rpc providers.
The provider for EVM or Solana Mainnet, if mainnet is enabled
A full list of all EVM or Solana providers that have been configured
A convenience method that lets you retrieve a provider for a specific Chain ID
Check out the reference for
EvmRpcProvider and
SolanaRpcProvider