ethers.js provider

🚧 Work in Progress Section

ethers-provider-openmev-bundle is a repository that contains the OpenMevBundleProvider ethers.js provider to provide high-level access to the eth_sendBundle rpc endpoint on mev-relay.

openmev-enabled relays and miners expose two new jsonrpc endpoint: eth_sendBundle and eth_callBundle. Since these are brand-new, non-standard endpoints, ethers.js and other libraries do not natively support these requests (like getTransactionCount).

In order to interact with these endpoints, you will also need access to another full-featured (non-Flashbots) endpoint for nonce-calculation, gas estimation, and transaction status.

This library is not a fully functional ethers.js implementation, just a simple provider class, designed to interact with your existing ethers.js v5 module.

// Force page refreshes on network changes
// The "any" network will allow spontaneous network changes
const provider = new ethers.providers.Web3Provider(window.ethereum, 'any');
provider.on('network', (newNetwork, oldNetwork) => {
// When a Provider makes its initial connection, it emits a "network"
// event with a null oldNetwork along with the newNetwork. So, if the
// oldNetwork exists, it represents a changing network
if (oldNetwork) {

At a minimum, most applications that support network changes will want to provider.removeAllListeners() on network changes, and re-establish their events.