Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ import { URLSearchParams } from 'url';
const TIMEOUT_QUERY_TX_MS = 5 * 60 * 1000

export default class MevShareClient {
private requestId: number
constructor(
private authSigner: Wallet,
private network: MevShareNetwork,
) {
this.authSigner = authSigner
this.network = network
this.requestId = 0
}

/** Connect to Flashbots MEV-Share node on Mainnet. */
Expand Down Expand Up @@ -91,7 +93,7 @@ export default class MevShareClient {
*/
private async handleApiRequest(params: Array<any>, method: any): Promise<any> {
try {
return this.postRpc(this.network.apiUrl, await getRpcRequest(params, method, this.authSigner))
return this.postRpc(this.network.apiUrl, await getRpcRequest(params, method, this.requestId++, this.authSigner))
} catch (e) {
if (e instanceof AxiosError) {
throw new NetworkFailure(e)
Expand Down
4 changes: 2 additions & 2 deletions src/flashbots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ export type JsonRpcData = {
* @param authSigner - Wallet used to sign Flashbots auth header; for reputation
* @returns Parameters of payload to send to Bundle API
*/
export const getRpcRequest = async (params: any, method: string, authSigner: Wallet) => {
export const getRpcRequest = async (params: any, method: string, id: number, authSigner: Wallet) => {
const body = {
params,
method,
id: 69,
id,
jsonrpc: "2.0"
}
const signature = `${authSigner.address}:${await authSigner.signMessage(ethersId(JSON.stringify(body)))}`
Expand Down