Skip to content

fallback

The fallback Transport consumes multiple Transports. If a Transport request fails, it will fall back to the next one in the list. Wraps Viem's fallback Transport.

Import

ts
import { fallback } from 'wagmi'

Usage

ts
import { 
  createConfig, 
  fallback,
  http,
} from 'wagmi'
import { mainnet } from 'wagmi/chains'

export const config = createConfig({
  chains: [mainnet],
  connectors: [injected()],
  transports: {
    [mainnet.id]: fallback([ 
      http('https://foo-bar-baz.quiknode.pro/...'), 
      http('https://mainnet.infura.io/v3/...'), 
    ]) 
  },
})

Released under the MIT License.