diff --git a/src/Services/api.service.js b/src/Services/api.service.js
index e568ce3..1de6f33 100644
--- a/src/Services/api.service.js
+++ b/src/Services/api.service.js
@@ -17,6 +17,14 @@ export const rubix = createApi({
],
endpoints: (builder) => ({
+
+
+
+ getKPIDetails: builder.query({
+ query: () => `Analytics/GetKPIDetails`,
+ providesTags: ["getKPIDetails"],
+ }),
+
getTransCount: builder.query({
query: () => `Analytics/Transactions/GetCount`,
providesTags: ["getTransCount"],
@@ -90,6 +98,7 @@ export const rubix = createApi({
}),
});
export const {
+ useGetKPIDetailsQuery,
useGetTransCountQuery,
useGetTransAllQuery,
useGetTransByIdQuery,
diff --git a/src/components/AmountCard/AmountCard.jsx b/src/components/AmountCard/AmountCard.jsx
index 4dbb3cf..e37c6aa 100644
--- a/src/components/AmountCard/AmountCard.jsx
+++ b/src/components/AmountCard/AmountCard.jsx
@@ -4,80 +4,85 @@ import {
Grid,
GridItem,
HStack,
+ Skeleton,
+ Spinner,
Text,
useColorMode,
VStack,
} from "@chakra-ui/react";
-import React from "react";
+import React, { useEffect, useState } from "react";
import { FaFileAlt, FaFileContract, FaMoneyCheckAlt, FaShoppingCart } from "react-icons/fa";
import { FaClipboard, FaGlobe, FaWallet } from "react-icons/fa6";
import { PiCircuitryFill, PiWalletFill } from "react-icons/pi";
import { LiaFileContractSolid } from "react-icons/lia";
import { TbTransactionDollar } from "react-icons/tb";
import { BsRCircleFill } from "react-icons/bs";
+import { useGetKPIDetailsQuery } from "../../Services/api.service";
const AmountCard = () => {
const { colorMode} = useColorMode();
+ const [ kpDetails, setKpDetails ] = useState(null)
+
+
+
+ const {
+ data,
+ isLoading,
+ } = useGetKPIDetailsQuery()
+
+ useEffect(() => {
+ setKpDetails(data?.data)
+ }, [data])
+
- const kpDetails = {
- "status": true,
- "data": {
- "transactionCount": "25998",
- "didCount": "309927",
- "totalSupply": "51,400,000",
- "circulatingSupply": "91848",
- "rbtPrice": "223.17",
- "pledgedRBT": "0",
- "numberContracts": "0"
- },
- "message": null
- }
const statsData = [
{
label: "RBT Price",
- value: kpDetails?.data?.rbtPrice,
+ value: kpDetails?.rbtPrice,
icon: ,
},
{
label: "Transaction",
- value: kpDetails?.data?.transactionCount,
+ value: kpDetails?.transactionCount,
icon: ,
},
{
label: "DID count",
- value: kpDetails?.data?.didCount,
+ value: kpDetails?.didCount,
icon: ,
},
{
label: "Total Supply",
- value: kpDetails?.data?.totalSupply,
+ value: kpDetails?.totalSupply,
icon: ,
display: { base: "block", md: "none" }, // Hidden on small, shown on medium and up
},
];
+ console.log(Number(kpDetails?.tvL_RBT).toFixed(3)); // Using Number()
+
const statsDataFour = [
{
label: "Total Supply",
- value: kpDetails?.data?.totalSupply,
+ value: kpDetails?.totalSupply,
icon: ,
display: { base: "none", md: "block" }, // Hidden on small, shown on medium and up
},
{
label: "Circulating Supply",
- value: kpDetails?.data?.circulatingSupply,
+ value: kpDetails?.circulatingSupply,
icon: ,
},
{
- label: "Pledged RBT",
- value: kpDetails?.data?.pledgedRBT,
+ label: "Total Value Locked (TVL)",
+ value: Number(kpDetails?.tvL_RBT).toFixed(3),
icon: ,
},
{
label: "Number of smart contracts",
- value: kpDetails?.data?.numberContracts,
+ value: kpDetails?.numberContracts,
icon: ,
},
];
@@ -123,7 +128,7 @@ const AmountCard = () => {
fontSize={"sm"}
color={colorMode === "light" ? "#230A79" : "#fff"}
>
- {item.value}
+ {isLoading ? :item.value}
{
fontWeight={600}
color={colorMode === "light" ? "#230A79" : "#fff"}
>
- {item.value}
+ {isLoading ? :item.value}
{
},
};
+ console.log(data);
+
return (
<>
diff --git a/src/pages/MainNet.jsx b/src/pages/MainNet.jsx
index be42f2d..fa085e4 100644
--- a/src/pages/MainNet.jsx
+++ b/src/pages/MainNet.jsx
@@ -24,7 +24,7 @@ import {
useGetMainNetCountQuery,
useGetMainNetQuery,
} from "../Services/api.service";
-import { formatRelativeDate } from "../Constants/Constants";
+import { formatRelativeDate, formatUTCToDDMMYYHHMMSS } from "../Constants/Constants";
import rbtLogoOutline from "../assets/images/rubix-filled.svg";
import FullScreenLoaader from "../components/FullScreenLoaader/FullScreenLoaader";
import { OPACITY_ON_LOAD } from "../Layout/animations";
@@ -145,7 +145,7 @@ const MainNet = () => {
Main Net - Overview
- Total Value Locked (TVL) {mainNetData?.data?.tvl} RBT
+ Total Value Locked (TVL) {Number(mainNetData?.data?.tvl).toFixed(3)} RBT
@@ -394,7 +394,7 @@ const MainNet = () => {
- {formatRelativeDate(timestamp)}
+ {formatUTCToDDMMYYHHMMSS(timestamp)}
@@ -468,12 +468,12 @@ const MainNet = () => {
colorMode === "light" ? "#230A79" : "#B09AFF"
}
>
-
- {subNetworkId}
-
+ {subNetworkId === "MainNet" ?{subNetworkId}:
+ {subNetworkId}
+ }
diff --git a/src/pages/SubnetId.jsx b/src/pages/SubnetId.jsx
index 0a69324..9ead0f0 100644
--- a/src/pages/SubnetId.jsx
+++ b/src/pages/SubnetId.jsx
@@ -88,7 +88,7 @@ const SubnetId = () => {
{item?.networkId}
- Tvl {item?.tvl} (RBT)
+ Tvl {Number(item?.tvl).toFixed(3)} (RBT)
Count{item?.transctionsCount}
>