Skip to content

Commit

Permalink
add id
Browse files Browse the repository at this point in the history
  • Loading branch information
KillariDev committed Jan 29, 2024
1 parent 474825d commit 694746a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/ts/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const NETWORKS: { [chainId: string]: { simulationRelay: string, submissionRelay: string, blockExplorer: string, rpcUrl: string }} = {
'1': { simulationRelay: 'https://relay.dark.florist', submissionRelay: 'https://beaver-cors-proxy.dark-florist.workers.dev', blockExplorer: 'https://etherscan.io/', rpcUrl: 'https://rpc.dark.florist/flipcardtrustone' },
'1': { simulationRelay: 'https://relay.dark.florist', submissionRelay: 'https://rpc.titanbuilder.xyz', blockExplorer: 'https://etherscan.io/', rpcUrl: 'https://rpc.dark.florist/flipcardtrustone' },
'5': { simulationRelay: 'https://relay-goerli.dark.florist', submissionRelay: 'https://relay-goerli.dark.florist', blockExplorer: 'https://goerli.etherscan.io/', rpcUrl: 'https://rpc-goerli.dark.florist/flipcardtrustone' }
}
8 changes: 7 additions & 1 deletion app/ts/library/flashbots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export async function simulateBundle(
}
}

let bundleId = 1
export async function sendBundle(bundle: Bundle, targetBlock: bigint, fundingAmountMin: bigint, provider: ProviderStore, signers: Signers, blockInfo: BlockInfo, appSettings: AppSettings) {
if (appSettings.blocksInFuture <= 0n) throw new Error('Blocks in future is negative or zero')

Expand All @@ -105,7 +106,12 @@ export async function sendBundle(bundle: Bundle, targetBlock: bigint, fundingAmo
maxBaseFee,
)

const payload = JSON.stringify({ jsonrpc: '2.0', method: 'eth_sendBundle', params: [{ txs, blockNumber: `0x${targetBlock.toString(16)}`, revertingTxHashes: [] }] })
const payload = JSON.stringify({
jsonrpc: '2.0',
method: 'eth_sendBundle',
id: bundleId++,
params: [{ txs, blockNumber: `0x${targetBlock.toString(16)}`, revertingTxHashes: [] }]
})
const flashbotsSig = `${await provider.authSigner.getAddress()}:${await provider.authSigner.signMessage(id(payload))}`
const request = await fetch(appSettings.submissionRelayEndpoint,
{ method: 'POST', body: payload, headers: { 'Content-Type': 'application/json', 'X-Flashbots-Signature': flashbotsSig } }
Expand Down

0 comments on commit 694746a

Please sign in to comment.