Skip to content

Commit

Permalink
Merge pull request #1 from FairCrypto/realtime
Browse files Browse the repository at this point in the history
add realtime events using the solana rpc
  • Loading branch information
nibty authored May 11, 2024
2 parents 7f85b3f + c0d57a6 commit c77b460
Show file tree
Hide file tree
Showing 5 changed files with 909 additions and 149 deletions.
21 changes: 7 additions & 14 deletions app/leaderboard/StateStats.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
import React, {useEffect, useState} from "react";
import {useSearchParams} from "next/navigation";
import React, { useEffect, useState } from "react";
import { useSearchParams } from "next/navigation";

interface State {
points: number;
export interface State {
points: bigint;
hashes: number;
superHashes: number;
txs: number;
amp: number;
lastAmpSlot: number;
lastAmpSlot: bigint;
}

export default function StateStats({state}: { state: State }) {
export default function StateStats({ state }: { state: State }) {
const isLoading = () => state?.points === undefined;

const totalSupplyValue = () => {
if (isNaN(state?.points)) {
return null;
}
return Intl.NumberFormat("en-US").format(
state?.points / 1_000_000_000,
parseInt(String(state.points / 1_000_000_000n)),
);
};

Expand Down Expand Up @@ -51,9 +48,6 @@ export default function StateStats({state}: { state: State }) {
};

const lastAmpSlotValue = () => {
if (isNaN(state?.lastAmpSlot)) {
return null;
}
return Intl.NumberFormat("en-US").format(state?.lastAmpSlot);
};

Expand Down Expand Up @@ -105,6 +99,5 @@ export default function StateStats({state}: { state: State }) {
<div className="stat-value text-sm md:text-2xl">{txsValue()}</div>
</div>
</div>

);
}
Loading

0 comments on commit c77b460

Please sign in to comment.