Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sambacha/web3-rpc-failover
web3 rpc provider connectivity failover
https://github.com/sambacha/web3-rpc-failover
ethereum provider rpc web3
Last synced: 23 days ago
JSON representation
web3 rpc provider connectivity failover
- Host: GitHub
- URL: https://github.com/sambacha/web3-rpc-failover
- Owner: sambacha
- License: mit
- Created: 2021-07-21T19:14:09.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-09-24T16:39:38.000Z (about 1 year ago)
- Last Synced: 2024-10-06T15:42:03.526Z (about 1 month ago)
- Topics: ethereum, provider, rpc, web3
- Language: TypeScript
- Homepage:
- Size: 662 KB
- Stars: 4
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# web3-rpc-failover
> FailoverProvider via yaml configuration file for cascading connection fallbacks
## Motivation
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](https://docs.ethers.io/v5/single-page/#/v5/api/providers/other/-%23-FallbackProvider)
## Install
`npm i web3-rpc-failover`
### Usage: as an external module
- install web3-rpc-failover
- configure your RPC Service Providers in order of preference for failover```yaml
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)### Usage: as a library
```js
const {FallbackProvider} = require('web3-rpc-failover')
const provider = new FallbackProvider()
```## License
MIT