Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c93793a93 | ||
|
|
e265a14e69 | ||
|
|
3189fc1b37 | ||
|
|
9715b681ea | ||
|
|
c7c42045a5 | ||
|
|
fbecf0bffd | ||
|
|
0413ef13f3 | ||
|
|
d28d238574 | ||
|
|
937f4beeb0 |
@@ -11,7 +11,7 @@ on:
|
||||
type: choice
|
||||
options:
|
||||
- explorer-e2e
|
||||
- console-lite-e2e
|
||||
- simple-trading-app-e2e
|
||||
- stats-e2e
|
||||
- token-e2e
|
||||
- trading-e2e
|
||||
@@ -36,7 +36,7 @@ jobs:
|
||||
uses: actions/setup-go@v3
|
||||
id: go
|
||||
with:
|
||||
go-version: 1.19
|
||||
go-version: 1.18
|
||||
- name: Set up Node 16
|
||||
uses: actions/setup-node@v2
|
||||
id: npm
|
||||
@@ -52,7 +52,7 @@ jobs:
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: vegaprotocol/vegacapsule
|
||||
ref: main
|
||||
ref: v0.2.1
|
||||
token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
|
||||
path: './capsule'
|
||||
|
||||
@@ -66,24 +66,22 @@ jobs:
|
||||
- name: Set GOBIN
|
||||
run: echo GOBIN=$(go env GOPATH)/bin >> $GITHUB_ENV
|
||||
|
||||
- name: Install binaries
|
||||
run: vegacapsule install-bins
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
|
||||
GOBIN: ${{ env.GOBIN }}
|
||||
|
||||
- name: Checkout Vega
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: vegaprotocol/vega
|
||||
ref: develop
|
||||
ref: tm35.9
|
||||
token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
|
||||
path: './vega'
|
||||
|
||||
- name: Install Vega binaries
|
||||
run: go install -v ./cmd/vega
|
||||
working-directory: vega
|
||||
|
||||
- name: Install Vega wallet binaries
|
||||
run: go install ./cmd/vegawallet
|
||||
working-directory: vega
|
||||
|
||||
- name: Install date-node binaries
|
||||
run: go install ./cmd/data-node
|
||||
- name: Install binary from Vega repo
|
||||
run: go install ./cmd/vega
|
||||
working-directory: vega
|
||||
|
||||
######
|
||||
|
||||
@@ -20,7 +20,7 @@ jobs:
|
||||
uses: actions/setup-go@v3
|
||||
id: go
|
||||
with:
|
||||
go-version: 1.19
|
||||
go-version: 1.18
|
||||
- name: Set up Node 16
|
||||
uses: actions/setup-node@v2
|
||||
id: npm
|
||||
@@ -36,7 +36,7 @@ jobs:
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: vegaprotocol/vegacapsule
|
||||
ref: main
|
||||
ref: v0.2.1
|
||||
token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
|
||||
path: './capsule'
|
||||
|
||||
@@ -50,24 +50,22 @@ jobs:
|
||||
- name: Set GOBIN
|
||||
run: echo GOBIN=$(go env GOPATH)/bin >> $GITHUB_ENV
|
||||
|
||||
- name: Install binaries
|
||||
run: vegacapsule install-bins
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
|
||||
GOBIN: ${{ env.GOBIN }}
|
||||
|
||||
- name: Checkout Vega
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: vegaprotocol/vega
|
||||
ref: develop
|
||||
ref: tm35.9
|
||||
token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
|
||||
path: './vega'
|
||||
|
||||
- name: Install Vega binaries
|
||||
run: go install -v ./cmd/vega
|
||||
working-directory: vega
|
||||
|
||||
- name: Install Vega wallet binaries
|
||||
run: go install ./cmd/vegawallet
|
||||
working-directory: vega
|
||||
|
||||
- name: Install date-node binaries
|
||||
run: go install ./cmd/data-node
|
||||
- name: Install binary from Vega repo
|
||||
run: go install ./cmd/vega
|
||||
working-directory: vega
|
||||
|
||||
######
|
||||
|
||||
@@ -22,7 +22,7 @@ jobs:
|
||||
uses: actions/setup-go@v3
|
||||
id: go
|
||||
with:
|
||||
go-version: 1.19
|
||||
go-version: 1.18
|
||||
- name: Set up Node 16
|
||||
uses: actions/setup-node@v2
|
||||
id: npm
|
||||
@@ -38,7 +38,7 @@ jobs:
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: vegaprotocol/vegacapsule
|
||||
ref: main
|
||||
ref: v0.2.1
|
||||
token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
|
||||
path: './capsule'
|
||||
|
||||
@@ -52,24 +52,22 @@ jobs:
|
||||
- name: Set GOBIN
|
||||
run: echo GOBIN=$(go env GOPATH)/bin >> $GITHUB_ENV
|
||||
|
||||
- name: Install binaries
|
||||
run: vegacapsule install-bins
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
|
||||
GOBIN: ${{ env.GOBIN }}
|
||||
|
||||
- name: Checkout Vega
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: vegaprotocol/vega
|
||||
ref: develop
|
||||
ref: tm35.9
|
||||
token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
|
||||
path: './vega'
|
||||
|
||||
- name: Install Vega binaries
|
||||
run: go install -v ./cmd/vega
|
||||
working-directory: vega
|
||||
|
||||
- name: Install Vega wallet binaries
|
||||
run: go install ./cmd/vegawallet
|
||||
working-directory: vega
|
||||
|
||||
- name: Install date-node binaries
|
||||
run: go install ./cmd/data-node
|
||||
- name: Install binary from Vega repo
|
||||
run: go install ./cmd/vega
|
||||
working-directory: vega
|
||||
|
||||
######
|
||||
|
||||
+2
-1
@@ -6,5 +6,6 @@ __generated__
|
||||
|
||||
apps/static/src/assets/devnet-tranches.json
|
||||
apps/static/src/assets/mainnet-tranches.json
|
||||
apps/static/src/assets/stagnet3-tranches.json
|
||||
apps/static/src/assets/stagnet1-tranches.json
|
||||
apps/static/src/assets/stagnet2-tranches.json
|
||||
apps/static/src/assets/testnet-tranches.json
|
||||
|
||||
Vendored
+1
-2
@@ -4,7 +4,6 @@
|
||||
"esbenp.prettier-vscode",
|
||||
"firsttris.vscode-jest-runner",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"stevejpurves.cucumber",
|
||||
"streetsidesoftware.code-spell-checker"
|
||||
"stevejpurves.cucumber"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ Run `nx serve my-app` for a dev server. Navigate to the port specified in `app/<
|
||||
In order to generate the schemas for your GraphQL queries, you can run `NX_VEGA_URL=[YOUR URL HERE] nx run types:generate`.
|
||||
|
||||
```bash
|
||||
export NX_VEGA_URL=https://api.n11.testnet.vega.xyz/graphql
|
||||
export NX_VEGA_URL=https://lb.testnet.vega.xyz/query
|
||||
yarn nx run types:generate
|
||||
```
|
||||
|
||||
@@ -127,7 +127,7 @@ As environment variables are build time and not run time in frontend application
|
||||
In order to override specific environment variables you can pass these to the container like this:
|
||||
|
||||
```bash
|
||||
docker run -e NX_VEGA_URL=https://api.n04.d.vega.xyz/graphql -p 3000:80 [TAG]
|
||||
docker run -e NX_VEGA_URL=https://n04.d.vega.xyz/query -p 3000:80 [TAG]
|
||||
```
|
||||
|
||||
Which will now point the app to use a devnet data node. To see a list of all possible config properties see the readme.md for each app in the app directory.
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
{
|
||||
"root": "apps/console-lite-e2e",
|
||||
"sourceRoot": "apps/console-lite-e2e/src",
|
||||
"projectType": "application",
|
||||
"targets": {
|
||||
"e2e": {
|
||||
"executor": "@nrwl/cypress:cypress",
|
||||
"options": {
|
||||
"cypressConfig": "apps/console-lite-e2e/cypress.config.js",
|
||||
"devServerTarget": "console-lite:serve"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"devServerTarget": "console-lite:serve:production"
|
||||
}
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nrwl/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
"options": {
|
||||
"lintFilePatterns": ["apps/console-lite-e2e/**/*.{js,ts}"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": [],
|
||||
"implicitDependencies": ["console-lite"]
|
||||
}
|
||||
@@ -1,138 +0,0 @@
|
||||
import { connectVegaWallet } from '../support/connect-wallet';
|
||||
import { aliasQuery } from '@vegaprotocol/cypress';
|
||||
import { generateSimpleMarkets } from '../support/mocks/generate-markets';
|
||||
import { generateDealTicket } from '../support/mocks/generate-deal-ticket';
|
||||
import { generateMarketTags } from '../support/mocks/generate-market-tags';
|
||||
import { generateMarketPositions } from '../support/mocks/generate-market-positions';
|
||||
import { generateEstimateOrder } from '../support/mocks/generate-estimate-order';
|
||||
import { generatePartyBalance } from '../support/mocks/generate-party-balance';
|
||||
import { generatePartyMarketData } from '../support/mocks/generate-party-market-data';
|
||||
import { generateMarketMarkPrice } from '../support/mocks/generate-market-mark-price';
|
||||
import { generateMarketNames } from '../support/mocks/generate-market-names';
|
||||
|
||||
describe('market selector', () => {
|
||||
let markets;
|
||||
beforeEach(() => {
|
||||
cy.mockGQL((req) => {
|
||||
aliasQuery(req, 'SimpleMarkets', generateSimpleMarkets());
|
||||
aliasQuery(req, 'DealTicketQuery', generateDealTicket());
|
||||
aliasQuery(req, 'MarketTags', generateMarketTags());
|
||||
aliasQuery(req, 'MarketPositions', generateMarketPositions());
|
||||
aliasQuery(req, 'EstimateOrder', generateEstimateOrder());
|
||||
aliasQuery(req, 'PartyBalanceQuery', generatePartyBalance());
|
||||
aliasQuery(req, 'PartyMarketData', generatePartyMarketData());
|
||||
aliasQuery(req, 'MarketMarkPrice', generateMarketMarkPrice());
|
||||
aliasQuery(req, 'MarketNames', generateMarketNames());
|
||||
});
|
||||
|
||||
cy.visit('/markets');
|
||||
cy.wait('@SimpleMarkets').then((response) => {
|
||||
if (response.response.body.data?.markets?.length) {
|
||||
markets = response.response.body.data.markets;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should be properly rendered', () => {
|
||||
if (markets?.length) {
|
||||
cy.visit(`/trading/${markets[0].id}`);
|
||||
connectVegaWallet();
|
||||
cy.get('input[placeholder="Search"]').should(
|
||||
'have.value',
|
||||
markets[0].name
|
||||
);
|
||||
cy.getByTestId('arrow-button').click();
|
||||
cy.getByTestId('market-pane').should('be.visible');
|
||||
cy.getByTestId('market-pane')
|
||||
.children()
|
||||
.find('[role="button"]')
|
||||
.first()
|
||||
.should('contain.text', markets[0].name);
|
||||
cy.getByTestId('market-pane')
|
||||
.children()
|
||||
.find('[role="button"]')
|
||||
.first()
|
||||
.click();
|
||||
cy.getByTestId('market-pane').should('not.be.visible');
|
||||
}
|
||||
});
|
||||
|
||||
it('typing should change list', () => {
|
||||
if (markets?.length) {
|
||||
cy.visit(`/trading/${markets[0].id}`);
|
||||
connectVegaWallet();
|
||||
cy.get('input[placeholder="Search"]').type('{backspace}');
|
||||
cy.getByTestId('market-pane')
|
||||
.children()
|
||||
.find('[role="button"]')
|
||||
.should('have.length.at.least', 1);
|
||||
cy.get('input[placeholder="Search"]').clear();
|
||||
cy.get('input[placeholder="Search"]').type('aa');
|
||||
const filtered = markets.filter(
|
||||
(market) =>
|
||||
market.data.market.state === 'STATE_ACTIVE' &&
|
||||
market.name.match(/aa/i)
|
||||
);
|
||||
cy.getByTestId('market-pane')
|
||||
.children()
|
||||
.find('[role="button"]')
|
||||
.should('have.length', filtered.length);
|
||||
cy.getByTestId('market-pane')
|
||||
.children()
|
||||
.find('[role="button"]')
|
||||
.last()
|
||||
.click();
|
||||
cy.location('pathname').should(
|
||||
'eq',
|
||||
`/trading/${filtered[filtered.length - 1].id}`
|
||||
);
|
||||
cy.get('input[placeholder="Search"]').should(
|
||||
'have.value',
|
||||
filtered[filtered.length - 1].name
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
it('keyboard navigation should work well', () => {
|
||||
if (markets?.length) {
|
||||
cy.visit(`/trading/${markets[0].id}`);
|
||||
connectVegaWallet();
|
||||
cy.get('input[placeholder="Search"]').type('{backspace}');
|
||||
cy.get('input[placeholder="Search"]').clear();
|
||||
cy.get('body').realPress('ArrowDown');
|
||||
cy.focused().eq(0).should('contain.text', 'AAVEDAI Monthly');
|
||||
cy.get('body').realPress('ArrowDown');
|
||||
cy.focused().eq(0).should('contain.text', 'ETHBTC').realPress('Enter');
|
||||
cy.location('pathname').should('eq', '/trading/ethbtc-quaterly');
|
||||
|
||||
cy.get('input[placeholder="Search"]').type('{backspace}');
|
||||
cy.get('input[placeholder="Search"]').clear();
|
||||
cy.getByTestId('market-pane').should('be.visible');
|
||||
cy.get('body').realPress('ArrowDown');
|
||||
cy.get('body').realPress('Tab');
|
||||
cy.getByTestId('market-pane').should('not.be.visible');
|
||||
}
|
||||
});
|
||||
|
||||
it('mobile view', () => {
|
||||
if (markets?.length) {
|
||||
cy.viewport('iphone-xr');
|
||||
cy.visit(`/trading/${markets[0].id}`);
|
||||
connectVegaWallet();
|
||||
cy.get('[role="dialog"]').should('not.exist');
|
||||
cy.getByTestId('arrow-button').click();
|
||||
cy.get('[role="dialog"]').should('be.visible');
|
||||
cy.get('input[placeholder="Search"]').clear();
|
||||
cy.getByTestId('market-pane')
|
||||
.children()
|
||||
.find('[role="button"]')
|
||||
.should('have.length', 3);
|
||||
cy.get('div[role="dialog"]').should('have.class', 'w-full');
|
||||
cy.getByTestId('dialog-close').click();
|
||||
cy.get('input[placeholder="Search"]').should(
|
||||
'have.value',
|
||||
markets[0].name
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,112 +0,0 @@
|
||||
const protoCandles = [
|
||||
{ open: '9556163', close: '9587028', __typename: 'Candle' },
|
||||
{
|
||||
open: '9587028',
|
||||
close: '9769899',
|
||||
__typename: 'Candle',
|
||||
},
|
||||
{ open: '9769899', close: '9586292', __typename: 'Candle' },
|
||||
{
|
||||
open: '9586292',
|
||||
close: '9261774',
|
||||
__typename: 'Candle',
|
||||
},
|
||||
{ open: '9261773', close: '9236369', __typename: 'Candle' },
|
||||
{
|
||||
open: '9236369',
|
||||
close: '9226070',
|
||||
__typename: 'Candle',
|
||||
},
|
||||
{ open: '9226077', close: '9233252', __typename: 'Candle' },
|
||||
{
|
||||
open: '9249854',
|
||||
close: '9333038',
|
||||
__typename: 'Candle',
|
||||
},
|
||||
{ open: '9333038', close: '9410371', __typename: 'Candle' },
|
||||
{
|
||||
open: '9410371',
|
||||
close: '9626249',
|
||||
__typename: 'Candle',
|
||||
},
|
||||
{ open: '9626247', close: '9493253', __typename: 'Candle' },
|
||||
{
|
||||
open: '9493253',
|
||||
close: '9309054',
|
||||
__typename: 'Candle',
|
||||
},
|
||||
{ open: '9309054', close: '9378428', __typename: 'Candle' },
|
||||
{
|
||||
open: '9378428',
|
||||
close: '9352996',
|
||||
__typename: 'Candle',
|
||||
},
|
||||
{ open: '9352996', close: '9451142', __typename: 'Candle' },
|
||||
{
|
||||
open: '9451142',
|
||||
close: '9691070',
|
||||
__typename: 'Candle',
|
||||
},
|
||||
{ open: '9691071', close: '9622031', __typename: 'Candle' },
|
||||
{
|
||||
open: '9622034',
|
||||
close: '9519285',
|
||||
__typename: 'Candle',
|
||||
},
|
||||
{ open: '9528904', close: '9671275', __typename: 'Candle' },
|
||||
{
|
||||
open: '9671275',
|
||||
close: '9988454',
|
||||
__typename: 'Candle',
|
||||
},
|
||||
{ open: '9982457', close: '10085537', __typename: 'Candle' },
|
||||
{
|
||||
open: '10085537',
|
||||
close: '9967390',
|
||||
__typename: 'Candle',
|
||||
},
|
||||
{ open: '9967390', close: '9974844', __typename: 'Candle' },
|
||||
{
|
||||
open: '9974844',
|
||||
close: '9940706',
|
||||
__typename: 'Candle',
|
||||
},
|
||||
];
|
||||
|
||||
export const protoMarket = {
|
||||
id: 'first-btcusd-id',
|
||||
name: 'AAVEDAI Monthly (30 Jun 2022)',
|
||||
data: {
|
||||
market: {
|
||||
id: 'first-btcusd-id',
|
||||
state: 'STATE_ACTIVE',
|
||||
__typename: 'Market',
|
||||
},
|
||||
__typename: 'MarketData',
|
||||
},
|
||||
tradableInstrument: {
|
||||
instrument: {
|
||||
code: 'AAVEDAI.MF21',
|
||||
metadata: {
|
||||
tags: [
|
||||
'formerly:2839D9B2329C9E70',
|
||||
'base:AAVE',
|
||||
'quote:DAI',
|
||||
'class:fx/crypto',
|
||||
'monthly',
|
||||
'sector:defi',
|
||||
],
|
||||
__typename: 'InstrumentMetadata',
|
||||
},
|
||||
product: {
|
||||
__typename: 'Future',
|
||||
quoteName: 'DAI',
|
||||
settlementAsset: { symbol: 'tDAI', __typename: 'Asset' },
|
||||
},
|
||||
__typename: 'Instrument',
|
||||
},
|
||||
__typename: 'TradableInstrument',
|
||||
},
|
||||
candles: protoCandles,
|
||||
__typename: 'Market',
|
||||
};
|
||||
@@ -1,136 +0,0 @@
|
||||
import { protoMarket } from './commons';
|
||||
|
||||
export const generateMarketNames = () => {
|
||||
return {
|
||||
markets: [
|
||||
{ ...protoMarket },
|
||||
{
|
||||
id: '1d7ddf67dac4924db03f5bf58571a7bcb1908d70c66580467717aabc5345b68a',
|
||||
name: 'Apple Monthly (30 Jun 2022)',
|
||||
state: 'STATE_SUSPENDED',
|
||||
tradableInstrument: {
|
||||
instrument: {
|
||||
code: 'AAPL.MF21',
|
||||
metadata: {
|
||||
tags: [
|
||||
'formerly:4899E01009F1A721',
|
||||
'quote:USD',
|
||||
'ticker:AAPL',
|
||||
'class:equities/single-stock-futures',
|
||||
'sector:tech',
|
||||
'listing_venue:NASDAQ',
|
||||
'country:US',
|
||||
],
|
||||
__typename: 'InstrumentMetadata',
|
||||
},
|
||||
product: { quoteName: 'USD', __typename: 'Future' },
|
||||
__typename: 'Instrument',
|
||||
},
|
||||
__typename: 'TradableInstrument',
|
||||
},
|
||||
__typename: 'Market',
|
||||
},
|
||||
{
|
||||
id: '87ae87cd3244fc1fab4b0e2dad2437879864192bb969f3109b69293421644c8b',
|
||||
name: 'Tesla Quarterly (30 Jun 2022)',
|
||||
state: 'STATE_SUSPENDED',
|
||||
tradableInstrument: {
|
||||
instrument: {
|
||||
code: 'TSLA.QM21',
|
||||
metadata: {
|
||||
tags: [
|
||||
'formerly:5A86B190C384997F',
|
||||
'quote:EURO',
|
||||
'ticker:TSLA',
|
||||
'class:equities/single-stock-futures',
|
||||
'sector:tech',
|
||||
'listing_venue:NASDAQ',
|
||||
'country:US',
|
||||
],
|
||||
__typename: 'InstrumentMetadata',
|
||||
},
|
||||
product: { quoteName: 'EURO', __typename: 'Future' },
|
||||
__typename: 'Instrument',
|
||||
},
|
||||
__typename: 'TradableInstrument',
|
||||
},
|
||||
__typename: 'Market',
|
||||
},
|
||||
{
|
||||
id: '69205712a854f1bbfb69fa3d11b60e01a1e249bafb5ece88115e7451e8ef07b3',
|
||||
name: 'BTCUSD Monthly (30 Jun 2022)',
|
||||
state: 'STATE_SUSPENDED',
|
||||
tradableInstrument: {
|
||||
instrument: {
|
||||
code: 'BTCUSD.MF21',
|
||||
metadata: {
|
||||
tags: [
|
||||
'formerly:076BB86A5AA41E3E',
|
||||
'base:BTC',
|
||||
'quote:USD',
|
||||
'class:fx/crypto',
|
||||
'monthly',
|
||||
'sector:crypto',
|
||||
],
|
||||
__typename: 'InstrumentMetadata',
|
||||
},
|
||||
product: { quoteName: 'USD', __typename: 'Future' },
|
||||
__typename: 'Instrument',
|
||||
},
|
||||
__typename: 'TradableInstrument',
|
||||
},
|
||||
__typename: 'Market',
|
||||
},
|
||||
{
|
||||
id: 'ethbtc-quaterly',
|
||||
name: 'ETHBTC Quarterly (30 Jun 2022)',
|
||||
state: 'STATE_ACTIVE',
|
||||
tradableInstrument: {
|
||||
instrument: {
|
||||
code: 'ETHBTC.QM21',
|
||||
metadata: {
|
||||
tags: [
|
||||
'formerly:1F0BB6EB5703B099',
|
||||
'base:ETH',
|
||||
'quote:BTC',
|
||||
'class:fx/crypto',
|
||||
'quarterly',
|
||||
'sector:crypto',
|
||||
],
|
||||
__typename: 'InstrumentMetadata',
|
||||
},
|
||||
product: { quoteName: 'BTC', __typename: 'Future' },
|
||||
__typename: 'Instrument',
|
||||
},
|
||||
__typename: 'TradableInstrument',
|
||||
},
|
||||
__typename: 'Market',
|
||||
},
|
||||
{
|
||||
id: '3c62b2714c4332d1a689a5352bff090e6aabccfd6bd87ce018936b38372530c9',
|
||||
name: 'UNIDAI Monthly (30 Jun 2022)',
|
||||
state: 'STATE_ACTIVE',
|
||||
tradableInstrument: {
|
||||
instrument: {
|
||||
code: 'UNIDAI.MF21',
|
||||
metadata: {
|
||||
tags: [
|
||||
'formerly:3C58ED2A4A6C5D7E',
|
||||
'base:UNI',
|
||||
'quote:DAI',
|
||||
'class:fx/crypto',
|
||||
'monthly',
|
||||
'sector:defi',
|
||||
],
|
||||
__typename: 'InstrumentMetadata',
|
||||
},
|
||||
product: { quoteName: 'DAI', __typename: 'Future' },
|
||||
__typename: 'Instrument',
|
||||
},
|
||||
__typename: 'TradableInstrument',
|
||||
},
|
||||
__typename: 'Market',
|
||||
},
|
||||
],
|
||||
};
|
||||
};
|
||||
@@ -1,17 +0,0 @@
|
||||
import { t } from '@vegaprotocol/react-helpers';
|
||||
|
||||
export const EST_MARGIN_TOOLTIP_TEXT = t(
|
||||
'When opening a position on a futures market, you must post margin to cover any potential losses that you may incur. The margin is typically a fraction of the notional position size. For example, for a notional position size of $500, if the margin requirement is 10%, then the estimated margin would be approximately $50.'
|
||||
);
|
||||
export const CONTRACTS_MARGIN_TOOLTIP_TEXT = t(
|
||||
'The number of contracts determines how many units of the futures contract to buy or sell. For example, this is similar to buying one share of a listed company. The value of 1 contract is equivalent to the price of the contract. For example, if the current price is $50, then one contract is worth $50.'
|
||||
);
|
||||
export const EST_CLOSEOUT_TOOLTIP_TEXT = t(
|
||||
'Because you only need to post a fraction of your position size as margin when trading futures, it is possible to obtain leverage meaning your notional position size exceeds your account balance. In this scenario, if the market moves against your position, it will sometimes be necessary to force close your position due to insufficient funds. The estimated close out tells you the price at which that would happen based on current position and account balance.'
|
||||
);
|
||||
export const NOTIONAL_SIZE_TOOLTIP_TEXT = t(
|
||||
'The notional size represents the position size in the settlement asset of the futures contract. The notional size is calculated by multiplying the number of contracts by the price of the contract. For example, ten contracts traded at a price of $50 has a notional size of $500.'
|
||||
);
|
||||
export const EST_FEES_TOOLTIP_TEXT = t(
|
||||
'When you execute a new buy or sell order, you must pay a small amount of commission to the network for doing so. This fee is used to provide income to the node operates of the network and market makers who make prices on the futures market you are trading.'
|
||||
);
|
||||
@@ -1,86 +0,0 @@
|
||||
import * as React from 'react';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { gql, useQuery } from '@apollo/client';
|
||||
import {
|
||||
DealTicketManager,
|
||||
DealTicketContainer as Container,
|
||||
} from '@vegaprotocol/deal-ticket';
|
||||
import { Loader } from '@vegaprotocol/ui-toolkit';
|
||||
import { t } from '@vegaprotocol/react-helpers';
|
||||
import { useVegaWallet } from '@vegaprotocol/wallet';
|
||||
import { DealTicketSteps } from './deal-ticket-steps';
|
||||
import { DealTicketBalance } from './deal-ticket-balance';
|
||||
import Baubles from './baubles-decor';
|
||||
import type { PartyBalanceQuery } from './__generated__/PartyBalanceQuery';
|
||||
import ConnectWallet from '../wallet-connector';
|
||||
|
||||
const tempEmptyText = (
|
||||
<p>{t('Please select a market from the markets page')}</p>
|
||||
);
|
||||
|
||||
const PARTY_BALANCE_QUERY = gql`
|
||||
query PartyBalanceQuery($partyId: ID!) {
|
||||
party(id: $partyId) {
|
||||
accounts {
|
||||
type
|
||||
balance
|
||||
asset {
|
||||
id
|
||||
symbol
|
||||
name
|
||||
decimals
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const DealTicketContainer = () => {
|
||||
const { marketId } = useParams<{ marketId: string }>();
|
||||
const { keypair } = useVegaWallet();
|
||||
|
||||
const { data: partyData, loading } = useQuery<PartyBalanceQuery>(
|
||||
PARTY_BALANCE_QUERY,
|
||||
{
|
||||
variables: { partyId: keypair?.pub },
|
||||
skip: !keypair?.pub,
|
||||
}
|
||||
);
|
||||
|
||||
const loader = <Loader />;
|
||||
|
||||
const container = marketId ? (
|
||||
<Container marketId={marketId}>
|
||||
{(data) => {
|
||||
const balance = (
|
||||
<DealTicketBalance
|
||||
className="mb-16"
|
||||
settlementAsset={
|
||||
data.market.tradableInstrument.instrument.product?.settlementAsset
|
||||
}
|
||||
accounts={partyData?.party?.accounts || []}
|
||||
isWalletConnected={!!keypair?.pub}
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<DealTicketManager market={data.market}>
|
||||
{loading ? loader : balance}
|
||||
<DealTicketSteps market={data.market} partyData={partyData} />
|
||||
</DealTicketManager>
|
||||
);
|
||||
}}
|
||||
</Container>
|
||||
) : (
|
||||
tempEmptyText
|
||||
);
|
||||
|
||||
return (
|
||||
<section className="flex">
|
||||
<section className="w-full md:w-1/2 md:min-w-[500px]">
|
||||
{keypair ? container : <ConnectWallet />}
|
||||
</section>
|
||||
<Baubles />
|
||||
</section>
|
||||
);
|
||||
};
|
||||
@@ -1,118 +0,0 @@
|
||||
import React from 'react';
|
||||
import type { ReactNode } from 'react';
|
||||
import { t } from '@vegaprotocol/react-helpers';
|
||||
import { Icon, Tooltip } from '@vegaprotocol/ui-toolkit';
|
||||
import { IconNames } from '@blueprintjs/icons';
|
||||
import * as constants from './constants';
|
||||
|
||||
interface DealTicketEstimatesProps {
|
||||
quoteName?: string;
|
||||
price?: string;
|
||||
estCloseOut?: string;
|
||||
estMargin?: string;
|
||||
fees?: string;
|
||||
notionalSize?: string;
|
||||
size?: string;
|
||||
}
|
||||
|
||||
interface DataTitleProps {
|
||||
children: ReactNode;
|
||||
quoteName?: string;
|
||||
}
|
||||
|
||||
const DataTitle = ({ children, quoteName = '' }: DataTitleProps) => (
|
||||
<dt>
|
||||
{children}
|
||||
{quoteName && <small> ({quoteName})</small>}
|
||||
</dt>
|
||||
);
|
||||
|
||||
interface ValueTooltipProps {
|
||||
value: string;
|
||||
description: string;
|
||||
id?: string;
|
||||
}
|
||||
|
||||
const ValueTooltipRow = ({ value, description, id }: ValueTooltipProps) => (
|
||||
<dd className="flex gap-x-5 items-center">
|
||||
{value}
|
||||
<Tooltip align="center" description={description}>
|
||||
<div className="cursor-help" id={id || ''} tabIndex={-1}>
|
||||
<Icon
|
||||
name={IconNames.ISSUE}
|
||||
className="block rotate-180"
|
||||
ariaLabel={description}
|
||||
/>
|
||||
</div>
|
||||
</Tooltip>
|
||||
</dd>
|
||||
);
|
||||
|
||||
export const DealTicketEstimates = ({
|
||||
price,
|
||||
quoteName,
|
||||
estCloseOut,
|
||||
estMargin,
|
||||
fees,
|
||||
notionalSize,
|
||||
size,
|
||||
}: DealTicketEstimatesProps) => (
|
||||
<dl className="text-black dark:text-white">
|
||||
{size && (
|
||||
<div className="flex justify-between mb-8">
|
||||
<DataTitle>{t('Contracts')}</DataTitle>
|
||||
<ValueTooltipRow
|
||||
value={size}
|
||||
description={constants.CONTRACTS_MARGIN_TOOLTIP_TEXT}
|
||||
id="contracts_tooltip_trigger"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{price && (
|
||||
<div className="flex justify-between mb-8">
|
||||
<DataTitle>{t('Est. Price')}</DataTitle>
|
||||
<dd>{price}</dd>
|
||||
</div>
|
||||
)}
|
||||
{notionalSize && (
|
||||
<div className="flex justify-between mb-8">
|
||||
<DataTitle quoteName={quoteName}>{t('Est. Position Size')}</DataTitle>
|
||||
<ValueTooltipRow
|
||||
value={notionalSize}
|
||||
description={constants.NOTIONAL_SIZE_TOOLTIP_TEXT}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{fees && (
|
||||
<div className="flex justify-between mb-8">
|
||||
<DataTitle quoteName={quoteName}>{t('Est. Fees')}</DataTitle>
|
||||
<ValueTooltipRow
|
||||
value={fees}
|
||||
description={constants.EST_FEES_TOOLTIP_TEXT}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{estMargin && (
|
||||
<div className="flex justify-between mb-8">
|
||||
<DataTitle quoteName={quoteName}>{t('Est. Margin')}</DataTitle>
|
||||
<ValueTooltipRow
|
||||
value={estMargin}
|
||||
description={constants.EST_MARGIN_TOOLTIP_TEXT}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{estCloseOut && (
|
||||
<div className="flex justify-between">
|
||||
<dt>
|
||||
<span>{t('Est. Close out')}</span>
|
||||
|
||||
<small>({quoteName})</small>
|
||||
</dt>
|
||||
<ValueTooltipRow
|
||||
value={estCloseOut}
|
||||
description={constants.EST_CLOSEOUT_TOOLTIP_TEXT}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</dl>
|
||||
);
|
||||
@@ -1,32 +0,0 @@
|
||||
import { routerConfig } from '../../routes';
|
||||
import { NavLink } from 'react-router-dom';
|
||||
import { NavItem } from './nav-item';
|
||||
import React from 'react';
|
||||
|
||||
interface NavProps {
|
||||
className?: string;
|
||||
tabs?: boolean;
|
||||
}
|
||||
|
||||
export const Nav = ({ className, tabs = false }: NavProps) => {
|
||||
return (
|
||||
<nav role={tabs ? 'tablist' : 'menu'} className={className}>
|
||||
{routerConfig
|
||||
.filter((r) => r.isNavItem)
|
||||
.map((r) => (
|
||||
<NavLink
|
||||
role={tabs ? 'tab' : 'menuitem'}
|
||||
key={r.name}
|
||||
to={r.path}
|
||||
className={({ isActive }) =>
|
||||
`text-h5 block md:mb-40 px-40 md:text-black md:dark:text-white ${
|
||||
isActive && 'text-white md:text-blue md:dark:text-blue'
|
||||
}`
|
||||
}
|
||||
>
|
||||
<NavItem iconName={r.icon} label={r.text} />
|
||||
</NavLink>
|
||||
))}
|
||||
</nav>
|
||||
);
|
||||
};
|
||||
-131
@@ -1,131 +0,0 @@
|
||||
import React from 'react';
|
||||
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';
|
||||
import type { SimpleMarkets_markets } from './__generated__/SimpleMarkets';
|
||||
import { markets as filterData } from './mocks/market-filters.json';
|
||||
|
||||
describe('SimpleMarketToolbar', () => {
|
||||
const WrappedCompForTest = () => {
|
||||
const routes = useRoutes([
|
||||
{
|
||||
path: '/',
|
||||
element: (
|
||||
<SimpleMarketToolbar data={filterData as SimpleMarkets_markets[]} />
|
||||
),
|
||||
},
|
||||
{
|
||||
path: 'markets',
|
||||
children: [
|
||||
{
|
||||
path: `:state`,
|
||||
element: (
|
||||
<SimpleMarketToolbar
|
||||
data={filterData as SimpleMarkets_markets[]}
|
||||
/>
|
||||
),
|
||||
children: [
|
||||
{
|
||||
path: `:product`,
|
||||
element: (
|
||||
<SimpleMarketToolbar
|
||||
data={filterData as SimpleMarkets_markets[]}
|
||||
/>
|
||||
),
|
||||
children: [
|
||||
{
|
||||
path: `:asset`,
|
||||
element: (
|
||||
<SimpleMarketToolbar
|
||||
data={filterData as SimpleMarkets_markets[]}
|
||||
/>
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
element: (
|
||||
<SimpleMarketToolbar data={filterData as SimpleMarkets_markets[]} />
|
||||
),
|
||||
},
|
||||
]);
|
||||
const location = useLocation();
|
||||
return (
|
||||
<>
|
||||
{routes}
|
||||
<div data-testid="location-display">{location.pathname}</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
afterEach(() => {
|
||||
jest.resetAllMocks();
|
||||
});
|
||||
|
||||
it('should be properly rendered', async () => {
|
||||
render(
|
||||
<MockedProvider mocks={[]} addTypename={false}>
|
||||
<WrappedCompForTest />
|
||||
</MockedProvider>,
|
||||
{ wrapper: BrowserRouter }
|
||||
);
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('Future')).toBeInTheDocument();
|
||||
});
|
||||
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);
|
||||
});
|
||||
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 () => {
|
||||
render(
|
||||
<MockedProvider mocks={[]} addTypename={false}>
|
||||
<WrappedCompForTest />
|
||||
</MockedProvider>,
|
||||
{ wrapper: BrowserRouter }
|
||||
);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('Future')).toBeInTheDocument();
|
||||
});
|
||||
fireEvent.click(screen.getByText('Future'));
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByTestId('location-display')).toHaveTextContent(
|
||||
'/markets/STATE_ACTIVE/Future'
|
||||
);
|
||||
});
|
||||
|
||||
fireEvent.click(
|
||||
screen
|
||||
.getByTestId('market-assets-menu')
|
||||
.children[5].querySelector('a') as HTMLAnchorElement
|
||||
);
|
||||
await waitFor(() => {
|
||||
expect(screen.getByTestId('location-display')).toHaveTextContent(
|
||||
'/markets/STATE_ACTIVE/Future/tEURO'
|
||||
);
|
||||
});
|
||||
|
||||
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'
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,40 +0,0 @@
|
||||
import { t } from '@vegaprotocol/react-helpers';
|
||||
import { Button } from '@vegaprotocol/ui-toolkit';
|
||||
import * as React from 'react';
|
||||
import { useContext } from 'react';
|
||||
import LocalContext from '../../context/local-context';
|
||||
|
||||
const ConnectWallet = () => {
|
||||
const {
|
||||
vegaWalletDialog: { setConnect },
|
||||
} = useContext(LocalContext);
|
||||
return (
|
||||
<section
|
||||
className="p-32 bg-white-normal dark:bg-offBlack"
|
||||
data-testid="trading-connect-wallet"
|
||||
>
|
||||
<h3 className="mb-16 text-2xl text-offBlack dark:text-white">
|
||||
{t('Please connect your Vega wallet to make a trade')}
|
||||
</h3>
|
||||
<Button
|
||||
variant="primary"
|
||||
onClick={() => setConnect(true)}
|
||||
className="h-[50px] mb-16"
|
||||
>
|
||||
{t('Connect Vega wallet')}
|
||||
</Button>
|
||||
<h4 className="text-lg text-offBlack dark:text-white">
|
||||
{t("Don't have a wallet?")}
|
||||
</h4>
|
||||
<p>
|
||||
{t('Head over to ')}
|
||||
<a className="text-blue" href="https://vega.xyz/wallet">
|
||||
https://vega.xyz/wallet
|
||||
</a>
|
||||
{t(' and follow the steps to create one.')}
|
||||
</p>
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
export default ConnectWallet;
|
||||
@@ -1,26 +0,0 @@
|
||||
import type { SimpleMarkets_markets } from '../components/simple-market-list/__generated__/SimpleMarkets';
|
||||
import { MarketState } from '@vegaprotocol/types';
|
||||
import { t } from '@vegaprotocol/react-helpers';
|
||||
|
||||
export const DATE_FORMAT = 'dd MMMM yyyy HH:mm';
|
||||
export const EXPIRE_DATE_FORMAT = 'MMM dd';
|
||||
|
||||
export const TRADABLE_STATES = {
|
||||
[MarketState.STATE_ACTIVE]: true,
|
||||
};
|
||||
|
||||
export const IS_MARKET_TRADABLE = (market: SimpleMarkets_markets) =>
|
||||
Boolean((market.data?.market.state ?? '') in TRADABLE_STATES && market?.id);
|
||||
|
||||
export const MARKET_STATES_MAP: Record<MarketState | '', string> = {
|
||||
[MarketState.STATE_ACTIVE]: t('Active'),
|
||||
[MarketState.STATE_CANCELLED]: t('Cancelled'),
|
||||
[MarketState.STATE_CLOSED]: t('Closed'),
|
||||
[MarketState.STATE_PENDING]: t('Pending'),
|
||||
[MarketState.STATE_PROPOSED]: t('Proposed'),
|
||||
[MarketState.STATE_REJECTED]: t('Rejected'),
|
||||
[MarketState.STATE_SETTLED]: t('Settled'),
|
||||
[MarketState.STATE_SUSPENDED]: t('Suspended'),
|
||||
[MarketState.STATE_TRADING_TERMINATED]: t('TradingTerminated'),
|
||||
'': t('Unknown'),
|
||||
};
|
||||
@@ -2,9 +2,9 @@
|
||||
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_URL=https://api.n04.d.vega.xyz/graphql
|
||||
NX_VEGA_URL=https://n04.d.vega.xyz/query
|
||||
NX_VEGA_ENV=DEVNET
|
||||
NX_VEGA_REST=https://api.n04.d.vega.xyz
|
||||
NX_VEGA_REST=https://n04.d.vega.xyz/datanode/rest
|
||||
|
||||
# App flags
|
||||
NX_EXPLORER_ASSETS=1
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
# App configuration variables
|
||||
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_URL=https://n03.s.vega.xyz/query
|
||||
NX_VEGA_ENV=STAGNET
|
||||
NX_VEGA_REST=https://n03.s.vega.xyz/datanode/rest
|
||||
|
||||
# App flags
|
||||
NX_EXPLORER_ASSETS=1
|
||||
NX_EXPLORER_GENESIS=1
|
||||
NX_EXPLORER_GOVERNANCE=1
|
||||
NX_EXPLORER_MARKETS=1
|
||||
NX_EXPLORER_ORACLES=1
|
||||
NX_EXPLORER_TXS_LIST=1
|
||||
NX_EXPLORER_NETWORK_PARAMETERS=1
|
||||
NX_EXPLORER_PARTIES=1
|
||||
NX_EXPLORER_VALIDATORS=1
|
||||
@@ -1,10 +1,10 @@
|
||||
# App configuration variables
|
||||
NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-explorer-api
|
||||
NX_TENDERMINT_URL=https://n01.stagnet3.vega.xyz/tm
|
||||
NX_TENDERMINT_WEBSOCKET_URL=wss://n01.stagnet3.vega.xyz/tm/websocket
|
||||
NX_VEGA_URL=https://api.n01.stagnet3.vega.xyz/graphql
|
||||
NX_VEGA_ENV=STAGNET3
|
||||
NX_VEGA_REST=https://api.n01.stagnet3.vega.xyz
|
||||
NX_TENDERMINT_URL=https://n03.stagnet2.vega.xyz/tm
|
||||
NX_TENDERMINT_WEBSOCKET_URL=wss://n03.stagnet2.vega.xyz/tm/websocket
|
||||
NX_VEGA_URL=https://n03.stagnet2.vega.xyz/query
|
||||
NX_VEGA_ENV=STAGNET2
|
||||
NX_VEGA_REST=https://n01.stagnet2.vega.xyz/datanode/rest
|
||||
|
||||
# App flags
|
||||
NX_EXPLORER_ASSETS=1
|
||||
@@ -1,10 +1,10 @@
|
||||
# App configuration variables
|
||||
NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-explorer-api
|
||||
NX_TENDERMINT_URL=https://tm.n06.testnet.vega.xyz/tm
|
||||
NX_TENDERMINT_URL=https://lb.testnet.vega.xyz/tm
|
||||
NX_TENDERMINT_WEBSOCKET_URL=wss://lb.testnet.vega.xyz/tm/websocket
|
||||
NX_VEGA_URL=https://api.n11.testnet.vega.xyz/graphql
|
||||
NX_VEGA_URL=https://lb.testnet.vega.xyz/query
|
||||
NX_VEGA_ENV=TESTNET
|
||||
NX_VEGA_REST=https://api.n11.testnet.vega.xyz
|
||||
NX_VEGA_REST=https://lb.testnet.vega.xyz/datanode/rest
|
||||
|
||||
# App flags
|
||||
NX_EXPLORER_ASSETS=1
|
||||
|
||||
@@ -2,9 +2,10 @@ const nodeErrorType = 'node-error-type';
|
||||
const nodeErrorMsg = 'node-error-message';
|
||||
const nodeId = 'node-url-0';
|
||||
const customNodeBtn = 'custom-node';
|
||||
const closeDialogBtn = 'dialog-close';
|
||||
|
||||
context('Node switcher', function () {
|
||||
beforeEach('visit home page', function () {
|
||||
before('visit home page', function () {
|
||||
cy.intercept('GET', 'https://static.vega.xyz/assets/capsule-network.json', {
|
||||
hosts: ['http://localhost:3028/query'],
|
||||
}).as('nodeData');
|
||||
@@ -19,7 +20,7 @@ context('Node switcher', function () {
|
||||
});
|
||||
});
|
||||
it('node data is displayed', function () {
|
||||
cy.getByTestId('node-row').should('have.length.at.least', 2);
|
||||
cy.getByTestId('node-row').should('have.length.at.least', 1);
|
||||
|
||||
cy.getByTestId('node-row')
|
||||
.eq(0)
|
||||
@@ -28,13 +29,21 @@ context('Node switcher', function () {
|
||||
.should('exist')
|
||||
.and('have.attr', 'aria-checked', 'true');
|
||||
cy.get('label').should('have.text', Cypress.env('networkQueryUrl'));
|
||||
cy.contains('-').should('not.exist');
|
||||
cy.getByTestId('response-time-cell').should('contain.text', 'ms');
|
||||
cy.getByTestId('response-time-cell')
|
||||
.should('not.be.empty')
|
||||
.and('contain.text', 'ms');
|
||||
cy.getByTestId('block-cell').should('not.be.empty');
|
||||
cy.getByTestId('ssl-cell').should('not.be.empty');
|
||||
cy.getByTestId('ssl-cell').should('have.text', 'Yes');
|
||||
});
|
||||
});
|
||||
|
||||
it('Incorrect network displayed', function () {
|
||||
const errorTypeTxt = 'Error: incorrect network';
|
||||
const nodeErrorTxt = 'This node is not on the CUSTOM network.';
|
||||
|
||||
validateNodeError(errorTypeTxt, nodeErrorTxt);
|
||||
});
|
||||
|
||||
it('cannot connect to network using invalid url', function () {
|
||||
const errorTypeTxt = 'Error: invalid url';
|
||||
const nodeErrorTxt = 'fakeUrl is not a valid url.';
|
||||
@@ -55,13 +64,16 @@ context('Node switcher', function () {
|
||||
cy.getByTestId('node-url-custom').click();
|
||||
|
||||
cy.getByTestId(customNodeBtn).within(() => {
|
||||
cy.get('input').clear().type('https://n03.s.vega.xyz/query');
|
||||
cy.get('input').clear().type('https://api.token.vega.xyz/query');
|
||||
cy.getByTestId('link').click();
|
||||
});
|
||||
cy.getByTestId('ssl-cell').should('contain.text', 'Yes');
|
||||
validateNodeError(errorTypeTxt, nodeErrorTxt);
|
||||
});
|
||||
|
||||
afterEach('Close node switcher', function () {
|
||||
cy.getByTestId(closeDialogBtn).should('be.enabled').click();
|
||||
});
|
||||
|
||||
function validateNodeError(errortype, errorMsg) {
|
||||
cy.getByTestId(nodeErrorType, { timeout: 10000 }).should(
|
||||
'have.text',
|
||||
|
||||
@@ -21,7 +21,8 @@ context('Validator page', function () {
|
||||
'have.text',
|
||||
'Tendermint data'
|
||||
);
|
||||
cy.get('[data-testid="tendermint-data"]').should('not.be.empty');
|
||||
cy.get('[data-testid="vega-header"]').should('have.text', 'Vega data');
|
||||
cy.get('[data-testid="vega-data"]').should('not.be.empty');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
+7
-5
@@ -3,14 +3,16 @@ NX_TENDERMINT_URL=http://localhost:26617
|
||||
NX_TENDERMINT_WEBSOCKET_URL=wss://localhost:26617/websocket
|
||||
NX_VEGA_URL=http://localhost:3028/query
|
||||
NX_VEGA_ENV=CUSTOM
|
||||
NX_VEGA_REST=http://localhost:3029
|
||||
|
||||
NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-explorer-api
|
||||
NX_TENDERMINT_URL=https://n01.stagnet3.vega.xyz/tm
|
||||
NX_TENDERMINT_WEBSOCKET_URL=wss://n01.stagnet3.vega.xyz/tm/websocket
|
||||
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet3-network.json
|
||||
NX_VEGA_URL=https://api.n01.stagnet3.vega.xyz/graphql
|
||||
NX_TENDERMINT_URL=https://lb.testnet.vega.xyz/tm
|
||||
NX_TENDERMINT_WEBSOCKET_URL=wss://lb.testnet.vega.xyz/tm/websocket
|
||||
NX_VEGA_URL=https://lb.testnet.vega.xyz/query
|
||||
NX_VEGA_ENV=TESTNET
|
||||
NX_VEGA_REST=https://lb.testnet.vega.xyz/datanode/rest
|
||||
NX_VEGA_NETWORKS='{"TESTNET":"https://explorer.fairground.wtf","MAINNET":"https://explorer.vega.xyz"}'
|
||||
NX_VEGA_ENV=STAGNET3
|
||||
CYPRESS_VEGA_TENDERMINT_URL=https://lb.testnet.vega.xyz/tm
|
||||
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
||||
|
||||
# App flags
|
||||
|
||||
@@ -5,6 +5,7 @@ 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=CUSTOM
|
||||
NX_VEGA_REST=http://localhost:3029
|
||||
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
||||
|
||||
# App flags
|
||||
|
||||
@@ -3,7 +3,8 @@ NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-exp
|
||||
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://api.n04.d.vega.xyz/graphql
|
||||
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
|
||||
NX_VEGA_REST=https://n04.d.vega.xyz/datanode/rest
|
||||
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
||||
|
||||
@@ -6,4 +6,5 @@ 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
|
||||
NX_VEGA_REST=https://api.token.vega.xyz/
|
||||
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
# App configuration variables
|
||||
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
|
||||
NX_VEGA_REST=https://n03.s.vega.xyz/datanode/rest
|
||||
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
||||
@@ -1,9 +1,10 @@
|
||||
# App configuration variables
|
||||
NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-explorer-api
|
||||
NX_TENDERMINT_URL=https://n01.stagnet3.vega.xyz/tm
|
||||
NX_TENDERMINT_WEBSOCKET_URL=wss://n01.stagnet3.vega.xyz/tm/websocket
|
||||
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet3-network.json
|
||||
NX_VEGA_URL=https://api.n01.stagnet3.vega.xyz/graphql
|
||||
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=STAGNET3
|
||||
NX_VEGA_ENV=STAGNET2
|
||||
NX_VEGA_REST=https://n01.stagnet2.vega.xyz/datanode/rest
|
||||
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
||||
@@ -1,9 +1,10 @@
|
||||
# App configuration variables
|
||||
NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-explorer-api
|
||||
NX_TENDERMINT_URL=https://tm.n06.testnet.vega.xyz/tm
|
||||
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://api.n11.testnet.vega.xyz/graphql
|
||||
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
|
||||
NX_VEGA_REST=https://lb.testnet.vega.xyz/datanode/rest
|
||||
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
||||
|
||||
@@ -4,4 +4,5 @@ NX_TENDERMINT_URL=http://localhost:26607/
|
||||
NX_TENDERMINT_WEBSOCKET_URL=wss://localhost:26607/websocket
|
||||
NX_VEGA_URL=http://localhost:3003/query
|
||||
NX_VEGA_ENV=CUSTOM
|
||||
NX_VEGA_REST=http://localhost:3029/rest
|
||||
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
||||
|
||||
@@ -35,23 +35,25 @@ Example configurations are provided here:
|
||||
- [Devnet](./.env.devnet)
|
||||
- [Capsule](./.env.capsule)
|
||||
- [Testnet](./.env.testnet)
|
||||
- [Stagnet3](./.env.stagnet3)
|
||||
- [Stagnet1](./.env.stagnet1)
|
||||
- [Stagnet2](./.env.stagnet2)
|
||||
|
||||
For convenience, you can boot the app injecting one of the configurations above by running:
|
||||
|
||||
```bash
|
||||
yarn nx run explorer:serve --env={env} # e.g. stagnet3
|
||||
yarn nx run explorer:serve --env={env} # e.g. stagnet1
|
||||
```
|
||||
|
||||
There are a few different configuration options offered for this app:
|
||||
|
||||
| **Flag** | **Purpose** |
|
||||
| -------------------------------- | ---------------------------------------------------------------------------------------------------- | --- |
|
||||
| -------------------------------- | ---------------------------------------------------------------------------------------------------- |
|
||||
| `NX_CHAIN_EXPLORER_URL` | The URL of the chain explorer service for decoding transactions |
|
||||
| `NX_TENDERMINT_URL` | The Tendermint REST URL for the Vega consesus engine |
|
||||
| `NX_TENDERMINT_WEBSOCKET_URL` | The Tendermint Websocket URL for the Vega consensus engine |
|
||||
| `NX_VEGA_URL` | The GraphQl query endpoint of a [Vega data node](https://github.com/vegaprotocol/networks#data-node) |
|
||||
| `NX_VEGA_ENV` | The name of the currently connected vega environment | |
|
||||
| `NX_VEGA_ENV` | The name of the currently connected vega environment |
|
||||
| `NX_VEGA_REST` | The REST URL for the Vega Data Node |
|
||||
| `NX_EXPLORER_ASSETS` | Enable the assets page for the explorer |
|
||||
| `NX_EXPLORER_GENESIS` | Enable the genesis page for the explorer |
|
||||
| `NX_EXPLORER_GOVERNANCE` | Enable the governance page for the explorer |
|
||||
|
||||
@@ -1,23 +1,15 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import * as Sentry from '@sentry/react';
|
||||
import { BrowserTracing } from '@sentry/tracing';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { ThemeContext, useThemeSwitcher } from '@vegaprotocol/react-helpers';
|
||||
import {
|
||||
EnvironmentProvider,
|
||||
NetworkLoader,
|
||||
useEnvironment,
|
||||
} from '@vegaprotocol/environment';
|
||||
import { EnvironmentProvider, NetworkLoader } from '@vegaprotocol/environment';
|
||||
import { NetworkInfo } from '@vegaprotocol/network-info';
|
||||
import { createClient } from './lib/apollo-client';
|
||||
import { Nav } from './components/nav';
|
||||
import { Header } from './components/header';
|
||||
import { Main } from './components/main';
|
||||
import { TendermintWebsocketProvider } from './contexts/websocket/tendermint-websocket-provider';
|
||||
import { ENV } from './config/env';
|
||||
|
||||
function App() {
|
||||
const { VEGA_ENV } = useEnvironment();
|
||||
const [theme, toggleTheme] = useThemeSwitcher();
|
||||
const [menuOpen, setMenuOpen] = useState(false);
|
||||
|
||||
@@ -27,49 +19,34 @@ function App() {
|
||||
setMenuOpen(false);
|
||||
}, [location]);
|
||||
|
||||
useEffect(() => {
|
||||
Sentry.init({
|
||||
dsn: ENV.dsn,
|
||||
integrations: [new BrowserTracing()],
|
||||
tracesSampleRate: 1,
|
||||
environment: VEGA_ENV,
|
||||
});
|
||||
}, [VEGA_ENV]);
|
||||
|
||||
return (
|
||||
<ThemeContext.Provider value={theme}>
|
||||
<TendermintWebsocketProvider>
|
||||
<NetworkLoader createClient={createClient}>
|
||||
<div
|
||||
className={`${
|
||||
menuOpen && 'h-[100vh] overflow-hidden'
|
||||
} antialiased m-0 bg-white dark:bg-black text-black dark:text-white`}
|
||||
>
|
||||
<div className="min-h-[100vh] max-w-[1300px] grid grid-rows-[repeat(2,_auto)_1fr] grid-cols-[1fr] md:grid-rows-[auto_minmax(700px,_1fr)] md:grid-cols-[300px_1fr] border-black dark:border-white lg:border-l-1 lg:border-r-1 mx-auto">
|
||||
<Header
|
||||
toggleTheme={toggleTheme}
|
||||
menuOpen={menuOpen}
|
||||
setMenuOpen={setMenuOpen}
|
||||
/>
|
||||
<Nav menuOpen={menuOpen} />
|
||||
<Main />
|
||||
<footer className="grid grid-rows-2 grid-cols-[1fr_auto] md:flex md:col-span-2 p-16 gap-12 border-t-1">
|
||||
<NetworkInfo />
|
||||
</footer>
|
||||
<EnvironmentProvider>
|
||||
<ThemeContext.Provider value={theme}>
|
||||
<TendermintWebsocketProvider>
|
||||
<NetworkLoader createClient={createClient}>
|
||||
<div
|
||||
className={`${
|
||||
menuOpen && 'h-[100vh] overflow-hidden'
|
||||
} antialiased m-0 bg-white dark:bg-black text-black dark:text-white`}
|
||||
>
|
||||
<div className="min-h-[100vh] max-w-[1300px] grid grid-rows-[repeat(2,_auto)_1fr] grid-cols-[1fr] md:grid-rows-[auto_minmax(700px,_1fr)] md:grid-cols-[300px_1fr] border-black dark:border-white lg:border-l-1 lg:border-r-1 mx-auto">
|
||||
<Header
|
||||
toggleTheme={toggleTheme}
|
||||
menuOpen={menuOpen}
|
||||
setMenuOpen={setMenuOpen}
|
||||
/>
|
||||
<Nav menuOpen={menuOpen} />
|
||||
<Main />
|
||||
<footer className="grid grid-rows-2 grid-cols-[1fr_auto] md:flex md:col-span-2 p-16 gap-12 border-t-1">
|
||||
<NetworkInfo />
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</NetworkLoader>
|
||||
</TendermintWebsocketProvider>
|
||||
</ThemeContext.Provider>
|
||||
</NetworkLoader>
|
||||
</TendermintWebsocketProvider>
|
||||
</ThemeContext.Provider>
|
||||
</EnvironmentProvider>
|
||||
);
|
||||
}
|
||||
|
||||
const Wrapper = () => {
|
||||
return (
|
||||
<EnvironmentProvider>
|
||||
<App />
|
||||
</EnvironmentProvider>
|
||||
);
|
||||
};
|
||||
|
||||
export default Wrapper;
|
||||
export default App;
|
||||
|
||||
@@ -17,7 +17,6 @@ export const SubHeading = ({
|
||||
'uppercase',
|
||||
'mt-12',
|
||||
'mb-12',
|
||||
'truncate',
|
||||
className
|
||||
);
|
||||
return (
|
||||
|
||||
@@ -11,10 +11,13 @@ export const ENV = {
|
||||
// Data sources
|
||||
// Environment
|
||||
dsn: windowOrDefault('NX_EXPLORER_SENTRY_DSN'),
|
||||
envName: windowOrDefault('NX_VEGA_ENV'),
|
||||
dataSources: {
|
||||
chainExplorerUrl: windowOrDefault('NX_CHAIN_EXPLORER_URL'),
|
||||
tendermintUrl: windowOrDefault('NX_TENDERMINT_URL'),
|
||||
tendermintWebsocketUrl: windowOrDefault('NX_TENDERMINT_WEBSOCKET_URL'),
|
||||
dataNodeUrl: windowOrDefault('NX_VEGA_URL'),
|
||||
restEndpoint: windowOrDefault('NX_VEGA_REST'),
|
||||
},
|
||||
flags: {
|
||||
assets: truthy.includes(windowOrDefault('NX_EXPLORER_ASSETS')),
|
||||
|
||||
@@ -6,8 +6,9 @@ export function createClient(base?: string) {
|
||||
if (!base) {
|
||||
throw new Error('Base must be passed into createClient!');
|
||||
}
|
||||
const urlHTTP = new URL(base);
|
||||
const urlWS = new URL(base);
|
||||
const gqlPath = 'query';
|
||||
const urlHTTP = new URL(gqlPath, base);
|
||||
const urlWS = new URL(gqlPath, base);
|
||||
// Replace http with ws, preserving if its a secure connection eg. https => wss
|
||||
urlWS.protocol = urlWS.protocol.replace('http', 'ws');
|
||||
|
||||
|
||||
+19
-28
@@ -9,15 +9,15 @@ import { AccountType } from "@vegaprotocol/types";
|
||||
// GraphQL query operation: AssetsQuery
|
||||
// ====================================================
|
||||
|
||||
export interface AssetsQuery_assetsConnection_edges_node_source_ERC20 {
|
||||
export interface AssetsQuery_assets_source_ERC20 {
|
||||
__typename: "ERC20";
|
||||
/**
|
||||
* The address of the ERC20 contract
|
||||
* The address of the erc20 contract
|
||||
*/
|
||||
contractAddress: string;
|
||||
}
|
||||
|
||||
export interface AssetsQuery_assetsConnection_edges_node_source_BuiltinAsset {
|
||||
export interface AssetsQuery_assets_source_BuiltinAsset {
|
||||
__typename: "BuiltinAsset";
|
||||
/**
|
||||
* Maximum amount that can be requested by a party through the built-in asset faucet at a time
|
||||
@@ -25,9 +25,9 @@ export interface AssetsQuery_assetsConnection_edges_node_source_BuiltinAsset {
|
||||
maxFaucetAmountMint: string;
|
||||
}
|
||||
|
||||
export type AssetsQuery_assetsConnection_edges_node_source = AssetsQuery_assetsConnection_edges_node_source_ERC20 | AssetsQuery_assetsConnection_edges_node_source_BuiltinAsset;
|
||||
export type AssetsQuery_assets_source = AssetsQuery_assets_source_ERC20 | AssetsQuery_assets_source_BuiltinAsset;
|
||||
|
||||
export interface AssetsQuery_assetsConnection_edges_node_infrastructureFeeAccount_market {
|
||||
export interface AssetsQuery_assets_infrastructureFeeAccount_market {
|
||||
__typename: "Market";
|
||||
/**
|
||||
* Market ID
|
||||
@@ -35,7 +35,7 @@ export interface AssetsQuery_assetsConnection_edges_node_infrastructureFeeAccoun
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface AssetsQuery_assetsConnection_edges_node_infrastructureFeeAccount {
|
||||
export interface AssetsQuery_assets_infrastructureFeeAccount {
|
||||
__typename: "Account";
|
||||
/**
|
||||
* Account type (General, Margin, etc)
|
||||
@@ -48,13 +48,13 @@ export interface AssetsQuery_assetsConnection_edges_node_infrastructureFeeAccoun
|
||||
/**
|
||||
* Market (only relevant to margin accounts)
|
||||
*/
|
||||
market: AssetsQuery_assetsConnection_edges_node_infrastructureFeeAccount_market | null;
|
||||
market: AssetsQuery_assets_infrastructureFeeAccount_market | null;
|
||||
}
|
||||
|
||||
export interface AssetsQuery_assetsConnection_edges_node {
|
||||
export interface AssetsQuery_assets {
|
||||
__typename: "Asset";
|
||||
/**
|
||||
* The ID of the asset
|
||||
* The id of the asset
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
@@ -66,35 +66,26 @@ export interface AssetsQuery_assetsConnection_edges_node {
|
||||
*/
|
||||
symbol: string;
|
||||
/**
|
||||
* The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18
|
||||
* The total supply of the market
|
||||
*/
|
||||
totalSupply: string;
|
||||
/**
|
||||
* The precision of the asset
|
||||
*/
|
||||
decimals: number;
|
||||
/**
|
||||
* The origin source of the asset (e.g: an ERC20 asset)
|
||||
* The origin source of the asset (e.g: an erc20 asset)
|
||||
*/
|
||||
source: AssetsQuery_assetsConnection_edges_node_source;
|
||||
source: AssetsQuery_assets_source;
|
||||
/**
|
||||
* The infrastructure fee account for this asset
|
||||
*/
|
||||
infrastructureFeeAccount: AssetsQuery_assetsConnection_edges_node_infrastructureFeeAccount;
|
||||
}
|
||||
|
||||
export interface AssetsQuery_assetsConnection_edges {
|
||||
__typename: "AssetEdge";
|
||||
node: AssetsQuery_assetsConnection_edges_node;
|
||||
}
|
||||
|
||||
export interface AssetsQuery_assetsConnection {
|
||||
__typename: "AssetsConnection";
|
||||
/**
|
||||
* The assets
|
||||
*/
|
||||
edges: (AssetsQuery_assetsConnection_edges | null)[] | null;
|
||||
infrastructureFeeAccount: AssetsQuery_assets_infrastructureFeeAccount;
|
||||
}
|
||||
|
||||
export interface AssetsQuery {
|
||||
/**
|
||||
* The list of all assets in use in the Vega network or the specified asset if ID is provided
|
||||
* The list of all assets in use in the vega network
|
||||
*/
|
||||
assetsConnection: AssetsQuery_assetsConnection;
|
||||
assets: AssetsQuery_assets[] | null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { gql, useQuery } from '@apollo/client';
|
||||
import { assetsConnectionToAssets, t } from '@vegaprotocol/react-helpers';
|
||||
import { t } from '@vegaprotocol/react-helpers';
|
||||
import React from 'react';
|
||||
import { RouteTitle } from '../../components/route-title';
|
||||
import { SubHeading } from '../../components/sub-heading';
|
||||
@@ -8,28 +8,25 @@ import type { AssetsQuery } from './__generated__/AssetsQuery';
|
||||
|
||||
export const ASSETS_QUERY = gql`
|
||||
query AssetsQuery {
|
||||
assetsConnection {
|
||||
edges {
|
||||
node {
|
||||
assets {
|
||||
id
|
||||
name
|
||||
symbol
|
||||
totalSupply
|
||||
decimals
|
||||
source {
|
||||
... on ERC20 {
|
||||
contractAddress
|
||||
}
|
||||
... on BuiltinAsset {
|
||||
maxFaucetAmountMint
|
||||
}
|
||||
}
|
||||
infrastructureFeeAccount {
|
||||
type
|
||||
balance
|
||||
market {
|
||||
id
|
||||
name
|
||||
symbol
|
||||
decimals
|
||||
source {
|
||||
... on ERC20 {
|
||||
contractAddress
|
||||
}
|
||||
... on BuiltinAsset {
|
||||
maxFaucetAmountMint
|
||||
}
|
||||
}
|
||||
infrastructureFeeAccount {
|
||||
type
|
||||
balance
|
||||
market {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,13 +35,11 @@ export const ASSETS_QUERY = gql`
|
||||
|
||||
const Assets = () => {
|
||||
const { data } = useQuery<AssetsQuery>(ASSETS_QUERY);
|
||||
|
||||
const assets = assetsConnectionToAssets(data?.assetsConnection);
|
||||
|
||||
if (!data || !data.assets) return null;
|
||||
return (
|
||||
<section>
|
||||
<RouteTitle data-testid="assets-header">{t('Assets')}</RouteTitle>
|
||||
{assets.map((a) => (
|
||||
{data?.assets.map((a) => (
|
||||
<React.Fragment key={a.id}>
|
||||
<SubHeading data-testid="asset-header">
|
||||
{a.name} ({a.symbol})
|
||||
|
||||
@@ -17,8 +17,8 @@ export interface ProposalsQuery_proposals_party {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface ProposalsQuery_proposals_terms_change_UpdateAsset {
|
||||
__typename: "UpdateAsset" | "NewFreeform";
|
||||
export interface ProposalsQuery_proposals_terms_change_NewFreeform {
|
||||
__typename: "NewFreeform";
|
||||
}
|
||||
|
||||
export interface ProposalsQuery_proposals_terms_change_NewMarket_instrument {
|
||||
@@ -53,7 +53,7 @@ export interface ProposalsQuery_proposals_terms_change_NewAsset_source_BuiltinAs
|
||||
export interface ProposalsQuery_proposals_terms_change_NewAsset_source_ERC20 {
|
||||
__typename: "ERC20";
|
||||
/**
|
||||
* The address of the ERC20 contract
|
||||
* The address of the erc20 contract
|
||||
*/
|
||||
contractAddress: string;
|
||||
}
|
||||
@@ -67,7 +67,7 @@ export interface ProposalsQuery_proposals_terms_change_NewAsset {
|
||||
*/
|
||||
symbol: string;
|
||||
/**
|
||||
* The source of the new asset
|
||||
* the source of the new Asset
|
||||
*/
|
||||
source: ProposalsQuery_proposals_terms_change_NewAsset_source;
|
||||
}
|
||||
@@ -89,7 +89,7 @@ export interface ProposalsQuery_proposals_terms_change_UpdateNetworkParameter {
|
||||
networkParameter: ProposalsQuery_proposals_terms_change_UpdateNetworkParameter_networkParameter;
|
||||
}
|
||||
|
||||
export type ProposalsQuery_proposals_terms_change = ProposalsQuery_proposals_terms_change_UpdateAsset | ProposalsQuery_proposals_terms_change_NewMarket | ProposalsQuery_proposals_terms_change_UpdateMarket | ProposalsQuery_proposals_terms_change_NewAsset | ProposalsQuery_proposals_terms_change_UpdateNetworkParameter;
|
||||
export type ProposalsQuery_proposals_terms_change = ProposalsQuery_proposals_terms_change_NewFreeform | ProposalsQuery_proposals_terms_change_NewMarket | ProposalsQuery_proposals_terms_change_UpdateMarket | ProposalsQuery_proposals_terms_change_NewAsset | ProposalsQuery_proposals_terms_change_UpdateNetworkParameter;
|
||||
|
||||
export interface ProposalsQuery_proposals_terms {
|
||||
__typename: "ProposalTerms";
|
||||
@@ -101,9 +101,8 @@ export interface ProposalsQuery_proposals_terms {
|
||||
/**
|
||||
* RFC3339Nano time and date when this proposal is executed (if passed). Note that it has to be after closing date time.
|
||||
* Constrained by "minEnactInSeconds" and "maxEnactInSeconds" network parameters.
|
||||
* Note: Optional as free form proposals do not require it.
|
||||
*/
|
||||
enactmentDatetime: string | null;
|
||||
enactmentDatetime: string;
|
||||
/**
|
||||
* Actual change being introduced by the proposal - action the proposal triggers if passed and enacted.
|
||||
*/
|
||||
@@ -149,15 +148,15 @@ export interface ProposalsQuery_proposals_votes_yes_votes {
|
||||
export interface ProposalsQuery_proposals_votes_yes {
|
||||
__typename: "ProposalVoteSide";
|
||||
/**
|
||||
* Total number of governance tokens from the votes cast for this side
|
||||
* Total tokens of governance token from the votes casted for this side
|
||||
*/
|
||||
totalTokens: string;
|
||||
/**
|
||||
* Total number of votes cast for this side
|
||||
* Total number of votes casted for this side
|
||||
*/
|
||||
totalNumber: string;
|
||||
/**
|
||||
* All votes cast for this side
|
||||
* All votes casted for this side
|
||||
*/
|
||||
votes: ProposalsQuery_proposals_votes_yes_votes[] | null;
|
||||
}
|
||||
@@ -201,15 +200,15 @@ export interface ProposalsQuery_proposals_votes_no_votes {
|
||||
export interface ProposalsQuery_proposals_votes_no {
|
||||
__typename: "ProposalVoteSide";
|
||||
/**
|
||||
* Total number of governance tokens from the votes cast for this side
|
||||
* Total tokens of governance token from the votes casted for this side
|
||||
*/
|
||||
totalTokens: string;
|
||||
/**
|
||||
* Total number of votes cast for this side
|
||||
* Total number of votes casted for this side
|
||||
*/
|
||||
totalNumber: string;
|
||||
/**
|
||||
* All votes cast for this side
|
||||
* All votes casted for this side
|
||||
*/
|
||||
votes: ProposalsQuery_proposals_votes_no_votes[] | null;
|
||||
}
|
||||
@@ -229,11 +228,11 @@ export interface ProposalsQuery_proposals_votes {
|
||||
export interface ProposalsQuery_proposals {
|
||||
__typename: "Proposal";
|
||||
/**
|
||||
* Proposal ID that is filled by Vega once proposal reaches the network
|
||||
* Proposal ID that is filled by VEGA once proposal reaches the network
|
||||
*/
|
||||
id: string | null;
|
||||
/**
|
||||
* A UUID reference to aid tracking proposals on Vega
|
||||
* A UUID reference to aid tracking proposals on VEGA
|
||||
*/
|
||||
reference: string;
|
||||
/**
|
||||
@@ -264,7 +263,7 @@ export interface ProposalsQuery_proposals {
|
||||
|
||||
export interface ProposalsQuery {
|
||||
/**
|
||||
* All governance proposals in the Vega network
|
||||
* All governance proposals in the VEGA network
|
||||
*/
|
||||
proposals: ProposalsQuery_proposals[] | null;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,21 @@
|
||||
import { DATA_SOURCES } from '../../config';
|
||||
import { StatsManager } from '@vegaprotocol/network-stats';
|
||||
import { ENV } from '../../config/env';
|
||||
|
||||
const envName = ENV.envName;
|
||||
const restEndpoint = DATA_SOURCES.restEndpoint;
|
||||
const statsEndpoint = `${restEndpoint}/statistics`;
|
||||
const nodesEndpoint = `${restEndpoint}/nodes-data`;
|
||||
|
||||
const Home = () => {
|
||||
const classnames = 'mt-12 grid grid-cols-1 lg:grid-cols-2 lg:gap-16';
|
||||
return (
|
||||
<section>
|
||||
<StatsManager className={classnames} />
|
||||
<StatsManager
|
||||
envName={envName}
|
||||
statsEndpoint={statsEndpoint}
|
||||
nodesEndpoint={nodesEndpoint}
|
||||
className="mt-12 grid grid-cols-1 lg:grid-cols-2 lg:gap-16"
|
||||
/>
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
+29
-21
@@ -52,7 +52,7 @@ export interface MarketsQuery_markets_tradableInstrument_instrument_product_sett
|
||||
export interface MarketsQuery_markets_tradableInstrument_instrument_product_settlementAsset {
|
||||
__typename: "Asset";
|
||||
/**
|
||||
* The ID of the asset
|
||||
* The id of the asset
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
@@ -60,9 +60,13 @@ export interface MarketsQuery_markets_tradableInstrument_instrument_product_sett
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18
|
||||
* The precision of the asset
|
||||
*/
|
||||
decimals: number;
|
||||
/**
|
||||
* The total supply of the market
|
||||
*/
|
||||
totalSupply: string;
|
||||
/**
|
||||
* The global reward pool account for this asset
|
||||
*/
|
||||
@@ -108,11 +112,11 @@ export interface MarketsQuery_markets_tradableInstrument_riskModel_LogNormalRisk
|
||||
*/
|
||||
r: number;
|
||||
/**
|
||||
* sigma parameter, annualised volatility of the underlying asset, must be a strictly non-negative real number
|
||||
* sigma parameter
|
||||
*/
|
||||
sigma: number;
|
||||
/**
|
||||
* mu parameter, annualised growth rate of the underlying asset
|
||||
* mu parameter
|
||||
*/
|
||||
mu: number;
|
||||
}
|
||||
@@ -120,15 +124,15 @@ export interface MarketsQuery_markets_tradableInstrument_riskModel_LogNormalRisk
|
||||
export interface MarketsQuery_markets_tradableInstrument_riskModel_LogNormalRiskModel {
|
||||
__typename: "LogNormalRiskModel";
|
||||
/**
|
||||
* Tau parameter of the risk model, projection horizon measured as a year fraction used in the expected shortfall calculation to obtain the maintenance margin, must be a strictly non-negative real number
|
||||
* Tau parameter of the risk model
|
||||
*/
|
||||
tau: number;
|
||||
/**
|
||||
* Lambda parameter of the risk model, probability confidence level used in expected shortfall calculation when obtaining the maintenance margin level, must be strictly greater than 0 and strictly smaller than 1
|
||||
* Lambda parameter of the risk model
|
||||
*/
|
||||
riskAversionParameter: number;
|
||||
/**
|
||||
* Parameters for the log normal risk model
|
||||
* Params for the log normal risk model
|
||||
*/
|
||||
params: MarketsQuery_markets_tradableInstrument_riskModel_LogNormalRiskModel_params;
|
||||
}
|
||||
@@ -166,7 +170,7 @@ export interface MarketsQuery_markets_tradableInstrument_marginCalculator_scalin
|
||||
*/
|
||||
initialMargin: number;
|
||||
/**
|
||||
* the scaling factor that determines the overflow margin level
|
||||
* The scaling factor that determines the overflow margin level
|
||||
*/
|
||||
collateralRelease: number;
|
||||
}
|
||||
@@ -182,7 +186,7 @@ export interface MarketsQuery_markets_tradableInstrument_marginCalculator {
|
||||
export interface MarketsQuery_markets_tradableInstrument {
|
||||
__typename: "TradableInstrument";
|
||||
/**
|
||||
* An instance of, or reference to, a fully specified instrument.
|
||||
* An instance of or reference to a fully specified instrument.
|
||||
*/
|
||||
instrument: MarketsQuery_markets_tradableInstrument_instrument;
|
||||
/**
|
||||
@@ -219,7 +223,7 @@ export interface MarketsQuery_markets_priceMonitoringSettings_parameters_trigger
|
||||
probability: number;
|
||||
/**
|
||||
* Price monitoring auction extension duration in seconds should the price
|
||||
* breach its theoretical level over the specified horizon at the specified
|
||||
* breach it's theoretical level over the specified horizon at the specified
|
||||
* probability level (> 0)
|
||||
*/
|
||||
auctionExtensionSecs: number;
|
||||
@@ -239,6 +243,10 @@ export interface MarketsQuery_markets_priceMonitoringSettings {
|
||||
* Specified a set of PriceMonitoringParameters to be use for price monitoring purposes
|
||||
*/
|
||||
parameters: MarketsQuery_markets_priceMonitoringSettings_parameters | null;
|
||||
/**
|
||||
* How often (in seconds) the price monitoring bounds should be updated
|
||||
*/
|
||||
updateFrequencySecs: number;
|
||||
}
|
||||
|
||||
export interface MarketsQuery_markets_liquidityMonitoringParameters_targetStakeParameters {
|
||||
@@ -268,7 +276,7 @@ export interface MarketsQuery_markets_liquidityMonitoringParameters {
|
||||
export interface MarketsQuery_markets_proposal {
|
||||
__typename: "Proposal";
|
||||
/**
|
||||
* Proposal ID that is filled by Vega once proposal reaches the network
|
||||
* Proposal ID that is filled by VEGA once proposal reaches the network
|
||||
*/
|
||||
id: string | null;
|
||||
}
|
||||
@@ -276,7 +284,7 @@ export interface MarketsQuery_markets_proposal {
|
||||
export interface MarketsQuery_markets_accounts_asset {
|
||||
__typename: "Asset";
|
||||
/**
|
||||
* The ID of the asset
|
||||
* The id of the asset
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
@@ -305,7 +313,7 @@ export interface MarketsQuery_markets_data_priceMonitoringBounds_trigger {
|
||||
__typename: "PriceMonitoringTrigger";
|
||||
/**
|
||||
* Price monitoring auction extension duration in seconds should the price
|
||||
* breach its theoretical level over the specified horizon at the specified
|
||||
* breach it's theoretical level over the specified horizon at the specified
|
||||
* probability level (> 0)
|
||||
*/
|
||||
auctionExtensionSecs: number;
|
||||
@@ -346,15 +354,15 @@ export interface MarketsQuery_markets_data_liquidityProviderFeeShare_party {
|
||||
export interface MarketsQuery_markets_data_liquidityProviderFeeShare {
|
||||
__typename: "LiquidityProviderFeeShare";
|
||||
/**
|
||||
* The liquidity provider party ID
|
||||
* The liquidity provider party id
|
||||
*/
|
||||
party: MarketsQuery_markets_data_liquidityProviderFeeShare_party;
|
||||
/**
|
||||
* The share owned by this liquidity provider (float)
|
||||
* The share own by this liquidity provider (float)
|
||||
*/
|
||||
equityLikeShare: string;
|
||||
/**
|
||||
* The average entry valuation of the liquidity provider for the market
|
||||
* the average entry valuation of the liquidity provider for the market
|
||||
*/
|
||||
averageEntryValuation: string;
|
||||
}
|
||||
@@ -362,7 +370,7 @@ export interface MarketsQuery_markets_data_liquidityProviderFeeShare {
|
||||
export interface MarketsQuery_markets_data {
|
||||
__typename: "MarketData";
|
||||
/**
|
||||
* the mark price (an unsigned integer)
|
||||
* the mark price (actually an unsigned int)
|
||||
*/
|
||||
markPrice: string;
|
||||
/**
|
||||
@@ -446,7 +454,7 @@ export interface MarketsQuery_markets_data {
|
||||
*/
|
||||
suppliedStake: string | null;
|
||||
/**
|
||||
* a list of valid price ranges per associated trigger
|
||||
* A list of valid price ranges per associated trigger
|
||||
*/
|
||||
priceMonitoringBounds: MarketsQuery_markets_data_priceMonitoringBounds[] | null;
|
||||
/**
|
||||
@@ -474,12 +482,12 @@ export interface MarketsQuery_markets {
|
||||
*/
|
||||
fees: MarketsQuery_markets_fees;
|
||||
/**
|
||||
* An instance of, or reference to, a tradable instrument.
|
||||
* An instance of or reference to a tradable instrument.
|
||||
*/
|
||||
tradableInstrument: MarketsQuery_markets_tradableInstrument;
|
||||
/**
|
||||
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
|
||||
* number denominated in the currency of the market. (uint64)
|
||||
* number denominated in the currency of the Market. (uint64)
|
||||
*
|
||||
* Examples:
|
||||
* Currency Balance decimalPlaces Real Balance
|
||||
@@ -516,7 +524,7 @@ export interface MarketsQuery_markets {
|
||||
*/
|
||||
state: MarketState;
|
||||
/**
|
||||
* The proposal that initiated this market
|
||||
* The proposal which initiated this market
|
||||
*/
|
||||
proposal: MarketsQuery_markets_proposal | null;
|
||||
/**
|
||||
|
||||
@@ -33,6 +33,7 @@ const MARKETS_QUERY = gql`
|
||||
id
|
||||
name
|
||||
decimals
|
||||
totalSupply
|
||||
globalRewardPoolAccount {
|
||||
balance
|
||||
}
|
||||
@@ -78,6 +79,7 @@ const MARKETS_QUERY = gql`
|
||||
auctionExtensionSecs
|
||||
}
|
||||
}
|
||||
updateFrequencySecs
|
||||
}
|
||||
liquidityMonitoringParameters {
|
||||
triggeringRatio
|
||||
|
||||
@@ -61,7 +61,7 @@ export interface OracleSpecs_oracleSpecs {
|
||||
*/
|
||||
status: OracleSpecStatus;
|
||||
/**
|
||||
* ID is a hash generated from the OracleSpec data.
|
||||
* id is a hash generated from the OracleSpec data.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { gql, useQuery } from '@apollo/client';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import type { OracleSpecs as OracleSpecsQuery } from './__generated__/OracleSpecs';
|
||||
|
||||
import React, { useEffect } from 'react';
|
||||
import React from 'react';
|
||||
import { SyntaxHighlighter } from '@vegaprotocol/ui-toolkit';
|
||||
import { RouteTitle } from '../../components/route-title';
|
||||
import { t } from '@vegaprotocol/react-helpers';
|
||||
@@ -34,20 +33,7 @@ const ORACLE_SPECS_QUERY = gql`
|
||||
`;
|
||||
|
||||
const Oracles = () => {
|
||||
const { hash } = useLocation();
|
||||
const { data, loading } = useQuery<OracleSpecsQuery>(ORACLE_SPECS_QUERY);
|
||||
|
||||
useEffect(() => {
|
||||
if (data && !loading && hash) {
|
||||
const element = document.getElementById(hash.substring(1));
|
||||
if (element) {
|
||||
window.scrollTo({
|
||||
top: element.offsetTop,
|
||||
});
|
||||
}
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [hash, loading, !!data]);
|
||||
const { data } = useQuery<OracleSpecsQuery>(ORACLE_SPECS_QUERY);
|
||||
|
||||
return (
|
||||
<section>
|
||||
@@ -55,7 +41,7 @@ const Oracles = () => {
|
||||
{data?.oracleSpecs
|
||||
? data.oracleSpecs.map((o) => (
|
||||
<React.Fragment key={o.id}>
|
||||
<SubHeading id={o.id.toString()}>{o.id}</SubHeading>
|
||||
<SubHeading>{o.id}</SubHeading>
|
||||
<SyntaxHighlighter data={o} />
|
||||
</React.Fragment>
|
||||
))
|
||||
|
||||
@@ -12,7 +12,7 @@ import { AccountType } from "@vegaprotocol/types";
|
||||
export interface PartyAssetsQuery_party_delegations_node {
|
||||
__typename: "Node";
|
||||
/**
|
||||
* The node URL eg n01.vega.xyz
|
||||
* The node url eg n01.vega.xyz
|
||||
*/
|
||||
id: string;
|
||||
name: string;
|
||||
@@ -49,7 +49,7 @@ export interface PartyAssetsQuery_party_accounts_asset_source_BuiltinAsset {
|
||||
export interface PartyAssetsQuery_party_accounts_asset_source_ERC20 {
|
||||
__typename: "ERC20";
|
||||
/**
|
||||
* The address of the ERC20 contract
|
||||
* The address of the erc20 contract
|
||||
*/
|
||||
contractAddress: string;
|
||||
}
|
||||
@@ -63,11 +63,11 @@ export interface PartyAssetsQuery_party_accounts_asset {
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The ID of the asset
|
||||
* The id of the asset
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18
|
||||
* The precision of the asset
|
||||
*/
|
||||
decimals: number;
|
||||
/**
|
||||
@@ -75,7 +75,7 @@ export interface PartyAssetsQuery_party_accounts_asset {
|
||||
*/
|
||||
symbol: string;
|
||||
/**
|
||||
* The origin source of the asset (e.g: an ERC20 asset)
|
||||
* The origin source of the asset (e.g: an erc20 asset)
|
||||
*/
|
||||
source: PartyAssetsQuery_party_accounts_asset_source;
|
||||
}
|
||||
@@ -115,7 +115,7 @@ export interface PartyAssetsQuery_party {
|
||||
|
||||
export interface PartyAssetsQuery {
|
||||
/**
|
||||
* An entity that is trading on the Vega network
|
||||
* An entity that is trading on the VEGA network
|
||||
*/
|
||||
party: PartyAssetsQuery_party | null;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ const PendingTxs = () => {
|
||||
<RouteTitle data-testid="unconfirmed-transactions-header">
|
||||
{t('Unconfirmed transactions')}
|
||||
</RouteTitle>
|
||||
https://tm.n06.testnet.vega.xyz/tm/unconfirmed_txs
|
||||
https://lb.testnet.vega.xyz/tm/unconfirmed_txs
|
||||
<br />
|
||||
<div>{t(`Number: ${unconfirmedTransactions?.result?.n_txs || 0}`)}</div>
|
||||
<br />
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
import { BrowserRouter as Router } from 'react-router-dom';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { truncateByChars } from '@vegaprotocol/react-helpers';
|
||||
import { TxDetails, txDetailsTruncateLength } from './tx-details';
|
||||
import type { Result } from '../tendermint-transaction-response.d';
|
||||
|
||||
const pubKey = 'test';
|
||||
const hash = '7416753A30622A9E24A06F0172D6C33A95186B36806D96345C6DC5A23FA3F283';
|
||||
const height = '52987';
|
||||
const tx =
|
||||
'ClMIpeWjmKnn77FNEPedA5J9QhJAOGI3YjQzMWNlMmNhNzc4MWMzMTQ1M2IyYjc0MWYwMTJlNzQ1MzBhZDhjMDgzODVkMWQ1YjRiY2VkMTJiNDc1MhKTAQqAATM5NDFlNmExMzQ3MGVhNTlhNGExNmQzMjRiYzlkZjI5YWZkMzYxMDRiZjQ5MzEwZWMxM2ZiOTMxNTM2NGY3ZjU2ZTQyOTJmYTAyZDlhNTBlZDc0OWE0ZjExMzJiNjM2ZTZmMzQ3YzQ2NjdkYmM5OThmYzcyZjYzYzQxMzU4ZTAzEgx2ZWdhL2VkMjU1MTkYAYB9AtI+QDA5MzFhOGZkOGNjOTM1NDU4ZjQ3MGU0MzVhMDU0MTQzODdjZWE2ZjMyOWQ2NDhiZTg5NGZjZDQ0YmQ1MTdhMmI=';
|
||||
|
||||
const txData = {
|
||||
hash,
|
||||
height,
|
||||
tx,
|
||||
index: 0,
|
||||
tx_result: {
|
||||
code: 0,
|
||||
data: null,
|
||||
log: '',
|
||||
info: '',
|
||||
events: [],
|
||||
gas_wanted: '0',
|
||||
gas_used: '0',
|
||||
codespace: '',
|
||||
},
|
||||
};
|
||||
|
||||
const renderComponent = (txData: Result) => (
|
||||
<Router>
|
||||
<TxDetails txData={txData} pubKey={pubKey} />
|
||||
</Router>
|
||||
);
|
||||
|
||||
describe('Transaction details', () => {
|
||||
it('Renders the tx hash', () => {
|
||||
render(renderComponent(txData));
|
||||
expect(screen.getByText(hash)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('Renders the pubKey', () => {
|
||||
render(renderComponent(txData));
|
||||
expect(screen.getByText(pubKey)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('Renders the height', () => {
|
||||
render(renderComponent(txData));
|
||||
expect(screen.getByText(height)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('Renders the truncated tx text', () => {
|
||||
render(renderComponent(txData));
|
||||
expect(
|
||||
screen.getByText(
|
||||
truncateByChars(tx, txDetailsTruncateLength, txDetailsTruncateLength)
|
||||
)
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('Renders a copy button', () => {
|
||||
render(renderComponent(txData));
|
||||
expect(screen.getByTestId('copy-tx-to-clipboard')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Routes } from '../../route-names';
|
||||
import { Button, CopyWithTooltip } from '@vegaprotocol/ui-toolkit';
|
||||
import type { Result } from '../tendermint-transaction-response.d';
|
||||
import {
|
||||
TableWithTbody,
|
||||
TableCell,
|
||||
@@ -8,16 +8,15 @@ import {
|
||||
} from '../../../components/table';
|
||||
import { TruncateInline } from '../../../components/truncate/truncate';
|
||||
import { t } from '@vegaprotocol/react-helpers';
|
||||
import { HighlightedLink } from '../../../components/highlighted-link';
|
||||
import type { Result } from '../tendermint-transaction-response.d';
|
||||
|
||||
import { HighlightedLink } from '../../../components/highlighted-link';
|
||||
interface TxDetailsProps {
|
||||
txData: Result | undefined;
|
||||
pubKey: string | undefined;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export const txDetailsTruncateLength = 30;
|
||||
const truncateLength = 30;
|
||||
|
||||
export const TxDetails = ({ txData, pubKey, className }: TxDetailsProps) => {
|
||||
if (!txData) {
|
||||
@@ -51,25 +50,12 @@ export const TxDetails = ({ txData, pubKey, className }: TxDetailsProps) => {
|
||||
</TableRow>
|
||||
<TableRow modifier="bordered">
|
||||
<TableCell>{t('Encoded txn')}</TableCell>
|
||||
<TableCell
|
||||
modifier="bordered"
|
||||
data-testid="encoded-tnx"
|
||||
className="flex justify-between"
|
||||
>
|
||||
<TableCell modifier="bordered" data-testid="encoded-tnx">
|
||||
<TruncateInline
|
||||
text={txData.tx}
|
||||
startChars={txDetailsTruncateLength}
|
||||
endChars={txDetailsTruncateLength}
|
||||
startChars={truncateLength}
|
||||
endChars={truncateLength}
|
||||
/>
|
||||
<CopyWithTooltip text="">
|
||||
<Button
|
||||
variant="inline-link"
|
||||
prependIconName="duplicate"
|
||||
title={t('Copy tx to clipboard')}
|
||||
onClick={() => navigator.clipboard.writeText(txData.tx)}
|
||||
data-testid="copy-tx-to-clipboard"
|
||||
/>
|
||||
</CopyWithTooltip>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</TableWithTbody>
|
||||
|
||||
@@ -28,33 +28,33 @@ export interface NodesQuery_nodes_epochData {
|
||||
export interface NodesQuery_nodes {
|
||||
__typename: "Node";
|
||||
/**
|
||||
* The node URL eg n01.vega.xyz
|
||||
* The node url eg n01.vega.xyz
|
||||
*/
|
||||
id: string;
|
||||
name: string;
|
||||
/**
|
||||
* URL from which you can get more info about the node.
|
||||
* URL where I can find out more info on the node. Will this be possible?
|
||||
*/
|
||||
infoUrl: string;
|
||||
avatarUrl: string | null;
|
||||
/**
|
||||
* Public key of the node operator
|
||||
* Pubkey of the node operator
|
||||
*/
|
||||
pubkey: string;
|
||||
/**
|
||||
* Tendermint public key of the node
|
||||
* Public key of Tendermint
|
||||
*/
|
||||
tmPubkey: string;
|
||||
/**
|
||||
* Ethereum public key of the node
|
||||
*/
|
||||
ethereumAddress: string;
|
||||
ethereumAdddress: string;
|
||||
/**
|
||||
* Country code for the location of the node
|
||||
*/
|
||||
location: string;
|
||||
/**
|
||||
* The amount of stake the node has put up themselves
|
||||
* The amount the node has put up themselves
|
||||
*/
|
||||
stakedByOperator: string;
|
||||
/**
|
||||
|
||||
@@ -18,7 +18,7 @@ const NODES_QUERY = gql`
|
||||
avatarUrl
|
||||
pubkey
|
||||
tmPubkey
|
||||
ethereumAddress
|
||||
ethereumAdddress
|
||||
location
|
||||
stakedByOperator
|
||||
stakedByDelegates
|
||||
|
||||
@@ -1,10 +1,24 @@
|
||||
import * as Sentry from '@sentry/react';
|
||||
import { BrowserTracing } from '@sentry/tracing';
|
||||
import { createRoot } from 'react-dom/client';
|
||||
import { BrowserRouter } from 'react-router-dom';
|
||||
import './styles.css';
|
||||
|
||||
import App from './app/app';
|
||||
import { ENV } from './app/config/env';
|
||||
import { StrictMode } from 'react';
|
||||
|
||||
const { dsn } = ENV;
|
||||
|
||||
/* istanbul ignore next */
|
||||
if (dsn) {
|
||||
Sentry.init({
|
||||
dsn,
|
||||
integrations: [new BrowserTracing()],
|
||||
tracesSampleRate: 1,
|
||||
environment: ENV.envName,
|
||||
});
|
||||
}
|
||||
const rootElement = document.getElementById('root');
|
||||
const root = rootElement && createRoot(rootElement);
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ NX_URL=$URL
|
||||
NX_DEPLOY_URL=$DEPLOY_URL
|
||||
NX_DEPLOY_PRIME_URL=$DEPLOY_PRIME_URL
|
||||
|
||||
NX_VEGA_URL=https://api.n11.testnet.vega.xyz/graphql
|
||||
NX_VEGA_URL=https://lb.testnet.vega.xyz/query
|
||||
NX_VEGA_ENV=TESTNET
|
||||
NX_VEGA_REST=https://api.n11.testnet.vega.xyz
|
||||
NX_VEGA_REST=https://lb.testnet.vega.xyz/datanode/rest
|
||||
NX_VEGA_WALLET_URL=http://localhost:1789/api/v1
|
||||
+3
-2
@@ -12,8 +12,9 @@ module.exports = defineConfig({
|
||||
supportFile: './src/support/index.ts',
|
||||
video: true,
|
||||
videoUploadOnPasses: false,
|
||||
videosFolder: '../../dist/cypress/apps/console-lite-e2e/videos',
|
||||
screenshotsFolder: '../../dist/cypress/apps/console-lite-e2e/screenshots',
|
||||
videosFolder: '../../dist/cypress/apps/simple-trading-app-e2e/videos',
|
||||
screenshotsFolder:
|
||||
'../../dist/cypress/apps/simple-trading-app-e2e/screenshots',
|
||||
chromeWebSecurity: false,
|
||||
viewportWidth: 1440,
|
||||
viewportHeight: 900,
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"root": "apps/simple-trading-app-e2e",
|
||||
"sourceRoot": "apps/simple-trading-app-e2e/src",
|
||||
"projectType": "application",
|
||||
"targets": {
|
||||
"e2e": {
|
||||
"executor": "@nrwl/cypress:cypress",
|
||||
"options": {
|
||||
"cypressConfig": "apps/simple-trading-app-e2e/cypress.config.js",
|
||||
"devServerTarget": "simple-trading-app:serve"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"devServerTarget": "simple-trading-app:serve:production"
|
||||
}
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nrwl/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
"options": {
|
||||
"lintFilePatterns": ["apps/simple-trading-app-e2e/**/*.{js,ts}"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": [],
|
||||
"implicitDependencies": ["simple-trading-app"]
|
||||
}
|
||||
+5
-40
@@ -1,14 +1,13 @@
|
||||
import { aliasQuery } from '@vegaprotocol/cypress';
|
||||
import {
|
||||
generateLongListMarkets,
|
||||
generateSimpleMarkets,
|
||||
} from '../support/mocks/generate-markets';
|
||||
import { generateSimpleMarkets } from '../support/mocks/generate-markets';
|
||||
import { generateFilters } from '../support/mocks/generate-filters';
|
||||
|
||||
describe('market list', () => {
|
||||
describe('simple url', () => {
|
||||
beforeEach(() => {
|
||||
cy.mockGQL((req) => {
|
||||
aliasQuery(req, 'SimpleMarkets', generateSimpleMarkets());
|
||||
aliasQuery(req, 'MarketFilters', generateFilters());
|
||||
});
|
||||
cy.visit('/markets');
|
||||
});
|
||||
@@ -63,6 +62,7 @@ describe('market list', () => {
|
||||
beforeEach(() => {
|
||||
cy.mockGQL((req) => {
|
||||
aliasQuery(req, 'SimpleMarkets', generateSimpleMarkets());
|
||||
aliasQuery(req, 'MarketFilters', generateFilters());
|
||||
});
|
||||
});
|
||||
|
||||
@@ -73,7 +73,7 @@ describe('market list', () => {
|
||||
|
||||
it('last asset (if exists)', () => {
|
||||
cy.visit('/markets');
|
||||
cy.wait('@SimpleMarkets').then((filters) => {
|
||||
cy.wait('@MarketFilters').then((filters) => {
|
||||
if (filters?.response?.body?.data?.markets?.length) {
|
||||
const asset =
|
||||
filters.response.body.data.markets[0].tradableInstrument.instrument
|
||||
@@ -93,39 +93,4 @@ describe('market list', () => {
|
||||
.should('have.text', 'Future');
|
||||
});
|
||||
});
|
||||
|
||||
describe('long list of results should be handled properly', () => {
|
||||
it('handles 5000 markets', () => {
|
||||
cy.viewport(1440, 900);
|
||||
cy.mockGQL((req) => {
|
||||
aliasQuery(req, 'SimpleMarkets', generateLongListMarkets(5000));
|
||||
});
|
||||
performance.mark('start-5k');
|
||||
cy.visit('/markets');
|
||||
cy.get('.ag-center-cols-container', { timeout: 50000 }).then(() => {
|
||||
performance.mark('end-5k');
|
||||
performance.measure('load-5k', 'start-5k', 'end-5k');
|
||||
const measure = performance.getEntriesByName('load-5k')[0];
|
||||
expect(measure.duration).lte(20000);
|
||||
cy.log(`Ag-grid 5k load took ${measure.duration} milliseconds.`);
|
||||
|
||||
cy.get('.ag-root').should('have.attr', 'aria-rowcount', '5001');
|
||||
cy.get('.ag-center-cols-container')
|
||||
.find('[role="row"]')
|
||||
.its('length')
|
||||
.then((length) => expect(length).to.be.closeTo(21, 2));
|
||||
cy.get('.ag-cell-label-container').eq(4).click();
|
||||
cy.get('body').then(($body) => {
|
||||
for (let i = 0; i < 20; i++) {
|
||||
cy.wrap($body).realPress('Tab', { pressDelay: 300 });
|
||||
}
|
||||
});
|
||||
cy.focused().parent('.ag-row').should('have.attr', 'row-index', '19');
|
||||
cy.get('.ag-center-cols-container')
|
||||
.find('[role="row"]')
|
||||
.its('length')
|
||||
.then((length) => expect(length).to.be.closeTo(31, 2));
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,91 @@
|
||||
describe('market selector', () => {
|
||||
let markets;
|
||||
before(() => {
|
||||
cy.intercept('POST', '/query', (req) => {
|
||||
const { body } = req;
|
||||
if (body.operationName === 'SimpleMarkets') {
|
||||
req.alias = `gqlSimpleMarketsQuery`;
|
||||
}
|
||||
});
|
||||
cy.visit('/markets');
|
||||
cy.wait('@gqlSimpleMarketsQuery').then((response) => {
|
||||
if (response.response.body.data?.markets?.length) {
|
||||
markets = response.response.body.data.markets;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should be properly rendered', () => {
|
||||
if (markets?.length) {
|
||||
cy.visit(`/trading/${markets[0].id}`);
|
||||
cy.get('input[placeholder="Search"]').should(
|
||||
'have.value',
|
||||
markets[0].name
|
||||
);
|
||||
cy.getByTestId('arrow-button').click();
|
||||
cy.getByTestId('market-pane').should('be.visible');
|
||||
cy.getByTestId('market-pane')
|
||||
.children()
|
||||
.find('[role="button"]')
|
||||
.first()
|
||||
.should('contain.text', markets[0].name);
|
||||
cy.getByTestId('market-pane')
|
||||
.children()
|
||||
.find('[role="button"]')
|
||||
.first()
|
||||
.click();
|
||||
cy.getByTestId('market-pane').should('not.be.visible');
|
||||
}
|
||||
});
|
||||
|
||||
it('typing should change list', () => {
|
||||
if (markets?.length) {
|
||||
cy.visit(`/trading/${markets[0].id}`);
|
||||
cy.get('input[placeholder="Search"]').type('{backspace}');
|
||||
cy.getByTestId('market-pane')
|
||||
.children()
|
||||
.find('[role="button"]')
|
||||
.should('have.length.at.least', 1);
|
||||
cy.get('input[placeholder="Search"]').clear();
|
||||
cy.get('input[placeholder="Search"]').type('app');
|
||||
const filtered = markets.filter((market) => market.name.match(/app/i));
|
||||
cy.getByTestId('market-pane')
|
||||
.children()
|
||||
.find('[role="button"]')
|
||||
.should('have.length', filtered.length);
|
||||
cy.getByTestId('market-pane')
|
||||
.children()
|
||||
.find('[role="button"]')
|
||||
.last()
|
||||
.click();
|
||||
cy.location('pathname').should(
|
||||
'eq',
|
||||
`/trading/${filtered[filtered.length - 1].id}`
|
||||
);
|
||||
cy.get('input[placeholder="Search"]').should(
|
||||
'have.value',
|
||||
filtered[filtered.length - 1].name
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
it('mobile view', () => {
|
||||
if (markets?.length) {
|
||||
cy.viewport('iphone-xr');
|
||||
cy.visit(`/trading/${markets[0].id}`);
|
||||
cy.get('[role="dialog"]').should('not.exist');
|
||||
cy.getByTestId('arrow-button').click();
|
||||
cy.get('[role="dialog"]').should('be.visible');
|
||||
cy.get('input[placeholder="Search"]').clear();
|
||||
cy.getByTestId('market-pane')
|
||||
.children()
|
||||
.find('[role="button"]')
|
||||
.should('have.length', markets.length);
|
||||
cy.getByTestId('dialog-close').click();
|
||||
cy.get('input[placeholder="Search"]').should(
|
||||
'have.value',
|
||||
markets[0].name
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
+15
-104
@@ -30,23 +30,9 @@ describe('Market trade', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should not display steps if wallet is disconnected', () => {
|
||||
cy.visit(`/trading/${markets[0].id}`);
|
||||
cy.getByTestId('trading-connect-wallet')
|
||||
.find('h3')
|
||||
.should('have.text', 'Please connect your Vega wallet to make a trade');
|
||||
cy.getByTestId('trading-connect-wallet')
|
||||
.find('button')
|
||||
.should('have.text', 'Connect Vega wallet');
|
||||
cy.getByTestId('trading-connect-wallet')
|
||||
.find('a')
|
||||
.should('have.text', 'https://vega.xyz/wallet');
|
||||
});
|
||||
|
||||
it('side selector should work well', () => {
|
||||
if (markets?.length) {
|
||||
cy.visit(`/trading/${markets[0].id}`);
|
||||
connectVegaWallet();
|
||||
cy.get('#step-1-control [aria-label^="Selected value"]').should(
|
||||
'have.text',
|
||||
'Long'
|
||||
@@ -65,7 +51,6 @@ describe('Market trade', () => {
|
||||
if (markets?.length) {
|
||||
cy.viewport('iphone-xr');
|
||||
cy.visit(`/trading/${markets[0].id}`);
|
||||
connectVegaWallet();
|
||||
cy.getByTestId('next-button').scrollIntoView().click();
|
||||
|
||||
cy.get('button[aria-label="Open long position"]').should(
|
||||
@@ -128,9 +113,6 @@ describe('Market trade', () => {
|
||||
.eq(0)
|
||||
.find('button')
|
||||
.should('have.text', '1');
|
||||
|
||||
cy.getByTestId('max-label').should('have.text', '21');
|
||||
|
||||
cy.getByTestId('percentage-selector')
|
||||
.find('button')
|
||||
.contains('Max')
|
||||
@@ -170,76 +152,26 @@ describe('Market trade', () => {
|
||||
}
|
||||
});
|
||||
|
||||
it('notional position size should be present', () => {
|
||||
if (markets?.length) {
|
||||
cy.visit(`/trading/${markets[1].id}`);
|
||||
connectVegaWallet();
|
||||
cy.get('#step-1-control [aria-label^="Selected value"]').click();
|
||||
cy.get('button[aria-label="Open short position"]').click();
|
||||
cy.get('#step-2-control').click();
|
||||
cy.get('#step-2-panel')
|
||||
.find('dd')
|
||||
.eq(0)
|
||||
.find('button')
|
||||
.should('have.text', '1');
|
||||
cy.get('#step-2-panel').find('dd').eq(0).find('button').click();
|
||||
cy.get('#step-2-panel')
|
||||
.find('dd')
|
||||
.eq(0)
|
||||
.find('input')
|
||||
.type('{backspace}2');
|
||||
cy.get('#step-2-panel').find('dd').eq(0).find('button').click();
|
||||
cy.get('#step-2-panel')
|
||||
.find('dt')
|
||||
.eq(2)
|
||||
.should('have.text', 'Est. Position Size (tDAI)');
|
||||
cy.get('#step-2-panel').find('dd').eq(2).should('have.text', '197.86012');
|
||||
}
|
||||
});
|
||||
|
||||
it('total fees should be displayed', () => {
|
||||
if (markets?.length) {
|
||||
cy.visit(`/trading/${markets[1].id}`);
|
||||
connectVegaWallet();
|
||||
cy.get('#step-1-control [aria-label^="Selected value"]').click();
|
||||
cy.get('button[aria-label="Open short position"]').click();
|
||||
cy.get('#step-2-control').click();
|
||||
cy.get('#step-2-panel')
|
||||
.find('dt')
|
||||
.eq(3)
|
||||
.should('have.text', 'Est. Fees (tDAI)');
|
||||
cy.get('#step-2-panel')
|
||||
.find('dd')
|
||||
.eq(3)
|
||||
.should('have.text', '3.00000 (3.03%)');
|
||||
}
|
||||
});
|
||||
|
||||
it('order review should display proper calculations', () => {
|
||||
if (markets?.length) {
|
||||
cy.visit(`/trading/${markets[0].id}`);
|
||||
connectVegaWallet();
|
||||
cy.get('#step-3-control').click();
|
||||
|
||||
cy.getByTestId('review-trade')
|
||||
.get('#contracts_tooltip_trigger')
|
||||
.trigger('click')
|
||||
.realTouch();
|
||||
|
||||
cy.get('[data-radix-popper-content-wrapper]').contains(
|
||||
'The number of contracts determines'
|
||||
);
|
||||
cy.get('#step-3-panel').find('dd').eq(1).should('have.text', '1');
|
||||
|
||||
cy.get('#step-3-panel').find('dd').eq(2).should('have.text', '98.93006');
|
||||
|
||||
cy.get('#step-3-panel')
|
||||
.find('dd')
|
||||
cy.get('h3').contains('Review Trade').click();
|
||||
cy.getByTestId('key-value-table')
|
||||
.find('dl')
|
||||
.eq(1)
|
||||
.find('dd div')
|
||||
.should('have.text', '25.78726');
|
||||
cy.getByTestId('key-value-table')
|
||||
.find('dl')
|
||||
.eq(2)
|
||||
.find('dd div')
|
||||
.should('have.text', '1.00000');
|
||||
cy.getByTestId('key-value-table')
|
||||
.find('dl')
|
||||
.eq(3)
|
||||
.should('have.text', '3.00000 (3.03%)');
|
||||
|
||||
cy.get('#step-3-panel').find('dd').eq(4).should('have.text', ' - ');
|
||||
|
||||
.find('dd div')
|
||||
.should('have.text', ' - ');
|
||||
cy.getByTestId('place-order').click();
|
||||
cy.getByTestId('dialog-title').should(
|
||||
'have.text',
|
||||
@@ -247,25 +179,4 @@ describe('Market trade', () => {
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
it('info tooltip on mobile view should work well', () => {
|
||||
if (markets?.length) {
|
||||
cy.viewport('iphone-xr');
|
||||
cy.visit(`/trading/${markets[0].id}`);
|
||||
connectVegaWallet();
|
||||
cy.get('#step-3-control').click();
|
||||
|
||||
cy.getByTestId('review-trade')
|
||||
.get('#contracts_tooltip_trigger')
|
||||
.realTouch();
|
||||
cy.get('[data-radix-popper-content-wrapper]').contains(
|
||||
'The number of contracts determines'
|
||||
);
|
||||
|
||||
cy.getByTestId('review-trade').get('div.cursor-help').eq(1).realTouch();
|
||||
cy.get('[data-radix-popper-content-wrapper]').contains(
|
||||
'The notional size represents the position size'
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
+2
-2
@@ -11,9 +11,9 @@ describe('Portfolio page', () => {
|
||||
it('button for wallet connect should work', () => {
|
||||
cy.visit('/');
|
||||
cy.get('[href="/portfolio"]').eq(0).click();
|
||||
cy.getByTestId('trading-connect-wallet').should('be.visible');
|
||||
cy.getByTestId('connect-vega-wallet-text').should('be.visible');
|
||||
connectVegaWallet();
|
||||
cy.getByTestId('trading-connect-wallet').should('not.exist');
|
||||
cy.getByTestId('connect-vega-wallet-text').should('not.exist');
|
||||
});
|
||||
|
||||
it('certain tabs should exist', () => {
|
||||
-1
@@ -14,6 +14,5 @@
|
||||
// ***********************************************************
|
||||
|
||||
import '@vegaprotocol/cypress';
|
||||
import 'cypress-real-events/support';
|
||||
// Import commands.js using ES2015 syntax:
|
||||
import './commands';
|
||||
+1
-1
@@ -5,7 +5,7 @@ export const generateDealTicket = () => {
|
||||
name: 'AAVEDAI Monthly (30 Jun 2022)',
|
||||
decimalPlaces: 5,
|
||||
positionDecimalPlaces: 0,
|
||||
state: 'STATE_ACTIVE',
|
||||
state: 'Active',
|
||||
tradingMode: 'Continuous',
|
||||
tradableInstrument: {
|
||||
instrument: {
|
||||
+1
-6
@@ -1,12 +1,7 @@
|
||||
export const generateEstimateOrder = () => {
|
||||
return {
|
||||
estimateOrder: {
|
||||
fee: {
|
||||
__typename: 'TradeFee',
|
||||
makerFee: '100000',
|
||||
liquidityFee: '100000',
|
||||
infrastructureFee: '100000',
|
||||
},
|
||||
totalFeeAmount: '16085.09240212.7380425.46',
|
||||
marginLevels: {
|
||||
initialLevel: '2844054.80937741220203',
|
||||
__typename: 'MarginLevels',
|
||||
@@ -0,0 +1,84 @@
|
||||
export const generateFilters = () => {
|
||||
return {
|
||||
markets: [
|
||||
{
|
||||
tradableInstrument: {
|
||||
instrument: {
|
||||
product: {
|
||||
__typename: 'Future',
|
||||
settlementAsset: { symbol: 'fDAI', __typename: 'Asset' },
|
||||
},
|
||||
__typename: 'Instrument',
|
||||
},
|
||||
__typename: 'TradableInstrument',
|
||||
},
|
||||
__typename: 'Market',
|
||||
},
|
||||
{
|
||||
tradableInstrument: {
|
||||
instrument: {
|
||||
product: {
|
||||
__typename: 'Future',
|
||||
settlementAsset: { symbol: 'fBTC', __typename: 'Asset' },
|
||||
},
|
||||
__typename: 'Instrument',
|
||||
},
|
||||
__typename: 'TradableInstrument',
|
||||
},
|
||||
__typename: 'Market',
|
||||
},
|
||||
{
|
||||
tradableInstrument: {
|
||||
instrument: {
|
||||
product: {
|
||||
__typename: 'Future',
|
||||
settlementAsset: { symbol: 'fDAI', __typename: 'Asset' },
|
||||
},
|
||||
__typename: 'Instrument',
|
||||
},
|
||||
__typename: 'TradableInstrument',
|
||||
},
|
||||
__typename: 'Market',
|
||||
},
|
||||
{
|
||||
tradableInstrument: {
|
||||
instrument: {
|
||||
product: {
|
||||
__typename: 'Future',
|
||||
settlementAsset: { symbol: 'fDAI', __typename: 'Asset' },
|
||||
},
|
||||
__typename: 'Instrument',
|
||||
},
|
||||
__typename: 'TradableInstrument',
|
||||
},
|
||||
__typename: 'Market',
|
||||
},
|
||||
{
|
||||
tradableInstrument: {
|
||||
instrument: {
|
||||
product: {
|
||||
__typename: 'Future',
|
||||
settlementAsset: { symbol: 'fUSDC', __typename: 'Asset' },
|
||||
},
|
||||
__typename: 'Instrument',
|
||||
},
|
||||
__typename: 'TradableInstrument',
|
||||
},
|
||||
__typename: 'Market',
|
||||
},
|
||||
{
|
||||
tradableInstrument: {
|
||||
instrument: {
|
||||
product: {
|
||||
__typename: 'Future',
|
||||
settlementAsset: { symbol: 'fEURO', __typename: 'Asset' },
|
||||
},
|
||||
__typename: 'Instrument',
|
||||
},
|
||||
__typename: 'TradableInstrument',
|
||||
},
|
||||
__typename: 'Market',
|
||||
},
|
||||
],
|
||||
};
|
||||
};
|
||||
+124
-48
@@ -1,17 +1,123 @@
|
||||
import { protoMarket } from './commons';
|
||||
|
||||
export const generateSimpleMarkets = () => {
|
||||
return {
|
||||
markets: [
|
||||
{ ...protoMarket },
|
||||
{
|
||||
id: 'first-btcusd-id',
|
||||
name: 'AAVEDAI Monthly (30 Jun 2022)',
|
||||
data: {
|
||||
market: {
|
||||
id: 'first-btcusd-id',
|
||||
state: 'Active',
|
||||
__typename: 'Market',
|
||||
},
|
||||
__typename: 'MarketData',
|
||||
},
|
||||
tradableInstrument: {
|
||||
instrument: {
|
||||
code: 'AAVEDAI.MF21',
|
||||
metadata: {
|
||||
tags: [
|
||||
'formerly:2839D9B2329C9E70',
|
||||
'base:AAVE',
|
||||
'quote:DAI',
|
||||
'class:fx/crypto',
|
||||
'monthly',
|
||||
'sector:defi',
|
||||
],
|
||||
__typename: 'InstrumentMetadata',
|
||||
},
|
||||
product: {
|
||||
__typename: 'Future',
|
||||
quoteName: 'DAI',
|
||||
settlementAsset: { symbol: 'tDAI', __typename: 'Asset' },
|
||||
},
|
||||
__typename: 'Instrument',
|
||||
},
|
||||
__typename: 'TradableInstrument',
|
||||
},
|
||||
candles: [
|
||||
{ open: '9556163', close: '9587028', __typename: 'Candle' },
|
||||
{
|
||||
open: '9587028',
|
||||
close: '9769899',
|
||||
__typename: 'Candle',
|
||||
},
|
||||
{ open: '9769899', close: '9586292', __typename: 'Candle' },
|
||||
{
|
||||
open: '9586292',
|
||||
close: '9261774',
|
||||
__typename: 'Candle',
|
||||
},
|
||||
{ open: '9261773', close: '9236369', __typename: 'Candle' },
|
||||
{
|
||||
open: '9236369',
|
||||
close: '9226070',
|
||||
__typename: 'Candle',
|
||||
},
|
||||
{ open: '9226077', close: '9233252', __typename: 'Candle' },
|
||||
{
|
||||
open: '9249854',
|
||||
close: '9333038',
|
||||
__typename: 'Candle',
|
||||
},
|
||||
{ open: '9333038', close: '9410371', __typename: 'Candle' },
|
||||
{
|
||||
open: '9410371',
|
||||
close: '9626249',
|
||||
__typename: 'Candle',
|
||||
},
|
||||
{ open: '9626247', close: '9493253', __typename: 'Candle' },
|
||||
{
|
||||
open: '9493253',
|
||||
close: '9309054',
|
||||
__typename: 'Candle',
|
||||
},
|
||||
{ open: '9309054', close: '9378428', __typename: 'Candle' },
|
||||
{
|
||||
open: '9378428',
|
||||
close: '9352996',
|
||||
__typename: 'Candle',
|
||||
},
|
||||
{ open: '9352996', close: '9451142', __typename: 'Candle' },
|
||||
{
|
||||
open: '9451142',
|
||||
close: '9691070',
|
||||
__typename: 'Candle',
|
||||
},
|
||||
{ open: '9691071', close: '9622031', __typename: 'Candle' },
|
||||
{
|
||||
open: '9622034',
|
||||
close: '9519285',
|
||||
__typename: 'Candle',
|
||||
},
|
||||
{ open: '9528904', close: '9671275', __typename: 'Candle' },
|
||||
{
|
||||
open: '9671275',
|
||||
close: '9988454',
|
||||
__typename: 'Candle',
|
||||
},
|
||||
{ open: '9982457', close: '10085537', __typename: 'Candle' },
|
||||
{
|
||||
open: '10085537',
|
||||
close: '9967390',
|
||||
__typename: 'Candle',
|
||||
},
|
||||
{ open: '9967390', close: '9974844', __typename: 'Candle' },
|
||||
{
|
||||
open: '9974844',
|
||||
close: '9940706',
|
||||
__typename: 'Candle',
|
||||
},
|
||||
],
|
||||
__typename: 'Market',
|
||||
},
|
||||
{
|
||||
id: '57fbaa322e97cfc8bb5f1de048c37e033c41b1ac1906d3aed9960912a067ef5a',
|
||||
name: 'CELUSD (June 2022)',
|
||||
state: 'Active',
|
||||
data: {
|
||||
market: {
|
||||
id: '57fbaa322e97cfc8bb5f1de048c37e033c41b1ac1906d3aed9960912a067ef5a',
|
||||
state: 'STATE_PENDING',
|
||||
state: 'Pending',
|
||||
__typename: 'Market',
|
||||
},
|
||||
__typename: 'MarketData',
|
||||
@@ -44,11 +150,10 @@ export const generateSimpleMarkets = () => {
|
||||
{
|
||||
id: 'ccf2f04865e5951ac3405da6e16b7cbdb535a0ad32df4df2dbed4262cf473255',
|
||||
name: 'XMRUSD market',
|
||||
state: 'Suspended',
|
||||
data: {
|
||||
market: {
|
||||
id: 'ccf2f04865e5951ac3405da6e16b7cbdb535a0ad32df4df2dbed4262cf473255',
|
||||
state: 'STATE_PROPOSED',
|
||||
state: 'Proposed',
|
||||
__typename: 'Market',
|
||||
},
|
||||
__typename: 'MarketData',
|
||||
@@ -81,11 +186,10 @@ export const generateSimpleMarkets = () => {
|
||||
{
|
||||
id: '6030e5b4e0ca3297a26081e5af4d453f97f96baab2d74bf56f84efcffc4c382f',
|
||||
name: 'UNIDAI Monthly (30 Jun 2022)',
|
||||
state: 'Active',
|
||||
data: {
|
||||
market: {
|
||||
id: '6030e5b4e0ca3297a26081e5af4d453f97f96baab2d74bf56f84efcffc4c382f',
|
||||
state: 'STATE_SUSPENDED',
|
||||
state: 'Suspended',
|
||||
__typename: 'Market',
|
||||
},
|
||||
__typename: 'MarketData',
|
||||
@@ -192,11 +296,10 @@ export const generateSimpleMarkets = () => {
|
||||
{
|
||||
id: 'de74a5572045b300e8ec50d136896912ec76e7d7ec135bc305dfd4854d9363a4',
|
||||
name: 'XMRUSD market',
|
||||
state: 'Pending',
|
||||
data: {
|
||||
market: {
|
||||
id: 'de74a5572045b300e8ec50d136896912ec76e7d7ec135bc305dfd4854d9363a4',
|
||||
state: 'STATE_ACTIVE',
|
||||
state: 'Active',
|
||||
__typename: 'Market',
|
||||
},
|
||||
__typename: 'MarketData',
|
||||
@@ -302,11 +405,10 @@ export const generateSimpleMarkets = () => {
|
||||
{
|
||||
id: '31ea96284611771e486c820acb26a325a99664f9854b5a7e7ad99023efa8f9e6',
|
||||
name: 'ApeCoin (18 Jul 2022)',
|
||||
state: 'Closed',
|
||||
data: {
|
||||
market: {
|
||||
id: '31ea96284611771e486c820acb26a325a99664f9854b5a7e7ad99023efa8f9e6',
|
||||
state: 'STATE_PROPOSED',
|
||||
state: 'Proposed',
|
||||
__typename: 'Market',
|
||||
},
|
||||
__typename: 'MarketData',
|
||||
@@ -338,11 +440,10 @@ export const generateSimpleMarkets = () => {
|
||||
{
|
||||
id: '34cff959cdc2ffdb0f167820d701fe8b51cc6b8588e650d93369aaa22d6f8b74',
|
||||
name: 'BTCUSD Monthly (18 Jul 2022)',
|
||||
state: 'Settled',
|
||||
data: {
|
||||
market: {
|
||||
id: '34cff959cdc2ffdb0f167820d701fe8b51cc6b8588e650d93369aaa22d6f8b74',
|
||||
state: 'STATE_PROPOSED',
|
||||
state: 'Proposed',
|
||||
__typename: 'Market',
|
||||
},
|
||||
__typename: 'MarketData',
|
||||
@@ -376,11 +477,10 @@ export const generateSimpleMarkets = () => {
|
||||
{
|
||||
id: '87b0bbb3c171baa5d97dfc3852332829c91e5c5dc9f7c8fb584c6d8ac75aaaf2',
|
||||
name: 'Builders Club x ETHcc',
|
||||
state: 'Settled',
|
||||
data: {
|
||||
market: {
|
||||
id: '87b0bbb3c171baa5d97dfc3852332829c91e5c5dc9f7c8fb584c6d8ac75aaaf2',
|
||||
state: 'STATE_ACTIVE',
|
||||
state: 'Active',
|
||||
__typename: 'Market',
|
||||
},
|
||||
__typename: 'MarketData',
|
||||
@@ -474,11 +574,10 @@ export const generateSimpleMarkets = () => {
|
||||
{
|
||||
id: '45266143c6e9b58f4cff9b8906e971c531bb29ea7af01066973f9b77e8134823',
|
||||
name: 'BTCUSD Monthly (18 Jul 2022)',
|
||||
state: 'Pending',
|
||||
data: {
|
||||
market: {
|
||||
id: '45266143c6e9b58f4cff9b8906e971c531bb29ea7af01066973f9b77e8134823',
|
||||
state: 'STATE_PROPOSED',
|
||||
state: 'Proposed',
|
||||
__typename: 'Market',
|
||||
},
|
||||
__typename: 'MarketData',
|
||||
@@ -512,11 +611,10 @@ export const generateSimpleMarkets = () => {
|
||||
{
|
||||
id: '65663ebdc96161162769c4d5c5508137416748178d7cb28e2cb0d07a151a2bc6',
|
||||
name: 'ETHBTC Quarterly (30 Jun 2022)',
|
||||
state: 'Active',
|
||||
data: {
|
||||
market: {
|
||||
id: '65663ebdc96161162769c4d5c5508137416748178d7cb28e2cb0d07a151a2bc6',
|
||||
state: 'STATE_ACTIVE',
|
||||
state: 'Active',
|
||||
__typename: 'Market',
|
||||
},
|
||||
__typename: 'MarketData',
|
||||
@@ -623,11 +721,10 @@ export const generateSimpleMarkets = () => {
|
||||
{
|
||||
id: '234afabd27e3bce1a879039c041f9f00f915d98459935ddafd0169d38dd13850',
|
||||
name: 'Apple Monthly (30 Jun 2022)',
|
||||
state: 'Active',
|
||||
data: {
|
||||
market: {
|
||||
id: '234afabd27e3bce1a879039c041f9f00f915d98459935ddafd0169d38dd13850',
|
||||
state: 'STATE_ACTIVE',
|
||||
state: 'Active',
|
||||
__typename: 'Market',
|
||||
},
|
||||
__typename: 'MarketData',
|
||||
@@ -735,11 +832,10 @@ export const generateSimpleMarkets = () => {
|
||||
{
|
||||
id: '9f2a3c1caa67bb0773ec18d908d32b55b129b9ec2d106a8e9a87f6aa5c0375a6',
|
||||
name: 'Tesla Quarterly (30 Jun 2022)',
|
||||
state: 'Active',
|
||||
data: {
|
||||
market: {
|
||||
id: '9f2a3c1caa67bb0773ec18d908d32b55b129b9ec2d106a8e9a87f6aa5c0375a6',
|
||||
state: 'STATE_ACTIVE',
|
||||
state: 'Active',
|
||||
__typename: 'Market',
|
||||
},
|
||||
__typename: 'MarketData',
|
||||
@@ -847,11 +943,10 @@ export const generateSimpleMarkets = () => {
|
||||
{
|
||||
id: '8a45ee934d3ddac4b036f9884df1064a5353c620a56f775ba36597d0edef9a7a',
|
||||
name: 'Go big or Go home',
|
||||
state: 'Active',
|
||||
data: {
|
||||
market: {
|
||||
id: '8a45ee934d3ddac4b036f9884df1064a5353c620a56f775ba36597d0edef9a7a',
|
||||
state: 'STATE_SUSPENDED',
|
||||
state: 'Settled',
|
||||
__typename: 'Market',
|
||||
},
|
||||
__typename: 'MarketData',
|
||||
@@ -898,11 +993,10 @@ export const generateSimpleMarkets = () => {
|
||||
{
|
||||
id: 'aede7b9ac0c3b225004929c5455160a00f59864aad32ec366e8a2bff1b30fd0f',
|
||||
name: 'BTCUSD Monthly (08 Jul 2022)',
|
||||
state: 'Active',
|
||||
data: {
|
||||
market: {
|
||||
id: 'aede7b9ac0c3b225004929c5455160a00f59864aad32ec366e8a2bff1b30fd0f',
|
||||
state: 'STATE_PROPOSED',
|
||||
state: 'Proposed',
|
||||
__typename: 'Market',
|
||||
},
|
||||
__typename: 'MarketData',
|
||||
@@ -936,11 +1030,10 @@ export const generateSimpleMarkets = () => {
|
||||
{
|
||||
id: '9398707e01daa1a1f1ca6ff87cf8d6c03fe7373ce31121ce81b99a129e6bda47',
|
||||
name: 'BTCUSD Monthly (18 Jul 2022)',
|
||||
state: 'Active',
|
||||
data: {
|
||||
market: {
|
||||
id: '9398707e01daa1a1f1ca6ff87cf8d6c03fe7373ce31121ce81b99a129e6bda47',
|
||||
state: 'STATE_PROPOSED',
|
||||
state: 'Proposed',
|
||||
__typename: 'Market',
|
||||
},
|
||||
__typename: 'MarketData',
|
||||
@@ -974,20 +1067,3 @@ export const generateSimpleMarkets = () => {
|
||||
],
|
||||
};
|
||||
};
|
||||
|
||||
export const generateLongListMarkets = (count: number) => {
|
||||
const markets = [];
|
||||
for (let i = 0; i < count; i++) {
|
||||
const { id, name } = protoMarket;
|
||||
markets.push({
|
||||
...protoMarket,
|
||||
id: id + i,
|
||||
name: name + i,
|
||||
data: {
|
||||
...protoMarket.data,
|
||||
id: id + i,
|
||||
},
|
||||
});
|
||||
}
|
||||
return { markets };
|
||||
};
|
||||
+4
-4
@@ -4,7 +4,7 @@ export const generatePartyBalance = () => {
|
||||
accounts: [
|
||||
{
|
||||
balance: '88474051',
|
||||
type: 'ACCOUNT_TYPE_GENERAL',
|
||||
type: 'General',
|
||||
asset: {
|
||||
id: '6d9d35f657589e40ddfb448b7ad4a7463b66efb307527fedd2aa7df1bbd5ea61',
|
||||
symbol: 'tDAI',
|
||||
@@ -16,7 +16,7 @@ export const generatePartyBalance = () => {
|
||||
},
|
||||
{
|
||||
balance: '100000000',
|
||||
type: 'ACCOUNT_TYPE_GENERAL',
|
||||
type: 'General',
|
||||
asset: {
|
||||
id: '8b52d4a3a4b0ffe733cddbc2b67be273816cfeb6ca4c8b339bac03ffba08e4e4',
|
||||
symbol: 'tEURO',
|
||||
@@ -28,7 +28,7 @@ export const generatePartyBalance = () => {
|
||||
},
|
||||
{
|
||||
balance: '3412867',
|
||||
type: 'ACCOUNT_TYPE_GENERAL',
|
||||
type: 'General',
|
||||
asset: {
|
||||
id: '6d9d35f657589e40ddfb448b7ad4a7463b66efb307527fedd2aa7df1bbd5ea61',
|
||||
symbol: 'tDAI',
|
||||
@@ -40,7 +40,7 @@ export const generatePartyBalance = () => {
|
||||
},
|
||||
{
|
||||
balance: '70007',
|
||||
type: 'ACCOUNT_TYPE_GENERAL',
|
||||
type: 'General',
|
||||
asset: {
|
||||
id: '6d9d35f657589e40ddfb448b7ad4a7463b66efb307527fedd2aa7df1bbd5ea61',
|
||||
symbol: 'tDAI',
|
||||
@@ -4,7 +4,7 @@
|
||||
"sourceMap": false,
|
||||
"outDir": "../../dist/out-tsc",
|
||||
"allowJs": true,
|
||||
"types": ["cypress", "node", "cypress-real-events"]
|
||||
"types": ["cypress", "node"]
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.js"]
|
||||
}
|
||||
@@ -19,9 +19,9 @@ 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://api.n11.testnet.vega.xyz/graphql"
|
||||
NX_VEGA_URL="https://lb.testnet.vega.xyz/query"
|
||||
NX_VEGA_WALLET_URL=http://localhost:1789/api/v1
|
||||
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"}
|
||||
NX_VEGA_NETWORKS={\"MAINNET\":\"https://alpha.console.vega.xyz\"}
|
||||
NX_VEGA_EXPLORER_URL=https://explorer.fairground.wtf
|
||||
@@ -1,8 +1,8 @@
|
||||
# App configuration variables
|
||||
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/devnet-network.json
|
||||
NX_VEGA_URL=https://api.n04.d.vega.xyz/graphql
|
||||
NX_VEGA_URL=https://n04.d.vega.xyz/query
|
||||
NX_VEGA_ENV=DEVNET
|
||||
NX_VEGA_REST=https://api.n04.d.vega.xyz
|
||||
NX_VEGA_REST=https://n04.d.vega.xyz/datanode/rest
|
||||
NX_VEGA_NETWORKS={\"MAINNET\":\"https://alpha.console.vega.xyz\"}
|
||||
NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
|
||||
NX_ETHERSCAN_URL=https://ropsten.etherscan.io
|
||||
@@ -2,7 +2,7 @@
|
||||
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
|
||||
NX_VEGA_REST=https://api.token.vega.xyz/
|
||||
NX_VEGA_NETWORKS='{\"MAINNET\":\"https://alpha.console.vega.xyz\"}'
|
||||
NX_ETHEREUM_PROVIDER_URL=https://mainnet.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
|
||||
NX_ETHERSCAN_URL=https://etherscan.io
|
||||
@@ -0,0 +1,9 @@
|
||||
# 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
|
||||
NX_VEGA_NETWORKS='{\"MAINNET\":\"https://alpha.console.vega.xyz\"}'
|
||||
NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
|
||||
NX_ETHERSCAN_URL=https://ropsten.etherscan.io
|
||||
NX_VEGA_EXPLORER_URL=https://staging.explorer.vega.xyz
|
||||
@@ -0,0 +1,9 @@
|
||||
# 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
|
||||
NX_VEGA_NETWORKS='{\"MAINNET\":\"https://alpha.console.vega.xyz\"}'
|
||||
NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
|
||||
NX_ETHERSCAN_URL=https://ropsten.etherscan.io
|
||||
NX_VEGA_EXPLORER_URL=https://staging2.explorer.vega.xyz
|
||||
@@ -1,8 +1,8 @@
|
||||
# App configuration variables
|
||||
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/testnet-network.json
|
||||
NX_VEGA_URL=https://api.n11.testnet.vega.xyz/graphql
|
||||
NX_VEGA_URL=https://lb.testnet.vega.xyz/query
|
||||
NX_VEGA_ENV=TESTNET
|
||||
NX_VEGA_REST=https://api.n11.testnet.vega.xyz
|
||||
NX_VEGA_REST=https://lb.testnet.vega.xyz/datanode/rest
|
||||
NX_VEGA_NETWORKS='{\"MAINNET\":\"https://alpha.console.vega.xyz\"}'
|
||||
NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
|
||||
NX_ETHERSCAN_URL=https://ropsten.etherscan.io
|
||||
@@ -1,11 +1,11 @@
|
||||
module.exports = {
|
||||
displayName: 'console-lite',
|
||||
displayName: 'simple-trading-app',
|
||||
preset: '../../jest.preset.js',
|
||||
transform: {
|
||||
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest',
|
||||
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nrwl/next/babel'] }],
|
||||
},
|
||||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
|
||||
coverageDirectory: '../../coverage/apps/console-lite',
|
||||
coverageDirectory: '../../coverage/apps/simple-trading-app',
|
||||
setupFilesAfterEnv: ['./setup-tests.ts'],
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"root": "apps/console-lite",
|
||||
"sourceRoot": "apps/console-lite/src",
|
||||
"root": "apps/simple-trading-app",
|
||||
"sourceRoot": "apps/simple-trading-app/src",
|
||||
"projectType": "application",
|
||||
"targets": {
|
||||
"build": {
|
||||
@@ -9,17 +9,17 @@
|
||||
"defaultConfiguration": "production",
|
||||
"options": {
|
||||
"compiler": "babel",
|
||||
"outputPath": "dist/apps/console-lite",
|
||||
"index": "apps/console-lite/src/index.html",
|
||||
"outputPath": "dist/apps/simple-trading-app",
|
||||
"index": "apps/simple-trading-app/src/index.html",
|
||||
"baseHref": "/",
|
||||
"main": "apps/console-lite/src/main.tsx",
|
||||
"polyfills": "apps/console-lite/src/polyfills.ts",
|
||||
"tsConfig": "apps/console-lite/tsconfig.app.json",
|
||||
"main": "apps/simple-trading-app/src/main.tsx",
|
||||
"polyfills": "apps/simple-trading-app/src/polyfills.ts",
|
||||
"tsConfig": "apps/simple-trading-app/tsconfig.app.json",
|
||||
"assets": [
|
||||
"apps/console-lite/src/favicon.ico",
|
||||
"apps/console-lite/src/assets"
|
||||
"apps/simple-trading-app/src/favicon.ico",
|
||||
"apps/simple-trading-app/src/assets"
|
||||
],
|
||||
"styles": ["apps/console-lite/src/styles.scss"],
|
||||
"styles": ["apps/simple-trading-app/src/styles.scss"],
|
||||
"scripts": [],
|
||||
"webpackConfig": "@nrwl/react/plugins/webpack"
|
||||
},
|
||||
@@ -27,8 +27,8 @@
|
||||
"production": {
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "apps/console-lite/src/environments/environment.ts",
|
||||
"with": "apps/console-lite/src/environments/environment.prod.ts"
|
||||
"replace": "apps/simple-trading-app/src/environments/environment.ts",
|
||||
"with": "apps/simple-trading-app/src/environments/environment.prod.ts"
|
||||
}
|
||||
],
|
||||
"optimization": true,
|
||||
@@ -43,13 +43,13 @@
|
||||
"serve": {
|
||||
"executor": "./tools/executors/webpack:serve",
|
||||
"options": {
|
||||
"buildTarget": "console-lite:build",
|
||||
"buildTarget": "simple-trading-app:build",
|
||||
"hmr": true,
|
||||
"port": 4001
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"buildTarget": "console-lite:build:production",
|
||||
"buildTarget": "simple-trading-app:build:production",
|
||||
"hmr": false
|
||||
}
|
||||
}
|
||||
@@ -58,14 +58,14 @@
|
||||
"executor": "@nrwl/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
"options": {
|
||||
"lintFilePatterns": ["apps/console-lite/**/*.{ts,tsx,js,jsx}"]
|
||||
"lintFilePatterns": ["apps/simple-trading-app/**/*.{ts,tsx,js,jsx}"]
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"executor": "@nrwl/jest:jest",
|
||||
"outputs": ["coverage/apps/console-lite"],
|
||||
"outputs": ["coverage/apps/simple-trading-app"],
|
||||
"options": {
|
||||
"jestConfig": "apps/console-lite/jest.config.js",
|
||||
"jestConfig": "apps/simple-trading-app/jest.config.js",
|
||||
"passWithNoTests": true
|
||||
}
|
||||
},
|
||||
@@ -73,8 +73,8 @@
|
||||
"builder": "@nrwl/workspace:run-commands",
|
||||
"options": {
|
||||
"commands": [
|
||||
"cp apps/console-lite/netlify.toml netlify.toml",
|
||||
"nx build console-lite"
|
||||
"cp apps/simple-trading-app/netlify.toml netlify.toml",
|
||||
"nx build simple-trading-app"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useEffect } from 'react';
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { createClient } from './lib/apollo-client';
|
||||
import { ThemeContext } from '@vegaprotocol/react-helpers';
|
||||
@@ -18,17 +18,17 @@ import LocalContext from './context/local-context';
|
||||
import useLocalValues from './hooks/use-local-values';
|
||||
|
||||
function App() {
|
||||
const localValues = useLocalValues();
|
||||
const [theme, toggleTheme] = useThemeSwitcher();
|
||||
const localValues = useLocalValues(toggleTheme);
|
||||
const {
|
||||
vegaWalletDialog,
|
||||
menu: { setMenuOpen },
|
||||
} = localValues;
|
||||
|
||||
const [menuOpen, setMenuOpen] = useState(false);
|
||||
const onToggle = () => setMenuOpen(!menuOpen);
|
||||
|
||||
const location = useLocation();
|
||||
|
||||
useEffect(() => {
|
||||
setMenuOpen(false);
|
||||
}, [location, setMenuOpen]);
|
||||
}, [location]);
|
||||
|
||||
return (
|
||||
<EnvironmentProvider>
|
||||
@@ -38,16 +38,16 @@ function App() {
|
||||
<LocalContext.Provider value={localValues}>
|
||||
<AppLoader>
|
||||
<div className="max-h-full min-h-full dark:bg-lite-black dark:text-white-60 bg-white text-black-60 grid grid-rows-[min-content,1fr]">
|
||||
<Header />
|
||||
<Main />
|
||||
<Header toggleTheme={toggleTheme} />
|
||||
<Main isMenuOpen={menuOpen} onToggle={onToggle} />
|
||||
<VegaConnectDialog
|
||||
connectors={Connectors}
|
||||
dialogOpen={vegaWalletDialog.connect}
|
||||
setDialogOpen={vegaWalletDialog.setConnect}
|
||||
dialogOpen={localValues.vegaWalletDialog.connect}
|
||||
setDialogOpen={localValues.vegaWalletDialog.setConnect}
|
||||
/>
|
||||
<VegaManageDialog
|
||||
dialogOpen={vegaWalletDialog.manage}
|
||||
setDialogOpen={vegaWalletDialog.setManage}
|
||||
dialogOpen={localValues.vegaWalletDialog.manage}
|
||||
setDialogOpen={localValues.vegaWalletDialog.setManage}
|
||||
/>
|
||||
</div>
|
||||
</AppLoader>
|
||||
+3
-3
@@ -26,7 +26,7 @@ export interface MarketTags_market_tradableInstrument_instrument {
|
||||
export interface MarketTags_market_tradableInstrument {
|
||||
__typename: "TradableInstrument";
|
||||
/**
|
||||
* An instance of, or reference to, a fully specified instrument.
|
||||
* An instance of or reference to a fully specified instrument.
|
||||
*/
|
||||
instrument: MarketTags_market_tradableInstrument_instrument;
|
||||
}
|
||||
@@ -34,14 +34,14 @@ export interface MarketTags_market_tradableInstrument {
|
||||
export interface MarketTags_market {
|
||||
__typename: "Market";
|
||||
/**
|
||||
* An instance of, or reference to, a tradable instrument.
|
||||
* An instance of or reference to a tradable instrument.
|
||||
*/
|
||||
tradableInstrument: MarketTags_market_tradableInstrument;
|
||||
}
|
||||
|
||||
export interface MarketTags {
|
||||
/**
|
||||
* An instrument that is trading on the Vega network
|
||||
* An instrument that is trading on the VEGA network
|
||||
*/
|
||||
market: MarketTags_market | null;
|
||||
}
|
||||
+3
-3
@@ -12,7 +12,7 @@ import { AccountType } from "@vegaprotocol/types";
|
||||
export interface PartyBalanceQuery_party_accounts_asset {
|
||||
__typename: "Asset";
|
||||
/**
|
||||
* The ID of the asset
|
||||
* The id of the asset
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
@@ -24,7 +24,7 @@ export interface PartyBalanceQuery_party_accounts_asset {
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18
|
||||
* The precision of the asset
|
||||
*/
|
||||
decimals: number;
|
||||
}
|
||||
@@ -55,7 +55,7 @@ export interface PartyBalanceQuery_party {
|
||||
|
||||
export interface PartyBalanceQuery {
|
||||
/**
|
||||
* An entity that is trading on the Vega network
|
||||
* An entity that is trading on the VEGA network
|
||||
*/
|
||||
party: PartyBalanceQuery_party | null;
|
||||
}
|
||||
+2
-2
@@ -5,7 +5,7 @@ import Star from '../icons/star';
|
||||
|
||||
const Baubles = () => {
|
||||
return (
|
||||
<aside className="relative right-0 top-0 h-[700px] hidden md:block md:w-1/2 overflow-hidden">
|
||||
<div className="relative right-0 top-0 h-[700px] hidden md:block md:w-1/2 overflow-hidden">
|
||||
<div className="absolute top-[100px] w-[393px] left-[19%] h-[517px]">
|
||||
<div className="absolute top-[82px] right-[34px] w-[100px] h-[100px] clip-path-rounded">
|
||||
<Video />
|
||||
@@ -29,7 +29,7 @@ const Baubles = () => {
|
||||
<Star />
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ const tDAI: PartyBalanceQuery_party_accounts_asset = {
|
||||
const accounts: PartyBalanceQuery_party_accounts[] = [
|
||||
{
|
||||
__typename: 'Account',
|
||||
type: AccountType.ACCOUNT_TYPE_GENERAL,
|
||||
type: AccountType.General,
|
||||
balance: '1000000',
|
||||
asset: tDAI,
|
||||
},
|
||||
+1
-1
@@ -24,7 +24,7 @@ export const DealTicketBalance = ({
|
||||
const settlementAccount = useSettlementAccount(
|
||||
settlementAssetId,
|
||||
accounts,
|
||||
AccountType.ACCOUNT_TYPE_GENERAL
|
||||
AccountType.General
|
||||
);
|
||||
const formatedNumber =
|
||||
settlementAccount?.balance &&
|
||||
@@ -0,0 +1,76 @@
|
||||
import * as React from 'react';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import {
|
||||
DealTicketManager,
|
||||
DealTicketContainer as Container,
|
||||
} from '@vegaprotocol/deal-ticket';
|
||||
import { DealTicketSteps } from './deal-ticket-steps';
|
||||
import { useVegaWallet } from '@vegaprotocol/wallet';
|
||||
import { gql, useQuery } from '@apollo/client';
|
||||
import { DealTicketBalance } from './deal-ticket-balance';
|
||||
import type { PartyBalanceQuery } from './__generated__/PartyBalanceQuery';
|
||||
import Baubles from './baubles-decor';
|
||||
|
||||
const tempEmptyText = <p>Please select a market from the markets page</p>;
|
||||
|
||||
const PARTY_BALANCE_QUERY = gql`
|
||||
query PartyBalanceQuery($partyId: ID!) {
|
||||
party(id: $partyId) {
|
||||
accounts {
|
||||
type
|
||||
balance
|
||||
asset {
|
||||
id
|
||||
symbol
|
||||
name
|
||||
decimals
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const DealTicketContainer = () => {
|
||||
const { marketId } = useParams<{ marketId: string }>();
|
||||
const { keypair } = useVegaWallet();
|
||||
|
||||
const { data: partyData, loading } = useQuery<PartyBalanceQuery>(
|
||||
PARTY_BALANCE_QUERY,
|
||||
{
|
||||
variables: { partyId: keypair?.pub },
|
||||
skip: !keypair?.pub,
|
||||
}
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="flex">
|
||||
<div className="w-full md:w-1/2 md:min-w-[500px]">
|
||||
{marketId ? (
|
||||
<Container marketId={marketId}>
|
||||
{(data) => (
|
||||
<DealTicketManager market={data.market}>
|
||||
{loading ? (
|
||||
'Loading...'
|
||||
) : (
|
||||
<DealTicketBalance
|
||||
className="mb-16"
|
||||
settlementAsset={
|
||||
data.market.tradableInstrument.instrument.product
|
||||
?.settlementAsset
|
||||
}
|
||||
accounts={partyData?.party?.accounts || []}
|
||||
isWalletConnected={!!keypair?.pub}
|
||||
/>
|
||||
)}
|
||||
<DealTicketSteps market={data.market} partyData={partyData} />
|
||||
</DealTicketManager>
|
||||
)}
|
||||
</Container>
|
||||
) : (
|
||||
tempEmptyText
|
||||
)}
|
||||
</div>
|
||||
<Baubles />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
+15
-15
@@ -10,7 +10,6 @@ import {
|
||||
FormGroup,
|
||||
} from '@vegaprotocol/ui-toolkit';
|
||||
import { BigNumber } from 'bignumber.js';
|
||||
import { DealTicketEstimates } from './deal-ticket-estimates';
|
||||
|
||||
interface DealTicketSizeProps {
|
||||
step: number;
|
||||
@@ -23,9 +22,7 @@ interface DealTicketSizeProps {
|
||||
price: string;
|
||||
estCloseOut: string;
|
||||
estMargin: string;
|
||||
fees: string;
|
||||
positionDecimalPlaces: number;
|
||||
notionalSize: string;
|
||||
}
|
||||
|
||||
const getSizeLabel = (value: number): string => {
|
||||
@@ -50,8 +47,6 @@ export const DealTicketSize = ({
|
||||
onValueChange,
|
||||
estCloseOut,
|
||||
positionDecimalPlaces,
|
||||
fees,
|
||||
notionalSize,
|
||||
}: DealTicketSizeProps) => {
|
||||
const sizeRatios = [0, 25, 50, 75, 100];
|
||||
const [inputValue, setInputValue] = useState(value);
|
||||
@@ -109,8 +104,8 @@ export const DealTicketSize = ({
|
||||
) : (
|
||||
<div>
|
||||
<div className="flex justify-between text-black dark:text-white mb-8">
|
||||
<span data-testid="min-label">{min}</span>
|
||||
<span data-testid="max-label">{max}</span>
|
||||
<span>{min}</span>
|
||||
<span>{max}</span>
|
||||
</div>
|
||||
<SliderRoot
|
||||
className="mb-8"
|
||||
@@ -147,7 +142,11 @@ export const DealTicketSize = ({
|
||||
|
||||
<dl className="text-black dark:text-white">
|
||||
<div className="flex items-center justify-between mb-8">
|
||||
<dt>{t('Contracts')}</dt>
|
||||
<dt>
|
||||
<span>{t('Size')}</span>
|
||||
|
||||
<small>({quoteName})</small>
|
||||
</dt>
|
||||
<dd className="flex justify-end w-full">
|
||||
<FormGroup
|
||||
className="mb-0 flex items-center"
|
||||
@@ -188,14 +187,15 @@ export const DealTicketSize = ({
|
||||
</FormGroup>
|
||||
</dd>
|
||||
</div>
|
||||
<div className="flex justify-between mb-8">
|
||||
<dt>{t('Est. price')}</dt>
|
||||
<dd>{price}</dd>
|
||||
</div>
|
||||
<div className="flex justify-between">
|
||||
<dt>{t('Est. close out')}</dt>
|
||||
<dd>{estCloseOut}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<DealTicketEstimates
|
||||
quoteName={quoteName}
|
||||
fees={fees}
|
||||
estCloseOut={estCloseOut}
|
||||
price={price}
|
||||
notionalSize={notionalSize}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
+9
-46
@@ -72,14 +72,6 @@ export const DealTicketSteps = ({
|
||||
market,
|
||||
partyId: keypair?.pub || '',
|
||||
});
|
||||
const value = new BigNumber(orderSize).toNumber();
|
||||
const price =
|
||||
market.depth.lastTrade &&
|
||||
addDecimal(market.depth.lastTrade.price, market.decimalPlaces);
|
||||
const emptyString = ' - ';
|
||||
|
||||
const [notionalSize, setNotionalSize] = useState<string | null>(null);
|
||||
const [fees, setFees] = useState<string | null>(null);
|
||||
|
||||
const maxTrade = useMaximumPositionSize({
|
||||
partyId: keypair?.pub || '',
|
||||
@@ -100,6 +92,7 @@ export const DealTicketSteps = ({
|
||||
}, [maxTrade, market.positionDecimalPlaces]);
|
||||
|
||||
const { message: invalidText, isDisabled } = useOrderValidation({
|
||||
step,
|
||||
market,
|
||||
orderType,
|
||||
orderTimeInForce,
|
||||
@@ -119,28 +112,6 @@ export const DealTicketSteps = ({
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (market?.depth?.lastTrade?.price) {
|
||||
const size = new BigNumber(market.depth.lastTrade.price)
|
||||
.multipliedBy(value)
|
||||
.toNumber();
|
||||
|
||||
setNotionalSize(addDecimal(size, market.decimalPlaces));
|
||||
}
|
||||
}, [market, value]);
|
||||
|
||||
useEffect(() => {
|
||||
if (estMargin?.fees && notionalSize) {
|
||||
const percentage = new BigNumber(estMargin?.fees)
|
||||
.dividedBy(notionalSize)
|
||||
.multipliedBy(100)
|
||||
.decimalPlaces(2)
|
||||
.toString();
|
||||
|
||||
setFees(`${estMargin.fees} (${percentage}%)`);
|
||||
}
|
||||
}, [estMargin, notionalSize]);
|
||||
|
||||
const transactionStatus =
|
||||
transaction.status === VegaTxStatus.Requested ||
|
||||
transaction.status === VegaTxStatus.Pending
|
||||
@@ -192,16 +163,15 @@ export const DealTicketSteps = ({
|
||||
onValueChange={onSizeChange}
|
||||
value={new BigNumber(orderSize).toNumber()}
|
||||
name="size"
|
||||
price={price || emptyString}
|
||||
positionDecimalPlaces={market.positionDecimalPlaces}
|
||||
quoteName={
|
||||
market.tradableInstrument.instrument.product.settlementAsset
|
||||
.symbol
|
||||
price={
|
||||
market.depth.lastTrade
|
||||
? addDecimal(market.depth.lastTrade.price, market.decimalPlaces)
|
||||
: ''
|
||||
}
|
||||
notionalSize={notionalSize || emptyString}
|
||||
positionDecimalPlaces={market.positionDecimalPlaces}
|
||||
quoteName={market.tradableInstrument.instrument.product.quoteName}
|
||||
estCloseOut={estCloseOut}
|
||||
fees={fees || emptyString}
|
||||
estMargin={estMargin?.margin || emptyString}
|
||||
estMargin={estMargin || ' - '}
|
||||
/>
|
||||
) : (
|
||||
'loading...'
|
||||
@@ -223,14 +193,7 @@ export const DealTicketSteps = ({
|
||||
transactionStatus={transactionStatus}
|
||||
order={order}
|
||||
estCloseOut={estCloseOut}
|
||||
estMargin={estMargin?.margin || emptyString}
|
||||
price={price || emptyString}
|
||||
quoteName={
|
||||
market.tradableInstrument.instrument.product.settlementAsset
|
||||
.symbol
|
||||
}
|
||||
notionalSize={notionalSize || emptyString}
|
||||
fees={fees || emptyString}
|
||||
estMargin={estMargin || ' - '}
|
||||
/>
|
||||
<TransactionDialog
|
||||
title={getOrderDialogTitle(finalizedOrder?.status)}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user