Skip to content

freelogstudio/ethers-flashbots

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ethers-flashbots

Create a wrapped Signer object that will send transactions via eth_sendPrivateTransaction, as supported by the Alchemy free tier API or flashbots relay RPC itself.

Usage

const { makePrivateSigner } = require('ethers-flashbots');


(async () => {
  const [ signer ] = ethers.getSigners();
  const contract = new Contract(address, ['function stateChangingFunction()'], makePrivateSigner({
    signer,
    getMaxBlockNumber: async (signer, tx) => {
      return ethers.utils.hexlify(Number(await signer.provider.getBlockNumber()) + 100);
    },
    getPreferences: async () => ({ fast: true }) // default behavior
  }));
  const tx = await contract.stateChangingFunction();
  console.log(await tx.wait());
})().catch(console.error);

Author

Freelog Studio LLC

About

eth_sendPrivateTransaction

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published