-
Notifications
You must be signed in to change notification settings - Fork 294
Description
`const flashbotsProvider = await FlashbotsBundleProvider.create(
provider,
authSigner,
// 使用主网 Flashbots,需要把下面两行删去
'https://relay-sepolia.flashbots.net/',
'sepolia'
);
// EIP 1559 transaction
const transaction0 = {
chainId: 11155111,
type: 2,
to: "0xC1c4301C5bd4eBe2C04817aC815AaceB4DeDA8DB",
value: ethers.utils.parseEther("0.001"),
maxFeePerGas: GWEI * 100n
}
// 5. 创建交易 Bundle
const transactionBundle = [
{
signer: wallet, // ethers signer
transaction: transaction0 // ethers populated transaction object
}
// 也可以加入mempool中签名好的交易(可以是任何人发送的)
// ,{
// signedTransaction: SIGNED_ORACLE_UPDATE_FROM_PENDING_POOL // serialized signed transaction hex
// }
]
// 6. 模拟交易,交易模拟成功后才能执行
// 签名交易
const signedTransactions = await flashbotsProvider.signBundle(transactionBundle)
// 设置交易的目标执行区块(在哪个区块执行)
const targetBlockNumber = (await provider.getBlockNumber()) + 1
// 模拟
const simulation = await flashbotsProvider.simulate(signedTransactions, targetBlockNumber)`
the resualt log :
body: '{"error":"Internal Server Error"}',