Skip to content

Commit

Permalink
Merge pull request #926 from Kwenta/v2
Browse files Browse the repository at this point in the history
Merge v2 into v2-dev
  • Loading branch information
platschi authored Jun 2, 2022
2 parents 392ed2b + 2dd1255 commit eae03df
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion queries/rates/useExchangeRatesQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type CurrencyRate = BigNumberish;
type SynthRatesTuple = [string[], CurrencyRate[]];

// Additional commonly used currencies to fetch, besides the one returned by the SynthUtil.synthsRates
const additionalCurrencies = [CRYPTO_CURRENCY_MAP.SNX, 'XAU', 'XAG'].map(
const additionalCurrencies = [CRYPTO_CURRENCY_MAP.SNX, 'XAU', 'XAG', 'DYDX', 'APE'].map(
ethers.utils.formatBytes32String
);

Expand Down
4 changes: 4 additions & 0 deletions queries/rates/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ const markets = [
'sXAU',
'sXAG',
'sWTI',
'sDYDX',
'sAPE',
] as const;

const map: Record<typeof markets[number], string> = {
Expand All @@ -96,6 +98,8 @@ const map: Record<typeof markets[number], string> = {
sXAU: '',
sXAG: '',
sWTI: '',
sDYDX: 'dydx',
sAPE: 'apecoin',
};

export const synthToCoingeckoPriceId = (synth: any) => {
Expand Down
2 changes: 1 addition & 1 deletion sections/futures/Trade/Trade.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ const Trade: React.FC<TradeProps> = ({ refetch, onEditPositionInput, position, c
}, [router.events]);

const onTradeAmountSUSDChange = (value: string) => {
const valueIsNull = value === '' || Number(value) === 0;
const valueIsNull = marketAssetRate.eq(0) || value === '' || Number(value) === 0;
const size = valueIsNull ? '' : wei(value).div(marketAssetRate).toNumber().toString();
const leverage = valueIsNull
? ''
Expand Down
3 changes: 1 addition & 2 deletions sections/futures/UserInfo/UserInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import React, { useMemo, useState, useCallback, useEffect } from 'react';
import styled from 'styled-components';
import { castArray } from 'lodash';
import { useRouter } from 'next/router';
import useSynthetixQueries from '@synthetixio/queries';

import { TabPanel } from 'components/Tab';
import TabButton from 'components/Button/TabButton';
Expand Down Expand Up @@ -32,6 +31,7 @@ import { FuturesTrade } from 'queries/futures/types';
import { useRecoilValue } from 'recoil';
import { walletAddressState } from 'store/wallet';
import useGetFuturesTradesForAccount from 'queries/futures/useGetFuturesTradesForAccount';
import useExchangeRatesQuery from 'queries/rates/useExchangeRatesQuery';

enum FuturesTab {
POSITION = 'position',
Expand All @@ -54,7 +54,6 @@ const UserInfo: React.FC<UserInfoProps> = ({ marketAsset, position, openOrders,
const router = useRouter();
const walletAddress = useRecoilValue(walletAddressState);

const { useExchangeRatesQuery } = useSynthetixQueries();
const exchangeRatesQuery = useExchangeRatesQuery({
refetchInterval: 15000,
});
Expand Down

0 comments on commit eae03df

Please sign in to comment.