useRpcProviders
Summary
This hook provides acces to EVM and Solana RPC providers.
Check out our guide on Using RPC Providers
Usage
This hook must be fed with an RPC provider selector, of which you can chose among two:
evmProvidersSelector
, exported from@dynamic-labs/rpc-provider-ethereum
solanaProvidersSelector
, exported from@dynamic-labs/rpc-provider-solana
import { useRpcProviders } from '@dynamic-labs/sdk-react-core'
import { evmProvidersSelector } from '@dynamic-labs/rpc-provider-ethereum'
import { solanaProvidersSelector } from '@dynamic-labs/rpc-provider-solana'
const App = () => {
const evmProviders = useRpcProviders(evmProvidersSelector)
const solanaProviders = useRpcProviders(solanaProvidersSelector)
}
Return Value
This hook’s return value depends on the selector with which it was fed:
- EvmRpcProviderMethods when fed with
evmProvidersSelector
- SolanaRpcProviderMethods when fed with
solanaProvidersSelector
Was this page helpful?