Merge branch 'master' into task/token-flow-tests

This commit is contained in:
AndyWhiteVega 2022-06-23 23:46:46 +01:00
commit f024d1d78a
194 changed files with 3277 additions and 1649 deletions

View File

@ -2,7 +2,7 @@ NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-exp
NX_TENDERMINT_URL=http://localhost:26617
NX_TENDERMINT_WEBSOCKET_URL=wss://localhost:26617/websocket
NX_VEGA_URL=http://localhost:3028/query
NX_VEGA_ENV=LOCAL
NX_VEGA_ENV=CUSTOM
NX_VEGA_REST=http://localhost:3029
CYPRESS_VEGA_TENDERMINT_URL=http://localhost:26617

View File

@ -14,7 +14,7 @@
"screenshotsFolder": "../../dist/cypress/apps/explorer-e2e/screenshots",
"chromeWebSecurity": false,
"env": {
"environment": "local",
"environment": "CUSTOM",
"tsConfig": "tsconfig.json",
"TAGS": "not @todo and not @ignore and not @manual"
}

View File

@ -5,12 +5,14 @@ Feature: Transactions Page
When I navigate to the transactions page
Then transactions page is correctly displayed
@ignore
Scenario: Navigate to transaction details page
Given I am on the homepage
When I navigate to the transactions page
And I click on the top transaction
Then transaction details are displayed
@ignore
Scenario: Navigate to transactions page using mobile
Given I am on mobile and open the toggle menu
When I navigate to the transactions page

View File

@ -2,7 +2,7 @@ NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-exp
NX_TENDERMINT_URL=http://localhost:26617
NX_TENDERMINT_WEBSOCKET_URL=wss://localhost:26617/websocket
NX_VEGA_URL=http://localhost:3028/query
NX_VEGA_ENV=LOCAL
NX_VEGA_ENV=CUSTOM
NX_VEGA_REST=http://localhost:3029
NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-explorer-api

View File

@ -4,7 +4,7 @@ NX_TENDERMINT_URL=http://localhost:26617
NX_TENDERMINT_WEBSOCKET_URL=wss://localhost:26617/websocket
NX_VEGA_URL=http://localhost:3028/query
NX_VEGA_NETWORKS='{"TESTNET":"https://explorer.fairground.wtf","MAINNET":"https://explorer.vega.xyz"}'
NX_VEGA_ENV=LOCAL
NX_VEGA_ENV=CUSTOM
NX_VEGA_REST=http://localhost:3029
# App flags

View File

@ -2,6 +2,7 @@
NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-explorer-api
NX_TENDERMINT_URL=https://n04.d.vega.xyz/tm
NX_TENDERMINT_WEBSOCKET_URL=wss://n04.d.vega.xyz/tm/websocket
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/devnet-network.json
NX_VEGA_URL=https://n04.d.vega.xyz/query
NX_VEGA_NETWORKS='{"TESTNET":"https://explorer.fairground.wtf","MAINNET":"https://explorer.vega.xyz"}'
NX_VEGA_ENV=DEVNET

View File

@ -2,6 +2,7 @@
NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-explorer-api
NX_TENDERMINT_URL=https://mainnet-observer-proxy01.ops.vega.xyz/
NX_TENDERMINT_WEBSOCKET_URL=wss://mainnet-observer-proxy01.ops.vega.xyz/websocket
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/mainnet-network.json
NX_VEGA_URL=https://api.token.vega.xyz/query
NX_VEGA_NETWORKS='{"TESTNET":"https://explorer.fairground.wtf","MAINNET":"https://explorer.vega.xyz"}'
NX_VEGA_ENV=MAINNET

View File

@ -2,6 +2,7 @@
NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-explorer-api
NX_TENDERMINT_URL=https://n03.s.vega.xyz/tm
NX_TENDERMINT_WEBSOCKET_URL=wss://n03.s.vega.xyz/tm/websocket
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet1-network.json
NX_VEGA_URL=https://n03.s.vega.xyz/query
NX_VEGA_NETWORKS='{"TESTNET":"https://explorer.fairground.wtf","MAINNET":"https://explorer.vega.xyz"}'
NX_VEGA_ENV=STAGNET

View File

@ -2,6 +2,7 @@
NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-explorer-api
NX_TENDERMINT_URL=https://n03.stagnet2.vega.xyz/tm
NX_TENDERMINT_WEBSOCKET_URL=wss://n03.stagnet2.vega.xyz/tm/websocket
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet2-network.json
NX_VEGA_URL=https://n03.stagnet2.vega.xyz/query
NX_VEGA_NETWORKS='{"TESTNET":"https://explorer.fairground.wtf","MAINNET":"https://explorer.vega.xyz"}'
NX_VEGA_ENV=STAGNET2

View File

@ -2,6 +2,7 @@
NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-explorer-api
NX_TENDERMINT_URL=https://lb.testnet.vega.xyz/tm
NX_TENDERMINT_WEBSOCKET_URL=wss://lb.testnet.vega.xyz/tm/websocket
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/testnet-network.json
NX_VEGA_URL=https://lb.testnet.vega.xyz/query
NX_VEGA_NETWORKS='{"TESTNET":"https://explorer.fairground.wtf","MAINNET":"https://explorer.vega.xyz"}'
NX_VEGA_ENV=TESTNET

View File

@ -1,13 +1,11 @@
import { useState, useEffect, useMemo } from 'react';
import { useState, useEffect } from 'react';
import { useLocation } from 'react-router-dom';
import { ApolloProvider } from '@apollo/client';
import { ThemeContext, useThemeSwitcher } from '@vegaprotocol/react-helpers';
import { EnvironmentProvider } from '@vegaprotocol/network-switcher';
import { EnvironmentProvider, NetworkLoader } from '@vegaprotocol/environment';
import { createClient } from './lib/apollo-client';
import { Nav } from './components/nav';
import { Header } from './components/header';
import { Main } from './components/main';
import { DATA_SOURCES } from './config';
import { TendermintWebsocketProvider } from './contexts/websocket/tendermint-websocket-provider';
function App() {
@ -20,13 +18,11 @@ function App() {
setMenuOpen(false);
}, [location]);
const client = useMemo(() => createClient(DATA_SOURCES.dataNodeUrl), []);
return (
<EnvironmentProvider>
<ThemeContext.Provider value={theme}>
<TendermintWebsocketProvider>
<ApolloProvider client={client}>
<NetworkLoader createClient={createClient}>
<div
className={`${
menuOpen && 'h-[100vh] overflow-hidden'
@ -42,7 +38,7 @@ function App() {
<Main />
</div>
</div>
</ApolloProvider>
</NetworkLoader>
</TendermintWebsocketProvider>
</ThemeContext.Provider>
</EnvironmentProvider>

View File

@ -1,5 +1,6 @@
import { NavLink } from 'react-router-dom';
import routerConfig from '../../routes/router-config';
import classnames from 'classnames';
interface NavProps {
menuOpen: boolean;
@ -9,18 +10,29 @@ export const Nav = ({ menuOpen }: NavProps) => {
return (
<nav className="relative">
<div
className={`${
menuOpen ? 'right-0 h-[100vh]' : 'right-[200vw] h-full'
} transition-[right] absolute top-0 w-full md:static md:border-r-1 bg-white dark:bg-black p-20`}
className={classnames(
'absolute top-0 z-50 md:static',
'w-full p-20 md:border-r-1',
'bg-white dark:bg-black',
'transition-[right]',
{
'right-0 h-[100vh]': menuOpen,
'right-[200vw] h-full': !menuOpen,
}
)}
>
{routerConfig.map((r) => (
<NavLink
key={r.name}
to={r.path}
className={({ isActive }) =>
`text-h5 block mb-8 px-8 hover:bg-vega-yellow hover:text-black ${
isActive && 'bg-vega-yellow text-black'
}`
classnames(
'block mb-8 px-8',
'text-h5 hover:bg-vega-yellow hover:text-black',
{
'bg-vega-yellow text-black': isActive,
}
)
}
>
{r.text}

View File

@ -1,11 +1,14 @@
describe('market list', () => {
describe('simple url', () => {
beforeEach(() => cy.visit('/markets'));
beforeEach(() => {
cy.visit('/markets');
});
it('selects menus', () => {
cy.get('.MuiDrawer-root [aria-current]').should('have.text', 'Markets');
cy.get('select[name="states"]').should('have.value', 'Active');
cy.get('[data-testid="market-assets-menu"] button.font-bold').should(
cy.getByTestId('state-trigger').should('have.text', 'Active');
cy.get('[aria-label="Future"]').click();
cy.get('[data-testid="market-assets-menu"] a.active').should(
'have.text',
'All'
);
@ -14,9 +17,12 @@ describe('market list', () => {
it('navigation should make possibly shortest url', () => {
cy.location('pathname').should('equal', '/markets');
cy.get('select[name="states"]').select('All');
cy.getByTestId('state-trigger').click();
cy.get('[role=menuitemcheckbox]').contains('All').click();
cy.location('pathname').should('equal', '/markets/all');
cy.get('[aria-label="Future"]').click();
cy.location('pathname').should('eq', '/markets/all/Future');
let asset = '';
cy.getByTestId('market-assets-menu')
.children()
@ -25,25 +31,18 @@ describe('market list', () => {
asset = children[1].innerText;
if (asset) {
cy.wrap(children[1]).click();
cy.location('pathname').should('equal', `/markets/all/${asset}`);
cy.location('pathname').should(
'match',
new RegExp(`/markets/all/Future/${asset}`, 'i')
);
cy.get('a').contains('All Markets').click();
cy.location('pathname').should('eq', '/markets/all');
}
}
});
if (asset) {
cy.get('button').contains('Future').click();
cy.location('pathname').should('equal', `/markets/all/${asset}/Future`);
cy.get('button').contains('All Markets').click();
cy.location('pathname').should('equal', `/markets/all/${asset}`);
}
cy.getByTestId('market-assets-menu')
.children()
.find('button')
.contains('All')
.click();
cy.location('pathname').should('equal', '/markets/all');
cy.get('select[name="states"]').select('Active');
cy.getByTestId('state-trigger').click();
cy.get('[role=menuitemcheckbox]').contains('Active').click();
cy.location('pathname').should('equal', '/markets');
});
});
@ -51,20 +50,29 @@ describe('market list', () => {
describe('url params should select filters', () => {
it('suspended status', () => {
cy.visit('/markets/Suspended');
cy.get('select[name="states"]').should('have.value', 'Suspended');
cy.getByTestId('state-trigger').should('have.text', 'Suspended');
});
it('tBTC asset', () => {
cy.visit('/markets/Suspended/tBTC');
it('last asset (if exists)', () => {
cy.intercept('POST', '/query').as('Filters');
cy.visit('/markets');
cy.wait('@Filters').then((filters) => {
if (filters?.response?.body.data.markets.length) {
const asset =
filters.response.body.data.markets[0].tradableInstrument.instrument
.product.settlementAsset.symbol;
cy.visit(`/markets/Suspended/Future/${asset}`);
cy.getByTestId('market-assets-menu')
.find('button.font-bold')
.should('have.text', 'tBTC');
.find('a.active')
.should('have.text', asset);
}
});
});
it('Future product', () => {
cy.visit('/markets/Suspended/tBTC/Future');
cy.visit('/markets/Suspended/Future');
cy.getByTestId('market-products-menu')
.find('button.active')
.find('a.active')
.should('have.text', 'Future');
});
});

View File

@ -17,3 +17,7 @@ NX_INCOMING_HOOK_BODY=$INCOMING_HOOK_BODY
NX_URL=$URL
NX_DEPLOY_URL=$DEPLOY_URL
NX_DEPLOY_PRIME_URL=$DEPLOY_PRIME_URL
NX_VEGA_CONFIG_URL="https://static.vega.xyz/assets/testnet-network.json"
NX_VEGA_ENV = 'TESTNET'
NX_VEGA_URL="https://lb.testnet.vega.xyz/query"

View File

@ -1,4 +1,5 @@
# App configuration variables
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/devnet-network.json
NX_VEGA_URL=https://n04.d.vega.xyz/query
NX_VEGA_ENV=DEVNET
NX_VEGA_REST=https://n04.d.vega.xyz/datanode/rest

View File

@ -1,4 +1,5 @@
# App configuration variables
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/mainnet-network.json
NX_VEGA_URL=https://api.token.vega.xyz/query
NX_VEGA_ENV=MAINNET
NX_VEGA_REST=https://api.token.vega.xyz/

View File

@ -1,4 +1,5 @@
# App configuration variables
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet1-network.json
NX_VEGA_URL=https://n03.s.vega.xyz/query
NX_VEGA_ENV=STAGNET
NX_VEGA_REST=https://n03.s.vega.xyz/datanode/rest

View File

@ -1,4 +1,5 @@
# App configuration variables
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet2-network.json
NX_VEGA_URL=https://n03.stagnet2.vega.xyz/query
NX_VEGA_ENV=STAGNET2
NX_VEGA_REST=https://n01.stagnet2.vega.xyz/datanode/rest

View File

@ -1,4 +1,5 @@
# App configuration variables
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/testnet-network.json
NX_VEGA_URL=https://lb.testnet.vega.xyz/query
NX_VEGA_ENV=TESTNET
NX_VEGA_REST=https://lb.testnet.vega.xyz/datanode/rest

View File

@ -1,15 +1,13 @@
import React, { useState, useMemo, useEffect } from 'react';
import { ApolloProvider } from '@apollo/client';
import { useState, useEffect } from 'react';
import { ThemeContext } from '@vegaprotocol/react-helpers';
import { useThemeSwitcher } from '@vegaprotocol/react-helpers';
import { EnvironmentProvider, NetworkLoader } from '@vegaprotocol/environment';
import { createClient } from './lib/apollo-client';
import { DATA_SOURCES } from './config';
import {
VegaConnectDialog,
VegaManageDialog,
VegaWalletProvider,
} from '@vegaprotocol/wallet';
import { EnvironmentProvider } from '@vegaprotocol/network-switcher';
import { VegaWalletConnectButton } from './components/vega-wallet-connect-button';
import { ThemeSwitcher } from '@vegaprotocol/ui-toolkit';
import { Connectors } from './lib/vega-connectors';
@ -26,8 +24,6 @@ function App() {
manage: false,
});
const client = useMemo(() => createClient(DATA_SOURCES.dataNodeUrl), []);
const [menuOpen, setMenuOpen] = useState(false);
const onToggle = () => setMenuOpen(!menuOpen);
@ -40,7 +36,7 @@ function App() {
return (
<EnvironmentProvider>
<ThemeContext.Provider value={theme}>
<ApolloProvider client={client}>
<NetworkLoader createClient={createClient}>
<VegaWalletProvider>
<AppLoader>
<div className="max-h-full min-h-full dark:bg-black dark:text-white-60 bg-white text-black-60 grid grid-rows-[min-content,1fr]">
@ -82,7 +78,7 @@ function App() {
</div>
</AppLoader>
</VegaWalletProvider>
</ApolloProvider>
</NetworkLoader>
</ThemeContext.Provider>
</EnvironmentProvider>
);

View File

@ -7,7 +7,6 @@ import { DealTicketSteps } from './deal-ticket-steps';
import { useVegaWallet } from '@vegaprotocol/wallet';
import { gql, useQuery } from '@apollo/client';
import { DealTicketBalance } from './deal-ticket-balance';
import * as React from 'react';
import type { PartyBalanceQuery } from './__generated__/PartyBalanceQuery';
const tempEmptyText = <p>Please select a market from the markets page</p>;

View File

@ -1,5 +1,5 @@
import * as React from 'react';
import { theme } from '@vegaprotocol/tailwindcss-config';
import { themelite as theme } from '@vegaprotocol/tailwindcss-config';
import type { ReactElement } from 'react';
import { useEffect } from 'react';
import Drawer from '@mui/material/Drawer';

View File

@ -3,6 +3,7 @@ import { act } from 'react-dom/test-utils';
import { render, screen, waitFor } from '@testing-library/react';
import { MockedProvider } from '@apollo/client/testing';
import type { MockedResponse } from '@apollo/client/testing';
import { BrowserRouter } from 'react-router-dom';
import { MarketState } from '@vegaprotocol/types';
import SimpleMarketList from './simple-market-list';
import { FILTERS_QUERY, MARKETS_QUERY } from './data-provider';
@ -54,7 +55,8 @@ describe('SimpleMarketList', () => {
render(
<MockedProvider mocks={[mocks, filterMock]}>
<SimpleMarketList />
</MockedProvider>
</MockedProvider>,
{ wrapper: BrowserRouter }
);
await new Promise((resolve) => setTimeout(resolve, 0));
});
@ -122,7 +124,8 @@ describe('SimpleMarketList', () => {
render(
<MockedProvider mocks={[mocks, filterMock]}>
<SimpleMarketList />
</MockedProvider>
</MockedProvider>,
{ wrapper: BrowserRouter }
);
await new Promise((resolve) => setTimeout(resolve, 0));
});

View File

@ -68,7 +68,7 @@ const SimpleMarketList = () => {
>
{localData?.map((market) => (
<li
className="w-full relative flex justify-start items-center no-underline box-border text-left pt-8 pb-8 pl-16 pr-16 mb-10"
className="w-full relative flex justify-start items-center no-underline box-border text-left py-8 mb-10"
key={market.id}
>
<div className="w-full grid sm:grid-cols-2">

View File

@ -1,6 +1,6 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import { theme } from '@vegaprotocol/tailwindcss-config';
import { themelite as theme } from '@vegaprotocol/tailwindcss-config';
import { MockedProvider } from '@apollo/react-testing';
import SimpleMarketPercentChange from './simple-market-percent-change';
import type { SimpleMarkets_markets_candles } from './__generated__/SimpleMarkets';

View File

@ -1,7 +1,7 @@
import React, { useState } from 'react';
import { InView } from 'react-intersection-observer';
import { useSubscription } from '@apollo/client';
import { theme } from '@vegaprotocol/tailwindcss-config';
import { themelite as theme } from '@vegaprotocol/tailwindcss-config';
import type { SimpleMarkets_markets_candles } from './__generated__/SimpleMarkets';
import type {
CandleLive,

View File

@ -1,5 +1,5 @@
import React from 'react';
import { act } from 'react-dom/test-utils';
import { useLocation, useRoutes, BrowserRouter } from 'react-router-dom';
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
import { MockedProvider } from '@apollo/react-testing';
import SimpleMarketToolbar from './simple-market-toolbar';
@ -8,14 +8,6 @@ import type { MarketFilters } from './__generated__/MarketFilters';
import { FILTERS_QUERY } from './data-provider';
import filterData from './mocks/market-filters.json';
const mockedNavigate = jest.fn();
jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'),
useNavigate: () => mockedNavigate,
useParams: () => ({}),
}));
describe('SimpleMarketToolbar', () => {
const filterMock: MockedResponse<MarketFilters> = {
request: {
@ -26,58 +18,105 @@ describe('SimpleMarketToolbar', () => {
},
};
const WrappedCompForTest = () => {
const routes = useRoutes([
{
path: '/',
element: <SimpleMarketToolbar />,
},
{
path: 'markets',
children: [
{
path: `:state`,
element: <SimpleMarketToolbar />,
children: [
{
path: `:product`,
element: <SimpleMarketToolbar />,
children: [
{ path: `:asset`, element: <SimpleMarketToolbar /> },
],
},
],
},
],
element: <SimpleMarketToolbar />,
},
]);
const location = useLocation();
return (
<>
{routes}
<div data-testid="location-display">{location.pathname}</div>
</>
);
};
afterEach(() => {
jest.resetAllMocks();
});
it('should be properly rendered', async () => {
await act(async () => {
render(
<MockedProvider mocks={[filterMock]} addTypename={false}>
<SimpleMarketToolbar />
</MockedProvider>
<WrappedCompForTest />
</MockedProvider>,
{ wrapper: BrowserRouter }
);
await new Promise((resolve) => setTimeout(resolve, 0));
});
await waitFor(() => {
expect(screen.getByTestId('market-assets-menu')).toBeInTheDocument();
expect(screen.getByText('Future')).toBeInTheDocument();
});
expect(screen.getByTestId('market-products-menu').children).toHaveLength(3);
fireEvent.click(screen.getByText('Future'));
await waitFor(() => {
expect(screen.getByTestId('market-products-menu').children).toHaveLength(
3
);
expect(screen.getByTestId('market-assets-menu').children).toHaveLength(6);
expect(screen.getByRole('combobox').children).toHaveLength(10);
});
fireEvent.click(screen.getByTestId('state-trigger'));
waitFor(() => {
expect(screen.getByRole('menu')).toBeInTheDocument();
expect(screen.getByRole('menu').children).toHaveLength(10);
});
});
it('navigation should work well', async () => {
await act(async () => {
render(
<MockedProvider mocks={[filterMock]} addTypename={false}>
<SimpleMarketToolbar />
</MockedProvider>
<WrappedCompForTest />
</MockedProvider>,
{ wrapper: BrowserRouter }
);
await new Promise((resolve) => setTimeout(resolve, 0));
});
await waitFor(() => {
expect(screen.getByTestId('market-assets-menu')).toBeInTheDocument();
expect(screen.getByText('Future')).toBeInTheDocument();
});
fireEvent.click(
screen
.getByTestId('market-products-menu')
.children[1].querySelector('button') as HTMLButtonElement
fireEvent.click(screen.getByText('Future'));
await waitFor(() => {
expect(screen.getByTestId('location-display')).toHaveTextContent(
'/markets/Active/Future'
);
expect(mockedNavigate).toHaveBeenCalledWith('/markets/Active/all/Future');
});
fireEvent.click(
screen
.getByTestId('market-assets-menu')
.children[5].querySelector('button') as HTMLButtonElement
.children[5].querySelector('a') as HTMLAnchorElement
);
await waitFor(() => {
expect(screen.getByTestId('location-display')).toHaveTextContent(
'/markets/Active/Future/tEURO'
);
expect(mockedNavigate).toHaveBeenCalledWith('/markets/Active/tEURO/Future');
fireEvent.change(screen.getByRole('combobox'), {
target: { value: 'Pending' },
});
expect(mockedNavigate).toHaveBeenCalledWith(
'/markets/Pending/tEURO/Future'
fireEvent.click(screen.getByTestId('state-trigger'));
waitFor(() => {
expect(screen.getByRole('menu')).toBeInTheDocument();
fireEvent.click(screen.getByText('Pending'));
expect(screen.getByTestId('location-display')).toHaveTextContent(
'/markets/Pending/Future/tEURO'
);
});
});
});

View File

@ -1,38 +1,41 @@
import React, { useCallback, useEffect, useRef, useState } from 'react';
import classNames from 'classnames';
import { useNavigate, useParams, Link } from 'react-router-dom';
import {
DropdownMenu,
DropdownMenuTrigger,
} from '@radix-ui/react-dropdown-menu';
import { IconNames } from '@blueprintjs/icons';
import { t } from '@vegaprotocol/react-helpers';
import { theme } from '@vegaprotocol/tailwindcss-config';
import { useNavigate, useParams } from 'react-router-dom';
import { Button, Select } from '@vegaprotocol/ui-toolkit';
import { themelite as theme } from '@vegaprotocol/tailwindcss-config';
import {
DropdownMenuCheckboxItem,
DropdownMenuContent,
DropdownMenuItemIndicator,
Icon,
} from '@vegaprotocol/ui-toolkit';
import useMarketFiltersData from '../../hooks/use-markets-filter';
import { STATES_FILTER } from './constants';
const SimpleMarketToolbar = () => {
const navigate = useNavigate();
const params = useParams();
const { assets, products, assetsPerProduct } = useMarketFiltersData();
const { products, assetsPerProduct } = useMarketFiltersData();
const [isOpen, setOpen] = useState(false);
const [activeNumber, setActiveNumber] = useState(
products?.length ? products.indexOf(params.product || '') + 1 : -1
);
const [activeAsset, setActiveAsset] = useState(params.asset || 'all');
const [activeState, setActiveState] = useState(params.state || 'Active');
const [sliderStyles, setSliderStyles] = useState<Record<string, string>>({});
const slideContRef = useRef<HTMLUListElement | null>(null);
const onStateChange = useCallback(
(e: React.ChangeEvent<HTMLSelectElement>) => {
setActiveState(e.target.value);
},
[setActiveState]
);
useEffect(() => {
// handle corner case when there is product
// param, but no products yet
if (activeNumber < 0 && products?.length) {
setActiveNumber(products.indexOf(params.product || '') + 1 || 0);
if (products.length) {
setActiveNumber(products.indexOf(params.product || '') + 1);
} else {
setActiveNumber(-1);
}
}, [activeNumber, setActiveNumber, products, params]);
}, [params, products, setActiveNumber]);
useEffect(() => {
const contStyles = (
@ -43,7 +46,7 @@ const SimpleMarketToolbar = () => {
]?.getBoundingClientRect();
const styles: Record<string, string> = selectedStyles
? {
backgroundColor: activeNumber ? '' : theme.colors.coral,
backgroundColor: activeNumber ? '' : theme.colors.pink,
width: `${selectedStyles.width}px`,
left: `${selectedStyles.left - contStyles.left}px`,
}
@ -51,42 +54,55 @@ const SimpleMarketToolbar = () => {
setSliderStyles(styles);
}, [activeNumber, slideContRef]);
useEffect(() => {
if (activeNumber < 0) {
return;
}
const product = activeNumber ? `/${products[activeNumber - 1]}` : '';
const asset = activeAsset !== 'all' || product ? `/${activeAsset}` : '';
const state = activeState !== 'Active' || asset ? `/${activeState}` : '';
navigate(`/markets${state}${asset}${product}`);
}, [activeNumber, activeAsset, activeState, products, navigate]);
const onStateChange = useCallback(
(activeState: string) => {
const asset =
params.asset && params.asset !== 'all' ? `/${params.asset}` : '';
const product = params.product ? `/${params.product}` : '';
const state =
activeState !== 'Active' || product ? `/${activeState}` : '';
navigate(`/markets${state}${product}${asset}`);
},
[params, navigate]
);
return (
<div className="w-max">
<div className="w-max mb-16 font-alpha">
<ul
ref={slideContRef}
className="grid grid-flow-col auto-cols-min gap-8 relative pb-4"
className="grid grid-flow-col auto-cols-min gap-8 relative pb-4 mb-16"
data-testid="market-products-menu"
aria-label={t('Product type')}
>
<li key="all" className="md:mx-16 whitespace-nowrap">
<Button
variant="inline"
onClick={() => setActiveNumber(0)}
style={{ color: theme.colors.coral }}
className={classNames({ active: !activeNumber })}
<li key="all" className="md:mr-16 whitespace-nowrap">
<Link
to={`/markets${
params.state && params.state !== 'Active'
? '/' + params.state
: ''
}`}
aria-label={t('All markets')}
className={classNames('text-h5 pl-0 text-pink hover:opacity-75', {
active: !activeNumber,
})}
>
{t('All Markets')}
</Button>
</Link>
</li>
{products.map((product, i) => (
<li key={product} className="mx-16 whitespace-nowrap">
<Button
variant="inline"
onClick={() => setActiveNumber(++i)}
className={classNames({ active: activeNumber - 1 === i })}
<Link
to={`/markets/${params.state || 'Active'}/${product}`}
className={classNames(
'text-h5 hover:opacity-75 text-black dark:text-white',
{
active: activeNumber - 1 === i,
}
)}
aria-label={product}
>
{product}
</Button>
</Link>
</li>
))}
<li
@ -96,53 +112,91 @@ const SimpleMarketToolbar = () => {
/>
</ul>
<div className="grid gap-8 pb-4 mt-8 md:grid-cols-[min-content,min-content,1fr]">
<div className="md:ml-16">
<Select
value={activeState}
onChange={onStateChange}
name="states"
className="mr-16 w-auto"
<div className="pb-8">
<DropdownMenu onOpenChange={(open) => setOpen(open)}>
<DropdownMenuTrigger
className="mr-16 w-auto text-capMenu text-black dark:text-white"
data-testid="state-trigger"
>
{STATES_FILTER.map((state) => (
<option key={state.value} value={state.value}>
{state.text}
</option>
))}
</Select>
<div className="w-full justify-between uppercase inline-flex items-center justify-center box-border">
{STATES_FILTER.find(
(state) =>
state.value === params.state ||
(!params.state && state.value === 'Active')
)?.text || params.state}
<Icon
name={IconNames.ARROW_DOWN}
className={classNames(
'fill-current ml-8 transition-transform',
{
'rotate-180': isOpen,
}
)}
size={16}
/>
</div>
<div className="hidden md:block">|</div>
<ul
className="grid grid-flow-col auto-cols-min md:gap-8 pb-4"
data-testid="market-assets-menu"
</DropdownMenuTrigger>
<DropdownMenuContent>
{STATES_FILTER.map(({ value, text }) => (
<DropdownMenuCheckboxItem
className="uppercase text-ui dark:text-white"
key={value}
inset
checked={
value === params.state ||
(!params.state && value === 'Active')
}
onCheckedChange={() => onStateChange(value)}
>
<li key="all" className="mx-8">
<Button
variant="inline"
onClick={() => setActiveAsset('all')}
className={classNames({
'font-bold': activeAsset === 'all',
<DropdownMenuItemIndicator>
<Icon name="tick" />
</DropdownMenuItemIndicator>
{text}
</DropdownMenuCheckboxItem>
))}
</DropdownMenuContent>
</DropdownMenu>
</div>
<div className="hidden md:block text-deemphasise dark:text-midGrey">
|
</div>
{activeNumber > 0 && (
<ul
className="grid grid-flow-col auto-cols-min md:gap-16 sm:gap-12 pb-4 md:ml-16"
data-testid="market-assets-menu"
aria-label={t('Asset on the market')}
>
<li key="all">
<Link
to={`/markets/${params.state}/${params.product}`}
className={classNames('uppercase pl-0 md:pl-4 text-capMenu', {
'text-deemphasise dark:text-midGrey':
params.asset && params.asset !== 'all',
'active text-black dark:text-white':
!params.asset || params.asset === 'all',
})}
aria-label={t('All assets')}
>
{t('All')}
</Button>
</Link>
</li>
{(activeNumber
? assetsPerProduct[products[activeNumber - 1]]
: assets
)?.map((asset) => (
<li key={asset} className="mx-8">
<Button
variant="inline"
onClick={() => setActiveAsset(asset)}
className={classNames({
'font-bold': activeAsset === asset,
{assetsPerProduct[products[activeNumber - 1]]?.map((asset) => (
<li key={asset}>
<Link
to={`/markets/${params.state}/${params.product}/${asset}`}
className={classNames('uppercase text-capMenu', {
'text-deemphasise dark:text-midGrey':
params.asset !== asset,
'active text-black dark:text-white': params.asset === asset,
})}
aria-label={asset}
>
{asset}
</Button>
</Link>
</li>
))}
</ul>
)}
</div>
</div>
);

View File

@ -1,5 +0,0 @@
export const DATA_SOURCES = {
dataNodeUrl: process.env['NX_VEGA_URL'] as string,
envName: process.env['NX_VEGA_ENV'] as string,
restEndpoint: process.env['NX_VEGA_REST'] as string,
};

View File

@ -4,7 +4,6 @@ import { FILTERS_QUERY } from '../components/simple-market-list/data-provider';
import type { MarketFilters } from '../components/simple-market-list/__generated__/MarketFilters';
const useMarketFilters = () => {
const [assets, setAssets] = useState<string[]>([]);
const [products, setProducts] = useState<string[]>([]);
const [assetsPerProduct, setAssetsPerProduct] = useState<
Record<string, string[]>
@ -14,7 +13,6 @@ const useMarketFilters = () => {
});
useEffect(() => {
const localProducts = new Set<string>();
const localAssets = new Set<string>();
const localAssetPerProduct: Record<string, Set<string>> = {};
data?.markets?.forEach((item) => {
const product = item.tradableInstrument.instrument.product.__typename;
@ -25,9 +23,7 @@ const useMarketFilters = () => {
}
localAssetPerProduct[product].add(asset);
localProducts.add(product);
localAssets.add(asset);
});
setAssets([...localAssets]);
setProducts([...localProducts]);
setAssetsPerProduct(
Object.entries(localAssetPerProduct).reduce(
@ -39,7 +35,7 @@ const useMarketFilters = () => {
)
);
}, [data]);
return { assets, products, assetsPerProduct };
return { products, assetsPerProduct };
};
export default useMarketFilters;

View File

@ -26,9 +26,9 @@ export const routerConfig = [
element: <SimpleMarketList />,
children: [
{
path: `:asset`,
path: `:product`,
element: <SimpleMarketList />,
children: [{ path: `:product`, element: <SimpleMarketList /> }],
children: [{ path: `:asset`, element: <SimpleMarketList /> }],
},
],
},

View File

@ -1,6 +1,6 @@
const { join } = require('path');
const { createGlobPatternsForDependencies } = require('@nrwl/next/tailwind');
const theme = require('../../libs/tailwindcss-config/src/theme');
const theme = require('../../libs/tailwindcss-config/src/theme-lite');
const vegaCustomClasses = require('../../libs/tailwindcss-config/src/vega-custom-classes');
module.exports = {

View File

@ -0,0 +1,3 @@
{
"hosts": ["https://n04.d.vega.xyz/query"]
}

View File

@ -0,0 +1,17 @@
{
"hosts": [
"https://vega-data-graphql.chorus.one/query",
"https://vega.xprv.io/datanode/query",
"http://nala.mainnet.vega.community:3008/query",
"http://commodum.mainnet.vega.community:3008/query",
"http://lovali.mainnet.vega.community:3008/query",
"http://b-harvest.mainnet.vega.community:3008/query",
"http://staking-facilities.mainnet.vega.community:3008/query",
"http://figment.mainnet.vega.community:3008/query",
"http://nodes-guru.mainnet.vega.community:3008/query",
"http://p2p.mainnet.vega.community:3008/query",
"http://rockaway.mainnet.vega.community:3008/query",
"http://greenfield-one.mainnet.vega.community:3008/query",
"http://ryabina.mainnet.vega.community:3008/query"
]
}

View File

@ -38,7 +38,7 @@
"tranche_end": "2023-12-05T00:00:00.000Z",
"total_added": "129999.45",
"total_removed": "0",
"locked_amount": "126143.693637837075430965",
"locked_amount": "125550.67163847386329389",
"deposits": [
{
"amount": "129999.45",
@ -488,7 +488,7 @@
"tranche_end": "2023-04-05T00:00:00.000Z",
"total_added": "97499.58",
"total_removed": "0",
"locked_amount": "66957.41426504243111508",
"locked_amount": "66375.714926165134519854",
"deposits": [
{
"amount": "97499.58",
@ -521,7 +521,7 @@
"tranche_end": "2023-04-05T00:00:00.000Z",
"total_added": "135173.4239508",
"total_removed": "0",
"locked_amount": "91519.225584984544134931503",
"locked_amount": "90724.1430149405949586301724",
"deposits": [
{
"amount": "135173.4239508",
@ -554,7 +554,7 @@
"tranche_end": "2023-04-05T00:00:00.000Z",
"total_added": "32499.86",
"total_removed": "0",
"locked_amount": "28167.82788860720687974",
"locked_amount": "27923.117022151803344928",
"deposits": [
{
"amount": "32499.86",
@ -587,7 +587,7 @@
"tranche_end": "2023-04-05T00:00:00.000Z",
"total_added": "10833.29",
"total_removed": "0",
"locked_amount": "9168.354643609749799926",
"locked_amount": "9088.703631196554874002",
"deposits": [
{
"amount": "10833.29",
@ -675,7 +675,7 @@
"tranche_end": "2022-11-01T00:00:00.000Z",
"total_added": "22500",
"total_removed": "0",
"locked_amount": "16232.58038949275475",
"locked_amount": "15926.89509737318925",
"deposits": [
{
"amount": "15000",
@ -761,7 +761,7 @@
"tranche_end": "2023-06-02T00:00:00.000Z",
"total_added": "1939928.38",
"total_removed": "0",
"locked_amount": "1837598.142190606213172846",
"locked_amount": "1824311.884226555593124554",
"deposits": [
{
"amount": "1852091.69",
@ -1777,7 +1777,7 @@
"tranche_end": "2022-09-30T00:00:00.000Z",
"total_added": "60916.66666633337",
"total_removed": "18323.723696937179372649",
"locked_amount": "15736.2487435827866542928933059592",
"locked_amount": "15345.7844080554792796843344487108",
"deposits": [
{
"amount": "2833.333333",
@ -3228,10 +3228,20 @@
"tranche_id": 10,
"tranche_start": "2021-07-15T23:37:11.000Z",
"tranche_end": "2021-07-15T23:37:11.000Z",
"total_added": "3623768.150000000000000001",
"total_removed": "3615578.640000000000000001",
"total_added": "3653968.150000000000000001",
"total_removed": "3645778.640000000000000001",
"locked_amount": "0",
"deposits": [
{
"amount": "30000",
"user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f",
"tx": "0xf366a57fa7a16029a9581c3f8e0ab19eee6f0758b60242fb59000df38a359e51"
},
{
"amount": "200",
"user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f",
"tx": "0x7b0e95e1914579c79eff111dd0df59e767321858e552cbd2a65e5f0ea8c60868"
},
{
"amount": "40000",
"user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f",
@ -3649,6 +3659,16 @@
}
],
"withdrawals": [
{
"amount": "30000",
"user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f",
"tx": "0x9ba5590885e34d6a61031167adaaa47a1f0b76d254813f93560d3b31f32b5c21"
},
{
"amount": "200",
"user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f",
"tx": "0xc5ad7140387b5c2eeeae5c158d97a8df0d4c0bbae4a61b3c03c784f11272c89a"
},
{
"amount": "40000",
"user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f",
@ -4009,6 +4029,18 @@
{
"address": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f",
"deposits": [
{
"amount": "30000",
"user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f",
"tranche_id": 10,
"tx": "0xf366a57fa7a16029a9581c3f8e0ab19eee6f0758b60242fb59000df38a359e51"
},
{
"amount": "200",
"user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f",
"tranche_id": 10,
"tx": "0x7b0e95e1914579c79eff111dd0df59e767321858e552cbd2a65e5f0ea8c60868"
},
{
"amount": "40000",
"user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f",
@ -4083,6 +4115,18 @@
}
],
"withdrawals": [
{
"amount": "30000",
"user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f",
"tranche_id": 10,
"tx": "0x9ba5590885e34d6a61031167adaaa47a1f0b76d254813f93560d3b31f32b5c21"
},
{
"amount": "200",
"user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f",
"tranche_id": 10,
"tx": "0xc5ad7140387b5c2eeeae5c158d97a8df0d4c0bbae4a61b3c03c784f11272c89a"
},
{
"amount": "40000",
"user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f",
@ -4150,8 +4194,8 @@
"tx": "0xac16a4ce688d40a482a59914d68c3a676592f8804ee8f0781b66a4ba5ccfbdfc"
}
],
"total_tokens": "477451",
"withdrawn_tokens": "477451",
"total_tokens": "507651",
"withdrawn_tokens": "507651",
"remaining_tokens": "0"
},
{
@ -5149,10 +5193,40 @@
"tranche_id": 11,
"tranche_start": "2021-09-03T00:00:00.000Z",
"tranche_end": "2022-09-03T00:00:00.000Z",
"total_added": "19080.000000000000000003",
"total_added": "19455.000000000000000003",
"total_removed": "5052.45813105178",
"locked_amount": "3855.01913242009197840060613508371385094",
"locked_amount": "3797.54184693683445435058558856544901071",
"deposits": [
{
"amount": "75",
"user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"tx": "0x0d4debf53c986bb6e0aaa85a330d38e761d8868985ceb20f860e627586b63c3c"
},
{
"amount": "60",
"user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"tx": "0x6235a605b72b2ed06318427bed0acc5421f06b008599a3bae2197856f7c37723"
},
{
"amount": "60",
"user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"tx": "0x7d0f55a7b806202784f40fec1f40ed9e0e027ee49018c247b2cbc29bf3396595"
},
{
"amount": "60",
"user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"tx": "0x9d29d8817da4655918f0175d9b9bc54c6a86ea1dffddc394d0443962055ee2fd"
},
{
"amount": "60",
"user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"tx": "0x281824795c787ffffa647f003e6f5d742a38861f70166bef54ab15debb8293fb"
},
{
"amount": "60",
"user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"tx": "0x72adba1aa2d918148f1a95eb6a447da22fa06217cadafa94d56f12fd22a389be"
},
{
"amount": "30",
"user": "0xb4eE687f019A8e48F7087f4b4f8653208B8cc48f",
@ -8457,6 +8531,106 @@
}
],
"users": [
{
"address": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"deposits": [
{
"amount": "75",
"user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"tranche_id": 11,
"tx": "0x0d4debf53c986bb6e0aaa85a330d38e761d8868985ceb20f860e627586b63c3c"
},
{
"amount": "60",
"user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"tranche_id": 11,
"tx": "0x6235a605b72b2ed06318427bed0acc5421f06b008599a3bae2197856f7c37723"
},
{
"amount": "60",
"user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"tranche_id": 11,
"tx": "0x7d0f55a7b806202784f40fec1f40ed9e0e027ee49018c247b2cbc29bf3396595"
},
{
"amount": "60",
"user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"tranche_id": 11,
"tx": "0x9d29d8817da4655918f0175d9b9bc54c6a86ea1dffddc394d0443962055ee2fd"
},
{
"amount": "60",
"user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"tranche_id": 11,
"tx": "0x281824795c787ffffa647f003e6f5d742a38861f70166bef54ab15debb8293fb"
},
{
"amount": "60",
"user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"tranche_id": 11,
"tx": "0x72adba1aa2d918148f1a95eb6a447da22fa06217cadafa94d56f12fd22a389be"
},
{
"amount": "250",
"user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"tranche_id": 11,
"tx": "0xf63cbb6224be2b11aae80f9a5f372869e53061d1b2c4a454095aa6b6b9b723bd"
},
{
"amount": "250",
"user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"tranche_id": 11,
"tx": "0x9540e07a486f617e7cc6db4dadc520c8f59491062fe8a1af3fb7b5d8c6b85a58"
},
{
"amount": "200",
"user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"tranche_id": 11,
"tx": "0xd7422454fd73831006588f945d807ec0d2312497d2f28738af27e7ff935c6e98"
},
{
"amount": "170",
"user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"tranche_id": 11,
"tx": "0x689c40036e449a1cac0958c0db669b1388b54bd8a0a0c6c71fe2a9b498066444"
},
{
"amount": "80",
"user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"tranche_id": 11,
"tx": "0xd3c728581506c71fc4f69aef018f512c8e87f278f36900b1b70661b9f2b5be40"
},
{
"amount": "100",
"user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"tranche_id": 11,
"tx": "0x28c0d7d0368216157d080db9ea958130b5d6f25bc111343ddb4a62ab7e1b051b"
},
{
"amount": "90",
"user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"tranche_id": 11,
"tx": "0xa99f5b902d47bdc4d106182ab72d21ce3f036d0830b07c6bb76f4facd17fc2b9"
},
{
"amount": "75",
"user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"tranche_id": 11,
"tx": "0xc4981c736caa5a186bb800cc61ce2d3372b66779a3f22a14e7b1871c959fccca"
}
],
"withdrawals": [
{
"amount": "940.30940496195",
"user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"tranche_id": 11,
"tx": "0x113a57018552a2003c49b030ef1cb9ffaee99747c81485647d195d08d676ed78"
}
],
"total_tokens": "1590",
"withdrawn_tokens": "940.30940496195",
"remaining_tokens": "649.69059503805"
},
{
"address": "0xb4eE687f019A8e48F7087f4b4f8653208B8cc48f",
"deposits": [
@ -8646,70 +8820,6 @@
"withdrawn_tokens": "0",
"remaining_tokens": "670"
},
{
"address": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"deposits": [
{
"amount": "250",
"user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"tranche_id": 11,
"tx": "0xf63cbb6224be2b11aae80f9a5f372869e53061d1b2c4a454095aa6b6b9b723bd"
},
{
"amount": "250",
"user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"tranche_id": 11,
"tx": "0x9540e07a486f617e7cc6db4dadc520c8f59491062fe8a1af3fb7b5d8c6b85a58"
},
{
"amount": "200",
"user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"tranche_id": 11,
"tx": "0xd7422454fd73831006588f945d807ec0d2312497d2f28738af27e7ff935c6e98"
},
{
"amount": "170",
"user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"tranche_id": 11,
"tx": "0x689c40036e449a1cac0958c0db669b1388b54bd8a0a0c6c71fe2a9b498066444"
},
{
"amount": "80",
"user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"tranche_id": 11,
"tx": "0xd3c728581506c71fc4f69aef018f512c8e87f278f36900b1b70661b9f2b5be40"
},
{
"amount": "100",
"user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"tranche_id": 11,
"tx": "0x28c0d7d0368216157d080db9ea958130b5d6f25bc111343ddb4a62ab7e1b051b"
},
{
"amount": "90",
"user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"tranche_id": 11,
"tx": "0xa99f5b902d47bdc4d106182ab72d21ce3f036d0830b07c6bb76f4facd17fc2b9"
},
{
"amount": "75",
"user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"tranche_id": 11,
"tx": "0xc4981c736caa5a186bb800cc61ce2d3372b66779a3f22a14e7b1871c959fccca"
}
],
"withdrawals": [
{
"amount": "940.30940496195",
"user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d",
"tranche_id": 11,
"tx": "0x113a57018552a2003c49b030ef1cb9ffaee99747c81485647d195d08d676ed78"
}
],
"total_tokens": "1215",
"withdrawn_tokens": "940.30940496195",
"remaining_tokens": "274.69059503805"
},
{
"address": "0xbd332c522c423B710Aa68f4d1403F912029F8625",
"deposits": [
@ -13969,7 +14079,7 @@
"tranche_end": "2023-06-05T00:00:00.000Z",
"total_added": "3732368.4671",
"total_removed": "74162.9780761646031",
"locked_amount": "2848249.88555518391350126666",
"locked_amount": "2827833.53284815265111086312",
"deposits": [
{
"amount": "1998.95815",
@ -14681,8 +14791,8 @@
"tranche_start": "2022-06-05T00:00:00.000Z",
"tranche_end": "2023-12-05T00:00:00.000Z",
"total_added": "15788853.065470999700000001",
"total_removed": "5344.1456869113936",
"locked_amount": "15320559.0022388444739507838954571001919437",
"total_removed": "6529.308282907170975",
"locked_amount": "15248534.5651159366987063864185024232049202",
"deposits": [
{
"amount": "16249.93",
@ -15176,6 +15286,16 @@
}
],
"withdrawals": [
{
"amount": "579.636872035866225",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"tx": "0xb11f9f763196e40be412b1c6992f64d3a73b094833f57eb7783a050c64ec159d"
},
{
"amount": "605.52572395991115",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"tx": "0x7bf7930893a08f0c18416bb3c9470c5671a1a10a9251d4ab5eb392ed90124a60"
},
{
"amount": "2446.31552516990115",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
@ -15262,6 +15382,18 @@
}
],
"withdrawals": [
{
"amount": "579.636872035866225",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"tranche_id": 2,
"tx": "0xb11f9f763196e40be412b1c6992f64d3a73b094833f57eb7783a050c64ec159d"
},
{
"amount": "605.52572395991115",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"tranche_id": 2,
"tx": "0x7bf7930893a08f0c18416bb3c9470c5671a1a10a9251d4ab5eb392ed90124a60"
},
{
"amount": "2446.31552516990115",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
@ -15306,8 +15438,8 @@
}
],
"total_tokens": "194999.1675",
"withdrawn_tokens": "5344.1456869113936",
"remaining_tokens": "189655.0218130886064"
"withdrawn_tokens": "6529.308282907170975",
"remaining_tokens": "188469.859217092829025"
},
{
"address": "0x89051CAb67Bc7F8CC44F7e270c6EDaf1EC57676c",
@ -16711,8 +16843,8 @@
"tranche_start": "2021-11-05T00:00:00.000Z",
"tranche_end": "2023-05-05T00:00:00.000Z",
"total_added": "14597706.0446472999",
"total_removed": "2067913.758606456406425022",
"locked_amount": "8495181.42411704905218150751009554",
"total_removed": "2069544.949743920512285522",
"locked_amount": "8428346.7523447924808560906348842",
"deposits": [
{
"amount": "129284.449",
@ -16921,6 +17053,21 @@
}
],
"withdrawals": [
{
"amount": "509.31853983395369725",
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
"tx": "0xa7bccea82ef34f1943bc5243ef75909d8ae81c45e67862b9c68b0a7532edc833"
},
{
"amount": "582.7808762737973505",
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
"tx": "0xcdbefdbd89a68d401dd21553cded39ee57bb5a7c6f3203ed6971e625f90c8b9d"
},
{
"amount": "539.09172135635481275",
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
"tx": "0x091d995cd60f0a5a93eccb13e0ca0e39fc513c28c860bd5bc6369da3994a09d0"
},
{
"amount": "652.48254356494551875",
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
@ -18497,6 +18644,24 @@
}
],
"withdrawals": [
{
"amount": "509.31853983395369725",
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
"tranche_id": 3,
"tx": "0xa7bccea82ef34f1943bc5243ef75909d8ae81c45e67862b9c68b0a7532edc833"
},
{
"amount": "582.7808762737973505",
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
"tranche_id": 3,
"tx": "0xcdbefdbd89a68d401dd21553cded39ee57bb5a7c6f3203ed6971e625f90c8b9d"
},
{
"amount": "539.09172135635481275",
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
"tranche_id": 3,
"tx": "0x091d995cd60f0a5a93eccb13e0ca0e39fc513c28c860bd5bc6369da3994a09d0"
},
{
"amount": "652.48254356494551875",
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
@ -19735,8 +19900,8 @@
}
],
"total_tokens": "359123.469575",
"withdrawn_tokens": "149880.84354723987146575",
"remaining_tokens": "209242.62602776012853425"
"withdrawn_tokens": "151512.03468470397732625",
"remaining_tokens": "207611.43489029602267375"
},
{
"address": "0xBdd412797c1B78535Afc5F71503b91fAbD0160fB",
@ -20726,8 +20891,8 @@
"tranche_start": "2021-10-05T00:00:00.000Z",
"tranche_end": "2023-04-05T00:00:00.000Z",
"total_added": "5778205.3912159303",
"total_removed": "1386457.324778695108317227",
"locked_amount": "3039594.15555795680959140026270059",
"total_removed": "1390546.591547348229906227",
"locked_amount": "3013187.37252800835890024298674749",
"deposits": [
{
"amount": "552496.6455",
@ -20871,6 +21036,11 @@
}
],
"withdrawals": [
{
"amount": "4089.266768653121589",
"user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90",
"tx": "0xa6b9993b9288eac739756499b2997155ce8b1bc6e862c1a6569c8e04463bb31f"
},
{
"amount": "13341.31568777778021",
"user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90",
@ -21699,6 +21869,12 @@
}
],
"withdrawals": [
{
"amount": "4089.266768653121589",
"user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90",
"tranche_id": 4,
"tx": "0xa6b9993b9288eac739756499b2997155ce8b1bc6e862c1a6569c8e04463bb31f"
},
{
"amount": "13341.31568777778021",
"user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90",
@ -21761,8 +21937,8 @@
}
],
"total_tokens": "331498.5873",
"withdrawn_tokens": "153215.022368261786721",
"remaining_tokens": "178283.564931738213279"
"withdrawn_tokens": "157304.28913691490831",
"remaining_tokens": "174194.29816308509169"
},
{
"address": "0x16da609341ed67750A8BCC5AAa2005471006Cd77",
@ -21839,7 +22015,7 @@
"tranche_end": "2023-06-05T00:00:00.000Z",
"total_added": "472355.6199999996",
"total_removed": "0",
"locked_amount": "451321.47565667900568555782445456",
"locked_amount": "448086.38786540236946778559309992",
"deposits": [
{
"amount": "3000",
@ -47492,7 +47668,7 @@
"tranche_start": "2021-12-05T00:00:00.000Z",
"tranche_end": "2022-06-05T00:00:00.000Z",
"total_added": "171288.42",
"total_removed": "28935.5825162206377",
"total_removed": "29685.4825162206377",
"locked_amount": "0",
"deposits": [
{
@ -51722,6 +51898,21 @@
"user": "0xEe3183EcE9ee7d73Fb7bA7F4eB262A2dE68C42B0",
"tx": "0x878349f3aa30227a241557b941a641d825182494242e571f571674b2e2007099"
},
{
"amount": "250",
"user": "0x7fAA8d1Cb6Ab8A9fC039b66fe844575557389CD4",
"tx": "0xb45e62f845fe45f11bb86fdffbc1af3e737573726b3c2c8cc6ba39ab8127369d"
},
{
"amount": "250",
"user": "0xEF5D4Be15019F9b972E54b6B904076617aDAfb1C",
"tx": "0x44d207a93bdb1ef457d5a31207d3ccbda3e9fce6528f3a6c0d04f9153e064a2a"
},
{
"amount": "249.9",
"user": "0xcad0D46627628A8bAF524BF202669e8B9f04250f",
"tx": "0xa403d8af5a940c4abd4aadcc579e279218ae73b9c7fc3d7e4216d6aab5ba70eb"
},
{
"amount": "183.6335597275",
"user": "0x690Fc36d52eD3f198F0eBDea1557333a1766f786",
@ -57695,10 +57886,17 @@
"tx": "0x75de6ca47e0da361181d14aceb5d08e572754861465caa67a12b528886d55307"
}
],
"withdrawals": [],
"withdrawals": [
{
"amount": "249.9",
"user": "0xcad0D46627628A8bAF524BF202669e8B9f04250f",
"tranche_id": 6,
"tx": "0xa403d8af5a940c4abd4aadcc579e279218ae73b9c7fc3d7e4216d6aab5ba70eb"
}
],
"total_tokens": "249.9",
"withdrawn_tokens": "0",
"remaining_tokens": "249.9"
"withdrawn_tokens": "249.9",
"remaining_tokens": "0"
},
{
"address": "0x783C204FfCC479cec7807C37480A4D4C77FB1F22",
@ -63978,10 +64176,17 @@
"tx": "0xd23813c30e93f3867eaa257b7aef7052a050b1ee1c1a90102a3f40c5d989fe82"
}
],
"withdrawals": [],
"withdrawals": [
{
"amount": "250",
"user": "0xEF5D4Be15019F9b972E54b6B904076617aDAfb1C",
"tranche_id": 6,
"tx": "0x44d207a93bdb1ef457d5a31207d3ccbda3e9fce6528f3a6c0d04f9153e064a2a"
}
],
"total_tokens": "250",
"withdrawn_tokens": "0",
"remaining_tokens": "250"
"withdrawn_tokens": "250",
"remaining_tokens": "0"
},
{
"address": "0x660Bc2766867E1E19252ad30A413fe20d08A85c4",
@ -64920,10 +65125,17 @@
"tx": "0xc8541da6a57f410b6faba47a5e5184bae700193b7bd042914fffc562114d92f5"
}
],
"withdrawals": [],
"withdrawals": [
{
"amount": "250",
"user": "0x7fAA8d1Cb6Ab8A9fC039b66fe844575557389CD4",
"tranche_id": 6,
"tx": "0xb45e62f845fe45f11bb86fdffbc1af3e737573726b3c2c8cc6ba39ab8127369d"
}
],
"total_tokens": "250",
"withdrawn_tokens": "0",
"remaining_tokens": "250"
"withdrawn_tokens": "250",
"remaining_tokens": "0"
},
{
"address": "0x77f9A22455916246551b6F5182f4FfA61f245961",

View File

@ -0,0 +1,3 @@
{
"hosts": ["https://n03.s.vega.xyz/query"]
}

View File

@ -38,7 +38,7 @@
"tranche_end": "2022-11-26T13:48:10.000Z",
"total_added": "100",
"total_removed": "0",
"locked_amount": "43.3757895738204",
"locked_amount": "42.69090246067986",
"deposits": [
{
"amount": "100",
@ -242,7 +242,7 @@
"tranche_end": "2022-10-12T00:53:20.000Z",
"total_added": "1100",
"total_removed": "673.04388635",
"locked_amount": "339.895639903602233",
"locked_amount": "332.36188165905626",
"deposits": [
{
"amount": "1000",

View File

@ -0,0 +1,3 @@
{
"hosts": ["https://n03.stagnet2.vega.xyz/query"]
}

View File

@ -0,0 +1,3 @@
{
"hosts": ["https://lb.testnet.vega.xyz/query"]
}

View File

@ -69,7 +69,7 @@
"tranche_end": "2022-10-12T00:53:20.000Z",
"total_added": "1010.000000000000000001",
"total_removed": "668.4622323651",
"locked_amount": "312.08602866565198040030899606798579404",
"locked_amount": "305.16870084982244640030214722856418064",
"deposits": [
{
"amount": "1000",

View File

@ -3,7 +3,6 @@ import { DATA_SOURCES } from './config';
import { Header } from './components/header';
import { StatsManager } from '@vegaprotocol/network-stats';
import { ThemeContext } from '@vegaprotocol/react-helpers';
import { EnvironmentProvider } from '@vegaprotocol/network-switcher';
import { useThemeSwitcher } from '@vegaprotocol/react-helpers';
const envName = DATA_SOURCES.envName;
@ -15,7 +14,6 @@ function App() {
const [theme, toggleTheme] = useThemeSwitcher();
return (
<EnvironmentProvider>
<ThemeContext.Provider value={theme}>
<div className="w-screen min-h-screen grid pb-24 bg-white text-black-95 dark:bg-black dark:text-white-80">
<div className="layout-grid w-screen justify-self-center">
@ -29,7 +27,6 @@ function App() {
</div>
</div>
</ThemeContext.Provider>
</EnvironmentProvider>
);
}

View File

@ -21,7 +21,6 @@ REACT_APP_DEPLOY_PRIME_URL=$DEPLOY_PRIME_URL
# App configuration variables
NX_VEGA_ENV=TESTNET
NX_VEGA_URL=https://lb.testnet.vega.xyz/query
NX_ETHEREUM_CHAIN_ID=3
NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://ropsten.etherscan.io
NX_FAIRGROUND=false

View File

@ -1,6 +1,5 @@
# App configuration variables
NX_VEGA_ENV=DEVNET
NX_VEGA_URL=https://n04.d.vega.xyz/query
NX_ETHEREUM_CHAIN_ID=3
NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://ropsten.etherscan.io

View File

@ -1,6 +1,5 @@
# App configuration variables
NX_VEGA_ENV=MAINNET
NX_VEGA_URL=https://api.token.vega.xyz/query
NX_ETHEREUM_CHAIN_ID=1
NX_ETHEREUM_PROVIDER_URL=https://mainnet.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://etherscan.io

View File

@ -1,6 +1,5 @@
# App configuration variables
NX_VEGA_ENV=STAGNET
NX_VEGA_URL=https://n03.s.vega.xyz/query
NX_ETHEREUM_CHAIN_ID=3
NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://ropsten.etherscan.io

View File

@ -1,6 +1,5 @@
# App configuration variables
NX_VEGA_ENV=STAGNET2
NX_VEGA_URL=https://n03.stagnet2.vega.xyz/query
NX_ETHEREUM_CHAIN_ID=3
NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://ropsten.etherscan.io

View File

@ -1,6 +1,5 @@
# App configuration variables
NX_VEGA_ENV=TESTNET
NX_VEGA_URL=https://lb.testnet.vega.xyz/query
NX_ETHEREUM_CHAIN_ID=3
NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://ropsten.etherscan.io

View File

@ -20,8 +20,8 @@ REACT_APP_DEPLOY_PRIME_URL=$DEPLOY_PRIME_URL
# App configuration variables
NX_VEGA_ENV=TESTNET
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/testnet-network.json
NX_VEGA_URL=https://lb.testnet.vega.xyz/query
NX_ETHEREUM_CHAIN_ID=3
NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://ropsten.etherscan.io
NX_FAIRGROUND=false

View File

@ -1,7 +1,7 @@
# App configuration variables
NX_VEGA_ENV=DEVNET
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/devnet-network.json
NX_VEGA_URL=https://n04.d.vega.xyz/query
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET":"https://dev.token.vega.xyz","STAGNET2":"staging2.token.vega.xyz","TESTNET":"token.fairground.wtf","MAINNET":"token.vega.xyz"}'
NX_ETHEREUM_CHAIN_ID=3
NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://ropsten.etherscan.io

View File

@ -1,7 +1,7 @@
# App configuration variables
NX_VEGA_ENV=MAINNET
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/mainnet-network.json
NX_VEGA_URL=https://api.token.vega.xyz/query
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET":"https://dev.token.vega.xyz","STAGNET2":"staging2.token.vega.xyz","TESTNET":"token.fairground.wtf","MAINNET":"token.vega.xyz"}'
NX_ETHEREUM_CHAIN_ID=1
NX_ETHEREUM_PROVIDER_URL=https://mainnet.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://etherscan.io

View File

@ -1,7 +1,7 @@
# App configuration variables
NX_VEGA_ENV=STAGNET
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet1-network.json
NX_VEGA_URL=https://n03.s.vega.xyz/query
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET":"https://dev.token.vega.xyz","STAGNET2":"staging2.token.vega.xyz","TESTNET":"token.fairground.wtf","MAINNET":"token.vega.xyz"}'
NX_ETHEREUM_CHAIN_ID=3
NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://ropsten.etherscan.io

View File

@ -1,7 +1,7 @@
# App configuration variables
NX_VEGA_ENV=STAGNET2
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet2-network.json
NX_VEGA_URL=https://n03.stagnet2.vega.xyz/query
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET":"https://dev.token.vega.xyz","STAGNET2":"staging2.token.vega.xyz","TESTNET":"token.fairground.wtf","MAINNET":"token.vega.xyz"}'
NX_ETHEREUM_CHAIN_ID=3
NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://ropsten.etherscan.io

View File

@ -1,7 +1,7 @@
# App configuration variables
NX_VEGA_ENV=TESTNET
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/testnet-network.json
NX_VEGA_URL=https://lb.testnet.vega.xyz/query
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET":"https://dev.token.vega.xyz","STAGNET2":"staging2.token.vega.xyz","TESTNET":"token.fairground.wtf","MAINNET":"token.vega.xyz"}'
NX_ETHEREUM_CHAIN_ID=3
NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://ropsten.etherscan.io

View File

@ -48,13 +48,13 @@ There are a few different configuration options offered for this app:
| `NX_APP_INFURA_ID` | Infura fallback for if the user does not have a web3 compatible browser |
| `NX_APP_HOSTED_WALLET_ENABLED` | If the hosted wallet is enabled or not. If so then allow users to login using the hosted wallet |
| `NX_APP_ENV` | Change network to connect to. When set to CUSTOM use CUSTOM\_\* vars for network parameters |
| `CUSTOM_URLS` | When NX_APP_ENV=CUSTOM use these Data Node REST URLs, optional if CUSTOM_URLS_WITH_GRAPHQL is used. |
| `CUSTOM_URLS_WITH_GRAPHQL` | When NX_APP_ENV=CUSTOM use these Data Node GraphQL URLs, optional if CUSTOM_URLS is used. |
| `CUSTOM_TOKEN_ADDRESS` | When NX_APP_ENV=CUSTOM specify Vega token address. |
| `CUSTOM_CLAIM_ADDRESS` | When NX_APP_ENV=CUSTOM specify Vega claim address. |
| `CUSTOM_LOCKED_ADDRESS` | When NX_APP_ENV=CUSTOM specify Vega locked address. |
| `CUSTOM_VESTING_ADDRESS` | When NX_APP_ENV=CUSTOM specify Vega vesting address. |
| `CUSTOM_STAKING_BRIDGE` | When NX_APP_ENV=CUSTOM specify Vega staking bridge address. |
| `NX_CUSTOM_URLS` | When NX_APP_ENV=CUSTOM use these Data Node REST URLs, optional if CUSTOM_URLS_WITH_GRAPHQL is used. |
| `NX_CUSTOM_URLS_WITH_GRAPHQL` | When NX_APP_ENV=CUSTOM use these Data Node GraphQL URLs, optional if CUSTOM_URLS is used. |
| `NX_CUSTOM_TOKEN_ADDRESS` | When NX_APP_ENV=CUSTOM specify Vega token address. |
| `NX_CUSTOM_CLAIM_ADDRESS` | When NX_APP_ENV=CUSTOM specify Vega claim address. |
| `NX_CUSTOM_LOCKED_ADDRESS` | When NX_APP_ENV=CUSTOM specify Vega locked address. |
| `NX_CUSTOM_VESTING_ADDRESS` | When NX_APP_ENV=CUSTOM specify Vega vesting address. |
| `NX_CUSTOM_STAKING_BRIDGE` | When NX_APP_ENV=CUSTOM specify Vega staking bridge address. |
## Example configs:

View File

@ -17,27 +17,31 @@ import { AppRouter } from './routes';
import { Web3Provider } from '@vegaprotocol/web3';
import { VegaWalletDialogs } from './components/vega-wallet-dialogs';
import { VegaWalletProvider } from '@vegaprotocol/wallet';
import { createConnectors } from './lib/web3-connectors';
import { ApolloProvider } from '@apollo/client';
import { createClient } from './lib/apollo-client';
import { AsyncRenderer } from '@vegaprotocol/ui-toolkit';
import { useEthereumConfig } from '@vegaprotocol/web3';
import {
EnvironmentProvider,
useEnvironment,
} from '@vegaprotocol/network-switcher';
EnvironmentProvider,
NetworkLoader,
} from '@vegaprotocol/environment';
import { createClient } from './lib/apollo-client';
import { createConnectors } from './lib/web3-connectors';
const AppContainer = () => {
const sideBar = React.useMemo(() => [<EthWallet />, <VegaWallet />], []);
const { ETHEREUM_PROVIDER_URL, ETHEREUM_CHAIN_ID, VEGA_URL } =
useEnvironment();
const Connectors = useMemo(
() => createConnectors(ETHEREUM_PROVIDER_URL, ETHEREUM_CHAIN_ID),
[ETHEREUM_CHAIN_ID, ETHEREUM_PROVIDER_URL]
);
const client = useMemo(() => createClient(VEGA_URL), [VEGA_URL]);
const { config, loading, error } = useEthereumConfig();
const { ETHEREUM_PROVIDER_URL } = useEnvironment();
const Connectors = useMemo(() => {
if (config?.chain_id) {
return createConnectors(ETHEREUM_PROVIDER_URL, Number(config.chain_id));
}
return undefined;
}, [config?.chain_id, ETHEREUM_PROVIDER_URL]);
return (
<ApolloProvider client={client}>
<Router>
<AppStateProvider>
<AsyncRenderer loading={loading} data={config} error={error}>
{Connectors && (
<Web3Provider connectors={Connectors}>
<Web3Connector>
<VegaWalletProvider>
@ -61,16 +65,19 @@ const AppContainer = () => {
</VegaWalletProvider>
</Web3Connector>
</Web3Provider>
)}
</AsyncRenderer>
</AppStateProvider>
</Router>
</ApolloProvider>
);
};
function App() {
return (
<EnvironmentProvider>
<NetworkLoader createClient={createClient}>
<AppContainer />
</NetworkLoader>
</EnvironmentProvider>
);
}

View File

@ -1,15 +1,14 @@
import { useTranslation } from 'react-i18next';
import { useEnvironment } from '@vegaprotocol/network-switcher';
import { useAddAssetSupported } from '../../hooks/use-add-asset-to-wallet';
import vegaVesting from '../../images/vega_vesting.png';
import { AddTokenButtonLink } from '../add-token-button/add-token-button';
import { Callout } from '@vegaprotocol/ui-toolkit';
import { ENV } from '../../config/env';
export const AddLockedTokenAddress = () => {
const { t } = useTranslation();
const addSupported = useAddAssetSupported();
const { ADDRESSES } = useEnvironment();
return (
<Callout
title={t(
@ -20,7 +19,7 @@ export const AddLockedTokenAddress = () => {
<>
<p className="flex justify-center">
<AddTokenButtonLink
address={ADDRESSES.lockedAddress}
address={ENV.addresses.lockedAddress}
symbol="VEGA🔒"
decimals={18}
image={vegaVesting}
@ -36,7 +35,7 @@ export const AddLockedTokenAddress = () => {
{t(
'The token address is {{address}}. Hit the add token button in your ERC20 wallet and enter this address.',
{
address: ADDRESSES.lockedAddress,
address: ENV.addresses.lockedAddress,
}
)}
</p>

View File

@ -12,7 +12,7 @@ export function TemplateSidebar({ children, sidebar }: TemplateSidebarProps) {
<div className="border-b border-white lg:grid lg:grid-rows-[auto_minmax(600px,_1fr)] lg:grid-cols-[1fr_450px]">
<Nav />
<main className="p-20">{children}</main>
<aside className="hidden lg:block lg:col-start-2 lg:col-end-3 lg:row-start-1 lg: row-end-3 p-20 bg-banner bg-contain border-l border-white">
<aside className="hidden lg:block lg:col-start-2 lg:col-end-4 lg:row-start-1 lg: row-end-4 p-20 bg-banner bg-contain border-l border-white">
{sidebar.map((Component, i) => (
<section className="mb-20 last:mb-0" key={i}>
{Component}

View File

@ -1,7 +1,7 @@
import { Callout, Intent } from '@vegaprotocol/ui-toolkit';
import { useTranslation } from 'react-i18next';
import { Link } from '@vegaprotocol/ui-toolkit';
import { useEnvironment } from '@vegaprotocol/network-switcher';
import { useEnvironment } from '@vegaprotocol/environment';
import type { ReactElement } from 'react';
export const TransactionComplete = ({

View File

@ -2,7 +2,7 @@ import { Button, Callout, Intent } from '@vegaprotocol/ui-toolkit';
import { useTranslation } from 'react-i18next';
import { Link } from '@vegaprotocol/ui-toolkit';
import { useEnvironment } from '@vegaprotocol/network-switcher';
import { useEnvironment } from '@vegaprotocol/environment';
export interface TransactionErrorProps {
error: Error | null;

View File

@ -2,7 +2,7 @@ import React from 'react';
import { Callout, Loader } from '@vegaprotocol/ui-toolkit';
import { useTranslation } from 'react-i18next';
import { Link } from '@vegaprotocol/ui-toolkit';
import { useEnvironment } from '@vegaprotocol/network-switcher';
import { useEnvironment } from '@vegaprotocol/environment';
export const TransactionPending = ({
hash,

View File

@ -1,5 +1,5 @@
import { Dialog, Link } from '@vegaprotocol/ui-toolkit';
import { useEnvironment } from '@vegaprotocol/network-switcher';
import { useEnvironment } from '@vegaprotocol/environment';
import React from 'react';
import { useTranslation } from 'react-i18next';

View File

@ -1,5 +1,6 @@
import { useEnvironment } from '@vegaprotocol/network-switcher';
import { Button, Splash } from '@vegaprotocol/ui-toolkit';
import { useEnvironment } from '@vegaprotocol/environment';
import { useEthereumConfig } from '@vegaprotocol/web3';
import { Button, Splash, AsyncRenderer } from '@vegaprotocol/ui-toolkit';
import { Web3ConnectDialog } from '@vegaprotocol/web3';
import { useWeb3React } from '@web3-react/core';
import type { ReactElement } from 'react';
@ -16,30 +17,35 @@ interface Web3ConnectorProps {
export function Web3Connector({ children }: Web3ConnectorProps) {
const { appState, appDispatch } = useAppState();
const { ETHEREUM_PROVIDER_URL, ETHEREUM_CHAIN_ID } = useEnvironment();
const Connectors = useMemo(
() => createConnectors(ETHEREUM_PROVIDER_URL, ETHEREUM_CHAIN_ID),
[ETHEREUM_CHAIN_ID, ETHEREUM_PROVIDER_URL]
);
const { ETHEREUM_PROVIDER_URL } = useEnvironment();
const { config, loading, error } = useEthereumConfig();
const Connectors = useMemo(() => {
if (config?.chain_id) {
return createConnectors(ETHEREUM_PROVIDER_URL, Number(config.chain_id));
}
return undefined;
}, [config?.chain_id, ETHEREUM_PROVIDER_URL]);
const setDialogOpen = useCallback(
(isOpen: boolean) => {
appDispatch({ type: AppStateActionType.SET_ETH_WALLET_OVERLAY, isOpen });
},
[appDispatch]
);
const appChainId = Number(ETHEREUM_CHAIN_ID);
const appChainId = Number(config?.chain_id);
return (
<>
<AsyncRenderer loading={loading} error={error} data={config}>
<Web3Content appChainId={appChainId} setDialogOpen={setDialogOpen}>
{children}
</Web3Content>
{Connectors && (
<Web3ConnectDialog
connectors={Connectors}
dialogOpen={appState.ethConnectOverlay}
setDialogOpen={setDialogOpen}
desiredChainId={appChainId}
/>
</>
)}
</AsyncRenderer>
);
}
@ -49,11 +55,7 @@ interface Web3ContentProps {
setDialogOpen: (isOpen: boolean) => void;
}
export const Web3Content = ({
children,
appChainId,
setDialogOpen,
}: Web3ContentProps) => {
export const Web3Content = ({ children, appChainId }: Web3ContentProps) => {
const { error, connector, chainId } = useWeb3React();
useEffect(() => {

View File

@ -1,3 +1,5 @@
import type { Networks } from '@vegaprotocol/environment';
const windowOrDefault = (key: string) => {
if (window._env_ && window._env_[key]) {
return window._env_[key];
@ -7,10 +9,49 @@ const windowOrDefault = (key: string) => {
const TRUTHY = ['1', 'true'];
interface VegaContracts {
claimAddress: string;
lockedAddress: string;
}
const customClaimAddress = process.env['NX_CUSTOM_CLAIM_ADDRESS'] as string;
const customLockedAddress = process.env['NX_CUSTOM_LOCKED_ADDRESS'] as string;
export const ContractAddresses: {
[key in Networks | 'CUSTOM']: VegaContracts;
} = {
CUSTOM: {
claimAddress: customClaimAddress ?? '0x0',
lockedAddress: customLockedAddress ?? '0x0',
},
DEVNET: {
claimAddress: '0x8Cef746ab7C83B61F6461cC92882bD61AB65a994',
lockedAddress: '0x0',
},
STAGNET: {
claimAddress: '0x8Cef746ab7C83B61F6461cC92882bD61AB65a994', // TODO not deployed to this env, but random address so app doesn't error
lockedAddress: '0x0', // TODO not deployed to this env
},
STAGNET2: {
claimAddress: '0x8Cef746ab7C83B61F6461cC92882bD61AB65a994', // TODO not deployed to this env, but random address so app doesn't error
lockedAddress: '0x0', // TODO not deployed to this env
},
TESTNET: {
claimAddress: '0x8Cef746ab7C83B61F6461cC92882bD61AB65a994', // TODO not deployed to this env, but random address so app doesn't error
lockedAddress: '0x0', // TODO not deployed to this env
},
MAINNET: {
claimAddress: '0x0ee1fb382caf98e86e97e51f9f42f8b4654020f3',
lockedAddress: '0x78344c7305d73a7a0ac3c94cd9960f4449a1814e',
},
};
const envName = windowOrDefault('NX_VEGA_ENV') ?? 'local';
export const ENV = {
// Environment
dsn: windowOrDefault('NX_SENTRY_DSN'),
envName: windowOrDefault('NX_VEGA_ENV'),
envName,
commit: windowOrDefault('NX_COMMIT_REF'),
branch: windowOrDefault('NX_BRANCH'),
vegaUrl: windowOrDefault('NX_VEGA_URL'),
@ -26,4 +67,6 @@ export const ENV = {
process.env['NX_IS_NEW_BRIDGE_CONTRACT'] as string
),
},
addresses:
ContractAddresses[(envName === 'local' ? 'CUSTOM' : envName) as Networks],
};

View File

@ -1,4 +1,3 @@
export * from './flags';
export * from './links';
export * from './network-params';
export * from './vega';

View File

@ -1,176 +0,0 @@
import { Networks } from '@vegaprotocol/react-helpers';
interface VegaNode {
url: string;
api: {
GraphQL: boolean;
};
}
type VegaNets = {
[N in Networks]: {
nodes: VegaNode[];
};
};
export type NetworkConfig = {
[N in Networks]: string[];
};
export const VegaNetworks: VegaNets = {
[Networks.DEVNET]: {
nodes: [
{
url: 'https://n01.d.vega.xyz',
api: {
GraphQL: false,
},
},
{
url: 'https://n02.d.vega.xyz',
api: {
GraphQL: false,
},
},
{
url: 'https://n03.d.vega.xyz',
api: {
GraphQL: false,
},
},
{
url: 'https://n04.d.vega.xyz',
api: {
GraphQL: true,
},
},
],
},
[Networks.STAGNET]: {
nodes: [
{
url: 'https://n01.s.vega.xyz',
api: {
GraphQL: false,
},
},
{
url: 'https://n02.s.vega.xyz',
api: {
GraphQL: false,
},
},
{
url: 'https://n03.s.vega.xyz',
api: {
GraphQL: true,
},
},
{
url: 'https://n04.s.vega.xyz',
api: {
GraphQL: false,
},
},
{
url: 'https://n05.s.vega.xyz',
api: {
GraphQL: false,
},
},
],
},
[Networks.STAGNET2]: {
nodes: [
{
url: 'https://n03.stagnet2.vega.xyz',
api: {
GraphQL: true,
},
},
],
},
[Networks.TESTNET]: {
nodes: [
{
url: 'https://lb.testnet.vega.xyz',
api: {
GraphQL: true,
},
},
{
url: 'https://n01.testnet.vega.xyz',
api: {
GraphQL: false,
},
},
{
url: 'https://n02.testnet.vega.xyz',
api: {
GraphQL: false,
},
},
{
url: 'https://n03.testnet.vega.xyz',
api: {
GraphQL: false,
},
},
{
url: 'https://n04.testnet.vega.xyz',
api: {
GraphQL: false,
},
},
{
url: 'https://n05.testnet.vega.xyz',
api: {
GraphQL: false,
},
},
{
url: 'https://n06.testnet.vega.xyz',
api: {
GraphQL: true,
},
},
{
url: 'https://n07.testnet.vega.xyz',
api: {
GraphQL: true,
},
},
{
url: 'https://n08.testnet.vega.xyz',
api: {
GraphQL: true,
},
},
{
url: 'https://n09.testnet.vega.xyz',
api: {
GraphQL: true,
},
},
],
},
[Networks.MAINNET]: {
nodes: [],
},
};
export const GraphQLNodes = Object.keys(VegaNetworks).reduce(
(obj: Record<string, string[]>, network) => {
const rawNodes: VegaNode[] = VegaNetworks[network as Networks].nodes;
const nodesWithGraphQL = rawNodes
.filter((n) => n.api.GraphQL)
.map((n) => n.url);
obj[network] = nodesWithGraphQL;
return obj;
},
{}
);
export const EnvironmentNodes = GraphQLNodes[
process.env['NX_VEGA_ENV'] as Networks
] as string[];

View File

@ -6,14 +6,15 @@ import {
} from '@vegaprotocol/smart-contracts';
import { Splash } from '@vegaprotocol/ui-toolkit';
import { useWeb3React } from '@web3-react/core';
import React, { useMemo } from 'react';
import React from 'react';
import { SplashLoader } from '../../components/splash-loader';
import type { ContractsContextShape } from './contracts-context';
import { ContractsContext } from './contracts-context';
import { createDefaultProvider } from '../../lib/web3-connectors';
import { useEthereumConfig } from '@vegaprotocol/web3';
import { useEnvironment } from '@vegaprotocol/network-switcher';
import { useEnvironment } from '@vegaprotocol/environment';
import { ENV } from '../../config/env';
/**
* Provides Vega Ethereum contract instances to its children.
@ -21,14 +22,9 @@ import { useEnvironment } from '@vegaprotocol/network-switcher';
export const ContractsProvider = ({ children }: { children: JSX.Element }) => {
const { provider: activeProvider, account } = useWeb3React();
const { config } = useEthereumConfig();
const { VEGA_ENV, ADDRESSES, ETHEREUM_PROVIDER_URL, ETHEREUM_CHAIN_ID } =
useEnvironment();
const { VEGA_ENV, ETHEREUM_PROVIDER_URL } = useEnvironment();
const [contracts, setContracts] =
React.useState<ContractsContextShape | null>(null);
const defaultProvider = useMemo(
() => createDefaultProvider(ETHEREUM_PROVIDER_URL, ETHEREUM_CHAIN_ID),
[ETHEREUM_PROVIDER_URL, ETHEREUM_CHAIN_ID]
);
// Create instances of contract classes. If we have an account use a signer for the
// contracts so that we can sign transactions, otherwise use the provider for just
@ -37,6 +33,12 @@ export const ContractsProvider = ({ children }: { children: JSX.Element }) => {
const run = async () => {
let signer = null;
if (config) {
const defaultProvider = createDefaultProvider(
ETHEREUM_PROVIDER_URL,
Number(config.chain_id)
);
const provider = activeProvider ? activeProvider : defaultProvider;
if (
@ -64,12 +66,13 @@ export const ContractsProvider = ({ children }: { children: JSX.Element }) => {
config.token_vesting_contract.address,
signer || provider
),
claim: new Claim(ADDRESSES.claimAddress, signer || provider),
claim: new Claim(ENV.addresses.claimAddress, signer || provider),
});
}
}
};
run();
}, [activeProvider, account, config, ADDRESSES, VEGA_ENV, defaultProvider]);
}, [activeProvider, account, config, VEGA_ENV, ETHEREUM_PROVIDER_URL]);
if (!contracts) {
return (

View File

@ -1,9 +1,9 @@
import React from 'react';
import * as Sentry from '@sentry/react';
import { Networks } from '@vegaprotocol/react-helpers';
import { Networks } from '@vegaprotocol/environment';
import { useWeb3React } from '@web3-react/core';
import { MetaMask } from '@web3-react/metamask';
import { useEnvironment } from '@vegaprotocol/network-switcher';
import { useEnvironment } from '@vegaprotocol/environment';
export const useAddAssetSupported = () => {
const { connector } = useWeb3React();

View File

@ -1,8 +1,8 @@
import type { Networks } from '@vegaprotocol/react-helpers';
import { useFetch } from '@vegaprotocol/react-helpers';
import type { Tranche } from '@vegaprotocol/smart-contracts';
import React, { useEffect } from 'react';
import { useEnvironment } from '@vegaprotocol/network-switcher';
import type { Networks } from '@vegaprotocol/environment';
import { useEnvironment } from '@vegaprotocol/environment';
import { BigNumber } from '../lib/bignumber';
@ -12,6 +12,7 @@ const TRANCHES_URLS: { [N in Networks]: string } = {
STAGNET: 'https://static.vega.xyz/assets/stagnet1-tranches.json',
STAGNET2: 'https://static.vega.xyz/assets/stagnet2-tranches.json',
DEVNET: 'https://static.vega.xyz/assets/devnet-tranches.json',
CUSTOM: 'https://static.vega.xyz/assets/testnet-tranches.json',
};
export function useTranches() {

View File

@ -1,5 +1,5 @@
import { Callout, Intent, Link, Button } from '@vegaprotocol/ui-toolkit';
import { useEnvironment } from '@vegaprotocol/network-switcher';
import { useEnvironment } from '@vegaprotocol/environment';
import { Trans, useTranslation } from 'react-i18next';
import { Link as RouteLink } from 'react-router-dom';

View File

@ -2,13 +2,14 @@ import { t } from '@vegaprotocol/react-helpers';
import { Link, Splash } from '@vegaprotocol/ui-toolkit';
import type { EthereumConfig } from '@vegaprotocol/web3';
import { useEthereumConfig } from '@vegaprotocol/web3';
import { useEnvironment } from '@vegaprotocol/network-switcher';
import { useEnvironment } from '@vegaprotocol/environment';
import { Heading } from '../../components/heading';
import { SplashLoader } from '../../components/splash-loader';
import { ENV } from '../../config/env';
const Contracts = () => {
const { config } = useEthereumConfig();
const { ADDRESSES, ETHERSCAN_URL } = useEnvironment();
const { ETHERSCAN_URL } = useEnvironment();
if (!config) {
return (
@ -47,7 +48,7 @@ const Contracts = () => {
</div>
);
})}
{Object.entries(ADDRESSES).map(([key, value]) => (
{Object.entries(ENV.addresses).map(([key, value]) => (
<div
key={key}
style={{ display: 'flex', justifyContent: 'space-between' }}

View File

@ -145,7 +145,6 @@ export const VoteButtons = ({
{proposalState === ProposalState.Open ? (
<Button
variant="inline-link"
className="text-yellow"
onClick={() => {
setChangeVote(true);
}}

View File

@ -1,7 +1,7 @@
import { useTranslation } from 'react-i18next';
import { Callout, Link, Intent, Splash } from '@vegaprotocol/ui-toolkit';
import { useEnvironment } from '@vegaprotocol/network-switcher';
import { useEnvironment } from '@vegaprotocol/environment';
import { KeyValueTable, KeyValueTableRow } from '@vegaprotocol/ui-toolkit';
import { useTranches } from '../../../hooks/use-tranches';
import type { BigNumber } from '../../../lib/bignumber';

View File

@ -1,5 +1,5 @@
import { Button, Callout, Link, Loader } from '@vegaprotocol/ui-toolkit';
import { useEnvironment } from '@vegaprotocol/network-switcher';
import { useEnvironment } from '@vegaprotocol/environment';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { Link as RouteLink } from 'react-router-dom';

View File

@ -5,7 +5,7 @@ import { Link as RouteLink } from 'react-router-dom';
import { BulletHeader } from '../../components/bullet-header';
import { Link } from '@vegaprotocol/ui-toolkit';
import { useEnvironment } from '@vegaprotocol/network-switcher';
import { useEnvironment } from '@vegaprotocol/environment';
import { Links } from '../../config';
import {
AppStateActionType,

View File

@ -2,7 +2,7 @@ import React from 'react';
import { useTranslation } from 'react-i18next';
import { Link } from '@vegaprotocol/ui-toolkit';
import { useEnvironment } from '@vegaprotocol/network-switcher';
import { useEnvironment } from '@vegaprotocol/environment';
import { KeyValueTable, KeyValueTableRow } from '@vegaprotocol/ui-toolkit';
import { BigNumber } from '../../lib/bignumber';
import { formatNumber } from '../../lib/format-number';

View File

@ -7,7 +7,7 @@ import { useParams } from 'react-router';
import { Navigate } from 'react-router-dom';
import { useOutletContext } from 'react-router-dom';
import { useEnvironment } from '@vegaprotocol/network-switcher';
import { useEnvironment } from '@vegaprotocol/environment';
import { BigNumber } from '../../lib/bignumber';
import { formatNumber } from '../../lib/format-number';
import { TrancheItem } from '../redemption/tranche-item';

View File

@ -5,7 +5,7 @@ import React from 'react';
import { useTranslation } from 'react-i18next';
import { Link } from '@vegaprotocol/ui-toolkit';
import { useEnvironment } from '@vegaprotocol/network-switcher';
import { useEnvironment } from '@vegaprotocol/environment';
import { Heading } from '../../components/heading';
import { KeyValueTable, KeyValueTableRow } from '@vegaprotocol/ui-toolkit';
import { SplashLoader } from '../../components/splash-loader';

View File

@ -17,7 +17,6 @@
"env": {
"TRADING_TEST_VEGA_WALLET_NAME": "UI_Trading_Test",
"ETHEREUM_PROVIDER_URL": "https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8",
"ETHEREUM_CHAIN_ID": 3,
"VEGA_PUBLIC_KEY": "47836c253520d2661bf5bed6339c0de08fd02cf5d4db0efee3b4373f20c7d278",
"VEGA_PUBLIC_KEY2": "1a18cdcaaa4f44a57b35a4e9b77e0701c17a476f2b407620f8c17371740cf2e4",
"TRUNCATED_VEGA_PUBLIC_KEY": "47836c…c7d278",

View File

@ -19,12 +19,14 @@ describe('orders', () => {
const orderTimeInForce = 'timeInForce';
const orderCreatedAt = 'createdAt';
it('renders orders', () => {
beforeEach(() => {
cy.getByTestId('Orders').click();
cy.getByTestId('tab-orders').contains('Please connect Vega wallet');
connectVegaWallet();
});
it('renders orders', () => {
cy.getByTestId('tab-orders').should('be.visible');
cy.getByTestId('tab-orders')
@ -68,4 +70,17 @@ describe('orders', () => {
cy.wrap($dateTime).invoke('text').should('not.be.empty');
});
});
it('orders are sorted by most recent order', () => {
const expectedOrderList = ['TSLA.QM21', 'BTCUSD.MF21', 'AAVEDAI.MF21'];
cy.getByTestId('tab-orders')
.get(`[col-id='${orderSymbol}']`)
.should('have.length.at.least', 3)
.each(($symbol, index) => {
if (index != 0) {
cy.wrap($symbol).should('have.text', expectedOrderList[index - 1]);
}
});
});
});

View File

@ -15,50 +15,6 @@ export const generateDealTicketQuery = (
positionDecimalPlaces: 0,
state: MarketState.Active,
tradingMode: MarketTradingMode.Continuous,
fees: {
__typename: 'Fees',
factors: {
__typename: 'FeeFactors',
makerFee: '0.0002',
infrastructureFee: '0.0005',
liquidityFee: '0.01',
},
},
priceMonitoringSettings: {
__typename: 'PriceMonitoringSettings',
parameters: {
__typename: 'PriceMonitoringParameters',
triggers: [
{
__typename: 'PriceMonitoringTrigger',
horizonSecs: 43200,
probability: 0.9999999,
auctionExtensionSecs: 600,
},
],
},
updateFrequencySecs: 1,
},
riskFactors: {
__typename: 'RiskFactor',
market:
'54b78c1b877e106842ae156332ccec740ad98d6bad43143ac6a029501dd7c6e0',
short: '0.008571790367285281',
long: '0.008508132993273576',
},
data: {
__typename: 'MarketData',
market: {
__typename: 'Market',
id: '54b78c1b877e106842ae156332ccec740ad98d6bad43143ac6a029501dd7c6e0',
},
markPrice: '5749',
indicativeVolume: '0',
bestBidVolume: '5',
bestOfferVolume: '1',
bestStaticBidVolume: '5',
bestStaticOfferVolume: '1',
},
tradableInstrument: {
__typename: 'TradableInstrument',
instrument: {
@ -74,17 +30,6 @@ export const generateDealTicketQuery = (
},
},
},
riskModel: {
__typename: 'LogNormalRiskModel',
tau: 0.0001140771161,
riskAversionParameter: 0.01,
params: {
__typename: 'LogNormalModelParams',
r: 0.016,
sigma: 0.3,
mu: 0,
},
},
},
depth: {
__typename: 'MarketDepth',

View File

@ -0,0 +1,100 @@
import type { MarketInfoQuery } from '@vegaprotocol/deal-ticket';
import { MarketState, MarketTradingMode } from '@vegaprotocol/types';
import merge from 'lodash/merge';
import type { PartialDeep } from 'type-fest';
export const generateMarketInfoQuery = (
override?: PartialDeep<MarketInfoQuery>
): MarketInfoQuery => {
const defaultResult: MarketInfoQuery = {
market: {
__typename: 'Market',
id: 'market-0',
name: 'ETHBTC Quarterly (30 Jun 2022)',
decimalPlaces: 2,
positionDecimalPlaces: 0,
state: MarketState.Active,
tradingMode: MarketTradingMode.Continuous,
fees: {
__typename: 'Fees',
factors: {
__typename: 'FeeFactors',
makerFee: '0.0002',
infrastructureFee: '0.0005',
liquidityFee: '0.01',
},
},
priceMonitoringSettings: {
__typename: 'PriceMonitoringSettings',
parameters: {
__typename: 'PriceMonitoringParameters',
triggers: [
{
__typename: 'PriceMonitoringTrigger',
horizonSecs: 43200,
probability: 0.9999999,
auctionExtensionSecs: 600,
},
],
},
updateFrequencySecs: 1,
},
riskFactors: {
__typename: 'RiskFactor',
market:
'54b78c1b877e106842ae156332ccec740ad98d6bad43143ac6a029501dd7c6e0',
short: '0.008571790367285281',
long: '0.008508132993273576',
},
data: {
__typename: 'MarketData',
market: {
__typename: 'Market',
id: '54b78c1b877e106842ae156332ccec740ad98d6bad43143ac6a029501dd7c6e0',
},
markPrice: '5749',
indicativeVolume: '0',
bestBidVolume: '5',
bestOfferVolume: '1',
bestStaticBidVolume: '5',
bestStaticOfferVolume: '1',
},
tradableInstrument: {
__typename: 'TradableInstrument',
instrument: {
__typename: 'Instrument',
product: {
__typename: 'Future',
quoteName: 'BTC',
settlementAsset: {
__typename: 'Asset',
id: '5cfa87844724df6069b94e4c8a6f03af21907d7bc251593d08e4251043ee9f7c',
symbol: 'tBTC',
name: 'tBTC TEST',
},
},
},
riskModel: {
__typename: 'LogNormalRiskModel',
tau: 0.0001140771161,
riskAversionParameter: 0.01,
params: {
__typename: 'LogNormalModelParams',
r: 0.016,
sigma: 0.3,
mu: 0,
},
},
},
depth: {
__typename: 'MarketDepth',
lastTrade: {
__typename: 'Trade',
price: '100',
},
},
},
};
return merge(defaultResult, override);
};

View File

@ -12,6 +12,7 @@ export const generateOrderBook = (
const marketDepth: MarketDepth_market = {
id: 'b2426f67b085ba8fb429f1b529d49372b2d096c6fb6f509f76c5863abb6d969e',
decimalPlaces: 5,
positionDecimalPlaces: 0,
data: {
staticMidPrice: '826337',
marketTradingMode: MarketTradingMode.Continuous,

View File

@ -18,6 +18,7 @@ export const generateOrders = (override?: PartialDeep<Orders>): Orders => {
id: 'c9f5acd348796011c075077e4d58d9b7f1689b7c1c8e030a5e886b83aa96923d',
name: 'AAVEDAI Monthly (30 Jun 2022)',
decimalPlaces: 5,
positionDecimalPlaces: 0,
tradableInstrument: {
__typename: 'TradableInstrument',
instrument: {
@ -33,7 +34,7 @@ export const generateOrders = (override?: PartialDeep<Orders>): Orders => {
remaining: '0',
price: '20000000',
timeInForce: OrderTimeInForce.GTC,
createdAt: new Date().toISOString(),
createdAt: new Date(2020, 1, 1).toISOString(),
updatedAt: null,
expiresAt: null,
rejectionReason: null,
@ -46,6 +47,7 @@ export const generateOrders = (override?: PartialDeep<Orders>): Orders => {
id: '5a4b0b9e9c0629f0315ec56fcb7bd444b0c6e4da5ec7677719d502626658a376',
name: 'Tesla Quarterly (30 Jun 2022)',
decimalPlaces: 5,
positionDecimalPlaces: 0,
tradableInstrument: {
__typename: 'TradableInstrument',
instrument: {
@ -59,13 +61,41 @@ export const generateOrders = (override?: PartialDeep<Orders>): Orders => {
status: OrderStatus.Filled,
side: Side.Buy,
remaining: '0',
price: '0',
price: '100',
timeInForce: OrderTimeInForce.GTC,
createdAt: new Date().toISOString(),
updatedAt: null,
expiresAt: null,
rejectionReason: null,
},
{
__typename: 'Order',
id: '4e93702990712c41f6995fcbbd94f60bb372ad12d64dfa7d96d205c49f790336',
market: {
__typename: 'Market',
id: 'c6f4337b31ed57a961969c3ba10297b369d01b9e75a4cbb96db4fc62886444e6',
name: 'BTCUSD Monthly (30 Jun 2022)',
decimalPlaces: 5,
tradableInstrument: {
__typename: 'TradableInstrument',
instrument: {
__typename: 'Instrument',
code: 'BTCUSD.MF21',
},
},
},
size: '1',
type: OrderType.Limit,
status: OrderStatus.Filled,
side: Side.Buy,
remaining: '0',
price: '20000',
timeInForce: OrderTimeInForce.GTC,
createdAt: new Date(2022, 5, 10).toISOString(),
updatedAt: null,
expiresAt: null,
rejectionReason: null,
},
];
const defaultResult = {

View File

@ -25,6 +25,7 @@ export const generatePositions = (
market: { __typename: 'Market', id: '123' },
},
decimalPlaces: 5,
positionDecimalPlaces: 0,
tradableInstrument: {
instrument: {
id: '',
@ -78,6 +79,7 @@ export const generatePositions = (
},
},
decimalPlaces: 5,
positionDecimalPlaces: 0,
tradableInstrument: {
instrument: {
id: '',

View File

@ -12,6 +12,7 @@ export const generateTrades = (override?: PartialDeep<Trades>): Trades => {
market: {
id: '0c3c1490db767f926d24fb674b4235a9aa339614915a4ab96cbfc0e1ad83c0ff',
decimalPlaces: 5,
positionDecimalPlaces: 0,
__typename: 'Market',
},
__typename: 'Trade',
@ -24,6 +25,7 @@ export const generateTrades = (override?: PartialDeep<Trades>): Trades => {
market: {
id: '0c3c1490db767f926d24fb674b4235a9aa339614915a4ab96cbfc0e1ad83c0ff',
decimalPlaces: 5,
positionDecimalPlaces: 0,
__typename: 'Market',
},
__typename: 'Trade',
@ -36,6 +38,7 @@ export const generateTrades = (override?: PartialDeep<Trades>): Trades => {
market: {
id: '0c3c1490db767f926d24fb674b4235a9aa339614915a4ab96cbfc0e1ad83c0ff',
decimalPlaces: 5,
positionDecimalPlaces: 0,
__typename: 'Market',
},
__typename: 'Trade',

View File

@ -6,6 +6,7 @@ import { generateCandles } from './mocks/generate-candles';
import { generateChart } from './mocks/generate-chart';
import { generateDealTicketQuery } from './mocks/generate-deal-ticket-query';
import { generateMarket } from './mocks/generate-market';
import { generateMarketInfoQuery } from './mocks/generate-market-info-query';
import { generateOrders } from './mocks/generate-orders';
import { generatePositions } from './mocks/generate-positions';
import { generateTrades } from './mocks/generate-trades';
@ -31,6 +32,11 @@ export const mockTradingPage = (
'DealTicketQuery',
generateDealTicketQuery({ market: { state } })
);
aliasQuery(
req,
'MarketInfoQuery',
generateMarketInfoQuery({ market: { state } })
);
aliasQuery(req, 'Trades', generateTrades());
aliasQuery(req, 'Chart', generateChart());
aliasQuery(req, 'Candles', generateCandles());

View File

@ -1,7 +1,7 @@
# App configuration variables
NX_VEGA_ENV=TESTNET
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/testnet-network.json
NX_VEGA_URL=https://lb.testnet.vega.xyz/query
NX_ETHEREUM_CHAIN_ID=3
NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://ropsten.etherscan.io
NX_VEGA_NETWORKS={\"MAINNET\":\"https://alpha.console.vega.xyz\"}

View File

@ -1,7 +1,7 @@
# App configuration variables
NX_VEGA_ENV=DEVNET
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/devnet-network.json
NX_VEGA_URL=https://n04.d.vega.xyz/query
NX_VEGA_NETWORKS={\"MAINNET\":\"https://alpha.console.vega.xyz\"}
NX_ETHEREUM_CHAIN_ID=3
NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://ropsten.etherscan.io

View File

@ -1,7 +1,7 @@
# App configuration variables
NX_VEGA_ENV=MAINNET
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/mainnet-network.json
NX_VEGA_URL=https://api.token.vega.xyz/query
NX_VEGA_NETWORKS='{\"MAINNET\":\"https://alpha.console.vega.xyz\"}'
NX_ETHEREUM_CHAIN_ID=1
NX_ETHEREUM_PROVIDER_URL=https://mainnet.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://etherscan.io

View File

@ -1,7 +1,7 @@
# App configuration variables
NX_VEGA_ENV=STAGNET
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet1-network.json
NX_VEGA_URL=https://n03.s.vega.xyz/query
NX_VEGA_NETWORKS='{\"MAINNET\":\"https://alpha.console.vega.xyz\"}'
NX_ETHEREUM_CHAIN_ID=3
NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://ropsten.etherscan.io

View File

@ -1,7 +1,7 @@
# App configuration variables
NX_VEGA_ENV=STAGNET2
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet2-network.json
NX_VEGA_URL=https://n03.stagnet2.vega.xyz/query
NX_VEGA_NETWORKS='{\"MAINNET\":\"https://alpha.console.vega.xyz\"}'
NX_ETHEREUM_CHAIN_ID=3
NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://ropsten.etherscan.io

View File

@ -1,7 +1,7 @@
# App configuration variables
NX_VEGA_ENV=TESTNET
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/testnet-network.json
NX_VEGA_URL=https://lb.testnet.vega.xyz/query
NX_VEGA_NETWORKS='{\"MAINNET\":\"https://alpha.console.vega.xyz\"}'
NX_ETHEREUM_CHAIN_ID=3
NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://ropsten.etherscan.io

View File

@ -26,11 +26,13 @@ Example configurations are provided here:
There are a few different configuration options offered for this app:
The network configuration for the app
| **Flag** | **Purpose** |
| -------------------------- | -------------------------------------------------------------------------------------------------------- |
| `NX_VEGA_ENV` | The name of the currently connected vega environment |
| `NX_VEGA_CONFIG_URL` | The network configuration for the app |
| `NX_VEGA_URL` | The GraphQL query endpoint of a [Vega data node](https://github.com/vegaprotocol/networks#data-node) |
| `NX_ETHEREUM_CHAIN_ID` | The ID of the Ethereum chain the currently connected Vega Network uses. E.g. Ropsten (3) for testnet |
| `NX_ETHEREUM_PROVIDER_URL` | The Ethereum Provider URL for getting data from the Ethereum network, for example Infura or a local node |
| `NX_ETHERSCAN_URL` | The Etherscan URL to link Ethereum transactions to |

View File

@ -1,6 +1,8 @@
import { useEagerConnect } from '@vegaprotocol/wallet';
import { Connectors } from '../../lib/vega-connectors';
import type { ReactNode } from 'react';
import { useEagerConnect } from '@vegaprotocol/wallet';
import { NetworkLoader } from '@vegaprotocol/environment';
import { Connectors } from '../../lib/vega-connectors';
import { createClient } from '../../lib/apollo-client';
interface AppLoaderProps {
children: ReactNode;
@ -14,5 +16,5 @@ export function AppLoader({ children }: AppLoaderProps) {
// Get keys from vega wallet immediately
useEagerConnect(Connectors);
return <>{children}</>;
return <NetworkLoader createClient={createClient}>{children}</NetworkLoader>;
}

View File

@ -5,7 +5,7 @@ import { Web3Container } from './web3-container';
import type { useWeb3React } from '@web3-react/core';
import type { NetworkParamsQuery } from '@vegaprotocol/web3';
import { NETWORK_PARAMS_QUERY } from '@vegaprotocol/web3';
import { EnvironmentProvider } from '@vegaprotocol/network-switcher';
import { EnvironmentProvider } from '@vegaprotocol/environment';
const defaultHookValue = {
isActive: false,

View File

@ -8,7 +8,7 @@ import { useWeb3React } from '@web3-react/core';
import type { ReactNode } from 'react';
import { useEffect, useState, useMemo } from 'react';
import { t } from '@vegaprotocol/react-helpers';
import { useEnvironment } from '@vegaprotocol/network-switcher';
import { useEnvironment } from '@vegaprotocol/environment';
import { createConnectors } from '../../lib/web3-connectors';
interface Web3ContainerProps {
@ -18,14 +18,15 @@ interface Web3ContainerProps {
export const Web3Container = ({ children }: Web3ContainerProps) => {
const [dialogOpen, setDialogOpen] = useState(false);
const { config, loading, error } = useEthereumConfig();
const { ETHEREUM_PROVIDER_URL, ETHEREUM_CHAIN_ID } = useEnvironment();
const Connectors = useMemo(
() => createConnectors(ETHEREUM_PROVIDER_URL, ETHEREUM_CHAIN_ID),
[ETHEREUM_CHAIN_ID, ETHEREUM_PROVIDER_URL]
);
const { ETHEREUM_PROVIDER_URL } = useEnvironment();
const Connectors = useMemo(() => {
if (config?.chain_id) {
return createConnectors(ETHEREUM_PROVIDER_URL, Number(config?.chain_id));
}
}, [config?.chain_id, ETHEREUM_PROVIDER_URL]);
return (
<AsyncRenderer data={config} loading={loading} error={error}>
{config ? (
{Connectors && config && (
<Web3Provider connectors={Connectors}>
<Web3Content
appChainId={Number(config.chain_id)}
@ -40,7 +41,7 @@ export const Web3Container = ({ children }: Web3ContainerProps) => {
desiredChainId={Number(config.chain_id)}
/>
</Web3Provider>
) : null}
)}
</AsyncRenderer>
);
};

View File

@ -1,5 +1,6 @@
import type { AppProps } from 'next/app';
import Head from 'next/head';
import { useRouter } from 'next/router';
import { Navbar } from '../components/navbar';
import { t, ThemeContext, useThemeSwitcher } from '@vegaprotocol/react-helpers';
import {
@ -7,29 +8,27 @@ import {
VegaManageDialog,
VegaWalletProvider,
} from '@vegaprotocol/wallet';
import { NetworkSwitcherDialog } from '@vegaprotocol/network-switcher';
import {
useEnvironment,
EnvironmentProvider,
NetworkSwitcherDialog,
} from '@vegaprotocol/environment';
import { Connectors } from '../lib/vega-connectors';
import { useMemo } from 'react';
import { createClient } from '../lib/apollo-client';
import { ThemeSwitcher } from '@vegaprotocol/ui-toolkit';
import { ApolloProvider } from '@apollo/client';
import { AppLoader } from '../components/app-loader';
import { VegaWalletConnectButton } from '../components/vega-wallet-connect-button';
import './styles.css';
import { useGlobalStore } from '../stores';
import { ENV } from '../lib/config/env';
import { EnvironmentProvider } from '@vegaprotocol/network-switcher';
import { useEnvironment } from '@vegaprotocol/network-switcher';
function AppBody({ Component, pageProps }: AppProps) {
const { push } = useRouter();
const store = useGlobalStore();
const { VEGA_NETWORKS } = useEnvironment();
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const [theme, toggleTheme] = useThemeSwitcher();
const [, toggleTheme] = useThemeSwitcher();
return (
<ThemeContext.Provider value={theme}>
<div className="h-full dark:bg-black dark:text-white-60 bg-white relative z-0 text-black-60 grid grid-rows-[min-content,1fr]">
<AppLoader>
<div className="flex items-stretch border-b-[7px] border-vega-yellow">
<Navbar />
<div className="flex items-center gap-4 ml-auto mr-8">
@ -62,25 +61,22 @@ function AppBody({ Component, pageProps }: AppProps) {
setDialogOpen={(open) => store.setVegaNetworkSwitcherDialog(open)}
onConnect={({ network }) => {
if (VEGA_NETWORKS[network]) {
window.location.href = VEGA_NETWORKS[network];
push(VEGA_NETWORKS[network] ?? '');
}
}}
/>
</AppLoader>
</div>
</ThemeContext.Provider>
);
}
function VegaTradingApp(props: AppProps) {
const [theme] = useThemeSwitcher();
const client = useMemo(() => createClient(ENV.vegaUrl), []);
return (
<EnvironmentProvider>
<ThemeContext.Provider value={theme}>
<ApolloProvider client={client}>
<VegaWalletProvider>
<AppLoader>
<Head>
<link
rel="preload"
@ -95,10 +91,7 @@ function VegaTradingApp(props: AppProps) {
type="image/x-icon"
href="https://static.vega.xyz/favicon.ico"
/>
<link
rel="stylesheet"
href="https://static.vega.xyz/fonts.css"
/>
<link rel="stylesheet" href="https://static.vega.xyz/fonts.css" />
{['1', 'true'].includes(
process.env['NX_USE_ENV_OVERRIDES'] || ''
) ? (
@ -107,9 +100,7 @@ function VegaTradingApp(props: AppProps) {
) : null}
</Head>
<AppBody {...props} />
</AppLoader>
</VegaWalletProvider>
</ApolloProvider>
</ThemeContext.Provider>
</EnvironmentProvider>
);

View File

@ -2,7 +2,10 @@ import classNames from 'classnames';
import AutoSizer from 'react-virtualized-auto-sizer';
import type { ReactNode } from 'react';
import { useState } from 'react';
import { DealTicketContainer } from '@vegaprotocol/deal-ticket';
import {
DealTicketContainer,
MarketInfoContainer,
} from '@vegaprotocol/deal-ticket';
import { OrderListContainer } from '@vegaprotocol/order-list';
import { TradesContainer } from '@vegaprotocol/trades';
import { PositionsContainer } from '@vegaprotocol/positions';
@ -30,6 +33,7 @@ const TradingViews = {
Positions: PositionsContainer,
Accounts: AccountsContainer,
Trades: TradesContainer,
Info: MarketInfoContainer,
};
type TradingView = keyof typeof TradingViews;
@ -52,12 +56,12 @@ export const TradeMarketHeader = ({
'font-sans font-normal mb-0 text-dark/80 dark:text-white/80 text-ui-small';
const itemValueClassName =
'capitalize font-sans tracking-tighter text-black dark:text-white text-ui';
const headerClassname = classNames(
const headerClassName = classNames(
'w-full p-8 bg-white dark:bg-black',
className
);
return (
<header className={headerClassname}>
<header className={headerClassName}>
<SelectMarketDialog dialogOpen={open} setDialogOpen={setOpen} />
<div className="flex flex-col md:flex-row gap-20 md:gap-64 ml-auto mr-8">
<button
@ -105,7 +109,7 @@ interface TradeGridProps {
export const TradeGrid = ({ market }: TradeGridProps) => {
const wrapperClasses = classNames(
'h-full max-h-full',
'grid gap-4 grid-cols-[1fr_375px_460px] grid-rows-[min-content_1fr_200px]',
'grid gap-4 grid-cols-[1fr_375px_460px] grid-rows-[min-content_1fr_300px]',
'bg-black-10 dark:bg-white-10',
'text-ui'
);
@ -115,7 +119,7 @@ export const TradeGrid = ({ market }: TradeGridProps) => {
<div className={wrapperClasses}>
<TradeMarketHeader
market={market}
className="row-start-1 row-end-2 col-start-1 col-end-2"
className="row-start-1 row-end-2 col-start-1 col-end-4"
/>
<TradeGridChild className="row-start-2 row-end-3 col-start-1 col-end-2">
<GridTabs>
@ -127,10 +131,17 @@ export const TradeGrid = ({ market }: TradeGridProps) => {
</GridTab>
</GridTabs>
</TradeGridChild>
<TradeGridChild className="row-start-1 row-end-3">
<TradeGridChild className="row-start-2 row-end-3 col-start-2 col-end-3">
<GridTabs>
<GridTab id="ticket" name={t('Ticket')}>
<TradingViews.Ticket marketId={market.id} />
</GridTab>
<GridTab id="info" name={t('Info')}>
<TradingViews.Info marketId={market.id} />
</GridTab>
</GridTabs>
</TradeGridChild>
<TradeGridChild className="row-start-1 row-end-3">
<TradeGridChild className="row-start-2 row-end-3 col-start-3 col-end-4">
<GridTabs>
<GridTab id="trades" name={t('Trades')}>
<TradingViews.Trades marketId={market.id} />

View File

@ -3,7 +3,7 @@ import { PageQueryContainer } from '../../../components/page-query-container';
import type { DepositPage } from './__generated__/DepositPage';
import { DepositManager } from '@vegaprotocol/deposits';
import { t } from '@vegaprotocol/react-helpers';
import { useEnvironment } from '@vegaprotocol/network-switcher';
import { useEnvironment } from '@vegaprotocol/environment';
import { Splash } from '@vegaprotocol/ui-toolkit';
import { ASSET_FRAGMENT } from '../../../lib/query-fragments';

View File

@ -9,124 +9,6 @@ import { MarketState, MarketTradingMode } from "@vegaprotocol/types";
// GraphQL query operation: DealTicketQuery
// ====================================================
export interface DealTicketQuery_market_fees_factors {
__typename: "FeeFactors";
/**
* The factor applied to calculate MakerFees, a non-negative float
*/
makerFee: string;
/**
* The factor applied to calculate InfrastructureFees, a non-negative float
*/
infrastructureFee: string;
/**
* The factor applied to calculate LiquidityFees, a non-negative float
*/
liquidityFee: string;
}
export interface DealTicketQuery_market_fees {
__typename: "Fees";
/**
* The factors used to calculate the different fees
*/
factors: DealTicketQuery_market_fees_factors;
}
export interface DealTicketQuery_market_priceMonitoringSettings_parameters_triggers {
__typename: "PriceMonitoringTrigger";
/**
* Price monitoring projection horizon τ in seconds (> 0).
*/
horizonSecs: number;
/**
* Price monitoring probability level p. (>0 and < 1)
*/
probability: number;
/**
* Price monitoring auction extension duration in seconds should the price
* breach it's theoretical level over the specified horizon at the specified
* probability level (> 0)
*/
auctionExtensionSecs: number;
}
export interface DealTicketQuery_market_priceMonitoringSettings_parameters {
__typename: "PriceMonitoringParameters";
/**
* The list of triggers for this price monitoring
*/
triggers: DealTicketQuery_market_priceMonitoringSettings_parameters_triggers[] | null;
}
export interface DealTicketQuery_market_priceMonitoringSettings {
__typename: "PriceMonitoringSettings";
/**
* Specified a set of PriceMonitoringParameters to be use for price monitoring purposes
*/
parameters: DealTicketQuery_market_priceMonitoringSettings_parameters | null;
/**
* How often (in seconds) the price monitoring bounds should be updated
*/
updateFrequencySecs: number;
}
export interface DealTicketQuery_market_riskFactors {
__typename: "RiskFactor";
/**
* market the risk factor was emitted for
*/
market: string;
/**
* short factor
*/
short: string;
/**
* long factor
*/
long: string;
}
export interface DealTicketQuery_market_data_market {
__typename: "Market";
/**
* Market ID
*/
id: string;
}
export interface DealTicketQuery_market_data {
__typename: "MarketData";
/**
* market id of the associated mark price
*/
market: DealTicketQuery_market_data_market;
/**
* the mark price (actually an unsigned int)
*/
markPrice: string;
/**
* indicative volume if the auction ended now, 0 if not in auction mode
*/
indicativeVolume: string;
/**
* the aggregated volume being bid at the best bid price.
*/
bestBidVolume: string;
/**
* the aggregated volume being offered at the best offer price.
*/
bestOfferVolume: string;
/**
* the aggregated volume being offered at the best static bid price, excluding pegged orders
*/
bestStaticBidVolume: string;
/**
* the aggregated volume being offered at the best static offer price, excluding pegged orders.
*/
bestStaticOfferVolume: string;
}
export interface DealTicketQuery_market_tradableInstrument_instrument_product_settlementAsset {
__typename: "Asset";
/**
@ -163,70 +45,12 @@ export interface DealTicketQuery_market_tradableInstrument_instrument {
product: DealTicketQuery_market_tradableInstrument_instrument_product;
}
export interface DealTicketQuery_market_tradableInstrument_riskModel_LogNormalRiskModel_params {
__typename: "LogNormalModelParams";
/**
* r parameter
*/
r: number;
/**
* sigma parameter
*/
sigma: number;
/**
* mu parameter
*/
mu: number;
}
export interface DealTicketQuery_market_tradableInstrument_riskModel_LogNormalRiskModel {
__typename: "LogNormalRiskModel";
/**
* Tau parameter of the risk model
*/
tau: number;
/**
* Lambda parameter of the risk model
*/
riskAversionParameter: number;
/**
* Params for the log normal risk model
*/
params: DealTicketQuery_market_tradableInstrument_riskModel_LogNormalRiskModel_params;
}
export interface DealTicketQuery_market_tradableInstrument_riskModel_SimpleRiskModel_params {
__typename: "SimpleRiskModelParams";
/**
* Risk factor for long
*/
factorLong: number;
/**
* Risk factor for short
*/
factorShort: number;
}
export interface DealTicketQuery_market_tradableInstrument_riskModel_SimpleRiskModel {
__typename: "SimpleRiskModel";
/**
* Params for the simple risk model
*/
params: DealTicketQuery_market_tradableInstrument_riskModel_SimpleRiskModel_params;
}
export type DealTicketQuery_market_tradableInstrument_riskModel = DealTicketQuery_market_tradableInstrument_riskModel_LogNormalRiskModel | DealTicketQuery_market_tradableInstrument_riskModel_SimpleRiskModel;
export interface DealTicketQuery_market_tradableInstrument {
__typename: "TradableInstrument";
/**
* An instance of or reference to a fully specified instrument.
*/
instrument: DealTicketQuery_market_tradableInstrument_instrument;
/**
* A reference to a risk model that is valid for the instrument
*/
riskModel: DealTicketQuery_market_tradableInstrument_riskModel;
}
export interface DealTicketQuery_market_depth_lastTrade {
@ -286,22 +110,6 @@ export interface DealTicketQuery_market {
* Current mode of execution of the market
*/
tradingMode: MarketTradingMode;
/**
* Fees related data
*/
fees: DealTicketQuery_market_fees;
/**
* Price monitoring settings for the market
*/
priceMonitoringSettings: DealTicketQuery_market_priceMonitoringSettings;
/**
* risk factors for the market
*/
riskFactors: DealTicketQuery_market_riskFactors | null;
/**
* marketData for the given market
*/
data: DealTicketQuery_market_data | null;
/**
* An instance of or reference to a tradable instrument.
*/

Some files were not shown because too many files have changed in this diff Show More