Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge v2 into v2-dev #926

Merged
merged 8 commits into from
Jun 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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