flashbots / ethers-provider-flashbots-bundle

Flashbots provider for ethers.js
543 stars 212 forks source link

Property 'sendBundle' does not exist on type 'Promise<FlashbotsBundleProvider>' #76

Closed JulioSarda closed 2 years ago

JulioSarda commented 2 years ago

Hello !!

src/flashloan.ts:151:41 - error TS2339: Property 'sendBundle' does not exist on type 'Promise'.

151 const resul = await flashbotsProvider.sendBundle(



I have:

import { ethers } from "ethers";
import { providers, Wallet } from "ethers";
import { FlashbotsBundleProvider } from "@flashbots/ethers-provider-bundle";

...

/* Nodo */
const maticProvider = new providers.JsonRpcProvider(
  process.env.ALCHEMY_POLYGON_RPC_URL
);

if (process.env.PRIVATE_KEY === undefined) {
  throw new Error("Private key is not defined");
}
/* Mi Key Wallet */
const private_key = process.env.PRIVATE_KEY;

/* Mi Wallet */
const signer = new ethers.Wallet(private_key, maticProvider);

/* Usuario Wallet Random */
const user = ethers.Wallet.createRandom().connect(maticProvider)

/* Mi Wallet Random */
const authSigner = Wallet.createRandom();

...

const flashbotsProvider =  FlashbotsBundleProvider.create(
provider, 
authSigner,
"https://relay-goerli.flashbots.net",
"goerli")

...

  const transactionBundle = [
    {
        signedTransaction: signer // serialized signed transaction hex
    },
    {
        signer: authSigner,
        trasaction: transaction
    }
  ]
...

  const resul = await flashbotsProvider.sendBundle(
  transactionBundle,
  blockNumber,
    {
      minTimestamp, // optional minimum timestamp at which this bundle is valid (inclusive)
      maxTimestamp  // optional maximum timestamp at which this bundle is valid (inclusive)
    }
  )

Why ?

Thanks !!