File tree Expand file tree Collapse file tree 3 files changed +8
-3
lines changed
pages/Courts/CourtDetails/Stats Expand file tree Collapse file tree 3 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -6,10 +6,14 @@ const fetchCoinPrices = async (...coinIds) => {
66 return data . coins ;
77} ;
88
9+ export type Prices = {
10+ [ coinId : string ] : { price : number } ;
11+ } ;
12+
913export const useCoinPrice = ( coinIds : string [ ] ) => {
1014 const isEnabled = coinIds !== undefined ;
1115
12- const { data : prices , isError } = useQuery ( {
16+ const { data : prices , isError } = useQuery < Prices > ( {
1317 queryKey : [ `coinPrice${ coinIds } ` ] ,
1418 enabled : isEnabled ,
1519 queryFn : async ( ) => fetchCoinPrices ( coinIds ) ,
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import styled from "styled-components";
33
44import ChartIcon from "svgs/icons/chart.svg" ;
55
6+ import { Prices } from "hooks/useCoinPrice" ;
67import { calculateSubtextRender } from "utils/calculateSubtextRender" ;
78import { isUndefined } from "utils/index" ;
89
@@ -50,7 +51,7 @@ const StyledCard = styled.div`
5051 gap: 20px 0;
5152` ;
5253
53- const StatsContent : React . FC < { court : CourtDetailsQuery [ "court" ] ; pricesData : any ; coinIds : string [ ] } > = ( {
54+ const StatsContent : React . FC < { court : CourtDetailsQuery [ "court" ] ; pricesData ?: Prices ; coinIds : string [ ] } > = ( {
5455 court,
5556 pricesData,
5657 coinIds,
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ export const stats: IStat[] = [
5454 return `${ formatPNK ( stake ) } PNK` ;
5555 } ,
5656 getSubtext : ( data , coinPrice ) => {
57- const stake = BigInt ( ( data ?. minStake * data ?. alpha ) / 1e4 ) ;
57+ const stake = ( BigInt ( data ?. minStake ) * BigInt ( data ?. alpha ) ) / BigInt ( 1e4 ) ;
5858 return formatUSD ( Number ( formatUnitsWei ( stake ) ) * ( coinPrice ?? 0 ) ) ;
5959 } ,
6060 color : "blue" ,
You can’t perform that action at this time.
0 commit comments