diff --git a/apps/app/src/data/bos-components.ts b/apps/app/src/data/bos-components.ts index 63fd030a..b065bee3 100644 --- a/apps/app/src/data/bos-components.ts +++ b/apps/app/src/data/bos-components.ts @@ -8,6 +8,7 @@ type NetworkComponents = { latestBlocks: string; latestTransactions: string; transactionOverview: string; + sponsoredText: string; }; const ComponentUrl = { @@ -18,6 +19,7 @@ const ComponentUrl = { latestBlocks: `${process.env.NEXT_PUBLIC_ACCOUNT_ID}/widget/bos-components.components.Blocks.Latest`, latestTransactions: `${process.env.NEXT_PUBLIC_ACCOUNT_ID}/widget/bos-components.components.Transactions.Latest`, transactionOverview: `${process.env.NEXT_PUBLIC_ACCOUNT_ID}/widget/bos-components.components.Transactions.Overview`, + sponsoredText: `${process.env.NEXT_PUBLIC_ACCOUNT_ID}/widget/bos-components.components.Shared.SponsoredText`, }; export const componentsByNetworkId: Record< diff --git a/apps/app/src/pages/index.tsx b/apps/app/src/pages/index.tsx index 5675d435..0852c0a2 100644 --- a/apps/app/src/pages/index.tsx +++ b/apps/app/src/pages/index.tsx @@ -6,6 +6,24 @@ const HomePage = () => { return ( <> +
+
+
+
+

+ Near Protocol Explorer +

+
+
+ +
+
+
+
+
diff --git a/apps/bos-components/src/components/Blocks/Latest.tsx b/apps/bos-components/src/components/Blocks/Latest.tsx index 7bdb912a..1f9f7acc 100644 --- a/apps/bos-components/src/components/Blocks/Latest.tsx +++ b/apps/bos-components/src/components/Blocks/Latest.tsx @@ -44,6 +44,11 @@ export default function () { } fetchLatestBlocks(); + const interval = setInterval(() => { + fetchLatestBlocks(); + }, 5000); + + return () => clearInterval(interval); }, [config.backendUrl]); return ( diff --git a/apps/bos-components/src/components/Transactions/Latest.tsx b/apps/bos-components/src/components/Transactions/Latest.tsx index 65820e70..bb1ba03d 100644 --- a/apps/bos-components/src/components/Transactions/Latest.tsx +++ b/apps/bos-components/src/components/Transactions/Latest.tsx @@ -31,10 +31,7 @@ export default function () { useEffect(() => { function fetchLatestTxns() { setIsLoading(true); - asyncFetch(`${config.backendUrl}txns/latest`, { - refreshInterval: 5000, - revalidateOnReconnect: true, - }).then( + asyncFetch(`${config.backendUrl}txns/latest`).then( (data: { body: { txns: TransactionInfo[]; @@ -47,6 +44,11 @@ export default function () { setIsLoading(false); } fetchLatestTxns(); + const interval = setInterval(() => { + fetchLatestTxns(); + }, 5000); + + return () => clearInterval(interval); }, [config.backendUrl]); return ( diff --git a/apps/bos-components/src/components/Transactions/Overview.tsx b/apps/bos-components/src/components/Transactions/Overview.tsx index 47411999..996230bd 100644 --- a/apps/bos-components/src/components/Transactions/Overview.tsx +++ b/apps/bos-components/src/components/Transactions/Overview.tsx @@ -245,28 +245,6 @@ export default function (props: Props) { return ( -
-
-
-
-

- Near Protocol Explorer -

-
-
- { - - } -
-
-
-
-
diff --git a/apps/bos-components/src/includes/types.ts b/apps/bos-components/src/includes/types.ts index 8d52833f..54b1e85a 100644 --- a/apps/bos-components/src/includes/types.ts +++ b/apps/bos-components/src/includes/types.ts @@ -134,6 +134,7 @@ export type StatusInfo = { total_txns: number; volume: number; }; + export type ChartSeriesInfo = { type: string; data: number[]; @@ -220,3 +221,40 @@ export type TransactionInfo = { signer_account_id: string; transaction_hash: string; }; + +export type ChartStat = { + date: string; + near_price: string; + market_cap: string; + total_supply: string; + blocks: string; + gas_fee: string; + gas_used: string; + avg_gas_price: string; + avg_gas_limit: string; + txns: string; + txn_volume: string; + txn_volume_usd: string; + txn_fee: string; + txn_fee_usd: string; + total_addresses: string; + addresses: string; +}; + +export type ChartTypeInfo = { + title: string; + description: string; +}; + +export type ChartConfig = { + chart: { + height: number; + zoomType: string; + }; + title: { + text: string; + }; + subtitle: { + text: string; + }; +};