Skip to content

Commit

Permalink
Add ability to create RPC service chain
Browse files Browse the repository at this point in the history
We want to update the `fetch` middleware in `eth-json-rpc-middleware`
and the Infura middleware in `eth-json-rpc-infura` to automatically fail
over to alternate RPC endpoints when the desired endpoint is down. To do
this, we need a way to string together a collection of RPC services,
where the first service represents the primary endpoint, the second
service is failover for the first, the third service is a failover for
the second, etc. This composite object should conform to the same
interface as an RPC service so consumers do not have to care whether
they are working with a single endpoint or a chain of them.

Also expose `AbstractRpcService` so that we can make use of it in the
middleware packages.
  • Loading branch information
mcmire committed Feb 3, 2025
1 parent 4ece19f commit aded418
Show file tree
Hide file tree
Showing 4 changed files with 898 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/network-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Add `AbstractRpcService`, the interface for all RPC services ([#5226](https://github.com/MetaMask/core/pull/5226))

### Changed

- Bump `@metamask/base-controller` from `^7.0.0` to `^7.1.0` ([#5079](https://github.com/MetaMask/core/pull/5079))
Expand Down
1 change: 1 addition & 0 deletions packages/network-controller/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ export type {
} from './types';
export { NetworkClientType } from './types';
export type { NetworkClient } from './create-network-client';
export type { AbstractRpcService } from './rpc-service/abstract-rpc-service';
Loading

0 comments on commit aded418

Please sign in to comment.