Skip to content

Commit 07f7f6b

Browse files
tom2drumisstuev
authored andcommitted
migrate to new response format from MegaETH flash blocks websocket
1 parent b4dd9b6 commit 07f7f6b

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

types/api/flashblocks.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ export interface FlashblockItemApiOptimism {
2626
}
2727

2828
export interface FlashblockItemApiMegaEth {
29-
block_number: number;
30-
index: number;
31-
gas_used: number;
32-
gas_offset: number;
33-
timestamp: string;
29+
block_number: string;
30+
block_timestamp: string;
31+
gas_used: string;
32+
index: string;
33+
mini_block_number: number;
34+
mini_block_timestamp: string;
35+
receipts: Array<unknown>;
3436
transactions: Array<unknown>;
35-
log_offset: number;
36-
tx_offset: number;
3737
}

ui/blocks/flashblocks/formatFlashblockItem.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ export function formatFlashblockItemOptimism(item: FlashblockItemApiOptimism): F
2323

2424
export function formatFlashblockItemMegaEth(item: FlashblockItemApiMegaEth): FlashblockItem {
2525
return {
26-
block_number: item.block_number,
27-
index: item.index,
26+
block_number: Number.parseInt(item.block_number, 16),
27+
index: Number(item.index),
2828
transactions_count: item.transactions.length,
29-
gas_used: item.gas_used,
30-
timestamp: item.timestamp,
29+
gas_used: Number(item.gas_used),
30+
timestamp: new Date(Math.round(Number.parseInt(item.mini_block_timestamp, 16) / 1000)).toISOString(),
3131
};
3232
}

0 commit comments

Comments
 (0)