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) => {
6
6
return data . coins ;
7
7
} ;
8
8
9
+ export type Prices = {
10
+ [ coinId : string ] : { price : number } ;
11
+ } ;
12
+
9
13
export const useCoinPrice = ( coinIds : string [ ] ) => {
10
14
const isEnabled = coinIds !== undefined ;
11
15
12
- const { data : prices , isError } = useQuery ( {
16
+ const { data : prices , isError } = useQuery < Prices > ( {
13
17
queryKey : [ `coinPrice${ coinIds } ` ] ,
14
18
enabled : isEnabled ,
15
19
queryFn : async ( ) => fetchCoinPrices ( coinIds ) ,
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import styled from "styled-components";
3
3
4
4
import ChartIcon from "svgs/icons/chart.svg" ;
5
5
6
+ import { Prices } from "hooks/useCoinPrice" ;
6
7
import { calculateSubtextRender } from "utils/calculateSubtextRender" ;
7
8
import { isUndefined } from "utils/index" ;
8
9
@@ -50,7 +51,7 @@ const StyledCard = styled.div`
50
51
gap: 20px 0;
51
52
` ;
52
53
53
- const StatsContent : React . FC < { court : CourtDetailsQuery [ "court" ] ; pricesData : any ; coinIds : string [ ] } > = ( {
54
+ const StatsContent : React . FC < { court : CourtDetailsQuery [ "court" ] ; pricesData ?: Prices ; coinIds : string [ ] } > = ( {
54
55
court,
55
56
pricesData,
56
57
coinIds,
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ export const stats: IStat[] = [
54
54
return `${ formatPNK ( stake ) } PNK` ;
55
55
} ,
56
56
getSubtext : ( data , coinPrice ) => {
57
- const stake = BigInt ( ( data ?. minStake * data ?. alpha ) / 1e4 ) ;
57
+ const stake = ( BigInt ( data ?. minStake ) * BigInt ( data ?. alpha ) ) / BigInt ( 1e4 ) ;
58
58
return formatUSD ( Number ( formatUnitsWei ( stake ) ) * ( coinPrice ?? 0 ) ) ;
59
59
} ,
60
60
color : "blue" ,
You can’t perform that action at this time.
0 commit comments