Skip to content

Commit

Permalink
Merge pull request #443 from secretkeylabs/jordankzf/fix-undefined-te…
Browse files Browse the repository at this point in the history
…stnet-hook

Fix undefined testnet hook
  • Loading branch information
jordankzf authored Jul 30, 2024
2 parents b3b30b3 + 5364be1 commit caf412c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
12 changes: 5 additions & 7 deletions src/app/hooks/queries/runes/useRuneFloorPriceQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,16 @@ export default function useRuneFloorPriceQuery(runeName: string, backgroundRefet
const runesApi = useRunesApi();
const queryFn = useCallback(
async () =>
network.type === 'Mainnet'
? runesApi
.getRuneMarketData(runeName)
.then((res) => Number(res.floorUnitPrice?.formatted ?? 0))
: undefined,
[network.type, runeName, runesApi],
runesApi
.getRuneMarketData(runeName)
.then((res) => Number(res.floorUnitPrice?.formatted ?? 0)),
[runeName, runesApi],
);
return useQuery({
refetchOnWindowFocus: backgroundRefetch,
refetchOnReconnect: backgroundRefetch,
queryKey: ['get-rune-floor-price', runeName],
enabled: Boolean(runeName),
enabled: Boolean(runeName) && network.type === 'Mainnet',
queryFn,
});
}
8 changes: 2 additions & 6 deletions src/app/screens/swap/quoteSummary/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,10 @@ export default function QuoteSummary({
const fromUnit =
fromToken === 'BTC'
? 'Sats'
: (fromToken as FungibleToken)?.runeSymbol ??
(fromToken as FungibleToken)?.ticker ??
RUNE_DISPLAY_DEFAULTS.symbol;
: (fromToken as FungibleToken)?.runeSymbol ?? RUNE_DISPLAY_DEFAULTS.symbol;

const toUnit =
toToken?.protocol === 'btc'
? 'Sats'
: toToken?.symbol ?? toToken?.ticker ?? RUNE_DISPLAY_DEFAULTS.symbol;
toToken?.protocol === 'btc' ? 'Sats' : toToken?.symbol ?? RUNE_DISPLAY_DEFAULTS.symbol;

const [showSlippageModal, setShowSlippageModal] = useState(false);
const [slippage, setSlippage] = useState(0.05);
Expand Down

0 comments on commit caf412c

Please sign in to comment.