web3 rpc provider connectivity failover
MIT License
FailoverProvider via yaml configuration file for cascading connection fallbacks
Providing assurances for Service Provider outages in a robust and simple way.
Do not confuse our usage of failover
with how ethers-js uses fallback. see the ethers documentation, fallback provider
npm i web3-rpc-failover
install web3-rpc-failover
configure your RPC Service Providers in order of preference for failover
providers:
- url: 'https://mainnet.infura**'
config:
priority: 2
stallTimeout: 200
weight: 2
- url: 'infura.io/zzz'
config:
priority: 1
stallTimeout: 100
weight: 1
priority
: priority used for the provider
stallTimeout
: timeout (in ms)
const {FallbackProvider} = require('web3-rpc-failover')
const provider = new FallbackProvider(<pathToYAMLConfig>)
MIT