Skip to content

Commit

Permalink
v6.0.8-alpha
Browse files Browse the repository at this point in the history
v6.0.8-alpha
  • Loading branch information
platschi authored Feb 4, 2023
2 parents d61ace7 + 9976d7a commit fdb6e7f
Show file tree
Hide file tree
Showing 27 changed files with 31 additions and 424 deletions.
4 changes: 3 additions & 1 deletion .env.local.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ NEXT_PUBLIC_PROVIDER_ID=INFURA
NEXT_PUBLIC_INFURA_PROJECT_ID="INFURA_PROJECT_ID"
NEXT_PUBLIC_BLASTAPI_PROJECT_ID="BLASTAPI_PROJECT_ID"
NEXT_PUBLIC_COMPETITION_ACTIVE=false
NEXT_PUBLIC_SOCKET_API_KEY="SOCKET_API_KEY"
NEXT_PUBLIC_SOCKET_API_KEY="SOCKET_API_KEY"
NEXT_PUBLIC_SATSUMA_API_KEY="API_KEY"
NEXT_PUBLIC_THEGRAPH_API_KEY="API_KEY"
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ Required:
- `NEXT_PUBLIC_INFURA_PROJECT_ID` - Infura project id (get it from [infura.io](https://infura.io/)) or
- `NEXT_PUBLIC_BLASTAPI_PROJECT_ID` - Blast API project id (get it from [blastapi.io](https://blastapi.io/))
- `NEXT_PUBLIC_SOCKET_API_KEY` - Socket API key (get it from [socket.tech](https://docs.socket.tech/socket-api/v2#api-key)
- `NEXT_PUBLIC_SATSUMA_API_KEY` - API key for Satsuma subgraph queries
- `NEXT_PUBLIC_THEGRAPH_API_KEY` - API key for The Graph's decentralized service

### Run

Expand Down
Binary file added assets/png/currencies/sAPT.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/png/currencies/sATOM.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/png/currencies/sAXS.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/png/currencies/sBCH.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/png/currencies/sCRV.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/png/currencies/sFIL.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/png/currencies/sFLOW.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/png/currencies/sFTM.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/png/currencies/sGMX.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/png/currencies/sLDO.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/png/currencies/sLTC.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/png/currencies/sNEAR.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/png/currencies/sSHIB.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 5 additions & 6 deletions components/ChangePercent/ChangePercent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ export const ChangePercent: FC<ChangePercentProps> = memo(
const isValid = !!value;
const isZero = value && wei(value).eq(0);
const isPositive = value && wei(value).gt(0);

return (
<CurrencyChange isValid={isValid} isPositive={isPositive} {...rest}>
{!isValid ? (
<CurrencyChange isValid={isValid} isPositive={isPositive} isZero={isZero} {...rest}>
{!isValid || isZero ? (
<>{NO_VALUE}</>
) : !showArrow ? (
<></>
Expand All @@ -31,17 +30,17 @@ export const ChangePercent: FC<ChangePercentProps> = memo(
) : (
<ChangeNegativeIcon />
)}
{value && formatPercent(wei(value).abs(), { minDecimals: decimals })}
{!isZero && value && formatPercent(wei(value).abs(), { minDecimals: decimals })}
</CurrencyChange>
);
}
);

const CurrencyChange = styled.span<{ isValid: boolean; isPositive: boolean }>`
const CurrencyChange = styled.span<{ isValid: boolean; isPositive: boolean; isZero: boolean }>`
display: inline-flex;
align-items: center;
color: ${(props) =>
!props.isValid
!props.isValid || props.isZero
? props.theme.colors.selectedTheme.white
: props.isPositive
? props.theme.colors.selectedTheme.green
Expand Down
13 changes: 7 additions & 6 deletions queries/futures/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,25 @@ import { gql } from 'graphql-request';

import { chain } from 'containers/Connector/config';

export const FUTURES_ENDPOINT_OP_MAINNET =
'https://api.thegraph.com/subgraphs/name/tburm/optimism-perps';
export const FUTURES_ENDPOINT_OP_MAINNET = `https://subgraph.satsuma-prod.com/${process.env.NEXT_PUBLIC_SATSUMA_API_KEY}/kwenta/optimism-perps/api`;

export const FUTURES_ENDPOINT_OP_GOERLI =
'https://api.thegraph.com/subgraphs/name/tburm/optimism-goerli-perps';
'https://api.thegraph.com/subgraphs/name/kwenta/optimism-goerli-perps';

export const FUTURES_ENDPOINTS = {
[chain.optimism.id]: FUTURES_ENDPOINT_OP_MAINNET,
[chain.optimismGoerli.id]: FUTURES_ENDPOINT_OP_GOERLI,
};

export const MAIN_ENDPOINT_OP_MAINNET =
'https://api.thegraph.com/subgraphs/name/tburm/optimism-main';
export const MAIN_ENDPOINT_MAINNET = `https://gateway.thegraph.com/api/${process.env.NEXT_PUBLIC_THEGRAPH_API_KEY}/subgraphs/id/HLy7PdmPJuVGjjmPNz1vW5RCCRpqzRWony2fSn7UKpf9`;

export const MAIN_ENDPOINT_OP_MAINNET = `https://subgraph.satsuma-prod.com/${process.env.NEXT_PUBLIC_SATSUMA_API_KEY}/kwenta/optimism-main/api`;

export const MAIN_ENDPOINT_OP_GOERLI =
'https://api.thegraph.com/subgraphs/name/tburm/optimism-goerli-main';
'https://api.thegraph.com/subgraphs/name/kwenta/optimism-goerli-main';

export const MAIN_ENDPOINTS = {
[chain.mainnet.id]: MAIN_ENDPOINT_MAINNET,
[chain.optimism.id]: MAIN_ENDPOINT_OP_MAINNET,
[chain.optimismGoerli.id]: MAIN_ENDPOINT_OP_GOERLI,
};
Expand Down
5 changes: 2 additions & 3 deletions queries/rates/constants.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { chain } from 'containers/Connector/config';

export const RATES_ENDPOINT_MAIN = 'https://api.thegraph.com/subgraphs/name/kwenta/mainnet-main';
export const RATES_ENDPOINT_MAIN = `https://gateway.thegraph.com/api/${process.env.NEXT_PUBLIC_THEGRAPH_API_KEY}/subgraphs/id/HLy7PdmPJuVGjjmPNz1vW5RCCRpqzRWony2fSn7UKpf9`;

export const RATES_ENDPOINT_OP_MAINNET =
'https://api.thegraph.com/subgraphs/name/kwenta/optimism-latest-rates';
export const RATES_ENDPOINT_OP_MAINNET = `https://subgraph.satsuma-prod.com/${process.env.NEXT_PUBLIC_SATSUMA_API_KEY}/kwenta/optimism-latest-rates/api`;

export const RATES_ENDPOINT_OP_GOERLI =
'https://api.thegraph.com/subgraphs/name/kwenta/optimism-goerli-latest-rates';
Expand Down
3 changes: 1 addition & 2 deletions sdk/constants/futures.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { FuturesMarketAsset, FuturesMarketConfig, FuturesMarketKey } from 'sdk/types/futures';

export const FUTURES_ENDPOINT_OP_MAINNET =
'https://api.thegraph.com/subgraphs/name/kwenta/optimism-perps';
export const FUTURES_ENDPOINT_OP_MAINNET = `https://subgraph.satsuma-prod.com/${process.env.NEXT_PUBLIC_SATSUMA_API_KEY}/kwenta/optimism-perps/api`;

export const FUTURES_ENDPOINT_OP_GOERLI =
'https://api.thegraph.com/subgraphs/name/kwenta/optimism-goerli-perps';
Expand Down
3 changes: 1 addition & 2 deletions sdk/constants/prices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { formatBytes32String } from 'ethers/lib/utils.js';

import { V2_MARKETS_LIST } from './futures';

export const MAIN_ENDPOINT_OP_MAINNET =
'https://api.thegraph.com/subgraphs/name/kwenta/optimism-latest-rates';
export const MAIN_ENDPOINT_OP_MAINNET = `https://subgraph.satsuma-prod.com/${process.env.NEXT_PUBLIC_SATSUMA_API_KEY}/kwenta/optimism-latest-rates/api`;

export const MAIN_ENDPOINT_OP_GOERLI =
'https://api.thegraph.com/subgraphs/name/kwenta/optimism-goerli-latest-rates';
Expand Down
13 changes: 0 additions & 13 deletions sections/dashboard/Markets/Markets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { DesktopOnlyView, MobileOrTabletView } from 'components/Media';
import { TabPanel } from 'components/Tab';

import FuturesMarketsTable from '../FuturesMarketsTable';
import SpotMarketsTable from '../SpotMarketsTable';

export enum MarketsTab {
FUTURES = 'futures',
Expand All @@ -29,14 +28,6 @@ const Markets: FC = () => {
setActiveMarketsTab(MarketsTab.FUTURES);
},
},
{
name: MarketsTab.SPOT,
label: t('dashboard.overview.markets-tabs.spot'),
active: activeMarketsTab === MarketsTab.SPOT,
onClick: () => {
setActiveMarketsTab(MarketsTab.SPOT);
},
},
],
[activeMarketsTab, t]
);
Expand All @@ -61,10 +52,6 @@ const Markets: FC = () => {
<TabPanel name={MarketsTab.FUTURES} activeTab={activeMarketsTab}>
<FuturesMarketsTable />
</TabPanel>

<TabPanel name={MarketsTab.SPOT} activeTab={activeMarketsTab}>
<SpotMarketsTable />
</TabPanel>
</>
);
};
Expand Down
35 changes: 0 additions & 35 deletions sections/dashboard/MobileDashboard/SpotMarkets.tsx

This file was deleted.

16 changes: 4 additions & 12 deletions sections/dashboard/Overview/Overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ import { FuturesAccountTypes } from 'queries/futures/types';
import { CompetitionBanner } from 'sections/shared/components/CompetitionBanner';
import { selectBalances } from 'state/balances/selectors';
import { sdk } from 'state/config';
import { fetchTokenList } from 'state/exchange/actions';
import {
// selectActiveCrossPositionsCount,
selectActiveIsolatedPositionsCount,
selectFuturesPortfolio,
} from 'state/futures/selectors';
import { useAppSelector } from 'state/hooks';
import { useAppSelector, useFetchAction } from 'state/hooks';
import { formatDollars, toWei, zeroBN } from 'utils/formatters/number';
import logError from 'utils/logError';

Expand All @@ -27,7 +28,6 @@ import FuturesPositionsTable from '../FuturesPositionsTable';
import { MarketsTab } from '../Markets/Markets';
import MobileDashboard from '../MobileDashboard';
import PortfolioChart from '../PortfolioChart';
import SpotMarketsTable from '../SpotMarketsTable';
import SynthBalancesTable from '../SynthBalancesTable';

export enum PositionsTab {
Expand Down Expand Up @@ -57,6 +57,8 @@ const Overview: FC = () => {

const [exchangeTokens, setExchangeTokens] = useState<any>([]);

useFetchAction(fetchTokenList, { dependencies: [network] });

useEffect(() => {
const initExchangeTokens = async () => {
try {
Expand Down Expand Up @@ -164,12 +166,6 @@ const Overview: FC = () => {
active: activeMarketsTab === MarketsTab.FUTURES,
onClick: () => setActiveMarketsTab(MarketsTab.FUTURES),
},
{
name: MarketsTab.SPOT,
label: t('dashboard.overview.markets-tabs.spot'),
active: activeMarketsTab === MarketsTab.SPOT,
onClick: () => setActiveMarketsTab(MarketsTab.SPOT),
},
],
[activeMarketsTab, setActiveMarketsTab, t]
);
Expand Down Expand Up @@ -211,10 +207,6 @@ const Overview: FC = () => {
<TabPanel name={MarketsTab.FUTURES} activeTab={activeMarketsTab}>
<FuturesMarketsTable />
</TabPanel>

<TabPanel name={MarketsTab.SPOT} activeTab={activeMarketsTab}>
<SpotMarketsTable />
</TabPanel>
</DesktopOnlyView>
<MobileOrTabletView>
<MobileDashboard exchangeTokens={exchangeTokens} />
Expand Down
Loading

0 comments on commit fdb6e7f

Please sign in to comment.