diff --git a/src/components/default/LatestBlocks/LatestBlocks.tsx b/src/components/default/LatestBlocks/LatestBlocks.tsx index 21133d1..2ea023e 100644 --- a/src/components/default/LatestBlocks/LatestBlocks.tsx +++ b/src/components/default/LatestBlocks/LatestBlocks.tsx @@ -88,6 +88,8 @@ function LatestBlocks({ fetchedInfo, fetchedLatestBlocks }: { fetchedInfo: Info const tableHeaders = [ "HEIGHT", "TIMESTAMP (UTC)", "AGE", "SIZE", "TRANSACTIONS", "HASH" ]; const tableElements = blocks.map(e => { + console.log(e); + const hash = e.hash; const hashLink = hash ? "/block/" + hash : "/"; return [ diff --git a/src/interfaces/common/BlockInfo.ts b/src/interfaces/common/BlockInfo.ts index 151ebdf..188d148 100644 --- a/src/interfaces/common/BlockInfo.ts +++ b/src/interfaces/common/BlockInfo.ts @@ -1,7 +1,7 @@ interface BlockInfo { type: "PoS" | "PoW"; - timestamp?: Date; - actualTimestamp?: BigInt; + timestamp?: string; + actualTimestamp?: string; difficulty: string; minerTextInfo?: string; cummulativeDiffAdjusted?: string; diff --git a/src/pages/block/[hash].tsx b/src/pages/block/[hash].tsx index 5bd47b9..99e217a 100644 --- a/src/pages/block/[hash].tsx +++ b/src/pages/block/[hash].tsx @@ -154,7 +154,7 @@ function Block(props: BlockProps) { Timestamp (UTC): - {blockInfo?.timestamp ? Utils.formatTimestampUTC(+new Date(blockInfo?.timestamp)) : "-"} + {blockInfo?.timestamp ? Utils.formatTimestampUTC(+new Date(parseInt(blockInfo?.timestamp, 10))) : "-"} ID diff --git a/src/utils/utils.ts b/src/utils/utils.ts index ee50afb..87b2f90 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -81,10 +81,12 @@ class Utils { static transformToBlocks(result: any, reverse: boolean = false, hashField: boolean = false): Block[] { if (result.sucess === false) return []; if (!(result instanceof Array)) return []; + console.log(result); + return (reverse ? result.reverse() : result).map((e: any) => ({ height: e.height, type: e.type === '0' ? "PoS" : "PoW", - timestamp: +new Date(e.timestamp), + timestamp: +new Date(parseInt(e.timestamp, 10)), size: e.total_txs_size, transactions: e.tr_count, hash: !hashField ? e.tx_id : e.hash