vector
vector copied to clipboard
[DNM] ChainRpcProvider class with fallback capabilities
The Problem
Issue #410: https://github.com/connext/vector/issues/410
The Solution
The user should be able to specify in their router's config multiple provider addresses which can be used to fallback to.
For fallback functionality, we are leaning on ethersproject FallbackProvider, but have made a custom extending class ChainProvider which wraps that functionality but also enforces we are using JsonRpcProvider.
Here we've implemented this change with backwards compatability by using comma-separated values. Example for chainProviders in config:
{
"1337": "http://localhost:8545,http://localhost:8546",
"1338": "http://localhost:8547"
}
TODO: Link change in docs where we've updated the config API.
Pending tests.