Skip to content

simulate error code=-32000 #114

@yuzhongrong

Description

@yuzhongrong
image

the code:

` const maxBaseFeeInFutureBlock = FlashbotsBundleProvider.getMaxBaseFeeInFutureBlock(block.baseFeePerGas, BLOCKS_IN_THE_FUTURE)

 //定义一个eip1559交易
const eip1559Transaction  = {
  to: '0xC1c4301C5bd4eBe2C04817aC815AaceB4DeDA8DB',
  type: 2,
  maxFeePerGas: PRIORITY_FEE.add(maxBaseFeeInFutureBlock),
  maxPriorityFeePerGas: PRIORITY_FEE,
  gasLimit: 100000,
  data: '0x',
  chainId: 5,
  value: ethers.utils.parseEther("0.1105"),
  nonce:mNonce
  
}

 



//签名绑定包
const signedTransactions = await flashbotsProvider.signBundle([
 
  {
    signer: wallet,
    transaction: eip1559Transaction
  }
])

//模拟
const targetBlockNumber = block.number + BLOCKS_IN_THE_FUTURE
const simulation = await flashbotsProvider.simulate(signedTransactions, targetBlockNumber)

// Using TypeScript discrimination
if ('error' in simulation) {
  console.warn(`Simulation Error: ${simulation.error.message}`)
  process.exit(1)
} else {
  console.log(`Simulation Success: ${JSON.stringify(simulation, null, 2)}`)
}

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions