diff --git a/assets/logos/stats.svg b/assets/logos/stats.svg deleted file mode 100644 index 88a2e6bba9..0000000000 --- a/assets/logos/stats.svg +++ /dev/null @@ -1,506 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/components/animations/AnimatedFiller.tsx b/packages/components/animations/AnimatedFiller.tsx new file mode 100644 index 0000000000..53f7083428 --- /dev/null +++ b/packages/components/animations/AnimatedFiller.tsx @@ -0,0 +1,6 @@ +import React from "react"; +import { View } from "react-native"; + +export const AnimatedFiller = () => { + return ; +}; diff --git a/packages/components/animations/AnimatedFiller.web.tsx b/packages/components/animations/AnimatedFiller.web.tsx new file mode 100644 index 0000000000..aadc31322d --- /dev/null +++ b/packages/components/animations/AnimatedFiller.web.tsx @@ -0,0 +1,515 @@ +import React from "react"; +import { View } from "react-native"; + +const svg = ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + `; + +export const AnimatedFiller = () => { + return ( + + + + ); +}; diff --git a/packages/screens/Metrics/MetricsScreen.tsx b/packages/screens/Metrics/MetricsScreen.tsx index 1939f25251..8826510167 100644 --- a/packages/screens/Metrics/MetricsScreen.tsx +++ b/packages/screens/Metrics/MetricsScreen.tsx @@ -1,17 +1,17 @@ import { useQuery } from "@tanstack/react-query"; +import axios from "axios"; import React from "react"; import { Linking, Pressable, useWindowDimensions, View } from "react-native"; -import statsLogo from "../../../assets/logos/stats.svg"; - import { BrandText } from "@/components/BrandText"; -import { SVG } from "@/components/SVG"; import { ScreenContainer } from "@/components/ScreenContainer"; +import { AnimatedFiller } from "@/components/animations/AnimatedFiller"; import { GradientText } from "@/components/gradientText"; import { SpacerColumn } from "@/components/spacer"; import { useIsMobile } from "@/hooks/useIsMobile"; -import { getNonSigningStargateClient } from "@/networks"; +import { getCosmosNetwork, getNonSigningStargateClient } from "@/networks"; import { teritoriNetwork } from "@/networks/teritori"; +import { prettyPrice } from "@/utils/coins"; import { ScreenFC } from "@/utils/navigation"; import { errorColor, secondaryColor } from "@/utils/style/colors"; import { fontBold16, fontSemibold28 } from "@/utils/style/fonts"; @@ -20,9 +20,11 @@ import { layout } from "@/utils/style/layout"; const targetBlock = 12614400; export const MetricsScreen: ScreenFC<"Metrics"> = () => { - const { data: currentHeight } = useCosmosHeight(teritoriNetwork.id); + const networkId = teritoriNetwork.id; + const { data: currentHeight } = useCosmosHeight(networkId); const { width: windowWidth } = useWindowDimensions(); const mobileMode = useIsMobile(); + const { data: burnTotal } = useBurnTotal(networkId); const blocksValues = [ { @@ -47,8 +49,8 @@ export const MetricsScreen: ScreenFC<"Metrics"> = () => { return ( } - forceNetworkId="teritori" + footerChildren={<>} + forceNetworkId={teritoriNetwork.id} > = () => { }} > {mobileMode && } - + + + {mobileMode && } = () => { { textTransform: "uppercase", color: errorColor }, ]} > - 🔥 118.55K $TORI 🔥 + 🔥{" "} + {burnTotal + ? prettyPrice(networkId, burnTotal.amount, burnTotal.denom, true) + : "..."}{" "} + $Tori 🔥 - {mobileMode && } + - ESTIMATED HALVING DATE: + ESTIMATED Thirdening DATE: {mobileMode && } @@ -160,6 +169,32 @@ export const MetricsScreen: ScreenFC<"Metrics"> = () => { ); }; +const useBurnTotal = (networkId: string | undefined) => { + const { data: mintParams, ...other } = useMintParams(networkId); + try { + return { data: mintParams.params.total_burnt_amount[0], ...other }; + } catch { + return { data: null, ...other }; + } +}; + +const useMintParams = (networkId: string | undefined) => { + return useQuery( + ["mintParams", networkId], + async () => { + const network = getCosmosNetwork(networkId); + if (!network) { + return null; + } + const res = await axios.get( + `${network.restEndpoint}/teritori/mint/v1beta1/params`, + ); + return res.data; + }, + { staleTime: Infinity }, + ); +}; + function useCosmosHeight(networkId: string) { return useQuery( ["cosmosStatus", networkId], @@ -167,6 +202,6 @@ function useCosmosHeight(networkId: string) { const client = await getNonSigningStargateClient(networkId); return await client.getHeight(); }, - { staleTime: Infinity, refetchInterval: 7000 }, + { staleTime: Infinity }, ); }