Compare commits

..
Author SHA1 Message Date
Matthew Russell 0e87ee18b6 chore: testing ledger entry query 2022-10-25 22:07:56 -07:00
Matthew Russell 96d331e714 wip: fix me 2022-10-25 20:49:12 -07:00
mattrussell36 4cbf7c3a4a chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-26 00:09:30 +00:00
mattrussell36 7800d2d566 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-25 18:19:44 +00:00
Matthew Russell 089dc33323 chore: fix market summary tests and remove positions title (#1850) 2022-10-25 19:00:52 +01:00
Bartłomiej Głownia b615e019b1 chore: improve data time formatting in token app (#1722)
* chore: improve data time formatting in token app

* chore: handle wrong date in network stats fields
2022-10-25 19:37:01 +02:00
Elmar cfab9e61f3 chore(explorer): add stagnet-1 env vars (#1846) 2022-10-25 14:37:51 +01:00
mattrussell36 53f3e39210 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-25 12:05:50 +00:00
Art 633c2ae526 chore: updated order rejection reason mapping, types regen (1808) (#1845) 2022-10-25 11:07:54 +01:00
Bartłomiej Głownia 3bc9d3386b chore: use queries from graphql file on orders lib (#1843) 2022-10-25 11:42:36 +02:00
Bartłomiej Głowniaandmaciek 17f93c2b7e chore: add build-spec targets and execute on affected apps and libs on CI (#1745)
* chore: add build-spec targets and execute on affected apps and libs on CI

* chore: fix market-depth and react-helpers specs typings

* chore: fix ui-toolkit specs typings

* chore: fix trades specs typings

* chore: fix orders specs typings

* chore: fix deposits specs typings

* chore: fix deal-ticket specs typings

* feat: fix tsc on specs check

* feat: fix tsc on specs check

* feat: fix tsc on specs check

* feat: fix tsc on specs check

* feat: fix tsc on specs check - fix token app

* feat: fix tsc on specs check - fix positions lib

* feat: fix tsc on specs check - fix environment lib

* chore: fix failling build-spec in positions lib

Co-authored-by: maciek <maciek@vegaprotocol.io>
2022-10-25 09:41:16 +02:00
mattrussell36 fcd99722b9 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-25 06:27:19 +00:00
mattrussell36 ab6307497d chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-25 00:14:05 +00:00
m.ray 4d20151abd feat: 1537 LP view data provider subscriptions after 0.58 release (#1630)
* fix: #1537 add lp provider sub

* fix: change LP title & update party.id

* fix: #1537 fix obligation and supplied

* fix: #1537 add min width on accounts

* fix: #1537 consistent null check

* fix: #1537 update lp data providers

* fix:  add acounts data provider but requires party id

* feat: #1537 LP data provider -  marketID & query or subscribe for accounts - partyId

* fix: #1537 remove log and fix build

* fix: #1537 fix build console lite and lp dashboard

* fix: #1537 fix tsconfig lp dahsboard

* fix: #1537 use interval to poll LP data - sub not working yet
2022-10-24 20:42:53 +01:00
Bartłomiej Głownia 630ef4a22d chore: add use throttled data provider hook (#1773)
* chore: add useThrottledDataProvider hook

* chore: add useThrottledDataProvider hook tests
2022-10-24 11:34:16 -07:00
Matthew RussellandMadalina Raicu d0976bbd46 Feat/522 close position (#1762)
* feat: use close position hook and dialog setup

* chore: update wallet tx interface for batch market instruction

* feat: add usage of data provider to show relevant order information

* feat: render correctly formatted values in close position dialog

* feat: make vega tx dialog more flexibly by allowing custom ui for every state of the tx

* feat: adjust text alignment and spacing between active orders and order to close

* feat: add unit tests

* chore: remove stray log

* chore: fix lint

* chore: ignore ts error for formatter function of vesting chart

* feat: split components up, memozie variables

* feat: add shared loading state to prevent content popping in

* feat: add time in force label

* feat: move transaction result hook to wallet lib

* feat: prevent being able to close vega tx dialog, must reject tx

* chore: add test for useTransactionResult hook

* chore: fix positiosn test after hook relocation

* Revert "feat: prevent being able to close vega tx dialog, must reject tx"

This reverts commit d1ecda69c3c55822bb042320f82b2e1c3833b99a.

* chore: add check for order edge to be defined

* chore: remove close callback

* feat: use tx result state to determine dialog state

* chore: update close position hook to check for transaction result

* fix: readd types tif selection persistance

* feat: convert order event func to be async, use it in close position for more result context

* fix: rename utils

* chore: adjust error language

Co-authored-by: Madalina Raicu <madalina@raygroup.uk>
2022-10-24 19:16:15 +01:00
mattrussell36 317dfc4bb1 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-24 18:08:56 +00:00
candida-dandDexter e2d4a6d0eb Docs/update add and remove signer labels (#1844)
* docs: update labels for add signer tool

* docs: fix remove signer labels

* chore: consistent capitalisation

* style: formating

Co-authored-by: Dexter <dexter.edwards93@gmail.com>
2022-10-24 18:27:20 +01:00
Bartłomiej Głownia 786b85fde2 chore: add market-depth-provider unit tests (#1839) 2022-10-24 14:30:22 +02:00
m.ray ee3b9a56c9 feat: 24h volume + market links in orders table (#1836)
* feat: #1659 add link to market in orders table

* feat: #1794 use volume 24h instead of indicative volume

* fix: remove total fees that was defined but not used in select columns

* fix: fix cypress test for volume (24h) header

* fix: add volume 24h tooltip

* fix: trading mode and volume order
2022-10-24 13:16:09 +01:00
mattrussell36 2d9fdbf98c chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-24 12:05:15 +00:00
Radosław Szpiech d4cbd4042b chore: remove unnecessary it.only in test (#1840) 2022-10-24 13:04:51 +02:00
botond 26d277d775 chore: migrate governance types (#1834)
* chore: migrate governance types

* fix: format

* fix: import
2022-10-24 11:51:48 +01:00
macqbatandmaciek da726ea439 feat: info about test network in transaction dialogs (#1830)
* feat: info about test network in transaction dialogs

* feat: info about test network in transaction dialogs

* feat: info about test network in transaction dialogs

* feat: info about test network in transaction dialogs - add unit test

* feat: info about test network in transaction dialogs - add unit test

* feat: info about test network in transaction dialogs - add unit test

* feat: info about test network in transaction dialogs - add unit test

Co-authored-by: maciek <maciek@vegaprotocol.io>
2022-10-24 10:57:21 +02:00
Bartłomiej Głownia 6dded8c2d2 Bugfix/orderbook data cummulative vol (#1833)
* chore: move market depth queries to .graphql file

* chore: fix orderbook data updates

* chore: allow to overlap subscription update with stored data in market depth
2022-10-24 09:26:44 +01:00
mattrussell36 d15af74ba5 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-24 06:30:06 +00:00
mattrussell36 8877391284 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-24 00:13:54 +00:00
mattrussell36 6a57672257 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-23 18:05:13 +00:00
m.rayandRado bf34f1c060 feat: 1486 add details of expected fees margin close out to deal ticket (#1771)
* fix: #1486 move deal ticket hooks from console-lite to be re-used in trading app for console v2

* fix: #1486 typo

* feat: #1486 deal ticket query update, console-lite fix

* feat: #1486 console-lite fix

* feat: #1486 initial hook to get fee details

* feat: #1486 add tooltips

* feat: #1486 add fees cell from market-info in tooltip

* fix: #1486 edit deal-ticket.spec.ts titles and index.ts of deal ticket hooks

* feat: #1486 move all hooks for slippage into deal ticket

* fix: #1486 fix linting deal-ticket issue

* fix: set price, fix NaN percentage, watch full order object

* fix: update only when market price is updated

* feat: #1486 add fees from est. order query, fees breakdown, fix BigNumber NaN issue

* feat: #1486 add fee factors in generate deal ticket query

* fix: #1486 show margin on short

* fix: #1486 format price and fix dal ticket use order margin import

* fix: #1486 fix price memo

* feat: #1486 update estimate ordr query with order price or mark price

* fix: #1486 revert apps/console-lite/.env

* fix: #1486 fix NaN value on close out

* fix: #1486 revert close out calculation

* fix: #1486 prevent NaN close out

* fix: #1486 revert close out

* feat: #1486 add fee factor percentages in tooltip and fix NaN

* fix: #1486 fix deal-ticket-steps est close out null handling

* fix: #1486 fix deal-ticket-steps est close out null handling

* fix: #1486 add tooltip for fees

* fix: #1486 fix console-lite formatting on notional size and close out

* fix: #1486 total fees formatting inside the hook

* feat: #1486 add qutote to fees tooltip

* fix: #1486 update hook, price, console-lite and styling

* chore: fix mock types

* fix: #1486 fix tests in console-lite

* fix: #1486 add declaration.d.ts to console-lite-e2e

* fix: #1486 fix deal ticket test

* fix: #1486 fix deal ticket test

Co-authored-by: Rado <szpiechrados@gmail.com>
2022-10-23 14:08:02 +01:00
mattrussell36 513c7f2b1a chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-23 12:05:45 +00:00
mattrussell36 884411e5b8 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-23 06:10:56 +00:00
mattrussell36 4516a09c43 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-23 00:13:50 +00:00
mattrussell36 cd99ae20a0 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-22 18:04:35 +00:00
mattrussell36 bc3a53c259 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-22 12:05:17 +00:00
mattrussell36 dddcd3d6f5 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-22 06:08:50 +00:00
mattrussell36 cc7897f723 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-22 00:13:36 +00:00
mattrussell36 bb82fe75da chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-21 18:06:06 +00:00
Bartłomiej Głownia c6f8ff68b8 chore: move market depth queries to .graphql file (#1814) 2022-10-21 10:34:04 -07:00
Dexter Edwards 23b517b4a1 feat: add status to node page (#1829) 2022-10-21 16:44:52 +01:00
Dexter Edwards c3175d3e65 fix: do no allow min or max fraction digits to go out of range (#1806) (#1809) 2022-10-21 16:30:30 +01:00
Sam Keen 33be5bc069 Multisig-signer: Ensuring we await the data from useLazyQuery properly (#1832)
* Feat/1512: Ensuring we await the data from useLazyQuery properly

* Feat/1512: Removed redundant await
2022-10-21 15:20:11 +01:00
Sam KeenandDexter bbb6cfe780 Release/sandbox (#1828)
* chore: adjust env variables

* chore: add sandbox for tools

Co-authored-by: Dexter <dexter.edwards93@gmail.com>
2022-10-21 14:38:42 +01:00
269d3820dc Fix/1622 proposal vote deadline fixes (#1730)
* Fix/1622: Partial progress

* Fix/1622: Proposal forms fields now correctly updating when vote deadline 'use min' and 'use max' are clicked

* Fix/1622: Removing some unused imports

* Fix/1622: WIP commit for generics for deadline component

* Fix/1622: WIP commit for generics for deadline component

* Fix/1622: Separate minMax functions

* Fix/1622: Updated unit tests

* Update apps/token/src/routes/governance/components/propose/proposal-form-vote-and-enactment-deadline.spec.tsx

Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com>

* Fix/1622: Tweaks from PR comments

* Fix/1622: Tests fixes

* chore: fix min proposer change for tests

* frontend-monorepo-1622 Removed unused value in governance-flow.cy.js

Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com>
Co-authored-by: Joe <joe@vega.xyz>
2022-10-21 13:47:46 +01:00
mattrussell36 2fa640a467 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-21 12:06:01 +00:00
Matthew Russell e66b6586b5 fix: add key alias to dropdown (#1813) 2022-10-21 09:34:36 +01:00
mattrussell36 5a5e06a8e9 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-21 06:12:14 +00:00
Bartłomiej Głownia ba9ad40ad2 chore: use optional chaining for ag-grid api (#1810) 2022-10-20 21:17:36 -07:00
mattrussell36 bb8d2660a0 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-21 00:14:32 +00:00
mattrussell36 5f2c7179c9 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-20 18:15:06 +00:00
Elmar 31ea48b90a fix(explorer): fix uptime to reference genesisTime field (#1807) 2022-10-20 16:11:55 +01:00
Elmar 1964d42e5b Feat/1501 improve party details (#1785)
* feat(explorer): change styling party details page

* feat(explorer): use panel component in txs-stats-info.tsx

* feat(explorer): change order for party details sections
2022-10-20 16:11:37 +01:00
Dexter Edwards 70eeeeb1e2 Fix/1376 proposal terms (#1789)
* chore: add missing property types

* chore: add removed types
2022-10-20 14:40:58 +01:00
Joe Tsang 044eb160af chore: tidy up capsule restart variables (#1800)
* chore: tidy up capsule restart variables

* chore: add flow for manually triggering all tests

* chore: fix if statement

* chore: revert flow change
2022-10-20 13:55:12 +01:00
macqbatandmaciek 61cfac22a1 chore: fix .env.sandbox file (#1805)
Co-authored-by: maciek <maciek@vegaprotocol.io>
2022-10-20 14:37:57 +02:00
mattrussell36 52b8f21a85 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-20 12:05:59 +00:00
macqbatandmaciek 8f8ccc9f0c chore: add .env.sandbox files (#1796)
* chore: add .env.sandbox files

* chore: add .env.sandbox files

* chore: add .env.sandbox files

Co-authored-by: maciek <maciek@vegaprotocol.io>
2022-10-20 12:12:08 +02:00
macqbatandmaciek fbf21e9cb8 chore: fix for persist force value selection after change of order type (#1779)
* chore: fix for persist force value selection after change of order type

* chore: fix for persist force value selection after change of order type fix some int test

* chore: fix for persist force value selection after change of order fast fixes

Co-authored-by: maciek <maciek@vegaprotocol.io>
2022-10-20 09:01:01 +02:00
macqbatandmaciek c15765de79 chore: improve connect wallet button in deal ticket (#1793)
* chore: improve connect wallet button in deal ticket

* chore: improve connect wallet button in deal ticket

* chore: improve connect wallet button in deal ticket

Co-authored-by: maciek <maciek@vegaprotocol.io>
2022-10-20 08:41:02 +02:00
mattrussell36 3c0dd55d7c chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-20 06:09:08 +00:00
mattrussell36 082a58e6fc chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-20 00:14:07 +00:00
8d2fe118ec chore: single position table (1645) (#1749)
* chore: single position table (1645)

chore: single position table (1645)

* chore: tests fixed

* chore: remove unused withSummaryRow arg

* chore: use ag grid value formatter type helper

* chore: update console-lite to use value formatter params helper

* chore: fix e2e test by ignoring pinned row

Co-authored-by: Rado <szpiechrados@gmail.com>
Co-authored-by: Matthew Russell <mattrussell36@gmail.com>
2022-10-19 16:59:36 -07:00
mattrussell36 ce283aeee7 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-19 18:12:30 +00:00
Joe Tsang 9465543b23 Test/1540 fix flow tests (#1788)
* fix: local failing tests

* chore: remove capsule restart from manual flow

* fix: try fix failing wallet test

* chore: set capsule teardown to true

* chore: revert attempted fix

* fix: remove wallet steps

* chore: revert investigation changes

* chore: move asset wallet faucets

* chore: add retry to get asset func

* chore: add func for faucet assets without checks

* chore: turn off capsule restart after flows

* chore: remove commented lines
2022-10-19 16:48:57 +01:00
Art 50611a4ba6 chore: format limits (547) (#1742) 2022-10-19 07:23:18 -07:00
Mikołaj Młodzikowski 5d04efe52d Update Jenkinsfile 2022-10-19 15:48:43 +02:00
Mikołaj Młodzikowski 349722d56d Update Jenkinsfile 2022-10-19 15:40:57 +02:00
Mikołaj Młodzikowski 7c4ce6eb87 feat: Add jenkinsfile to run approbation (relates to: vegaprotocol/devops-infra#1476) (#1781)
* feat: Add jenkinsfile to run approbation (relates to: vegaprotocol/devops-infra#1476)

* Update Jenkinsfile
2022-10-19 15:33:24 +02:00
Elmar cc8f052a5b Feat/397 list transactions (#1770)
* chore(explorer): add stagnet 1 env vars

* feat(explorer): add info block component

* feat(explorer): change tx order type lozenge

* feat(explorer): change truncated-link.tsx style

* feat(explorer): add stats info component for txs

* feat(explorer): change page title size

* feat(explorer): update txs list and add txs for party

* fix(explorer): remove unused var

* fix(explorer): change copy and remove unused vars

* fix(explorer): pr review fixes
2022-10-19 14:08:17 +01:00
Dexter Edwards 033ee14009 Feat/sandbox env (#1774)
* chore: add sandbox network json

* style: lint

* test: make tests environment agnostic
2022-10-19 13:36:16 +01:00
mattrussell36 9a56fc9b6f chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-19 12:07:29 +00:00
Radosław Szpiech ab760eee58 chore: fix chainId mock (#1777)
* chore: fix chainId popup

* chore: cleanup
2022-10-19 12:14:52 +01:00
Bartłomiej Głownia a6576132b1 chore: generic data provider improvments (#1772) 2022-10-19 10:14:18 +01:00
mattrussell36 21ae0f2592 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-19 06:29:33 +00:00
mattrussell36 fb464b956f chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-19 00:14:47 +00:00
mattrussell36 835ffdbfb4 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-18 18:09:32 +00:00
macqbatandmaciek 1a539efdd6 feat: add connect vega wallet button to the deal ticket (#1768)
* feat: add connect vega wallet button to the deal ticket

* feat: add connect vega wallet button to the deal ticket - manage some int tests

Co-authored-by: maciek <maciek@vegaprotocol.io>
2022-10-18 17:59:17 +01:00
mattrussell36 346901fc9c chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-18 12:05:35 +00:00
m.rayandRado 6a1b823838 fix: market info data provider and oracle spec data - API changes (#1634)
* fix: #1621 oracle spec query fix  - data instead of price

* fix: 1621 add marketInfodataProvider

* fix: import  use data provider

* fix: asset id can be null in market?.tradableInstrument.instrument.product?.settlementAsset.id

* fix: #1621 export MarketInfo

* fix: #1621 fix trading-e2e build

* chore: fix failed tests

Co-authored-by: Rado <szpiechrados@gmail.com>
2022-10-18 12:56:19 +01:00
macqbatandmaciek d8544ddd00 chore: accounts-table reload after partyId change (#1764)
* chore: accounts-table reload after partyId change

* chore: accounts-table reload after partyId change

Co-authored-by: maciek <maciek@vegaprotocol.io>
2022-10-18 11:40:26 +01:00
malinantonsson 3b41e9f2f8 Feat/lp dashboard markets (#1664)
* feat: generate new nx application

* feat: add env variables & render a headline

* feat: add cypress projectId and delete unused files

* feat: liquidity  market list

* feat: render LP grid

* feat: create liquidity provision lib

* feat: liquidity provision calculate volume

* feat: add volume change, generate types

* feat: add EnvironmentProvider

* feat: add LP health bar

* feat: liquidity provision health

* feat: liquidity provider dashboard healthbars

* feat: liquidity provider dashnoard - add auction trigger

* feat: liquidity provider dashboard - display multiple fees

* feat: liquidity provision provider refactor

* feat: liquidity provision provider refactor

* feat: liquidity utils tests

* feat: add benefits and links to docs

* feat: liquidiity provision styles

* feat: fix liquidity provision e2e tests

* feat: liquidity target

* feat: liquidity provision dashboard
2022-10-18 09:58:44 +02:00
mattrussell36 1124a86527 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-18 06:26:49 +00:00
mattrussell36 941e439082 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-18 00:13:32 +00:00
Matthew Russell ee33721010 fix: deposit button blocking account rows (#1757) 2022-10-17 11:57:13 -07:00
mattrussell36 16d765fff3 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-17 18:14:24 +00:00
Dexter Edwards 50dfcfa058 chore: run coverage on untested files (#1759) 2022-10-17 15:42:57 +01:00
Radosław Szpiech e984ea8e2a chore: change tests to use stagnet3 by default (#1760) 2022-10-17 16:11:13 +02:00
Dexter Edwards 1bc41c8a9a fix: voting during waiting for node vote (#1748)
* fix: voting during waiting for node vote

allow voting during waiting for node vote, bug fix for vote cancelled, show correct status

* fix: adjust vote information to be more correct

* test: begin adding tests for current proposal status

* chore: clean up render logic, add more tests for current proposal status

* chore: add tests for failed proposals

* test: add final tests for vote information

* test: fix rebase issues
2022-10-17 13:27:59 +01:00
mattrussell36 5e75e0ee21 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-17 12:05:05 +00:00
malinantonsson 9e7277e578 Chore/liquidity provisiond stagnet1 (#1743)
* chore: update envs file for stagnet1 liquidity provision dashboard

* chore: update envs file for stagnet1 liquidity provision dashboard
2022-10-17 11:12:13 +01:00
Dexter Edwards 6958f551b8 fix: docs URL not showing up correctly (#1755) 2022-10-17 09:22:10 +01:00
mattrussell36 8bbf12f754 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-17 06:28:31 +00:00
mattrussell36 c6540d9bb4 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-17 00:13:19 +00:00
mattrussell36 9dd9674e2f chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-16 18:05:10 +00:00
mattrussell36 1b23ea1f70 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-16 12:05:10 +00:00
mattrussell36 d6c7f9bcc0 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-16 06:09:44 +00:00
mattrussell36 ed250c1ba2 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-16 00:12:56 +00:00
mattrussell36 0a52fca40f chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-15 18:04:33 +00:00
mattrussell36 304503f515 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-15 12:05:03 +00:00
mattrussell36 904d7345d8 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-15 06:11:28 +00:00
mattrussell36 dbabea3aec chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-15 00:11:51 +00:00
mattrussell36 da1eab5281 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-14 18:06:02 +00:00
Joe Tsang b1c15d5711 Test/1723 update asset proposal (#1753)
* test: test for update asset proposal

* test: added test for hiding validator list

* chore: update vegacapsule config files

* fix: lint

* chore: add reason to skipped test
2022-10-14 16:54:27 +01:00
macqbatandmaciek 37a6217169 market page: break down components to smaller chunks for better performance (#1726)
* chore: break down components to smaller chunks for better performance

* chore: break down components to smaller chunks for better performance

* chore: break down components to smaller chunks for better performance - fix failing tests

* chore: break down components to smaller chunks for better performance - adjust token app cases

* chore: break down components to smaller chunks for better performance - small fixes

* chore: break down components to smaller chunks for better performance - small fixes

* chore: break down components to smaller chunks for better performance - small fixes

* chore: break down components to smaller chunks for better performance - small fixes

* chore: break down components to smaller chunks for better performance - add nwe store for pageTitle

* chore: break down components to smaller chunks for better performance - sm fix

* chore: break down components to smaller chunks for better performance - sm fix

* chore: break down components to smaller chunks for better performance - sm imprv

* chore: break down components to smaller chunks for better performance - change prop names

* chore: break down components to smaller chunks for better performance - fix some test

* chore: break down components to smaller chunks for better performance - change cypress url

* chore: break down components to smaller chunks for better perf - set back redundant changes

* chore: resolve conflicts

Co-authored-by: maciek <maciek@vegaprotocol.io>
2022-10-14 17:42:53 +02:00
Radosław Szpiech ecb19f226b fix: change way of locating order status (#1752) 2022-10-14 17:18:08 +02:00
Dexter Edwards 8ecb4430cc Fix/1546 staking requests (#1747)
* fix: bad data flow

* chore: generate types

* chore: move component to where it is used

* chore: move things top the routes where they are actually used

* chore: more moving of files

* chore: generate types

* chore: replace old type files with new

* test: fix tests
2022-10-14 15:59:00 +01:00
Radosław Szpiech 144b4bd847 fix: change n07 to n06 (#1751) 2022-10-14 16:56:17 +02:00
Sam Keen 6d71109798 Fix/1326: Do not allow proposal voting unless sufficient associated t… (#1701)
* Fix/1326: Do not allow proposal voting unless sufficient associated tokens

* Fix/1326: Renaming string

* Fix/1326: Changes from PR comments and vote-buttons tests

* Fix/1326: Switched to enum

* Fix/1326: Used enum in unit tests
2022-10-14 14:13:51 +01:00
mattrussell36 16d35df133 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-14 12:05:34 +00:00
Radosław SzpiechandMadalina Raicu be9e1ee84b Market page test refactor (#1741)
* fix: markets fixed test with new mock

* test: market summary tests refactored

* fix: fix undefined row.price issue

* chore: comments adressed

Co-authored-by: Madalina Raicu <madalina@raygroup.uk>
2022-10-14 10:15:34 +02:00
Dexter Edwards 7aac1b6506 style: pending transactions styling (#1738)
* test: pending transactions styling

* fix: don't always show button

* chore: revert reverted changes
2022-10-14 09:08:24 +01:00
m.ray fe472acfe9 feat: 1661 add market expiry date from metadata tags to market info and market header (#1739) 2022-10-14 08:09:11 +01:00
mattrussell36 d674162e38 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-14 06:24:20 +00:00
mattrussell36 0182b32708 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-14 00:14:51 +00:00
mattrussell36 8246a942c2 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-13 18:10:43 +00:00
Dexter 6038fca01e ci: run generate queries on develop 2022-10-13 16:59:05 +01:00
Dexter Edwards 56d9a70b97 Fix/1685 connet wrong on associate (#1718)
* fix: incorrect connection logic on the associate page

* test: add tests for staking wallet container

* chore: move files to be consistent with other routes structures

* chore: rename to be consistent with other route strcutures

* style: lint

* test: allow seeing of node information when not connected to wallets

* test: add test for disassociate page
2022-10-13 15:10:27 +01:00
Matthew Russell 1fce4c0ed6 Feat/wallet changes (#1616)
* fix: padding on connect dialog footer

* chore: refactor connect dialog so custom url input is own component with own state
2022-10-13 15:10:13 +01:00
Bartłomiej Głownia 969d66a6a1 feat(#1536): remove zero volume rows from orderbook (#1624)
* feat(#1536): remove zero volume rows from orderbook

* feat(#1536): add orderbook debug console

* feat(#1536): move best bid/ask price line position outside of render functon

* feat(#1536): orderbook scroll to price fixes
2022-10-13 15:09:54 +01:00
Dexter Edwards dee0b016eb fix: wallet errors incorrectly showing as user rejections (#1737) 2022-10-13 14:34:16 +01:00
candida-d cb92a30015 chore: update tooltips for asset limits (#1733) 2022-10-13 14:19:05 +01:00
mattrussell36 29e6bc8375 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-13 12:05:07 +00:00
AndyWhiteVega 152a55831a Test/block exp node tests (#1724)
* test: extra check and tweaks

* test: lint
2022-10-13 11:21:06 +01:00
mattrussell36 3f5a0bc452 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-13 06:19:39 +00:00
mattrussell36 f4fcb62395 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-13 00:13:18 +00:00
Matthew Russell 79a53e18b8 chore: add missing env vars and alphabeticise them (#1736) 2022-10-12 14:28:55 -07:00
Matthew Russell 38c58ba54e Chore/Stagnet 1 for trading (#1735)
* chore: update envs file for stagnet1 trading

* chore: add escapes for double quotes
2022-10-12 21:51:48 +01:00
mattrussell36 ad553f8a9e chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-12 18:09:51 +00:00
mattrussell36 b45c97ed96 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-12 12:05:54 +00:00
Joe Tsang d071ffa777 chore: updated acs for governance (#1711) 2022-10-12 12:39:08 +01:00
Dexter Edwards 06541a1527 Chore/stagnet1 (#1721)
* chore: add static files required

* style: lint

* chore: tidy stagnet3 env file

* chore: add env file for stagnet1

* chore: add stagnet1 environment to possible environement types

* chore: correct url

* style: lint

* test: update tests
2022-10-12 11:57:51 +01:00
m.rayandBartłomiej Głownia 7c5bfc4471 feat: 1648 add deposit button and show accounts 0 state (#1696)
* feat: #1648 add deposit button and show accounts 0 state

* fix: remove text-white and text-black

* fix: #1648 revert and add back row model type and data source in accounts table

* fix: #1648 fix linting issue

* fix: #1648 table tweaks buttons at the bottom

* fix: #1644 hide withdrawals history title

* fix: #1648 fix accounts-table test

* fix: #1648 fix trading-accounts.cy.ts test

* fix: leave ag grid to show overlay if data is simply null but there is no error or it's not loading

Co-authored-by: Bartłomiej Głownia <bglownia@gmail.com>
2022-10-12 11:49:13 +01:00
macqbatandmaciek 00381a2b3e chore: ag grid row data and value can be undefined (#1709)
* chore: improve ag-grid typings - fix runtime bug

* chore: improve ag-grid typings - add numeric type checking

* chore: improve ag-grid typings - remove redundant cl

* chore: improve ag-grid typings - remove redundant cl

* chore: improve ag-grid typings - add some basic unit test

* chore: improve ag-grid typings - add some basic unit test

Co-authored-by: maciek <maciek@vegaprotocol.io>
2022-10-12 10:06:19 +01:00
Radosław SzpiechandBartłomiej Głownia 50df63c858 test: added tests to cover submit orders ac (#1708)
* test: added tests to cover submit orders ac

* fix: unit tests

* fix: mock subscription fixed

* fix: typo

* fix: lint

* fix(1593): remove ag-grid api presence check from providder update callbacks

* fix: unit tests

Co-authored-by: Bartłomiej Głownia <bglownia@gmail.com>
2022-10-12 09:55:23 +02:00
mattrussell36 5152e3f603 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-12 06:11:32 +00:00
mattrussell36 62203b5e73 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-12 00:14:33 +00:00
Art f2aaf287eb fix: fixed horizontal scrollbars appearing when dialog is open (#1714) 2022-10-11 21:07:17 +02:00
Art 5e423f4fd3 fix: reverted custom page title element (#1715) 2022-10-11 21:07:03 +02:00
mattrussell36 219e29b947 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-11 18:06:18 +00:00
Art f2f0f33975 chore: fixed failing tests in different TZ and locale (#1713) 2022-10-11 18:53:49 +02:00
Art 0129dbd611 Chore/update wording assets (#1712)
* chore: updated wording

* chore: updated wording

* chore: updated wording

* chore: updated wording

* chore: updated unit tests

* chore: fixed lint errors
2022-10-11 18:18:01 +02:00
Joe Tsang 7824c39bfe Test/1689 staking acs (#1698)
* test: vesting test with eth wallet connected

* chore: acs for staking added

* chore: acs for staking income
2022-10-11 14:49:57 +01:00
Dexter Edwards 6ec6c6b8b7 test: reintroduce tests that were failing (#1505) 2022-10-11 14:36:16 +01:00
Elmar a7d100bce8 Feat/1682 fix api endpoints (#1690)
* chore(explorer): replace tendermint api with block explorer api for transaction related searches

* feat(explorer): replace detect search type to be by process of elimination as temp measure

* fix(explorer): fix broken tests
2022-10-11 14:17:10 +01:00
Dexter 0b8c9c836c fix: wallet connect (#1706) 2022-10-11 13:36:13 +01:00
macqbatandmaciek 0bb2e95091 chore: market header live update (#1672)
* chore: market header live update

* chore: market header live update

* chore: market header live update - adjust some mocks

* chore: market header live update - add single market query

* chore: market header live update - small fixes

* chore: market header live update - fix int tests

* chore: market header live update - fix int tests

* chore: market header live update - remove unnecessary props from query

* chore: market header live update - change concept - split for small comps

* chore: market header live update - small fix for mocks

* chore: market header live update - fix updates throttling

* chore: market header live update - improve update methods of data providers

* chore: market header live update - improve update methods of data providers

* chore: market header live update - improve update methods store for get rid of blinking

* chore: market header live update - fix title component

Co-authored-by: maciek <maciek@vegaprotocol.io>
2022-10-11 14:30:07 +02:00
Art 64c85b2b4a Chore/1653 full asset details (#1700)
* chore: full list of asset details for dialog

* chore: show full asset details in market info and dialog (1653)

* fixed lint errors
2022-10-11 13:22:55 +01:00
mattrussell36 503c831018 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-11 12:05:14 +00:00
Bartłomiej Głownia 9dfe8789d1 fix(1649): don't use old data on rerender when data update from provider is handled by component (#1707) 2022-10-11 13:52:35 +02:00
AndyWhiteVega 224ec8653b Test/block exp validator tests (#1703)
* test: validators and network restart

* test: lint

* test: flake removal

* test: theme test fixes

* test: lint

* test: tweak to network restart

* test: check removal

* test: check tweak
2022-10-11 11:37:36 +01:00
Sam Keen 178597dc01 Feat/1541: Hide top third of validators to promote decentralisation (#1626)
* Feat/1541: Hide top third of validators to promote decentralisation

* Feat/1541: Hide top third of validators

* Feat/1541: Only top validators if 3 or more
2022-10-11 09:23:29 +01:00
mattrussell36 e6c19cf9b1 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-11 06:20:26 +00:00
mattrussell36 79ddf307a9 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-11 00:13:11 +00:00
mattrussell36 2e841b009d chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-10 18:09:34 +00:00
m.rayandMatthew Russell e25f0085eb fix: 1642 show in type column if order is pegged or LP (#1697)
* fix: #1642 show in type column if order is pegged or LP

* Update libs/orders/src/lib/components/order-list/order-list.spec.tsx

Co-authored-by: Matthew Russell <mattrussell36@gmail.com>

* Update libs/orders/src/lib/components/order-list/order-list.spec.tsx

Co-authored-by: Matthew Russell <mattrussell36@gmail.com>

Co-authored-by: Matthew Russell <mattrussell36@gmail.com>
2022-10-10 16:17:38 +01:00
m.ray 4d8abeb2a3 fix: 1644 edit order dialog default to existing price and change price label (#1695)
* fix: #1644 default to existing price and change label

* fix: #1644 fix formatting
2022-10-10 16:05:42 +01:00
mattrussell36 37ecb0d526 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-10 12:05:33 +00:00
AndyWhiteVega c3e70d6457 Test/block exp network params (#1681)
* test: network parameter tests

* test: lint

* test: add comments

* test: more guidance notes

* test: disable theme check whilst investigating

* test: fix failing test for console lite

* test: attempt 2 to fix console lite error only in CI

* test: lint

* test: remove check

* test: update conflict function
2022-10-10 10:35:43 +01:00
Joe Tsang fb9505a8a8 chore: acs updated for token association (#1687) 2022-10-10 09:22:41 +01:00
Joe Tsang 2edd2d95ff Test/1633 governance flows (#1683)
* test: refactor most existing tests to use raw proposal

* chore: remove unnecessary waits
2022-10-10 09:22:30 +01:00
mattrussell36 4ac34a3c4b chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-10 06:21:41 +00:00
mattrussell36 a62bc35a2a chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-10 00:11:43 +00:00
mattrussell36 3be90c55bb chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-09 18:04:37 +00:00
mattrussell36 ebf1f5ac7b chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-09 12:04:56 +00:00
mattrussell36 185787dfe0 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-09 06:07:13 +00:00
mattrussell36 cafb5e3706 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-09 00:12:00 +00:00
mattrussell36 4adadcfe3c chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-08 18:03:57 +00:00
mattrussell36 11dc6e39c7 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-08 12:05:07 +00:00
mattrussell36 1f9c53e210 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-08 06:05:57 +00:00
mattrussell36 1b8da24ea1 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-08 00:12:45 +00:00
mattrussell36 a83df68f7c chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-07 18:09:14 +00:00
m.rayandMatthew Russell a71f40956b fix: deal ticket estimated uncrossing (#1636)
* fix: invalid uncrossing price

* chore: align estimated uncrossing price with size label

* fix: 0 used balance on margin and bond accounts should not be displayed

* fix: small tweaks and bugfixes

* fix: filter empty acounts

* fix: fix unit test

* fix: fix unit test

Co-authored-by: Matthew Russell <mattrussell36@gmail.com>
2022-10-07 16:19:01 +01:00
mattrussell36 eb3ca33eae chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-07 12:05:48 +00:00
Elmar ec47ee2930 feat(explorer): add txs infinite scroll list (#1625) 2022-10-07 09:46:54 +01:00
mattrussell36 057322c4d7 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-07 06:07:37 +00:00
mattrussell36 7d3c90f3ca chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-07 00:16:14 +00:00
mattrussell36 7df7626418 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-06 18:06:55 +00:00
Art 48ce7978ee feat: updated withdrawal tab (849) (#1579)
* feat: updated withdrawal tab (849)

* added pending table to the token app, added pending completed filtering to the data provider

* amended and added unit tests

* amended time formats

* added units

* fixes errors

* addressed comments
2022-10-06 17:40:34 +02:00
Bartłomiej Głownia 4ca22c4e98 fix: remove setting up viewport height to derived from grid element (#1673) 2022-10-06 17:38:31 +02:00
Art ad9436c7cf chore: added useYesterday hook (#1635)
* chore: added useYesteday hook

* chore: added useYesterday hook
2022-10-06 16:31:11 +02:00
Art 329d073b34 housekeeping: fixes wallet tests (#1669) 2022-10-06 15:24:02 +02:00
Radosław Szpiech 38454a7e33 Adjust workflow to new wallet (#1668)
* chore: change wallet import and fix test

* chore: fix wallet run

* chore: fix wallet run

* chore: update capsule config
2022-10-06 14:40:15 +02:00
mattrussell36 c03281ee0d chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-06 12:05:31 +00:00
mattrussell36 2ef64a3e2f chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-06 06:08:21 +00:00
mattrussell36 7a7766d79a chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-06 00:13:30 +00:00
Matthew Russell e588418972 chore: rename wallet label to match app, add more user friendly fetch failed message (#1650) 2022-10-05 16:58:16 -07:00
Bartłomiej Głownia ae10cdfb2c chore: move generateAccounts to seerate file (#1623) 2022-10-05 12:57:55 -07:00
mattrussell36 ddeb514aaa chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-05 18:11:27 +00:00
Joe Tsang 656cda636f Test/1574 governance proposal forms (#1629)
* chore: remove repeated code from existing test

* test: update parameters added

* test: new proposals added

* chore: tidy forms flow

* test: governance acs added

* chore: revert change in asset json

* chore: remove only tag
2022-10-05 16:24:25 +01:00
46d03826cc Feat/1446: Add UpdateAsset proposal form (#1558)
* Feat/1446: Add UpdateAsset proposal form

* Feat/1446: Formatting fix

* Feat/1446: changes from PR comments

* Feat/1446: Fix for mockWalletContext shape and lint fix

* Feat/1446: Fix more tests reliant on the updated mockPubkey shape change

* Feat/1446: Adding the update asset proposal terms interface into the new location

Co-authored-by: Bartłomiej Głownia <bglownia@gmail.com>
Co-authored-by: Dexter <dexter.edwards93@gmail.com>
2022-10-05 16:07:42 +01:00
mattrussell36 b2619eac7c chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-05 12:05:44 +00:00
Bartłomiej Głownia 0821cafdf0 chore: replace duplicated assets queries with assetsProvider (#1617) 2022-10-05 12:42:22 +02:00
macqbatandmaciek 2bf614afd2 chore: remove old type gen in positions (#1619)
* chore: remove old type gen

* chore: remove old type gen - small fixes

Co-authored-by: maciek <maciek@vegaprotocol.io>
2022-10-05 11:30:42 +02:00
mattrussell36 50d0c45d51 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-05 06:14:04 +00:00
Matthew Russell 1f8f54617b chore: misc quick wins (#1596)
* fix: make sparkline appear after change cell

* fix: make price come after expiry in market header

* fix: refer to size rather than amount in validation

* fix: radio colors in light theme

* fix: remove orange border from vega tx pending state

* chore: combine deposit and withdraw buttons into single cell

* chore: update accounts table test, remove console warning from breakdown tests

* chore: update order validation test

* chore: place market table header in correct position

* chore: use actual change id to avoid clash

* fix: remove assertion in fills table that is flakey

* chore: render fills table with act

* fix: add a wait time for infura queries to resolve
2022-10-04 21:00:06 -07:00
mattrussell36 61721e61f6 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-05 00:13:08 +00:00
Dexter EdwardsandMatthew Russell d6583f5969 chore: sepolia migration (#1517)
* chore: seoplia migration

* fix: remove trailing slash from etherscan urls

* fix: make mock assets for withdraw form real assets so working with infura works

* chore: remove stray screen.debug

* fix: global mocks for chainid

* fix: add additional chain id mock for withdrawals page

Co-authored-by: Matthew Russell <mattrussell36@gmail.com>
2022-10-04 15:24:27 -07:00
Edd df04825ce5 chore: revert "always prefix static assets with dot (#1615)"
This reverts commit e82c4b5b3a.
2022-10-04 14:55:40 -07:00
Edd e82c4b5b3a chore(trading): always prefix static assets with dot (#1615) 2022-10-04 12:52:21 -07:00
mattrussell36 727d303932 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-04 18:10:24 +00:00
AndyWhiteVega 27545ba697 Test/expand parties test coverage to include json (#1612)
* test: assets

* test: lint
2022-10-04 17:10:08 +01:00
Matthew Russell 7863384974 feat: adjust wallet styles and translations (#1611) 2022-10-04 17:09:38 +01:00
macqbatandmaciek 15e6c4ffef Bug/1606 wrong update of new added deposit (#1608)
* chore: fix for accounts update

* chore: fix for accounts update

Co-authored-by: maciek <maciek@vegaprotocol.io>
2022-10-04 17:57:36 +02:00
Art 2031a57b48 fix: failing trading-accounts (#1610) 2022-10-04 08:32:29 -07:00
mattrussell36 3c53b7059b chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-04 12:05:35 +00:00
m.ray 22ebbf746a fix: #1403 format with asset decimals withdrawal limit values (#1603) 2022-10-04 12:54:38 +02:00
AndyWhiteVega d889b8e970 Test/block explorer assets tests (#1602)
* test: update asset tests

* test: lint

* test: heading tweak

* test: remove comments

* test: lint
2022-10-04 11:42:15 +01:00
Bartłomiej Głownia a40f494a6f chore: remove unused __generated__ files (#1599)
* chore: remove unused __generated__ files

* chore: change default env for type generation to testnet

* chore: fix import in assets data provider
2022-10-04 12:14:58 +02:00
Matthew Russell faa1d51acb fix: seller fills should be red (#1597) 2022-10-04 11:59:38 +02:00
Bartłomiej Głownia ae4960f700 Chore/move trade queries to graphql files (#1598)
* chore: move trade queries to graphql file

* chore: change default base for affected to develop
2022-10-04 11:03:39 +02:00
macqbatandmaciek 406b69566f Feat/1491 insert accounts and positions (#1515)
* feat: inserts of new item in positions

* feat: inserts of new item in positions - move select-market to app dir

* feat: inserts of new item in positions - add delta to update

* feat: inserts of new item in positions - fix e2e mocks

* feat: inserts of new item in positions - fix e2e mocks

* feat: inserts of new item in positions - adjust e2e mocks

* feat: inserts of new item in positions - adjust e2e tests

* feat: inserts of new item in positions - adjust e2e tests

* feat: inserts of new item in positions - adjust e2e trading tests

* feat: inserts of new item in positions - adjust e2e account tests

* feat: inserts of new item in positions - adjust e2e account tests

* feat: inserts of new item in positions - adjust e2e account tests

* feat: inserts of new item in accounts - manage inserting new accounts

* feat: inserts of new item in accounts - adjust console-lite tests

* feat: inserts of new item in accounts - adjust console-v2 tests

* feat: inserts of new item in accounts - adjust console-v2 tests

* feat: inserts of new item in accounts - clean up after merge

* feat: inserts of new item in accounts - fixes after feedback

Co-authored-by: maciek <maciek@vegaprotocol.io>
2022-10-04 10:37:31 +02:00
mattrussell36 8156a3c1a9 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-04 06:11:25 +00:00
mattrussell36 eacf95ea10 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-04 00:15:17 +00:00
Matthew RussellandDexter 4ed623c84c feat#873): wallet service v2 (#1349)
* feat: update connect dialog to handle api v2

* feat: better error handling

* feat: update to only use strings for pubkey, add json rpc connector

* feat: make json connector follow same patterns as rest connector

* feat: add ability to change wallet location

* feat: add chain id fetch

* feat: improve types

* feat: adjust send tx types

* chore: remove dialog title and chain check temporarily

* feat: additional UI and error handling

* feat: rename keypair and keypairs to pubKey and pubKeys

* feat: make rest and json rpc connectors return consistent data

* feat: rename derived ids more clearly

* feat: update send_transaction response type

* chore: fix tests after context name change

* feat: add utils for wallet, add encode tx func

* feat: return null if tx is rejected

* feat: fix up styles for connect buttons

* feat: handle wallet version check

* feat: add chain id check

* chore: rename select pub key function to match, fix tests

* fix: tests for rest connector form

* feat: add tests for json rpc flow

* feat: connect dialog changes

* chore: change status to enum to avoid magic strings

* feat: add custom icons and handle provided key name

* chore: update global wallet connection e2d tests

* chore: change zod validation to only expected required values

* chore: ignore new generated code files

* chore: fix typos and add translations

* chore: set hosted wallet via env var and only show if not mainnet

* feat: add functionality for try again button

* test: fix failing tests

* chore: fix lint and test

* chore: remove double import

* chore: make console-lite-e2e strict so json connector compiles correctly

* chore: make token e2e tsconfig strict

* chore: make stats-e2e tsconfig strict

* feat: update json rpc request namespace

* feat: simplify connector setup, support try again

* chore: remove comment

* fix: build errors

* chore: make chainId check optional based on presence of appChainId, mock request for tests

* chore: mock chain id request for all apps on all pages

* fix: footer border on small screens

* fix: use beforeEach for chainId query mock

* chore: remove optional chain check, prevent rendering until fetch is complete

* chore: update NX_VEGA_WALLET_URLs as the application now appends the base path, adjust token tests

* fix: token e2e test that checks for pubkey name

* chore: remove duplicated test, update wallet title assertion

* fix: token tests

* fix: token e2e assertions

* fix: withdraw test

* feat: enable json RPC for token

* fix: sendTx command now accpets pubkey as separate arg

* fix: test to use gui option temporarily

Co-authored-by: Dexter <dexter.edwards93@gmail.com>
2022-10-03 11:12:34 -07:00
mattrussell36 fe6c5520a9 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-03 18:09:25 +00:00
Bartłomiej Głownia 40527e9bc8 Chore/markets-list: move queries to .graphql, combine data in marketListProvider (#1554)
* chore: combine data instead of providing three lists in marketListProvider

* chore: move markets-libs lib queries to .graphql files

* chore: fix markets queries names in e2e tests

* chore: add missing variables to simple market list candles query

* chore: fix trading  home e2e

* chore: change liquidity-provision-dashboard serve port to allow parell e2e tests
2022-10-03 18:28:32 +01:00
Radosław Szpiech 6681c01b43 chore: run nightly run on demand (#1592) 2022-10-03 16:57:23 +02:00
Joe Tsang ae8ef6001c Test/1484 update token smoke tests (#1571)
* test: added smoke tests from flows

* chore: move failing test
2022-10-03 16:29:52 +02:00
Elmar 620bf1bab4 fix(explorer): add party to consolidated search (#1588)
* fix(explorer): add party to consolidated search

* chore(explorer): add missing tests for detect-search.spec.ts
2022-10-03 13:20:00 +01:00
mattrussell36 09476eea38 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-03 12:05:16 +00:00
Bartłomiej Głownia 9486db134c chore: replace Order type with existing OrderSubmissionBody['orderSubission'] (#1518)
* chore: replace Order type with existing OrderSubmissionBody['orderSubmission']

* chore: drop WithMarket from Order, Trade and Fill types

* chore: fix order list mock
2022-10-03 13:31:46 +02:00
AndyWhiteVega edb31e0f46 Test/expand explorer tests to include parties page (#1530)
* test: parties test suite

* test: lint

* test: improve error handling

* test: lint

* test: extra error handling and deletion of redundant curl params

* test: lint

* test: lint

* test: update

* test: skip test

* test: tweaks

* test: lint

* test: lint
2022-10-03 09:50:36 +01:00
m.ray f743828cb5 feat: 991 deal ticket should show estimated crossing price for market orders when market is in auction (#1561)
* feat: #991 move order validation back in deal ticket, add tooltip

* fix: align view full market list link styling

* feat: #991 move tooltip add for monitoring liq auction

* feat: #991 order validation messages, LP table sortable, padding sparkline, warning instead of errro

* feat: #991 check only in monitoring auction to add tooltips, re-use isMarketInAuction

* fix: #991 fix import for isMarketInAuction

* fix: #991 console-lite imports

* fix: formatting in console-lite deal-ticket-steps.tsx

* fix: add market depth

* fix: add market depth and fix generate orders

* fix: revert market list and generate orders

* fix: fix trading-e2e build

* feat: #991 in monitoring auction don't show a price input color update based on intent

* fix: #991 update docs links to docs.vega.xyz in tooltips
2022-10-03 09:41:34 +01:00
Michael b10844147e Chore/1535 update ac code refrences to new (#1577)
* 1002-STKE to 2001-STKE

* ASSO from 1000 to 1004
2022-10-03 09:29:28 +01:00
m.rayandBartłomiej Głownia 361f8fa870 fix: 1569 navigation link active on market selected refresh (#1580)
* chore: ignore apollo errors - to be reverted after API will be fixed

* fix: navigtaion link market - no global local storage init

* fix: update active link check

* fix: fix any hydration errors and default fallback to markets

Co-authored-by: Bartłomiej Głownia <bglownia@gmail.com>
2022-10-03 09:29:07 +01:00
Bartłomiej Głownia 1d87eab47c chore: fix generic data provider isUpdate (#1560) 2022-10-03 09:28:52 +01:00
Dexter Edwards 96811b45e3 fix: do not show success state if user cancels tx (#1562) 2022-10-03 09:17:40 +01:00
Sam Keen 520f767d09 Feat/1279: Make validator profiles visible on token front end without wallet connected (#1578) 2022-10-03 09:09:35 +01:00
Matthew Russell 219c9e1b41 feat: disable scrolling to change value for size and price fields (#1584) 2022-10-03 09:05:26 +01:00
Dexter Edwards 0a5a87f432 Feat/1478 better proposal title (#1544)
* chore: generate types

* feat: add asset id to title

* test: add test for new functionality
2022-10-03 09:01:45 +01:00
mattrussell36 eb7b261ec4 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-03 06:09:39 +00:00
mattrussell36 d70059a0d4 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-03 00:12:42 +00:00
mattrussell36 b7c3b9cdb0 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-02 18:04:37 +00:00
mattrussell36 6473738758 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-02 12:04:57 +00:00
mattrussell36 1a2130abbd chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-02 06:09:07 +00:00
mattrussell36 1ec7cc2ed5 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-02 00:13:49 +00:00
Radosław Szpiech dade1e502e fix: wallet connection issue in PR check (#1583) 2022-10-01 12:09:50 -07:00
mattrussell36 335d1bef38 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-01 18:04:23 +00:00
mattrussell36 009a6cc2e1 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-01 12:05:38 +00:00
mattrussell36 2aa23ae202 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-01 06:16:26 +00:00
mattrussell36 1a7ad58199 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-01 00:14:40 +00:00
mattrussell36 682049d17c chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-30 18:06:57 +00:00
m.ray c221d0772c fix: 1569 trading tab navigation update (#1573)
* fix: #1569 trading tab navigation update

* fix: #1569 get market id value from init
2022-09-30 16:50:48 +01:00
Radosław Szpiech efcd128240 fix: console-lite e2e tests (#1576) 2022-09-30 16:51:41 +02:00
Radosław Szpiechandasiaznik 9a88c33458 Fix/console failing tests (#1572)
* fix: market and trading tests

* fix: trading tests

* fix: balance DP

* fix: select asset

* fix: withdrawal tests

Co-authored-by: asiaznik <artur@vegaprotocol.io>
2022-09-30 15:42:42 +02:00
mattrussell36 d2a5adf6ce chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-30 12:04:57 +00:00
Radosław Szpiech ab0065bd9a chore: env setup fixed (#1567) 2022-09-30 11:02:55 +02:00
Radosław Szpiech 5600c56da1 fix: fix (#1565) 2022-09-30 10:59:15 +02:00
Radosław Szpiech 3d7267f496 fix: fix capsule workflow (#1563) 2022-09-30 10:31:38 +02:00
mattrussell36 c87beb4050 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-30 06:25:43 +00:00
m.rayandBartłomiej Głownia 907a4e256e feat(#847): collateral table, add breakdown (#1442)
* feat: #847 show progress bar, margin accounts, no used/deposited

* feat: #847 add collateral tables

* fix: #847 add deposit asset type and fix tests

* feat: #847 show deposited value, avaliable and percentage used

* fix: #847 add styling fixes

* fix: #847 add deposit new asset button

* fix: #847 remove disabledSelect
to fix withdraw and deposit dialogs

* fix: #847 remove global reward from incoming - needs to be party specific

* fix: #847 integration tests

* fix: #847 default select deposit & withdraw

* fix: #847 default select deposit & withdraw

* fix: #847 pass asset id as default value

* fix:  #847 use only bigint no bignumber, remove NaN check

* fix:  #847 update deposit-form.spec.tsx

* fix: revert update on account fields

* feat: add storybook set up

* chore: ignore apollo errors - to be reverted after API will be fixed

* fix: container moved, progress bar in helpers

* fix: #847 UI tweaks around accounts container

* feat: #847 added useDepositAsset and useWithdrawAsset

* fix: #847 fix progress bar in accounts and positions

* feat: #847 add storybook

* fix: #847 added tooltip and updated filtering

* chore: #847 add get account data test

* fix: #847 fix lint and type in account story

* fix:  #847 update data provider

* fix: #847 fix get account data dry & lp link

* fix: #847 fix breakdown table test

* fix: #847 account data provider test

* fix: #847 remove deposit new asset button - subscription does not display a
sset data

* fix: #847 add defaultValue in select otherwise default is not set up

* feat: #847 update data provider update method and tables

* fix: #847 fix accounts tests

* fix: #847 remove unused getRows

* fix: add decimals

* fix: #847 fix imports

* fix: update ids

* Update apps/trading/pages/liquidity/[marketId].page.tsx

* fix: #847 accounts update method check delta

* fix: #847 use vega value formatters and cell renderers

* fix: #847 fix imports

* fix: #847 handle new account else block comment

* fix: accounts and breakdown tables

* fix(#847): account data provider improvments

* fix: #847 fix formatters null check and add param

* fix: #847 fix withdraw test and mock the hook

* fix: #847 fix console lite grid select market test

* fix: console lite build

* fix: revert withdraw limits

* fix: remove redundant waitFor use vega cell renderer

* fix: breakdown display only use accounts

* fix: breakdown display only use accounts

* fix: updated accounts table

* fix: move update inside try useWithdrawAsset

* fix: update trading-accounts test

* fix: portfolio-page.test.ts

Co-authored-by: Bartłomiej Głownia <bglownia@gmail.com>
2022-09-29 17:40:44 -07:00
mattrussell36 835bf36393 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-30 00:17:39 +00:00
John Walley 57863a7167 chore(deps): update dependency pennant to v0.4.18 (#1557) 2022-09-29 16:47:36 -07:00
Sam KeenandDexter 4272fefb0b feat(#807): adds app for validator add and remove signer (#1402)
* Feat/807: ABI and classes for the contract methods

* Feat/807: Added a new multisig-signer app

* Feat/807: Added a new multisig-signer app

* Feat/800: Untested signer forms

* Feat/800: Moved reused bg video into ui-toolkit to use in multisig-signer project, and cleaned up some spacing that was overlooked in the stats theme changes

* Feat/800: Componentised a bit, made the app look ok

* Feat/800: Linting, prettifying, removing some unneeded tests, ensuring e2e tests run

* Feat/800: Bit of translation

* chore: fix type errors

* chore: some parts error handling

* feat: handle error and not found cases

* feat: add changes to remove signer form as well

* chore: rename component

* chore: fix type issues

* feat: add web3 connector logic

* feat: allow disconnecting and show connected eth wallet info

* Feat/800: Removed unused 'useApolloClient'

* Feat/800: Ensure bundle.nonce and bundle.signatures have '0x' prepended

* Feat/800: Removed unused e2e directory

* Feat/800: Removed unnecessary app test

* Feat/800: Removed unnecessary router

* Feat/800: Capturing GQL errors in Sentry

* Feat/800: Removing references to the unused e2e test directory

* Feat/807: Consistent react hook imports

* Feat/807: Removed unnecessary spreads

Co-authored-by: Dexter <dexter.edwards93@gmail.com>
2022-09-29 12:10:53 -07:00
mattrussell36 8fee3ca080 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-29 18:06:47 +00:00
Radosław Szpiech 98abe2910d chore: fix smoke flag meaning (#1553) 2022-09-29 19:11:52 +02:00
AndyWhiteVega 22f4edff82 test: fix mocks for console light to include id (#1551) 2022-09-29 18:06:33 +01:00
Radosław Szpiech 28aa5cd060 Chore/add skip nx cache flag (#1549)
* chore: add skip-nx-cache flag to manual flow

* chore: set --skip-nx-cache flag

* chore: set --skip-nx-cache flag

* chore: set --skip-nx-cache flag

* chore: remove log
2022-09-29 18:27:08 +02:00
Radosław Szpiech 7b0d41b4a6 fix: typo (#1547) 2022-09-29 18:02:40 +02:00
Radosław Szpiech 83ea12b4cb Fix/smoke test flag (#1545)
* fix: fix smoke test flag logic

* fix: fix smoke test flag logic
2022-09-29 16:32:43 +01:00
Dexter Edwards a7768f154b chore: relabel total associated (#1531) 2022-09-29 15:47:09 +01:00
Matthew Russell 65af6bc0a8 fix: make sparkline strokes the same thickness (#1527)
* fix: make sparkline strokes the same thickness

* fix: data test id in sparkline
2022-09-29 07:20:04 -07:00
Radosław Szpiech 93c1835cd6 Chore/1495 workflows minor improvements fixes and cleanup (#1538)
* test: try with shared actions

* test: fix env

* test: fix path

* test: fix path

* test: fix path

* test: fix path

* test: fix path

* test: fix path

* test: fix path

* test: fix path

* test: fix path

* test: fix path

* test: fix path

* test: create action for capsule build

* test: create action for capsule build

* test: create action for capsule build

* test: create action for capsule build

* fix: fix

* fix: fix

* fix: fix

* fix: fix

* chore: create action for vegawallet setup

* chore: create action for vegawallet setup

* chore: fix

* chore: fix

* chore: fix

* chore: fix

* fix: fix

* fix: fix

* fix: fix

* fix: fix

* fix: fix

* fix: fix

* fix: fix

* fix: fix

* fix: fix

* fix: fix

* chore: apply changes to all workflows

* chore: apply changes to all workflows
2022-09-29 14:13:09 +01:00
Art 446af23d9c fix: orderbook sticky behaviour and precision options (#1519)
* fix: orderbook sticky behaviour and precision options

* chore: add handling of y-axis resize

* fix: addressed PR comments

* fix: addressed PR comments

* added cy.log

* Update apps/trading-e2e/src/support/vega-wallet.ts
2022-09-29 14:23:14 +02:00
mattrussell36 2cfe8608fb chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-29 12:05:36 +00:00
Matthew Russell 032805b5b9 Feat/1500 cancel and edit buttons conditional rendering (#1528)
* feat: allow second type arg to be generic as you dont always need the value

* feat: update order data provider to include fields required to determine if editable or cancellable

* feat: use ag grid type helpers and add rendering logic to cancel and amend buttons

* feat: combine cancel/edit buttons into single cell for better spacing

* feat: add test cases for dispaly of amend/cancel buttons

* chore: add missing fields to mock generate function

* chore: remove unnecessary wait for in fills test that was sporadically failing

* fix: add missing fields to generate order function

* fix: add missing fields to generate order function for console-lite
2022-09-29 11:00:39 +02:00
Joe Tsang 7a7c4ad452 Test/governance flows update (#1523)
* test: update governance flows with new ui change

* chore: existing governance flow tests passing

* chore: remove unused import

* chore: remove unused var
2022-09-29 09:18:06 +01:00
mattrussell36 0c5b2f5c29 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-29 06:27:20 +00:00
mattrussell36 a8667eea31 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-29 00:15:10 +00:00
Bartłomiej GłowniaandRado 8dd63d7cac chore: fix mocks and hydration error (#1520)
* chore: fix DealTicket mock

* chore: fix React Hydration Error

* test: change tag

Co-authored-by: Rado <szpiechrados@gmail.com>
2022-09-28 14:40:21 -07:00
Matthew Russell 8bffc05be2 fix: ensure sub is cancelled if dialog is closed (#1472)
* fix: ensure sub is cancelled if dialog is closed

* fix: pass transaction object in use proposal hooks
2022-09-28 12:34:49 -07:00
Matthew Russell 26e3596c5a fix: align market dropdown cells for both my markets and all markets (#1492) 2022-09-28 12:15:09 -07:00
mattrussell36 6ad68f87cc chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-28 18:08:30 +00:00
Radosław Szpiech 86fdd75d6c fix: disabled test (#1525) 2022-09-28 18:56:45 +02:00
Dexter Edwards f688b28b29 fix: vote not seen being incorrectly reported (#1508) 2022-09-28 14:55:25 +01:00
Radosław Szpiech 6ddceaf6bd chore: update vega binaries to v0.57.0 (#1514) 2022-09-28 15:31:35 +02:00
AndyWhiteVega a9e8b6915e Test/using chrome headless (#1516)
* test: change night run to use headless chrome to address memory issues

* test: update manual for non-smoke

* test: remove headless flag since depreciated

* test: update browser for cypress
2022-09-28 14:26:22 +01:00
Dexter Edwards 9318dab698 Chore/support update asset (#1473)
* chore: generate types

* chore: add update asset type

* feat: display asset change proposals in list

* chore: generate types
2022-09-28 13:46:41 +01:00
mattrussell36 ae0424e21a chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-28 12:06:11 +00:00
mattrussell36 5e484dfab0 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-28 06:26:05 +00:00
mattrussell36 e5b1390302 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-28 00:16:31 +00:00
m.ray 6a6779ee72 feat: 1506 add risk parameters (#1510)
* feat: #1506 add risk parameters

* fix: integration test

* fix: integration test
2022-09-27 23:49:34 +01:00
Bartłomiej Głownia 414b8ced13 chore: fix positions data provider restarts (#1509) 2022-09-27 15:02:48 -07:00
Bartłomiej Głownia e310f04034 chore: set default fetchPolicy, handle subscription errors like query errors, timeout unsubscribe (#1482)
* chore: set default fetchPolicy, handle subscription errors like query errors,add unsubscribe timeout

* chore: improve no data handling in fills, ordes and trades

* chore: make reset delay optional, fix pagination and useOrderListData spec
2022-09-27 11:48:53 -07:00
mattrussell36 adf6059701 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-27 18:07:13 +00:00
m.ray 5dda58334e fix: 1425 add link on select market table row (#1493)
* fix: #1425 add link on select market table row

* fix: #1425 use only on select

* fix: #1425 revert withdraw manager spec
2022-09-27 14:03:58 +01:00
Dexter Edwards 3b03b16938 Chore/vote progress color (#1504)
* chore: fix vote progress color

* chore: sort out double full stops
2022-09-27 14:00:11 +01:00
Dexter Edwards 0d8c052ec6 fix: hide enacted on proposal details page for freeform proposals (#1503) 2022-09-27 13:59:09 +01:00
mattrussell36 9836f29e15 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-27 12:04:37 +00:00
AndyWhiteVega 4d69dceaa7 Test/faucet fake assets into vegawallet - then check displayed correctly in TFE (#1485)
* test: initial

* test: update

* test: lint

* test: faucet asset checks

* test: lint

* test: tweaks

* test: tweaks

* test: lint

* test: tweaks

* test: lint

* test: re-arrange into views

* test: lint
2022-09-27 11:22:44 +01:00
Radosław Szpiech 6af189150b test: vega in vegacapsule version changed to 0.56.0 (#1499) 2022-09-27 12:10:39 +02:00
Elmar 6f20c9125d fix(explorer): theme dark nav (#1498) 2022-09-27 10:24:42 +01:00
Dexter Edwards 7c6b14f73a fix: full reload when moving to propose child routes (#1496)
* fix: full reload when moving to propose child routes

* chore: replace outlet
2022-09-27 10:06:31 +01:00
mattrussell36 0fa1f47ad5 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-27 06:21:37 +00:00
Matthew Russell c4468d507b fix: classname mismatch warning by setting dark class for nav (#1465)
* fix: classname mismatch warning, tidy unnecessary classes to accomodate dark nav

* chore: lint

* fix: lp test console error and fix

* fix: remove fixed bg from console-lite theme switcher
2022-09-26 23:18:41 -07:00
191e73335e chore: fixes for 0.56 release (#1487)
* chore: use new GQL candle fields

* Revert "chore: downgrade to 0.55 (#1406)"

This reverts commit cc7a4f2ddd.

* chore: update queries to be compatible with 0.56

* fix: update positions data provider to use only marketId field, omit new position insertion for now

* fix: regen types after merging candles query update

* chore: remove unused generated files

* chore: check for null markets connection

* fix: import errors

* chore: export types from market-list, disable unrelated failing tests

Co-authored-by: johnwalley <john@walley.org.uk>
Co-authored-by: Matthew Russell <mattrussell36@gmail.com>
2022-09-26 17:40:08 -07:00
mattrussell36 dae8949b46 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-27 00:17:06 +00:00
Matthew Russell 3aca9207ed fix: network params query name clash which was blocking type generation (#1490) 2022-09-26 15:04:40 -07:00
mattrussell36 69db3fdecb chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-26 18:04:40 +00:00
Dexter Edwardsandcandida-d d9a747102d Feat/1076 proposal not found (#1432)
* feat: add not found page

* test: add tests for not found

* Update apps/token/src/i18n/translations/dev.json

Co-authored-by: candida-d <62548908+candida-d@users.noreply.github.com>

* test: fix test for new updated copy

Co-authored-by: candida-d <62548908+candida-d@users.noreply.github.com>
2022-09-26 14:35:53 +01:00
Bartłomiej Głownia 3f6bd066f1 Feat/asset balance decimals fix (#1474)
* feat: positions tab asset balance decimals

* feat: positions tab asset balance decimals
2022-09-26 14:33:01 +01:00
Joe TsangandRado 195e234f16 Chore/separate cypress install in workflow (#1481)
* chore: add step that makes sure that Cypress bins are installed correctly

* chore: missing working directory

* chore: update remaining flows

Co-authored-by: Rado <szpiechrados@gmail.com>
2022-09-26 14:56:53 +02:00
mattrussell36 b505a0598d chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-26 12:05:44 +00:00
Joe Tsang f87fd676f6 chore: revert hosted runner (#1480) 2022-09-26 13:42:43 +02:00
Joe Tsang b885696659 Chore/use self hosted runners (#1475)
* chore: edit manual flow

* chore: install yarn in flow

* chore: change runner for remaining flows

* chore: add yarn install to other flows
2022-09-26 12:15:05 +01:00
Radosław Szpiech 5d553271a5 test: fixed public key 2 issue in trading test (#1477) 2022-09-26 13:07:11 +02:00
botond 87f7efd960 Chore/migrate to new types (#1439)
* fix: candle type paths

* chore: migrate deal-ticket

* chore: migrate deposits

* fix: format

* chore: migrate environment

* fix: format

* chore: migrate fills

* fix: format

* chore: fix build errors

* fix: format

* fix: lint

* fix: env tests

* fix: add missing query variable

* fix: format

* fix: change vega_url because n11 is down

* fix: deal ticket query name

* chore: extend event type

* fix: incorrect e2e test
2022-09-26 11:35:45 +01:00
Elmar d9e3b9de99 Feat/1334 replace json (#1459)
* feat(explorer): add panel component

* feat(explorer): add info panel component

* feat(explorer): change layout styles

* feat(explorer): render json data in component for parties

* feat(explorer): change testnet env

* feat(explorer): change eslint json

* feat(explorer): render staking json in info panel component

* fix(explorer): pr comments
2022-09-26 10:10:33 +01:00
macqbatandmaciek b5e2513d53 chore: [console-lite] - portfolio - use more advanced react router (#1467)
* chore: [console-lite] - portfolio use mora advanced react router

* chore: [console-lite] - portfolio - fix container dimms

Co-authored-by: maciek <maciek@vegaprotocol.io>
2022-09-26 09:59:52 +02:00
mattrussell36 ba27f9e738 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-26 06:26:10 +00:00
mattrussell36 22787bd4c4 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-26 00:10:51 +00:00
mattrussell36 c5eeead356 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-25 18:04:17 +00:00
mattrussell36 612b906cb4 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-25 12:04:32 +00:00
mattrussell36 94a2de859f chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-25 06:06:21 +00:00
mattrussell36 f287dced18 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-25 00:12:57 +00:00
mattrussell36 3beb43a719 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-24 18:04:13 +00:00
mattrussell36 da807c883d chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-24 12:05:10 +00:00
mattrussell36 5a842c9be9 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-24 00:11:49 +00:00
mattrussell36 3bec65ac67 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-23 18:04:47 +00:00
Radosław Szpiech f124275ce5 chore: remove unnecessary if (#1468) 2022-09-23 16:49:38 +02:00
Art d271f28b82 feat: page title (660) (#1437)
* feat: page title (660)

* fix: trading-e2e home tests
2022-09-23 16:29:35 +02:00
Radosław Szpiech 483cf05050 fix: need to yarn install before nx usage (#1466) 2022-09-23 16:23:54 +02:00
Radosław Szpiechandasiaznik a452a6e831 Chore/use cache in GitHub jobs (#1461)
* chore: use cache v3

* chore: just cache whole node modules

* chore: download binaries instead of building them

* chore: missing directory flag

* chore: remove directory

* chore: aaah gobin

* chore: apply all improvements to other workflows

* chore: cache cypress

* fix: added mock for one failing test, removed console.log

* fix: removed increased timeout - not needed

* chore: change name back

Co-authored-by: asiaznik <artur@vegaprotocol.io>
2022-09-23 15:56:47 +02:00
ArtandMatthew Russell ebf2bfc7a9 feat: added asset details dialog to market select (1226) (#1260)
* feat: added asset details dialog to market select (1226)

* Update libs/ui-toolkit/src/components/dialog/dialog.tsx

Co-authored-by: Matthew Russell <mattrussell36@gmail.com>

* removed focus complexity from popover, refactored

* chore: after rebase fixes

* fix: fixed console-lite asset details dialog func - after rebase

* fix: added mock for one failing test, removed console.log

* fix: removed increased timeout - not needed

Co-authored-by: Matthew Russell <mattrussell36@gmail.com>
2022-09-23 15:14:52 +02:00
mattrussell36 d60cf3e5e6 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-23 12:05:44 +00:00
Radosław Szpiech 2650329a31 chore: update trading testnet config (#1415) 2022-09-23 12:36:29 +02:00
4ef8218267 Feat/800 better proposal ux round 1 (#1223)
* Feat/800: Configured routes for different proposal types

* Feat/800: Refactored propose.tsx to be a hub for the new proposal routes

* Feat/800: Link style tweak for proposals guide

* Feat/927: Hydrating the new proposal forms

* chore: fix typings for shared components

* Feat/927: Proposal forms built with reusable components

* Feat/800: Updated network params, added new method to get param keys as well as values, updated generated types

* Feat/800: Updated and built more reusable proposal form components

* Feat/800: Removed old catchall file of reusable proposal form components

* Feat/800: Added utils for vote deadline and enactment timestamps

* Feat/800: Readded necessary 'color-scheme-dark' class for dark-theme date and datetime inputs

* Feat/800: Tweak to icon positioning on the dialog component

* Feat/800: Regenerated types for network params

* Feat/800: Added iso8601-duration package for working with API vote deadline and enactment data

* Feat/800: Reworked the proposal forms

* Feat/800: Couple of translation additions

* Feat/800: Another translation addition

* Feat/800: Raw proposal test (tests as per old proposal form test)

* Feat/800: Some basic proposal form tests

* Feat/800: Fixing small types error in test

* Feat/800: Updating simple proposal form tests

* Feat/800: Set up env-specific proposal docs links

* Feat/800: Deadlines to the bottom of proposal forms

* Feat/800: Another type error from API changes fixed

* Feat/800: Added the spam protection min tokens network param to proposal forms requests, and the min requirements now displays the larger value of spam protection or min proposer balance

* Feat/800: Network param value change now a textarea

* Feat/800: Improved way to pass docs url

* Feat/800: Added useful explorer links to proposal forms

* Feat/800: Show current value of selected network param in proposal form

* Feat/800: Removed wallet-confirmation buffer, suspect it is not necessary

* Feat/800: Condense vote and enactment ui into single component for simpler state management, memoised some stuff

* Feat/800: Set a default select option for the market selector

* Feat/800: For network params that aren't JSON, display the network param current value in a readonly text input rather than the syntax highlighter

* Feat/800: Corrected network param form network params

* Feat/800: Timestamp functions for closing, enactment and validation, with tests

* Feat/800: More translations

* Feat/800: Added validation options to proposal-form-vote-and-enactment-deadline.tsx, generally improved the component and added tests

* Feat/800: Improved workings of proposal-form-min-requirements.tsx and wrote tests

* Feat/800: Tests for the other reusable form components

* Feat/800: Improved tests for the proposal forms

* Feat/800: Corrected mistake in get-enactment-timestamp.ts

* Feat/800: Fixed type issues that were preventing spotting an error

* Feat/800: Added some extra docs links

* Feat/800: Using renamed Dialog passed in from useProposalSubmit

* refactor: network params to return an object

* fix: update net param form, remove old net params obj

* fix: check for params before rendering

* Feat/800: Rename and simplify isJson based off PR comment

* Feat/800: Small tweaks to timestamp helpers based on PR comments

* Feat/800: Removed proposal-docs-link.tsx

* Feat/800: Used bignumber for min-requirements calculation

* Feat/800: Update tests to work with merged network params branch

* Feat/800: Removed unnecessary translations splitting

* Feat/800: Removed unwanted test

* Feat/800: Removed unwanted tests

* Feat/800: Consistent arrow functions

* Feat/800: Sorted links

* Feat/800: Removed unnecessary typecasting

* Feat/800: Refactored routing

* Feat/800: Refactored mocking of proposal forms to use MockedProvider

* Feat/800: Correct response from the raw proposal submission test

* Feat/800: Removed console.logs added for debugging

* Feat/800: Result of running 'nx format:write'

* Feat/800: Cleaning up lint warnings

* Update apps/token/.env.stagnet3

Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com>

* Feat/800: Added extra test for docs link in the proposal-form-terms component

* Feat/800: Removed stray console.log

* Feat/800: Added basic render test for proposal-form-terms and cleaned up a bit

* Feat/800: Added tests for the correct form components for the different forms

* Feat/800: Split up the proposal-form-vote-and-enactment-deadline components inside the file to make things a bit more readable

* Feat/800: router config webpack chunk name tweak

* Feat/800: Lint issue fixed

* Feat/800: Fixed timing issue with get-[deadline]-timestamp tests

* Feat/800: Setting a system time in proposal-form-vote-and-enactment-deadline.spec.tsx that doesn't get affected by British Summer Time

* Feat/800: Skipping a cypress test as the newProposalButton no longer takes a user directly to a proposal form. Leaving it in the codebase as the test is very likely to be updated.

* Feat/800: Adding comment on why I've skipped a cypress test

Co-authored-by: Dexter <dexter@vega.xyz>
Co-authored-by: Matthew Russell <mattrussell36@gmail.com>
Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com>
2022-09-23 11:10:13 +01:00
m.ray e3254564ae fix: view liquidity provision anchor (#1443)
* fix: view liquidity provision anchor

* fix: remove router push and use external links in tooltips

* fix:  remove unused push router

* fix:  remove unused push router
2022-09-23 09:18:59 +01:00
Bartłomiej Głownia 7effa0791c chore: add example of gql subscription mock usage (#1440) 2022-09-23 09:20:22 +02:00
mattrussell36 93108c5b48 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-23 06:20:36 +00:00
macqbatandmaciek 06a2fc4d12 fix: [console-lite] - empty portfolio views (#1433)
* fix: [console-lite] - empty protfolio views

* fix: [console-lite] - empty portfolio views - fix linters

Co-authored-by: maciek <maciek@vegaprotocol.io>
2022-09-23 07:51:18 +02:00
mattrussell36 c274a4694a chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-23 00:10:49 +00:00
mattrussell36 756d4d00de chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-22 18:04:24 +00:00
Joe Tsang ac16ca9ee5 Test/783 cypress tags (#1428)
* test: add tags for slow tests

* chore: remove old flows

* test: added smoke tags to view tests

* test: add tags for trading tests

* test: tags for explorer tests added

* chore: add tags to remaining tests and tidy files

* chore: pass env in test command

* chore: fix build errors

* chore: re-add teardown for manual flow

* chore: ability to only run smoke tests in manual flow

* chore: fix manual input flow
2022-09-22 18:40:11 +01:00
Radosław Szpiech c3cdcede9f Chore/speed up manual workflow (#1436)
* chore: add similar way to speed up tests that is used in  capsule-cypress

* chore: fix typo

* chore: fix the fix

* fix: add network import

* fix: add home

* fix: another fix bites the dust
2022-09-22 18:19:18 +02:00
Radosław Szpiech 186a624466 fix: use fairground network for vega wallet if capsule is not run (#1431)
* fix: use fairground network for vega wallet if capsule is not run

* fix: this fix should fix the fix

* fix: add import fairground network

* fix: home paths added to vega wallet
2022-09-22 17:59:31 +02:00
Radosław Szpiech 4d9c43cf19 Chore/improve ci test times (#1423)
* chore: disable video record for token e2e

* chore: disable videos in all tests

* fix: change main-branch-name to base-ref

* chore: disable capsule being run when not necessary

* fix: missing true

* chore: fix typo

* chore: fix if contruction

* chore: fix env

* chore: fix envs

* chore: try to fix develop ref
2022-09-22 16:07:18 +02:00
mattrussell36 8f20216b39 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-22 12:05:39 +00:00
macqbatandmaciek 5c4af868a7 feat: [console-lite] - abstract components for portfolio page (#1306)
* feat: [console-lite] - abstract components for portfolio page

* feat: [console-lite] - abstract components for portfolio page - improvements

* feat: [console-lite] - use abstract list with accounts manager

* feat: [console-lite] - use abstract list with positions

* feat: [console-lite] - use abstract list with orders

* feat: [console-lite] - use abstract list with fills

* feat: [console-lite] - fix failings linters

* feat: [console-lite] - fix failings e2e test

* feat: [console-lite] - fix failings e2e test

* feat: [console-lite] - improve some css

* feat: [console-lite] - a bunch of fixes for positions

* feat: [console-lite] - tweaks of columns confs, bunch of e2e tests

* feat: [console-lite] - abstract components for portfolio page - after review feedback fixes

* feat: [console-lite] - abstract components for portfolio page - after review feedback fixes

* feat: [console-lite] - abstract components for portfolio page - add missing asset datails dialog

* feat: [console-lite] - portfolio abstractions - add fills hook unit tests

* feat: [console-lite] - portfolio abstractions - add orders hook unit tests

* feat: [console-lite] - portfolio abstractions - fix lint error

* feat: [console-lite] - abstract components for portfolio page -fix failings tests

* feat: [console-lite] - abstract components for portfolio page -fix failings tests

* feat: [console-lite] - abstract components for portfolio page - fix failings lint check

* feat: [console-lite] - abstract components for portfolio page - next fix

* feat: [console-lite] - abstract components for portfolio page - improve some int test

Co-authored-by: maciek <maciek@vegaprotocol.io>
2022-09-22 13:09:12 +02:00
Bartłomiej Głownia d95bfb60ea chore: mock gql subscriptions (#1419)
* chore: mock gql subscriptions

* chore: fix market info, inprove fills unit tests

* chore: fix socket mock
2022-09-22 11:15:20 +02:00
mattrussell36 792459e589 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-22 06:23:32 +00:00
mattrussell36 4ca244a975 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-22 00:11:28 +00:00
m.rayandBartłomiej Głownia 010d7e5e31 fix: order data provider error (#1420)
* chore: ignore apollo errors - to be reverted after API will be fixed

* fix: order data provider error

Co-authored-by: Bartłomiej Głownia <bglownia@gmail.com>
2022-09-21 13:47:17 -07:00
mattrussell36 9b04310ab8 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-21 18:05:00 +00:00
m.ray 832327c918 fix: add back risk factors (#1397)
* fix: #1302 add back risk factors

* fix:  omit __typename is default

* fix: add risk factors in generate-market-info-query.ts
2022-09-21 08:31:11 -07:00
m.rayandBartłomiej Głownia c59aa19bd2 fix: liquidity provisions view not working after API update (#1410)
* chore: ignore apollo errors - to be reverted after API will be fixed

* fix: partyID should not be enforced in market liquidity query

* Update apps/trading/components/page-query-container/page-query-container.tsx

* Update libs/react-helpers/src/lib/generic-data-provider.ts

* fix: remove partyId from the query to avoid any confusion

Co-authored-by: Bartłomiej Głownia <bglownia@gmail.com>
2022-09-21 08:26:18 -07:00
Bartłomiej Głownia efc1d909b3 chore: ignore apollo errors - to be reverted after API will be fixed (#1407) 2022-09-21 07:00:48 -07:00
Bartłomiej Głownia cc7a4f2ddd chore: downgrade to 0.55 (#1406) 2022-09-21 13:49:11 +01:00
mattrussell36 ddbaea5e3f chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-21 12:05:17 +00:00
mattrussell36 1fd325a44f chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-21 06:26:47 +00:00
mattrussell36 2ad248b6d7 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-21 00:12:01 +00:00
Matthew Russell 10e1315afa chore: fix incorrect event id mock 2022-09-20 16:05:08 -07:00
ArtandMadalina Raicu 4ddacb5269 fix: total fees calculation (#1394)
* fix: total fees calculation

* fix: total fees calculation

* fix: add two more tests

* fix: market-info.cy.ts

Co-authored-by: Madalina Raicu <madalina@vegaprotocol.io>
2022-09-20 15:13:42 -07:00
mattrussell36 597a1fa878 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-20 18:05:23 +00:00
3bf5d823ee chore: stagnet3 api updates (#1321)
* chore: update account, fills and orders subscriptions in data providers

* chore: update account, fills and orders subscriptions in data providers

* fixing console-lite

* fixing types in general - regen

* chore: update account, fills and orders subscriptions in data providers

* fixed console-lite unit tests, uncommented quote name

* chore: update account, fills and orders subscriptions in data providers

* type aligning of assets and proposals

* fixes liquidity data provider

* fixed accounts build errors and unit tests

* regen types, removed market name

* regen types

* fixed positions

* chore: handle updates in derived market provider, update orders

* removed taker fee mapping (renamed to maker fee)

* chore: update account, fills and orders subscriptions in data providers

* chore: update account, fills and orders subscriptions in data providers

* chore: fix Order type

* chore: fix possible null types

* chore: revert order-list.stories.tsx

* chore:  derivedDataProvider fixes

* fills unit tests fixes

* orders unit tests fixes

* added eslint ingore for generated files in liquidity

* added unique key to the list element of simple market toolbar

* changed main-branch-name to develop for pr workflows

* removed redundant waitFor

* increased test timeout to 10s

* removed mocked response

* chore: disable simple market list tests

* chore: fix e2e projects mock types

* feat: [subscription-update] - uncomment some console-lite tests

* cypress: trading-accounts

* chore: replace  market candles with candlesConnection

* chore: ignore gql errors, to be reverted after candlesConnectio n will be fixed

* feat: [subscription-update] - improve wrongly renamed hook

* feat: [subscription-update] - improve wrongly renamed hook

* feat: [subscription-update] - improve wrongly renamed hook 3

* chore: add pagination hangdling to derived data provier

* cypress: trading-fills

* feat: [stagnet3 api update] - remove redundant command in tests

* feat: [stagnet3 api update] - remove redundant command in tests

* chore: fix trading orders e2e tests

* chore: fix console lite e2e mocks

* chore: fix market-trade tests

* chore: use markets only in market selector, change Instrument cache policy

* chore: fix market-selector tests

* feat: [subscription-update] - improve ag grid conf for unit tests

* feat: [subscription-update] - improve ag grid conf for unit tests

* chore: fix candle types in console lite market mocks

* chore: revert error policy ignore

* chore: revert jest timeout

* chore: remove unused AccountFields

* chore: revert remove unused AccountFields

* chore: simplify node subscription probe

* chore: remove unused generated types in candles-chart

* chore: improve useMarketsList mock

* feat: [subscription-update] - increase jest timeout

* feat: [subscription-update] - fix jest timeout

* feat: [subscription-update] - fix jest timeout

* feat: [subscription-update] - try to fix failing test again

* chore: fix candles-chart types

* feat: [subscription-update] - temporary skip failing test

* feat: [subscription-update] - temporary skip failing test

* feat: [subscription-update] - temporary skip failing test

* feat: [subscription-update] - fix failling int test

* feat: [subscription-update] - try to restore commented unit tests

* feat: [subscription-update] - try to restore commented unit tests

* feat: [subscription-update] - improve fixed unit tests

Co-authored-by: asiaznik <artur@vegaprotocol.io>
Co-authored-by: maciek <maciek@vegaprotocol.io>
2022-09-20 08:24:28 -07:00
mattrussell36 df3b79478e chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-20 12:05:27 +00:00
mattrussell36 f383dedb24 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-20 06:24:20 +00:00
mattrussell36 592ec14b26 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-20 00:13:27 +00:00
mattrussell36 76126ae386 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-19 18:05:55 +00:00
c211c179b6 Create issue templates (#1386)
* Create bug issue template

* Create chore.md issue template

* Create user story issue template

* Update ---bug.md

* Update chore.md

* Update user-story.md

* test: update formatting

* fix: formatting

Co-authored-by: Gordsport <83510148+gordsport@users.noreply.github.com>
Co-authored-by: Madalina Raicu <madalina@vegaprotocol.io>
2022-09-19 15:33:23 +01:00
mattrussell36 4818b57fb2 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-19 12:05:36 +00:00
John Walley 70df56f745 fix: use correct graphql candle timestamp field (#1324) 2022-09-19 12:21:38 +01:00
mattrussell36 2b76e7d5c8 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-19 06:28:17 +00:00
mattrussell36 947180a6a6 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-19 00:10:20 +00:00
mattrussell36 d25755474f chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-18 18:04:15 +00:00
mattrussell36 888cbbec68 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-18 12:05:11 +00:00
botond 46884e3fec fix: cleanup more env things (#1383)
* fix: remove vega_rest from monorepo
* fix: mainnet api urls
* fix: remove redundant vega url from token config
* fix: lint
* chore: remove redundant env props from token app
* fix: format
2022-09-18 11:15:05 +00:00
mattrussell36 589c15de9d chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-18 06:06:08 +00:00
mattrussell36 0271e62439 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-18 00:10:24 +00:00
mattrussell36 84a5cbd44b chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-17 18:04:17 +00:00
mattrussell36 a386ea5cad chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-17 12:05:37 +00:00
mattrussell36 599ee1a360 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-17 06:04:33 +00:00
mattrussell36 d176285021 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-17 00:09:14 +00:00
mattrussell36 40337ee698 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-16 18:05:34 +00:00
AndyWhiteVega d47d754ac9 Test/governance suite expansion (#1372)
* test: initial commit

* test: commit

* test: extra tests and references added also new tag 0.55.0 for builds

* test: lint

* test: back to 0.54 for capsule cypress until tests fixed

* test: skip two tests since wallet name no longer shown soon to be fixed

* test: couple more tests to fulfill ACs

* test: lint

* test: more tests

* test: lint

* test: extra check within test

* test: lint

* test: minor

* test: improve test flake and skip test bugs outstanding

* test: lint and increase epoch length by second

* test: more tests

* test: lint

* test: lint

* test: lint

* test: teardown functionality

* test: lint

* test: epoch speed up and network restart stuff

* test: lint

* test: change epoch duration

* test: timing tweaks due to failures in CI

* test: lint

* test: more timing tweaks

* test: lint

* test: timing tweak

* test: lint

* test: lint

* test: config changes
2022-09-16 18:12:08 +01:00
Matthew Russell 666fe9aebb chore: update wallet types to align with protos (#1351) 2022-09-16 17:04:54 +01:00
Matthew Russell b8d5680011 chore: set curly eslint rule to multi line (#1322)
* chore: set curly eslint rule to multi line

* chore: fix lint

* chore: make eslint rule error and fix resulting errors
2022-09-16 17:04:32 +01:00
Dexter Edwards 4aa9bbaa23 fix: remove shortening of description content (#1346)
* fix: remove shortening of description content

* chore: remove test for removed functionality
2022-09-16 17:03:11 +01:00
Dexter Edwards 9385e0f4c3 Chore/revert changes (#1368)
* chore: revert changes to stagent3 yml

* style: lint
2022-09-16 15:49:47 +01:00
mattrussell36 03df9e9c5d chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-16 12:05:47 +00:00
Dexter Edwards e8d110d207 Chore/more env config (#1363)
* chore: remove vega URL as no longer needed

* chore: remove bad env config

* chore: remove config caching

* chore: remove silly text

* style: lint

* chore: style lint

* test: remove test for removed functionality
2022-09-16 12:32:44 +01:00
mattrussell36 6c41c0b14d chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-16 06:22:40 +00:00
mattrussell36 e4f175b691 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-16 00:11:21 +00:00
mattrussell36 4b6c7f062d chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-15 18:04:27 +00:00
Dexter Edwards 2fa80f65d0 chore: sort out environement stuff (#1345) 2022-09-15 16:39:11 +00:00
Matthew Russell 7fb3a23a5a chore: add netlify build command for lp dashboard (#1343) 2022-09-15 08:55:14 -07:00
malinantonsson 9169165a03 feat: lp dashboard setup (#1327)
* feat: generate new nx application

* feat: add env variables & render a headline

* feat: add netlify config

* feat: add cypress projectId and delete unused files
2022-09-15 08:37:02 -07:00
mattrussell36 608ecf36af chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-15 12:05:03 +00:00
Elmar df29c9ee72 fix(stats-manager): fix uptime pointing to incorrect field (#1328) 2022-09-15 11:47:51 +01:00
mattrussell36 e3809f5bc3 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-15 06:18:49 +00:00
mattrussell36 ff317f1c3a chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-15 00:10:04 +00:00
mattrussell36 e6b7f73be2 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-14 18:04:48 +00:00
mattrussell36 d65bdb1482 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-14 12:05:15 +00:00
m.rayandJoe ff7c501621 fix: decimal precision out of range (#1318)
* fix: fix fraction digits getting out of range

* fix: cumulative volume pos decimal places, number formatting tests and typos

* fix: added braces

* chore: increase request timeout

Co-authored-by: Joe <joe@vega.xyz>
2022-09-14 10:05:26 +01:00
mattrussell36 60f286c8af chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-14 06:25:03 +00:00
mattrussell36 a2c8c5a9c4 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-14 00:10:14 +00:00
mattrussell36 2eea3e2e34 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-13 18:05:16 +00:00
AndyWhiteVega 040cf0b83b Test/governance suite expansion (#1317)
* test: initial commit

* test: commit

* test: extra tests and references added also new tag 0.55.0 for builds

* test: lint

* test: back to 0.54 for capsule cypress until tests fixed

* test: skip two tests since wallet name no longer shown soon to be fixed
2022-09-13 13:28:48 +01:00
mattrussell36 9d2f2fe3aa chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-13 12:05:22 +00:00
Bartłomiej Głowniaandasiaznik a08f63c7d8 Feature/1243 market data providers refactoring (#1254)
* feat(#1243): Market data providers

* feat(#1243): Market data providers

* feat(#1243): Market data providers

* feat(#1243): refactor market lists

* feat(#1243): refactor market lists

* feat(#1243): refactor market lists

* feat(#1243): refactor orderbook data providers

* feat(#1243): refactor orderbook data providers

* feat(#1243): refactor depth chart data layer

* feat(#1243): fix market depth typing

* fixed unit tests

* feat(#1243): e2e test fixes

* feat(#1243): code style fixes

* feat(#1243): post merge fixes

* feat(#1243): fix lint issues

* feat(#1243): post merge fixes

* feat(#1243): remove market name from market

* feat(#1243): fix console lite e2e data depth mocks

* feat(#1243): fix console lite e2e market trade test

* feat(#1243): fix lint issues

* feat(#1243): fix trading e2e home test

Co-authored-by: asiaznik <artur@vegaprotocol.io>
2022-09-13 12:14:06 +02:00
Matthew Russell 3ff5bbb5a7 chore: use trading header and tidy tailwind usage (#1313)
* fix: border too thick, use grid head component

* fix: unused and superfluous classes, define border color in one place

* fix: tooltip should be on data not label
2022-09-13 09:19:41 +01:00
AndyWhiteVega 535bdb5183 Test/governance and wallet tweaks (#1309)
* test: tweaks

* test: lint

* test: lint

* test: remove unnessecary timeouts

* test: lint

* test: syntax tweak
2022-09-13 08:43:40 +01:00
mattrussell36 4505e86363 chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-13 06:26:28 +00:00
mattrussell36 7b2e86f32e chore: update tranches
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-13 00:12:14 +00:00
1148 changed files with 50943 additions and 28697 deletions
+3 -3
View File
@@ -51,8 +51,7 @@
"ul": ["list"],
"ol": ["list"]
}
],
"curly": "warn"
]
}
},
{
@@ -75,7 +74,8 @@
"prefer": "type-imports",
"disallowTypeAnnotations": true
}
]
],
"curly": ["error", "multi-line"]
}
},
{
+45
View File
@@ -0,0 +1,45 @@
---
name: "\U0001F41B Bug"
about: Create a report to help us improve
title: ''
labels: "\U0001F41B bug"
assignees: ''
---
## Description
A clear and concise description of what the bug is.
## Steps to Reproduce
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
## Expected behavior
A clear and concise description of what you expected to happen.
## Screenshots
If applicable, add screenshots to help explain your problem.
## Device details
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
## Additional context
Add any other context about the problem here.
+21
View File
@@ -0,0 +1,21 @@
---
name: Chore
about:
A template to capture non feature / enhancement work we need to do like work
to support other functions or housekeeping etc.
title: ''
labels: chore
assignees: ''
---
## The Chore
What we need to achieve and who for
## Tasks
- [ ] What do we need to do first
- [ ] and then what?
- [ ] Etc.
## Additional details / background info
+33
View File
@@ -0,0 +1,33 @@
---
name: User Story
about:
A template to describe a features or enhancements we want to make from a users
perspective to ensure we understand what is needed and the value it would add
title: ''
labels: feature
assignees: ''
---
## Story
As a
I want
So that
## Acceptance Criteria
- [ ] I can
- [ ] I can
- [ ] I can
## Tasks
- [ ] Explore and sketch
- [ ] Team and stakeholder review
- [ ] Visual Design
- [ ] Team review
- [ ] Etc.
## Sketch
## Additional details / background info
@@ -0,0 +1,31 @@
inputs:
all:
description: 'Install all binaries'
default: false
version:
description: 'Vega version'
gobin:
description: 'GOBIN path'
default: '/home/runner/go/bin'
runs:
using: 'composite'
steps:
- name: Install Vega binaries
if: ${{ inputs.all }}
shell: bash
run: |
wget 'https://github.com/vegaprotocol/vega/releases/download/${{ env.VEGA_VERSION }}/vega-linux-amd64.zip' -q
unzip vega-linux-amd64.zip -d ${{ inputs.gobin }}
- name: Install date-node binaries
if: ${{ inputs.all }}
shell: bash
run: |
wget 'https://github.com/vegaprotocol/vega/releases/download/${{ env.VEGA_VERSION }}/data-node-linux-amd64.zip' -q
unzip data-node-linux-amd64.zip -d ${{ inputs.gobin }}
- name: Install Vega wallet binaries
shell: bash
run: |
wget 'https://github.com/vegaprotocol/vega/releases/download/${{ env.VEGA_VERSION }}/vegawallet-linux-amd64.zip' -q
unzip vegawallet-linux-amd64.zip -d ${{ inputs.gobin }}
@@ -0,0 +1,30 @@
inputs:
github-token:
description: 'github token'
runs:
using: 'composite'
steps:
- name: Checkout capsule
uses: actions/checkout@v2
with:
repository: vegaprotocol/vegacapsule
ref: main
token: ${{ inputs.github-token }}
path: './capsule'
- name: Build capsule
run: go install
shell: bash
working-directory: capsule
- name: Login to docker
shell: bash
run: echo -n ${{ inputs.github-token }} | docker login https://ghcr.io -u vega-ci-bot --password-stdin
- name: Start nomad
shell: bash
run: vegacapsule nomad &
- name: Bootstrap network
shell: bash
run: vegacapsule network bootstrap --config-path=./frontend-monorepo/vegacapsule/config.hcl --force
@@ -0,0 +1,45 @@
inputs:
recovery:
description: 'Recovery phrase'
passphrase:
description: 'Wallet password'
capsule:
description: 'Is Capsule network used'
default: false
runs:
using: 'composite'
steps:
- name: Create passphrase
shell: bash
run: echo "${{ inputs.passphrase }}" > ./passphrase
- name: Create recovery
shell: bash
run: echo "${{ inputs.recovery }}" > ./recovery
- name: Initialize wallet
shell: bash
run: vegawallet init -f --home ~/.vegacapsule/testnet/wallet
- name: Import wallet
shell: bash
run: vegawallet import -w UI_Trading_Test --recovery-phrase-file ./recovery -p ./passphrase --home ~/.vegacapsule/testnet/wallet
- name: Create public key 2
shell: bash
run: vegawallet key generate -w UI_Trading_Test -p ./passphrase --home ~/.vegacapsule/testnet/wallet
- name: Import fairground network
shell: bash
if: ${{ inputs.capsule==false }}
run: vegawallet network import --from-url="https://raw.githubusercontent.com/vegaprotocol/networks-internal/master/stagnet3/stagnet3.toml" --force --home ~/.vegacapsule/testnet/wallet
- name: Start service using fairground network
shell: bash
if: ${{ inputs.capsule==false }}
run: vegawallet service run --network stagnet3 --automatic-consent --no-version-check --home ~/.vegacapsule/testnet/wallet &
- name: Start service using capsule network
shell: bash
if: ${{ inputs.capsule==true }}
run: vegawallet service run --network DV --automatic-consent --home ~/.vegacapsule/testnet/wallet &
@@ -1,4 +1,4 @@
name: Capsule tests -- manual trigger
name: Cypress tests -- manual trigger
# This workflow runs the frontend tests against chosen branch
@@ -15,20 +15,43 @@ on:
- stats-e2e
- token-e2e
- trading-e2e
includeFlows:
description: 'Include long flows (if any)?'
smokeOnly:
description: 'Run only smoke tests?'
required: true
type: boolean
default: true
default: false
skip-nx-cache:
description: 'Add --skip-nx-cache to cypress test'
required: false
type: boolean
default: false
jobs:
manual:
name: Run capsule tests -- manual trigger
runs-on: ubuntu-latest
name: Run Cypress tests -- manual trigger
runs-on: self-hosted
env:
GO111MODULE: 'on'
GOPROXY: ${{ secrets.GO_PROXY }}
GOBIN: /home/runner/go/bin
VEGA_VERSION: 'v0.58.0'
steps:
#######
## Setup flags
#######
- name: Set smoke tag
if: ${{ github.event.inputs.smokeOnly == 'true' }}
run: echo TAGS="--env.grepTags @smoke" >> $GITHUB_ENV
- name: Set --skip-nx-cache flag
if: ${{ github.event.inputs.skip-nx-cache == 'true' }}
run: echo SKIP_NX_CACHE="--skip-nx-cache" >> $GITHUB_ENV
# See if we capsule is needed for this project
- name: Set capsule flag
if: ${{ github.event.inputs.project == 'explorer-e2e' || github.event.inputs.project == 'token-e2e'}}
run: echo RUN_CAPSULE=true >> $GITHUB_ENV
#######
## Setup langs
#######
@@ -37,6 +60,7 @@ jobs:
id: go
with:
go-version: 1.19
- name: Set up Node 16
uses: actions/setup-node@v2
id: npm
@@ -44,112 +68,92 @@ jobs:
node-version: 16
#######
## Checkout capsule
## Install Yarn
#######
- name: Setup yarn
run: npm install -g yarn
#######
## Checkout repos
#######
# Checkout front ends
- name: Checkout frontend mono repo
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
path: './frontend-monorepo'
# Checkout capsule to build local network
- name: Checkout capsule
uses: actions/checkout@v2
# Restore node_modules from cache if possible
- name: Restore node_modules from cache
uses: actions/cache@v3
with:
repository: vegaprotocol/vegacapsule
ref: main
token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
path: './capsule'
path: |
frontend-monorepo/node_modules
/home/runner/.cache/Cypress
key: node_modules_cypress-${{ hashFiles('frontend-monorepo/yarn.lock') }}
# Install frontend dependencies
- name: Install root dependencies
run: yarn install --frozen-lockfile
working-directory: frontend-monorepo
#######
## Build binaries
## Build and run Vegacapsule network
#######
- name: Build capsule
run: go install
working-directory: capsule
- name: Set GOBIN
run: echo GOBIN=$(go env GOPATH)/bin >> $GITHUB_ENV
- name: Checkout Vega
uses: actions/checkout@v2
with:
repository: vegaprotocol/vega
ref: v0.54.0
token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
path: './vega'
- name: Install Vega binaries
run: go install -v ./cmd/vega
working-directory: vega
uses: ./frontend-monorepo/.github/actions/install-vega-binaries
with:
all: ${{ env.RUN_CAPSULE }}
version: ${{ env.VEGA_VERSION }}
gobin: ${{ env.GOBIN }}
- name: Install Vega wallet binaries
run: go install ./cmd/vegawallet
working-directory: vega
- name: Install date-node binaries
run: go install ./cmd/data-node
working-directory: vega
######
## Start capsule
######
- name: Login to docker
run: echo -n ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }} | docker login https://ghcr.io -u vega-ci-bot --password-stdin
- name: Start nomad
run: vegacapsule nomad &
- name: Bootstrap network
run: vegacapsule network bootstrap --config-path=../frontend-monorepo/vegacapsule/config.hcl --force
working-directory: capsule
- name: Build and run Vegacapsule network
if: ${{ env.RUN_CAPSULE }}
uses: ./frontend-monorepo/.github/actions/run-vegacapsule
with:
github-token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
######
## Setup a Vega wallet for our user
######
- name: Create passphrase
run: echo "${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }}" > ./passphrase
- name: Create recovery
run: echo "${{ secrets.TRADING_TEST_VEGA_WALLET_RECOVERY }}" > ./recovery
- name: Initialize wallet
run: vegawallet init -f --home ~/.vegacapsule/testnet/wallet
- name: Import wallet
run: vegawallet import -w UI_Trading_Test --recovery-phrase-file ./recovery -p ./passphrase --home ~/.vegacapsule/testnet/wallet
- name: Create public key 2
run: vegawallet key generate -w UI_Trading_Test -p ./passphrase --home ~/.vegacapsule/testnet/wallet
- name: Start service
run: vegawallet service run --network DV --automatic-consent --home ~/.vegacapsule/testnet/wallet &
- name: Set up Vegawallet
uses: ./frontend-monorepo/.github/actions/setup-vegawallet
with:
recovery: ${{ secrets.TRADING_TEST_VEGA_WALLET_RECOVERY }}
passphrase: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }}
capsule: ${{ env.RUN_CAPSULE }}
######
## Run some tests
######
- name: Install root dependencies
run: yarn install
# To make sure that all Cypress binaries are installed properly
- name: Install cypress bins
run: yarn cypress install
working-directory: frontend-monorepo
- name: Run Cypress tests
run: yarn nx run ${{ github.event.inputs.project }}:e2e --record --key ${{ secrets.CYPRESS_RECORD_KEY }}
run: yarn nx run ${{ github.event.inputs.project }}:e2e ${{ env.SKIP_NX_CACHE }} --record --key ${{ secrets.CYPRESS_RECORD_KEY }} --browser chrome ${{ env.TAGS }}
working-directory: frontend-monorepo
env:
CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }}
CYPRESS_SLACK_WEBHOOK: ${{ secrets.CYPRESS_SLACK_WEBHOOK }}
CYPRESS_ETH_WALLET_MNEMONIC: ${{ secrets.CYPESS_ETH_WALLET_MNEMONIC }}
CYPRESS_INCLUDE_FLOWS: ${{ github.event.inputs.includeFlows }}
CYPRESS_ETH_WALLET_MNEMONIC: ${{ secrets.CYPRESS_ETH_WALLET_MNEMONIC }}
CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS: false
######
## Upload logs
######
- name: Logs
if: ${{ always() }}
if: ${{ env.RUN_CAPSULE }}
run: vegacapsule network logs > vega-capsule-logs.txt
- uses: actions/upload-artifact@v2
if: ${{ env.RUN_CAPSULE }}
with:
name: logs
path: ./vega-capsule-logs.txt
+50 -67
View File
@@ -1,17 +1,22 @@
name: Capsule tests -- night run
name: Cypress tests -- night run
# This workflow runs the frontend tests against latest develop of the core to preempt breaking changes
on:
schedule:
- cron: '0 4 * * *'
workflow_dispatch:
jobs:
nightly:
name: Run capsule tests -- nightly
runs-on: ubuntu-latest
name: Run Cypress tests -- nightly
runs-on: self-hosted
timeout-minutes: 60
env:
GO111MODULE: 'on'
GOBIN: /home/runner/go/bin
VEGA_VERSION: 'v0.58.0'
RUN_CAPSULE: true
steps:
#######
## Setup langs
@@ -28,110 +33,88 @@ jobs:
node-version: 16
#######
## Checkout capsule
## Install Yarn
#######
- name: Setup yarn
run: npm install -g yarn
#######
## Checkout repos
#######
# Checkout front ends
- name: Checkout frontend mono repo
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
path: './frontend-monorepo'
# Checkout capsule to build local network
- name: Checkout capsule
uses: actions/checkout@v2
# Restore node_modules from cache if possible
- name: Restore node_modules from cache
uses: actions/cache@v3
with:
repository: vegaprotocol/vegacapsule
ref: main
token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
path: './capsule'
path: |
frontend-monorepo/node_modules
/home/runner/.cache/Cypress
key: node_modules_cypress-${{ hashFiles('frontend-monorepo/yarn.lock') }}
# Install frontend dependencies
- name: Install root dependencies
run: yarn install --frozen-lockfile
working-directory: frontend-monorepo
#######
## Build binaries
## Build and run Vegacapsule network
#######
- name: Build capsule
run: go install
working-directory: capsule
- name: Set GOBIN
run: echo GOBIN=$(go env GOPATH)/bin >> $GITHUB_ENV
- name: Checkout Vega
uses: actions/checkout@v2
with:
repository: vegaprotocol/vega
ref: v0.54.0
token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
path: './vega'
- name: Install Vega binaries
run: go install -v ./cmd/vega
working-directory: vega
uses: ./frontend-monorepo/.github/actions/install-vega-binaries
with:
all: ${{ env.RUN_CAPSULE }}
version: ${{ env.VEGA_VERSION }}
gobin: ${{ env.GOBIN }}
- name: Install Vega wallet binaries
run: go install ./cmd/vegawallet
working-directory: vega
- name: Install date-node binaries
run: go install ./cmd/data-node
working-directory: vega
######
## Start capsule
######
- name: Login to docker
run: echo -n ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }} | docker login https://ghcr.io -u vega-ci-bot --password-stdin
- name: Start nomad
run: vegacapsule nomad &
- name: Bootstrap network
run: vegacapsule network bootstrap --config-path=../frontend-monorepo/vegacapsule/config.hcl --force
working-directory: capsule
- name: Build and run Vegacapsule network
if: ${{ env.RUN_CAPSULE }}
uses: ./frontend-monorepo/.github/actions/run-vegacapsule
with:
github-token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
######
## Setup a Vega wallet for our user
######
- name: Create passphrase
run: echo "${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }}" > ./passphrase
- name: Create recovery
run: echo "${{ secrets.TRADING_TEST_VEGA_WALLET_RECOVERY }}" > ./recovery
- name: Initialize wallet
run: vegawallet init -f --home ~/.vegacapsule/testnet/wallet
- name: Import wallet
run: vegawallet import -w UI_Trading_Test --recovery-phrase-file ./recovery -p ./passphrase --home ~/.vegacapsule/testnet/wallet
- name: Create public key 2
run: vegawallet key generate -w UI_Trading_Test -p ./passphrase --home ~/.vegacapsule/testnet/wallet
- name: Start service
run: vegawallet service run --network DV --automatic-consent --home ~/.vegacapsule/testnet/wallet &
- name: Set up Vegawallet
uses: ./frontend-monorepo/.github/actions/setup-vegawallet
with:
recovery: ${{ secrets.TRADING_TEST_VEGA_WALLET_RECOVERY }}
passphrase: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }}
capsule: ${{ env.RUN_CAPSULE }}
######
## Run some tests
######
- name: Install root dependencies
run: yarn install
# To make sure that all Cypress binaries are installed properly
- name: Install cypress bins
run: yarn cypress install
working-directory: frontend-monorepo
- name: Run Cypress tests
run: yarn nx run-many --target=e2e --all --record --key ${{ secrets.CYPRESS_RECORD_KEY }}
run: yarn nx run-many --skip-nx-cache --target=e2e --all --record --key ${{ secrets.CYPRESS_RECORD_KEY }} --browser chrome --parallel=1
working-directory: frontend-monorepo
env:
CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }}
CYPRESS_SLACK_WEBHOOK: ${{ secrets.CYPRESS_SLACK_WEBHOOK }}
CYPRESS_ETH_WALLET_MNEMONIC: ${{ secrets.CYPESS_ETH_WALLET_MNEMONIC }}
CYPRESS_ETH_WALLET_MNEMONIC: ${{ secrets.CYPRESS_ETH_WALLET_MNEMONIC }}
CYPRESS_NIGHTLY_RUN: true
CYPRESS_INCLUDE_FLOWS: true
CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS: true
######
## Upload logs
######
- name: Logs
if: ${{ always() }}
run: vegacapsule network logs > vega-capsule-logs.txt
- uses: actions/upload-artifact@v2
+69 -76
View File
@@ -1,10 +1,10 @@
name: Capsule tests
name: Cypress tests
on:
push:
branches:
- master
- develop
- main
pull_request:
types:
- opened
@@ -14,11 +14,13 @@ on:
jobs:
pr:
name: Run capsule tests - PR
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.draft == false }}
name: Run Cypress tests - PR
runs-on: self-hosted
timeout-minutes: 30
env:
GO111MODULE: 'on'
GOBIN: /home/runner/go/bin
VEGA_VERSION: 'v0.58.0'
steps:
#######
## Setup langs
@@ -28,6 +30,7 @@ jobs:
id: go
with:
go-version: 1.19
- name: Set up Node 16
uses: actions/setup-node@v2
id: npm
@@ -35,119 +38,109 @@ jobs:
node-version: 16
#######
## Checkout capsule
## Install Yarn
#######
- name: Setup yarn
run: npm install -g yarn
#######
## Checkout repos
#######
# Checkout front ends
- name: Checkout frontend mono repo
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
path: './frontend-monorepo'
# Checkout capsule to build local network
- name: Checkout capsule
uses: actions/checkout@v2
# Restore node_modules from cache if possible
- name: Restore node_modules from cache
uses: actions/cache@v3
with:
repository: vegaprotocol/vegacapsule
ref: main
token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
path: './capsule'
path: |
frontend-monorepo/node_modules
/home/runner/.cache/Cypress
key: node_modules_cypress-${{ hashFiles('frontend-monorepo/yarn.lock') }}
# Install frontend dependencies
- name: Install root dependencies
run: yarn install --frozen-lockfile
working-directory: frontend-monorepo
# Check SHAs
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v2
with:
working-directory: frontend-monorepo
main-branch-name: ${{ github.base_ref || github.ref_name }}
set-environment-variables-for-job: true
# See if we capsule is needed for this project
- name: See affected apps
run: echo AFFECTED=$(yarn nx print-affected --base=${{ env.NX_BASE }} --head=${{ env.NX_HEAD }} --select=projects) >> $GITHUB_ENV
working-directory: frontend-monorepo
- name: See if capsule is necessary
if: ${{ contains(env.AFFECTED, 'token') || contains(env.AFFECTED, 'token-e2e') || contains(env.AFFECTED, 'explorer') || contains(env.AFFECTED, 'explorer-e2e') }}
run: echo RUN_CAPSULE=true >> $GITHUB_ENV
#######
## Build binaries
## Build and run Vegacapsule network
#######
- name: Build capsule
run: go install
working-directory: capsule
- name: Set GOBIN
run: echo GOBIN=$(go env GOPATH)/bin >> $GITHUB_ENV
- name: Checkout Vega
uses: actions/checkout@v2
with:
repository: vegaprotocol/vega
ref: v0.54.0
token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
path: './vega'
- name: Install Vega binaries
run: go install -v ./cmd/vega
working-directory: vega
uses: ./frontend-monorepo/.github/actions/install-vega-binaries
with:
all: ${{ env.RUN_CAPSULE }}
version: ${{ env.VEGA_VERSION }}
gobin: ${{ env.GOBIN }}
- name: Install Vega wallet binaries
run: go install ./cmd/vegawallet
working-directory: vega
- name: Install date-node binaries
run: go install ./cmd/data-node
working-directory: vega
######
## Start capsule
######
- name: Login to docker
run: echo -n ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }} | docker login https://ghcr.io -u vega-ci-bot --password-stdin
- name: Start nomad
run: vegacapsule nomad &
- name: Bootstrap network
run: vegacapsule network bootstrap --config-path=../frontend-monorepo/vegacapsule/config.hcl --force
working-directory: capsule
- name: Build and run Vegacapsule network
if: ${{ env.RUN_CAPSULE }}
uses: ./frontend-monorepo/.github/actions/run-vegacapsule
with:
github-token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
######
## Setup a Vega wallet for our user
######
- name: Create passphrase
run: echo "${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }}" > ./passphrase
- name: Create recovery
run: echo "${{ secrets.TRADING_TEST_VEGA_WALLET_RECOVERY }}" > ./recovery
- name: Initialize wallet
run: vegawallet init -f --home ~/.vegacapsule/testnet/wallet
- name: Import wallet
run: vegawallet import -w UI_Trading_Test --recovery-phrase-file ./recovery -p ./passphrase --home ~/.vegacapsule/testnet/wallet
- name: Create public key 2
run: vegawallet key generate -w UI_Trading_Test -p ./passphrase --home ~/.vegacapsule/testnet/wallet
- name: Start service
run: vegawallet service run --network DV --automatic-consent --home ~/.vegacapsule/testnet/wallet &
- name: Set up Vegawallet
uses: ./frontend-monorepo/.github/actions/setup-vegawallet
with:
recovery: ${{ secrets.TRADING_TEST_VEGA_WALLET_RECOVERY }}
passphrase: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }}
capsule: ${{ env.RUN_CAPSULE }}
######
## Run some tests
######
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v2
with:
working-directory: frontend-monorepo
main-branch-name: master
- name: Install root dependencies
run: yarn install
# To make sure that all Cypress binaries are installed properly
- name: Install cypress bins
run: yarn cypress install
working-directory: frontend-monorepo
- name: Run Cypress tests
run: npx nx affected:e2e --record --key ${{ secrets.CYPRESS_RECORD_KEY }}
run: npx nx affected:e2e --record --key ${{ secrets.CYPRESS_RECORD_KEY }} --env.grepTags='@smoke' --browser chrome
working-directory: frontend-monorepo
env:
CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }}
CYPRESS_SLACK_WEBHOOK: ${{ secrets.CYPRESS_SLACK_WEBHOOK }}
CYPRESS_ETH_WALLET_MNEMONIC: ${{ secrets.CYPESS_ETH_WALLET_MNEMONIC }}
CYPRESS_INCLUDE_FLOWS: false
CYPRESS_ETH_WALLET_MNEMONIC: ${{ secrets.CYPRESS_ETH_WALLET_MNEMONIC }}
CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS: false
######
## Upload logs
######
- name: Logs
if: ${{ always() }}
if: ${{ env.RUN_CAPSULE }}
run: vegacapsule network logs > vega-capsule-logs.txt
- uses: actions/upload-artifact@v2
if: ${{ always() }}
if: ${{ env.RUN_CAPSULE }}
with:
name: logs
path: ./vega-capsule-logs.txt
+1 -1
View File
@@ -3,7 +3,7 @@ name: Generate queries
on:
push:
branches:
- master
- develop
jobs:
master:
-32
View File
@@ -1,32 +0,0 @@
---
name: Deploy affected projects to IPFS
'on':
# Triggers the workflow on push to main branch
push:
branches: [master]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch: null
jobs:
master:
name: Publish NX Affected
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
- name: Use Node.js 16
id: Node
uses: actions/setup-node@v2
with:
node-version: 16.14.0
- name: Install root dependencies
run: yarn install
- name: Run deploy for affected sites
env:
FLEEK_API_KEY: ${{ secrets.FLEEK_API_KEY }}
run: ./tools/ipfs-deploy.js
+10 -37
View File
@@ -3,50 +3,16 @@ name: Unit tests & build
on:
push:
branches:
- master
- develop
- main
pull_request:
jobs:
master:
name: Test and lint - main
runs-on: ubuntu-latest
permissions:
contents: 'read'
actions: 'read'
if: ${{ github.event_name != 'pull_request' }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v2
with:
main-branch-name: master
- name: Use Node.js 16
id: Node
uses: actions/setup-node@v3
with:
node-version: 16.14.0
- name: Install root dependencies
run: yarn install
- name: Check formatting
run: yarn nx format:check
- name: Lint affected
run: yarn nx affected:lint --max-warnings=0
- name: Test affected
run: yarn nx affected:test
- name: Build affected
run: yarn nx affected:build
pr:
name: Test and lint - PR
runs-on: ubuntu-latest
permissions:
contents: 'read'
actions: 'read'
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Checkout
uses: actions/checkout@v3
@@ -55,14 +21,19 @@ jobs:
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v2
with:
main-branch-name: master
main-branch-name: ${{ github.base_ref }}
- name: Use Node.js 16
id: Node
uses: actions/setup-node@v3
with:
node-version: 16.14.0
- name: Restore node_modules from cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: node_modules-${{ hashFiles('**/yarn.lock') }}
- name: Install root dependencies
run: yarn install
run: yarn install --frozen-lockfile
- name: Check formatting
run: yarn nx format:check
- name: Lint affected
@@ -71,3 +42,5 @@ jobs:
run: yarn nx affected:test
- name: Build affected
run: yarn nx affected:build
- name: Build affected spec
run: yarn nx affected --target=build-spec
Vendored
+20
View File
@@ -0,0 +1,20 @@
@Library('vega-shared-library') _
def commitHash = 'UNKNOWN'
pipeline {
agent any
options {
skipDefaultCheckout true
parallelsAlwaysFailFast()
}
stages {
stage('approbation') {
steps {
sh 'printenv'
checkout scm
runApprobation ignoreFailure: false, frontendBranch: env.BRANCH_NAME, type: 'frontend'
}
}
}
}
+4
View File
@@ -30,6 +30,10 @@ An application for the status of the Vega network. Showing block height and othe
Hosting for static content being shared across apps, for example fonts.
### [Multisig-signer](./apps/multisig-signer)
The utility dApp for validators wishing to add or remove themselves as a signer of the multisig contract.
# 🧱 Libraries in this repo
### [UI toolkit](./libs/ui-toolkit)
+8 -27
View File
@@ -1,27 +1,8 @@
# React Environment Variables
# https://facebook.github.io/create-react-app/docs/adding-custom-environment-variables#expanding-environment-variables-in-env
# Netlify Environment Variables
# https://www.netlify.com/docs/continuous-deployment/#environment-variables
NX_VERSION=$npm_package_version
NX_REPOSITORY_URL=$REPOSITORY_URL
NX_BRANCH=$BRANCH
NX_PULL_REQUEST=$PULL_REQUEST
NX_HEAD=$HEAD
NX_COMMIT_REF=$COMMIT_REF
NX_CONTEXT=$CONTEXT
NX_REVIEW_ID=$REVIEW_ID
NX_INCOMING_HOOK_TITLE=$INCOMING_HOOK_TITLE
NX_INCOMING_HOOK_URL=$INCOMING_HOOK_URL
NX_INCOMING_HOOK_BODY=$INCOMING_HOOK_BODY
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_ENV=TESTNET
NX_VEGA_REST=https://api.n11.testnet.vega.xyz
NX_VEGA_WALLET_URL=http://localhost:1789/api/v1
# App configuration variables
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet3-network.json
NX_VEGA_URL=https://api.n01.stagnet3.vega.xyz/graphql
NX_VEGA_ENV=STAGNET3
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_VEGA_EXPLORER_URL=https://stagnet3.explorer.vega.xyz
NX_VEGA_WALLET_URL=http://localhost:1789
+11 -4
View File
@@ -3,14 +3,18 @@ module.exports = defineConfig({
projectId: 'et4snf',
e2e: {
setupNodeEvents(on, config) {
require('cypress-grep/src/plugin')(config);
return config;
},
baseUrl: 'http://localhost:4200',
fileServerFolder: '.',
fixturesFolder: false,
specPattern: './src/integration/*.ts',
excludeSpecPattern: '**/*.js',
modifyObstructiveCode: false,
supportFile: './src/support/index.ts',
video: true,
supportFile: './src/support/index.js',
video: false,
videoUploadOnPasses: false,
videosFolder: '../../dist/cypress/apps/console-lite-e2e/videos',
screenshotsFolder: '../../dist/cypress/apps/console-lite-e2e/screenshots',
@@ -21,7 +25,7 @@ module.exports = defineConfig({
env: {
TRADING_TEST_VEGA_WALLET_NAME: 'UI_Trading_Test',
ETHEREUM_PROVIDER_URL:
'https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8',
'https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8',
VEGA_PUBLIC_KEY:
'47836c253520d2661bf5bed6339c0de08fd02cf5d4db0efee3b4373f20c7d278',
VEGA_PUBLIC_KEY2:
@@ -29,11 +33,14 @@ module.exports = defineConfig({
TRUNCATED_VEGA_PUBLIC_KEY: '47836c…c7d278',
TRUNCATED_VEGA_PUBLIC_KEY2: '1a18cd…0cf2e4',
ETHEREUM_WALLET_ADDRESS: '0x265Cc6d39a1B53d0d92068443009eE7410807158',
ETHERSCAN_URL: 'https://ropsten.etherscan.io',
ETHERSCAN_URL: 'https://sepolia.etherscan.io',
tsConfig: 'tsconfig.json',
TAGS: 'not @todo and not @ignore and not @manual',
TRADING_TEST_VEGA_WALLET_PASSPHRASE: '123',
ETH_WALLET_MNEMONIC:
'ugly gallery notice network true range brave clarify flat logic someone chunk',
grepTags: '@regression @smoke @slow',
grepFilterSpecs: true,
grepOmitFiltered: true,
},
});
+1
View File
@@ -0,0 +1 @@
declare module '*.scss';
@@ -1,5 +1,17 @@
describe('simple trading app', () => {
beforeEach(() => cy.visit('/'));
import { aliasQuery } from '@vegaprotocol/cypress';
import {
generateSimpleMarkets,
generateMarketsCandles,
} from '../support/mocks/generate-markets';
describe('simple trading app', { tags: '@smoke' }, () => {
beforeEach(() => {
cy.mockGQL((req) => {
aliasQuery(req, 'Markets', generateSimpleMarkets());
aliasQuery(req, 'MarketsCandles', generateMarketsCandles());
});
cy.visit('/');
});
it('render', () => {
cy.get('#root').should('exist');
@@ -1,4 +1,4 @@
describe('console lite header', () => {
describe('console lite header', { tags: '@smoke' }, () => {
beforeEach(() => {
window.localStorage.setItem('theme', 'dark');
cy.visit('/');
@@ -1,14 +1,17 @@
import { aliasQuery } from '@vegaprotocol/cypress';
import type { MarketsQuery } from '@vegaprotocol/market-list';
import {
generateLongListMarkets,
generateSimpleMarkets,
generateMarketsCandles,
} from '../support/mocks/generate-markets';
describe('market list', () => {
describe('market list', { tags: '@smoke' }, () => {
describe('simple url', () => {
beforeEach(() => {
cy.mockGQL((req) => {
aliasQuery(req, 'SimpleMarkets', generateSimpleMarkets());
aliasQuery(req, 'Markets', generateSimpleMarkets());
aliasQuery(req, 'MarketsCandles', generateMarketsCandles());
});
cy.visit('/markets');
});
@@ -62,7 +65,8 @@ describe('market list', () => {
describe('url params should select filters', () => {
beforeEach(() => {
cy.mockGQL((req) => {
aliasQuery(req, 'SimpleMarkets', generateSimpleMarkets());
aliasQuery(req, 'Markets', generateSimpleMarkets());
aliasQuery(req, 'MarketsCandles', generateMarketsCandles());
});
});
@@ -73,10 +77,11 @@ describe('market list', () => {
it('last asset (if exists)', () => {
cy.visit('/markets');
cy.wait('@SimpleMarkets').then((filters) => {
if (filters?.response?.body?.data?.markets?.length) {
cy.wait('@Markets').then((filters) => {
const data: MarketsQuery | undefined = filters?.response?.body?.data;
if (data?.marketsConnection?.edges.length) {
const asset =
filters.response.body.data.markets[0].tradableInstrument.instrument
data?.marketsConnection?.edges[0].node.tradableInstrument.instrument
.product.settlementAsset.symbol;
cy.visit(`/markets/Suspended/Future/${asset}`);
cy.getByTestId('market-assets-menu')
@@ -98,7 +103,8 @@ describe('market list', () => {
it('handles 1000 markets', () => {
cy.viewport(1440, 900);
cy.mockGQL((req) => {
aliasQuery(req, 'SimpleMarkets', generateLongListMarkets(1000));
aliasQuery(req, 'Markets', generateLongListMarkets(1000));
aliasQuery(req, 'MarketsCandles', generateMarketsCandles());
});
performance.mark('start-1k');
cy.visit('/markets');
@@ -1,6 +1,10 @@
import { connectVegaWallet } from '../support/connect-wallet';
import { aliasQuery } from '@vegaprotocol/cypress';
import { generateSimpleMarkets } from '../support/mocks/generate-markets';
import {
generateMarketsCandles,
generateMarketsData,
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';
@@ -9,26 +13,32 @@ 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';
import { generateMarketDepth } from '../support/mocks/generate-market-depth';
import type { Market, MarketsQuery } from '@vegaprotocol/market-list';
describe('market selector', () => {
let markets;
describe('market selector', { tags: '@smoke' }, () => {
let markets: Market[];
beforeEach(() => {
cy.mockGQL((req) => {
aliasQuery(req, 'SimpleMarkets', generateSimpleMarkets());
aliasQuery(req, 'DealTicketQuery', generateDealTicket());
aliasQuery(req, 'Markets', generateSimpleMarkets());
aliasQuery(req, 'MarketsCandles', generateMarketsCandles());
aliasQuery(req, 'MarketsData', generateMarketsData());
aliasQuery(req, 'DealTicket', generateDealTicket());
aliasQuery(req, 'MarketTags', generateMarketTags());
aliasQuery(req, 'MarketPositions', generateMarketPositions());
aliasQuery(req, 'EstimateOrder', generateEstimateOrder());
aliasQuery(req, 'PartyBalanceQuery', generatePartyBalance());
aliasQuery(req, 'PartyBalance', generatePartyBalance());
aliasQuery(req, 'PartyMarketData', generatePartyMarketData());
aliasQuery(req, 'MarketMarkPrice', generateMarketMarkPrice());
aliasQuery(req, 'MarketNames', generateMarketNames());
aliasQuery(req, 'MarketDepth', generateMarketDepth());
});
cy.visit('/markets');
cy.wait('@SimpleMarkets').then((response) => {
if (response.response.body.data?.markets?.length) {
markets = response.response.body.data.markets;
cy.wait('@Markets').then((response) => {
const data: MarketsQuery | undefined = response?.response?.body?.data;
if (data?.marketsConnection?.edges.length) {
markets = data?.marketsConnection?.edges.map((edge) => edge.node);
}
});
});
@@ -126,7 +136,7 @@ describe('market selector', () => {
cy.getByTestId('market-pane')
.children()
.find('[role="button"]')
.should('have.length', 3);
.should('have.length', 9);
cy.get('div[role="dialog"]').should('have.class', 'w-screen');
cy.getByTestId('dialog-close').click();
cy.get('input[placeholder="Search"]').should(
@@ -1,5 +1,10 @@
import { aliasQuery } from '@vegaprotocol/cypress';
import { generateSimpleMarkets } from '../support/mocks/generate-markets';
import {
generateSimpleMarkets,
generateMarketsCandles,
generateMarketsData,
generateMarket,
} 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';
@@ -9,25 +14,31 @@ import { generatePartyMarketData } from '../support/mocks/generate-party-market-
import { generateMarketMarkPrice } from '../support/mocks/generate-market-mark-price';
import { generateMarketDepth } from '../support/mocks/generate-market-depth';
import { connectVegaWallet } from '../support/connect-wallet';
import type { MarketsQuery, Market } from '@vegaprotocol/market-list';
describe('Market trade', () => {
let markets;
describe('Market trade', { tags: '@smoke' }, () => {
let markets: Market[];
beforeEach(() => {
cy.mockGQL((req) => {
aliasQuery(req, 'Markets', generateSimpleMarkets());
aliasQuery(req, 'MarketsCandles', generateMarketsCandles());
aliasQuery(req, 'MarketsData', generateMarketsData());
aliasQuery(req, 'SimpleMarkets', generateSimpleMarkets());
aliasQuery(req, 'DealTicketQuery', generateDealTicket());
aliasQuery(req, 'DealTicket', generateDealTicket());
aliasQuery(req, 'MarketTags', generateMarketTags());
aliasQuery(req, 'MarketPositions', generateMarketPositions());
aliasQuery(req, 'EstimateOrder', generateEstimateOrder());
aliasQuery(req, 'PartyBalanceQuery', generatePartyBalance());
aliasQuery(req, 'PartyBalance', generatePartyBalance());
aliasQuery(req, 'PartyMarketData', generatePartyMarketData());
aliasQuery(req, 'MarketMarkPrice', generateMarketMarkPrice());
aliasQuery(req, 'MarketDepth', generateMarketDepth());
aliasQuery(req, 'Market', generateMarket());
});
cy.visit('/markets');
cy.wait('@SimpleMarkets').then((response) => {
if (response.response.body.data?.markets?.length) {
markets = response.response.body.data.markets;
cy.wait('@Markets').then((response) => {
const data: MarketsQuery | undefined = response?.response?.body?.data;
if (data?.marketsConnection?.edges.length) {
markets = data?.marketsConnection?.edges.map((edge) => edge.node);
}
});
});
@@ -287,11 +298,7 @@ describe('Market trade', () => {
cy.get('#step-3-panel').find('dd').eq(4).should('have.text', ' - ');
cy.getByTestId('place-order').click();
cy.getByTestId('dialog-title').should(
'have.text',
'Confirm transaction in wallet'
);
cy.getByTestId('place-order').should('be.enabled').click();
}
});
@@ -2,8 +2,23 @@ import {
connectVegaWallet,
disconnectVegaWallet,
} from '../support/connect-wallet';
import { aliasQuery } from '@vegaprotocol/cypress';
import {
generatePositions,
emptyPositions,
generateMargins,
} from '../support/mocks/generate-positions';
import { generateAccounts } from '../support/mocks/generate-accounts';
import { generateAssets } from '../support/mocks/generate-assets';
import { generateOrders } from '../support/mocks/generate-orders';
import { generateFills } from '../support/mocks/generate-fills';
import {
generateFillsMarkets,
generateMarketsData,
generatePositionsMarkets,
} from '../support/mocks/generate-markets';
describe('Portfolio page', () => {
describe('Portfolio page', { tags: '@smoke' }, () => {
afterEach(() => {
disconnectVegaWallet();
});
@@ -19,19 +34,144 @@ describe('Portfolio page', () => {
it('certain tabs should exist', () => {
cy.visit('/portfolio');
connectVegaWallet();
cy.getByTestId('Assets').should('exist');
cy.getByTestId('tab-assets').should('exist');
cy.getByTestId('Positions').click();
cy.getByTestId('tab-positions').should('exist');
cy.getByTestId('assets').click();
cy.location('pathname').should('eq', '/portfolio/assets');
cy.getByTestId('Orders').click();
cy.getByTestId('tab-orders').should('exist');
cy.getByTestId('positions').click();
cy.location('pathname').should('eq', '/portfolio/positions');
cy.getByTestId('Fills').click();
cy.getByTestId('tab-fills').should('exist');
cy.getByTestId('orders').click();
cy.location('pathname').should('eq', '/portfolio/orders');
cy.getByTestId('Deposits').click();
cy.getByTestId('tab-deposits').should('exist');
cy.getByTestId('fills').click();
cy.location('pathname').should('eq', '/portfolio/fills');
cy.getByTestId('deposits').click();
cy.location('pathname').should('eq', '/portfolio/deposits');
});
describe('Assets view', () => {
beforeEach(() => {
cy.mockGQL((req) => {
aliasQuery(req, 'Positions', generatePositions());
aliasQuery(req, 'Margins', generateMargins());
aliasQuery(req, 'Markets', generatePositionsMarkets());
aliasQuery(req, 'MarketsData', generateMarketsData());
aliasQuery(req, 'Accounts', generateAccounts());
aliasQuery(req, 'Assets', generateAssets());
});
cy.visit('/portfolio/assets');
connectVegaWallet();
});
it('data should be properly rendered', () => {
cy.get('.ag-center-cols-container .ag-row').should('have.length', 3);
cy.get(
'.ag-center-cols-container [row-id="ACCOUNT_TYPE_GENERAL-asset-id-null"]'
)
.find('button')
.click();
cy.getByTestId('dialog-title').should(
'have.text',
'Asset details - tEURO'
);
cy.getByTestId('dialog-close').click();
});
});
describe('Positions view', () => {
beforeEach(() => {
cy.mockGQL((req) => {
aliasQuery(req, 'Positions', generatePositions());
aliasQuery(req, 'Accounts', generateAccounts());
aliasQuery(req, 'Margins', generateMargins());
aliasQuery(req, 'Markets', generatePositionsMarkets());
aliasQuery(req, 'MarketsData', generateMarketsData());
aliasQuery(req, 'Assets', generateAssets());
});
cy.visit('/portfolio/positions');
connectVegaWallet();
});
it('data should be properly rendered', () => {
cy.getByTestId('positions-asset-tDAI').should('exist');
cy.getByTestId('positions-asset-tEURO').should('exist');
});
});
describe('Orders view', () => {
beforeEach(() => {
cy.mockGQL((req) => {
aliasQuery(req, 'Orders', generateOrders());
aliasQuery(req, 'Markets', generateFillsMarkets());
});
cy.visit('/portfolio/orders');
connectVegaWallet();
});
it('data should be properly rendered', () => {
cy.get('.ag-center-cols-container .ag-row').should('have.length', 5);
});
});
describe('Fills view', () => {
beforeEach(() => {
cy.mockGQL((req) => {
aliasQuery(req, 'Fills', generateFills());
aliasQuery(req, 'Markets', generateFillsMarkets());
});
cy.visit('/portfolio/fills');
connectVegaWallet();
});
it('data should be properly rendered', () => {
cy.get('.ag-center-cols-container .ag-row').should('have.length', 4);
});
});
describe('Empty views', () => {
beforeEach(() => {
cy.mockGQL((req) => {
aliasQuery(req, 'Positions', emptyPositions());
aliasQuery(req, 'Accounts', { party: null });
aliasQuery(req, 'Orders', { party: null });
aliasQuery(req, 'Fills', { party: null });
aliasQuery(req, 'Markets', {
marketsConnection: { edges: [], __typename: 'MarketConnection' },
});
aliasQuery(req, 'Assets', {
assetsConnection: { edges: null, __typename: 'AssetsConnection' },
});
});
cy.visit('/portfolio');
connectVegaWallet();
});
it('"No data to display" should be always displayed', () => {
cy.getByTestId('assets').click();
cy.get('div.flex.items-center.justify-center').should(
'contain.text',
'No data to display'
);
cy.getByTestId('positions').click();
cy.get('div.flex.items-center.justify-center').should(
'contain.text',
'No data to display'
);
cy.getByTestId('orders').click();
cy.get('div.flex.items-center.justify-center').should(
'contain.text',
'No data to display'
);
cy.getByTestId('fills').click();
cy.get('div.flex.items-center.justify-center').should(
'contain.text',
'No data to display'
);
});
});
});
@@ -4,7 +4,9 @@ export const connectVegaWallet = () => {
const walletPassphrase = Cypress.env('TRADING_TEST_VEGA_WALLET_PASSPHRASE');
cy.getByTestId('connect-vega-wallet').click();
cy.getByTestId('connectors-list').find('button').click();
cy.getByTestId('connectors-list')
.find('[data-testid="connector-gui"]')
.click();
cy.getByTestId(form).find('#wallet').click().type(walletName);
cy.getByTestId(form).find('#passphrase').click().type(walletPassphrase);
cy.getByTestId('rest-connector-form').find('button[type=submit]').click();
@@ -0,0 +1,34 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
import '@vegaprotocol/cypress';
import 'cypress-real-events/support';
// Import commands.js using ES2015 syntax:
import './commands';
import registerCypressGrep from 'cypress-grep';
import { aliasQuery } from '@vegaprotocol/cypress';
registerCypressGrep();
before(() => {
// Mock chainId fetch which happens on every page for wallet connection
cy.mockGQL((req) => {
aliasQuery(req, 'ChainId', {
statistics: {
__typename: 'Statistics',
chainId: 'vega-fairground-202210041151',
},
});
});
});
@@ -1,4 +1,8 @@
const protoCandles = [
import type { Market } from '@vegaprotocol/market-list';
import { MarketState, MarketTradingMode } from '@vegaprotocol/types';
import type { SingleMarketFieldsFragment } from '@vegaprotocol/market-list';
export const protoCandles = [
{ open: '9556163', close: '9587028', __typename: 'Candle' },
{
open: '9587028',
@@ -73,11 +77,29 @@ const protoCandles = [
},
];
export const protoMarket = {
id: 'first-btcusd-id',
state: 'STATE_ACTIVE',
export const protoMarket: Market = {
id: 'ca7768f6de84bf86a21bbb6b0109d9659c81917b0e0339b2c262566c9b581a15',
tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS,
state: MarketState.STATE_ACTIVE,
decimalPlaces: 5,
positionDecimalPlaces: 0,
marketTimestamps: {
__typename: 'MarketTimestamps',
close: '',
open: '',
},
fees: {
__typename: 'Fees',
factors: {
__typename: 'FeeFactors',
makerFee: '',
infrastructureFee: '',
liquidityFee: '',
},
},
tradableInstrument: {
instrument: {
id: '',
code: 'AAVEDAI.MF21',
name: 'AAVEDAI Monthly (30 Jun 2022)',
metadata: {
@@ -94,12 +116,32 @@ export const protoMarket = {
product: {
__typename: 'Future',
quoteName: 'DAI',
settlementAsset: { symbol: 'tDAI', __typename: 'Asset' },
settlementAsset: { symbol: 'tDAI', __typename: 'Asset', decimals: 5 },
},
__typename: 'Instrument',
},
__typename: 'TradableInstrument',
},
candles: protoCandles,
__typename: 'Market',
};
export const singleMarket: SingleMarketFieldsFragment = {
...protoMarket,
tradableInstrument: {
...protoMarket.tradableInstrument,
instrument: {
...protoMarket.tradableInstrument.instrument,
product: {
...protoMarket.tradableInstrument.instrument.product,
settlementAsset: {
...protoMarket.tradableInstrument.instrument.product.settlementAsset,
id: 'dai-id',
name: 'DAI Name',
},
oracleSpecForTradingTermination: {
id: 'oid',
},
},
},
},
};
@@ -0,0 +1,77 @@
import merge from 'lodash/merge';
import type { AccountsQuery } from '@vegaprotocol/accounts';
import { AccountType } from '@vegaprotocol/types';
import type { PartialDeep } from 'type-fest';
export const generateAccounts = (
override?: PartialDeep<AccountsQuery>
): AccountsQuery => {
const defaultAccounts: AccountsQuery = {
party: {
__typename: 'Party',
id: Cypress.env('VEGA_PUBLIC_KEY'),
accounts: [
{
__typename: 'AccountBalance',
type: AccountType.ACCOUNT_TYPE_GENERAL,
balance: '100000000',
market: null,
asset: {
__typename: 'Asset',
id: 'asset-id',
},
},
{
__typename: 'AccountBalance',
type: AccountType.ACCOUNT_TYPE_GENERAL,
balance: '100000000',
market: {
id: '0604e8c918655474525e1a95367902266ade70d318c2c908f0cca6e3d11dcb13',
__typename: 'Market',
},
asset: {
__typename: 'Asset',
id: 'asset-id-2',
},
},
{
__typename: 'AccountBalance',
type: AccountType.ACCOUNT_TYPE_MARGIN,
balance: '1000',
market: {
__typename: 'Market',
id: '5a4b0b9e9c0629f0315ec56fcb7bd444b0c6e4da5ec7677719d502626658a376',
},
asset: {
__typename: 'Asset',
id: 'asset-id',
},
},
{
__typename: 'AccountBalance',
type: AccountType.ACCOUNT_TYPE_MARGIN,
balance: '1000',
market: {
__typename: 'Market',
id: 'c9f5acd348796011c075077e4d58d9b7f1689b7c1c8e030a5e886b83aa96923d',
},
asset: {
__typename: 'Asset',
id: 'asset-id-2',
},
},
{
__typename: 'AccountBalance',
type: AccountType.ACCOUNT_TYPE_GENERAL,
balance: '100000000',
market: null,
asset: {
__typename: 'Asset',
id: 'asset-0',
},
},
],
},
};
return merge(defaultAccounts, override);
};
@@ -0,0 +1,120 @@
import merge from 'lodash/merge';
import type { AssetsQuery } from '@vegaprotocol/assets';
import { Schema as Types } from '@vegaprotocol/types';
import type { PartialDeep } from 'type-fest';
export const generateAssets = (override?: PartialDeep<AssetsQuery>) => {
const defaultAssets: AssetsQuery = {
assetsConnection: {
edges: [
{
node: {
id: 'asset-id',
symbol: 'tEURO',
decimals: 5,
name: 'Euro',
source: {
__typename: 'ERC20',
contractAddress: '0x0158031158Bb4dF2AD02eAA31e8963E84EA978a4',
lifetimeLimit: '1',
withdrawThreshold: '2',
},
quantum: '',
status: Types.AssetStatus.STATUS_ENABLED,
infrastructureFeeAccount: {
balance: '1',
__typename: 'AccountBalance',
},
globalRewardPoolAccount: {
balance: '2',
__typename: 'AccountBalance',
},
takerFeeRewardAccount: {
balance: '3',
__typename: 'AccountBalance',
},
makerFeeRewardAccount: {
balance: '4',
__typename: 'AccountBalance',
},
lpFeeRewardAccount: {
balance: '5',
__typename: 'AccountBalance',
},
marketProposerRewardAccount: {
balance: '6',
__typename: 'AccountBalance',
},
__typename: 'Asset',
},
},
{
node: {
id: 'asset-id-2',
symbol: 'tDAI',
decimals: 5,
name: 'DAI',
source: {
__typename: 'ERC20',
contractAddress: '0x0158031158Bb4dF2AD02eAA31e8963E84EA978a4',
lifetimeLimit: '1',
withdrawThreshold: '2',
},
quantum: '',
status: Types.AssetStatus.STATUS_ENABLED,
infrastructureFeeAccount: {
balance: '1',
__typename: 'AccountBalance',
},
globalRewardPoolAccount: {
balance: '2',
__typename: 'AccountBalance',
},
takerFeeRewardAccount: {
balance: '3',
__typename: 'AccountBalance',
},
makerFeeRewardAccount: {
balance: '4',
__typename: 'AccountBalance',
},
lpFeeRewardAccount: {
balance: '5',
__typename: 'AccountBalance',
},
marketProposerRewardAccount: {
balance: '6',
__typename: 'AccountBalance',
},
__typename: 'Asset',
},
},
{
node: {
id: 'asset-0',
symbol: 'AST0',
decimals: 5,
name: 'Asto',
source: {
__typename: 'BuiltinAsset',
maxFaucetAmountMint: '3',
},
quantum: '',
status: Types.AssetStatus.STATUS_ENABLED,
infrastructureFeeAccount: {
balance: '0',
__typename: 'AccountBalance',
},
globalRewardPoolAccount: null,
takerFeeRewardAccount: null,
makerFeeRewardAccount: null,
lpFeeRewardAccount: null,
marketProposerRewardAccount: null,
__typename: 'Asset',
},
},
],
},
};
return merge(defaultAssets, override);
};
@@ -1,13 +1,21 @@
export const generateDealTicket = () => {
return {
import type { DealTicketQuery } from '@vegaprotocol/deal-ticket';
import { MarketTradingMode, MarketState } from '@vegaprotocol/types';
import merge from 'lodash/merge';
import type { PartialDeep } from 'type-fest';
export const generateDealTicket = (
override?: PartialDeep<DealTicketQuery>
): DealTicketQuery => {
const defaultResult: DealTicketQuery = {
market: {
id: 'first-btcusd-id',
id: 'ca7768f6de84bf86a21bbb6b0109d9659c81917b0e0339b2c262566c9b581a15',
decimalPlaces: 5,
positionDecimalPlaces: 0,
state: 'STATE_ACTIVE',
tradingMode: 'Continuous',
state: MarketState.STATE_ACTIVE,
tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS,
tradableInstrument: {
instrument: {
id: 'c9f5acd348796011c075077e4d58d9b7f1689b7c1c8e030a5e886b83aa96923d',
name: 'AAVEDAI Monthly (30 Jun 2022)',
product: {
quoteName: 'DAI',
@@ -15,6 +23,7 @@ export const generateDealTicket = () => {
id: '6d9d35f657589e40ddfb448b7ad4a7463b66efb307527fedd2aa7df1bbd5ea61',
symbol: 'tDAI',
name: 'tDAI TEST',
decimals: 5,
__typename: 'Asset',
},
__typename: 'Future',
@@ -27,7 +36,17 @@ export const generateDealTicket = () => {
lastTrade: { price: '9893006', __typename: 'Trade' },
__typename: 'MarketDepth',
},
fees: {
factors: {
makerFee: '0.0002',
infrastructureFee: '0.0005',
liquidityFee: '0.001',
__typename: 'FeeFactors',
},
__typename: 'Fees',
},
__typename: 'Market',
},
};
return merge(defaultResult, override);
};
@@ -0,0 +1,111 @@
import type { FillsQuery, FillFieldsFragment } from '@vegaprotocol/fills';
import { Schema } from '@vegaprotocol/types';
import merge from 'lodash/merge';
import type { PartialDeep } from 'type-fest';
export const generateFills = (
override?: PartialDeep<FillsQuery>
): FillsQuery => {
const fills: FillFieldsFragment[] = [
generateFill({
buyer: {
id: Cypress.env('VEGA_PUBLIC_KEY'),
},
}),
generateFill({
id: '1',
seller: {
id: Cypress.env('VEGA_PUBLIC_KEY'),
},
aggressor: Schema.Side.SIDE_SELL,
buyerFee: {
infrastructureFee: '5000',
},
market: {
id: 'market-1',
},
}),
generateFill({
id: '2',
seller: {
id: Cypress.env('VEGA_PUBLIC_KEY'),
},
aggressor: Schema.Side.SIDE_BUY,
}),
generateFill({
id: '3',
aggressor: Schema.Side.SIDE_SELL,
market: {
id: 'market-2',
},
buyer: {
id: Cypress.env('VEGA_PUBLIC_KEY'),
},
}),
];
const defaultResult: FillsQuery = {
party: {
id: 'buyer-id',
tradesConnection: {
__typename: 'TradeConnection',
edges: fills.map((f) => {
return {
__typename: 'TradeEdge',
node: f,
cursor: '3',
};
}),
pageInfo: {
__typename: 'PageInfo',
startCursor: '1',
endCursor: '2',
hasNextPage: false,
hasPreviousPage: false,
},
},
__typename: 'Party',
},
};
return merge(defaultResult, override);
};
export const generateFill = (override?: PartialDeep<FillFieldsFragment>) => {
const defaultFill: FillFieldsFragment = {
__typename: 'Trade',
id: '0',
createdAt: new Date().toISOString(),
price: '10000000',
size: '50000',
buyOrder: 'buy-order',
sellOrder: 'sell-order',
aggressor: Schema.Side.SIDE_BUY,
buyer: {
__typename: 'Party',
id: 'buyer-id',
},
seller: {
__typename: 'Party',
id: 'seller-id',
},
buyerFee: {
__typename: 'TradeFee',
makerFee: '100',
infrastructureFee: '100',
liquidityFee: '100',
},
sellerFee: {
__typename: 'TradeFee',
makerFee: '200',
infrastructureFee: '200',
liquidityFee: '200',
},
market: {
__typename: 'Market',
id: 'market-0',
},
};
return merge(defaultFill, override);
};
@@ -1,24 +1,15 @@
export const generateMarketDepth = () => {
return {
import merge from 'lodash/merge';
import type { PartialDeep } from 'type-fest';
// eslint-disable-next-line @nrwl/nx/enforce-module-boundaries
import type { MarketDepthQuery } from '../../../../../libs/market-depth/src/lib/__generated___/MarketDepth';
export const generateMarketDepth = (
override?: PartialDeep<MarketDepthQuery>
): MarketDepthQuery => {
const defaultResult: MarketDepthQuery = {
market: {
id: 'a46bd7e5277087723b7ab835844dec3cef8b4445738101269624bf5537d5d423',
decimalPlaces: 5,
positionDecimalPlaces: 0,
data: {
staticMidPrice: '9893006',
marketTradingMode: 'TRADING_MODE_CONTINUOUS',
indicativeVolume: '0',
indicativePrice: '0',
bestStaticBidPrice: '9893006',
bestStaticOfferPrice: '9893006',
market: {
id: 'a46bd7e5277087723b7ab835844dec3cef8b4445738101269624bf5537d5d423',
__typename: 'Market',
},
__typename: 'MarketData',
},
depth: {
lastTrade: { price: '9893006', __typename: 'Trade' },
sell: [
{
price: '9893007',
@@ -215,4 +206,5 @@ export const generateMarketDepth = () => {
__typename: 'Market',
},
};
return merge(defaultResult, override);
};
@@ -21,7 +21,7 @@ export const generateMarketPositions = () => {
},
balance: '265329',
market: {
id: 'first-btcusd-id',
id: 'ca7768f6de84bf86a21bbb6b0109d9659c81917b0e0339b2c262566c9b581a15',
__typename: 'Market',
},
},
@@ -43,7 +43,7 @@ export const generateMarketPositions = () => {
node: {
openVolume: '12',
market: {
id: 'first-btcusd-id',
id: 'ca7768f6de84bf86a21bbb6b0109d9659c81917b0e0339b2c262566c9b581a15',
__typename: 'Market',
},
__typename: 'Position',
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,143 @@
import merge from 'lodash/merge';
import type { PartialDeep } from 'type-fest';
import type { OrdersQuery, OrderFieldsFragment } from '@vegaprotocol/orders';
import { Schema } from '@vegaprotocol/types';
export const generateOrders = (
override?: PartialDeep<OrdersQuery>
): OrdersQuery => {
const orders: OrderFieldsFragment[] = [
{
__typename: 'Order',
id: '066468C06549101DAF7BC51099E1412A0067DC08C246B7D8013C9D0CBF1E8EE7',
market: {
__typename: 'Market',
id: 'market-0',
},
size: '10',
type: Schema.OrderType.TYPE_LIMIT,
status: Schema.OrderStatus.STATUS_FILLED,
side: Schema.Side.SIDE_BUY,
remaining: '0',
price: '20000000',
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
createdAt: new Date(2020, 1, 30).toISOString(),
updatedAt: null,
expiresAt: null,
rejectionReason: null,
liquidityProvision: null,
peggedOrder: null,
},
{
__typename: 'Order',
id: '48DB6767E4E4E0F649C5A13ABFADE39F8451C27DA828DAF14B7A1E8E5EBDAD99',
market: {
__typename: 'Market',
id: 'market-1',
},
size: '1',
type: Schema.OrderType.TYPE_LIMIT,
status: Schema.OrderStatus.STATUS_FILLED,
side: Schema.Side.SIDE_BUY,
remaining: '0',
price: '100',
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
createdAt: new Date(2020, 1, 29).toISOString(),
updatedAt: null,
expiresAt: null,
rejectionReason: null,
liquidityProvision: null,
peggedOrder: null,
},
{
__typename: 'Order',
id: '4e93702990712c41f6995fcbbd94f60bb372ad12d64dfa7d96d205c49f790336',
market: {
__typename: 'Market',
id: 'market-2',
},
size: '1',
type: Schema.OrderType.TYPE_LIMIT,
status: Schema.OrderStatus.STATUS_FILLED,
side: Schema.Side.SIDE_BUY,
remaining: '0',
price: '20000',
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
createdAt: new Date(2020, 1, 28).toISOString(),
updatedAt: null,
expiresAt: null,
rejectionReason: null,
liquidityProvision: null,
peggedOrder: null,
},
{
__typename: 'Order',
id: '94737d2bafafa4bc3b80a56ef084ae52a983b91aa067c31e243c61a0f962a836',
market: {
__typename: 'Market',
id: 'market-3',
},
size: '1',
type: Schema.OrderType.TYPE_LIMIT,
status: Schema.OrderStatus.STATUS_ACTIVE,
side: Schema.Side.SIDE_BUY,
remaining: '0',
price: '100000',
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
createdAt: new Date(2020, 1, 27).toISOString(),
updatedAt: null,
expiresAt: null,
rejectionReason: null,
liquidityProvision: null,
peggedOrder: null,
},
{
__typename: 'Order',
id: '94aead3ca92dc932efcb503631b03a410e2a5d4606cae6083e2406dc38e52f78',
market: {
__typename: 'Market',
id: 'market-3',
},
size: '10',
type: Schema.OrderType.TYPE_LIMIT,
status: Schema.OrderStatus.STATUS_PARTIALLY_FILLED,
side: Schema.Side.SIDE_SELL,
remaining: '3',
price: '100000',
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
createdAt: new Date(2020, 1, 27).toISOString(),
updatedAt: null,
expiresAt: null,
liquidityProvision: null,
peggedOrder: null,
rejectionReason: null,
},
];
const defaultResult: OrdersQuery = {
party: {
id: Cypress.env('VEGA_PUBLIC_KEY'),
ordersConnection: {
__typename: 'OrderConnection',
edges: orders.map((f) => {
return {
__typename: 'OrderEdge',
node: f,
cursor: f.id,
};
}),
pageInfo: {
__typename: 'PageInfo',
startCursor:
'066468C06549101DAF7BC51099E1412A0067DC08C246B7D8013C9D0CBF1E8EE7',
endCursor:
'94737d2bafafa4bc3b80a56ef084ae52a983b91aa067c31e243c61a0f962a836',
hasNextPage: false,
hasPreviousPage: false,
},
},
__typename: 'Party',
},
};
return merge(defaultResult, override);
};
@@ -1,10 +1,17 @@
export const generatePartyBalance = () => {
return {
import merge from 'lodash/merge';
import type { PartyBalanceQuery } from '@vegaprotocol/deal-ticket';
import type { PartialDeep } from 'type-fest';
import { AccountType } from '@vegaprotocol/types';
export const generatePartyBalance = (
override?: PartialDeep<PartyBalanceQuery>
): PartyBalanceQuery => {
const defaultResult: PartyBalanceQuery = {
party: {
accounts: [
{
balance: '88474051',
type: 'ACCOUNT_TYPE_GENERAL',
type: AccountType.ACCOUNT_TYPE_GENERAL,
asset: {
id: '6d9d35f657589e40ddfb448b7ad4a7463b66efb307527fedd2aa7df1bbd5ea61',
symbol: 'tDAI',
@@ -12,11 +19,11 @@ export const generatePartyBalance = () => {
decimals: 5,
__typename: 'Asset',
},
__typename: 'Account',
__typename: 'AccountBalance',
},
{
balance: '100000000',
type: 'ACCOUNT_TYPE_GENERAL',
type: AccountType.ACCOUNT_TYPE_GENERAL,
asset: {
id: '8b52d4a3a4b0ffe733cddbc2b67be273816cfeb6ca4c8b339bac03ffba08e4e4',
symbol: 'tEURO',
@@ -24,11 +31,11 @@ export const generatePartyBalance = () => {
decimals: 5,
__typename: 'Asset',
},
__typename: 'Account',
__typename: 'AccountBalance',
},
{
balance: '3412867',
type: 'ACCOUNT_TYPE_GENERAL',
type: AccountType.ACCOUNT_TYPE_GENERAL,
asset: {
id: '6d9d35f657589e40ddfb448b7ad4a7463b66efb307527fedd2aa7df1bbd5ea61',
symbol: 'tDAI',
@@ -36,11 +43,11 @@ export const generatePartyBalance = () => {
decimals: 5,
__typename: 'Asset',
},
__typename: 'Account',
__typename: 'AccountBalance',
},
{
balance: '70007',
type: 'ACCOUNT_TYPE_GENERAL',
type: AccountType.ACCOUNT_TYPE_GENERAL,
asset: {
id: '6d9d35f657589e40ddfb448b7ad4a7463b66efb307527fedd2aa7df1bbd5ea61',
symbol: 'tDAI',
@@ -48,10 +55,12 @@ export const generatePartyBalance = () => {
decimals: 5,
__typename: 'Asset',
},
__typename: 'Account',
__typename: 'AccountBalance',
},
],
__typename: 'Party',
},
};
return merge(defaultResult, override);
};
@@ -8,7 +8,7 @@ export const generatePartyMarketData = () => {
balance: '1200000',
asset: { id: 'fBTC', decimals: 5, __typename: 'Asset' },
market: null,
__typename: 'Account',
__typename: 'AccountBalance',
},
],
marginsConnection: { edges: null, __typename: 'MarginConnection' },
@@ -0,0 +1,145 @@
import merge from 'lodash/merge';
import type { PartialDeep } from 'type-fest';
import type {
PositionsQuery,
PositionFieldsFragment,
MarginsQuery,
} from '@vegaprotocol/positions';
export const generatePositions = (
override?: PartialDeep<PositionsQuery>
): PositionsQuery => {
const nodes: PositionFieldsFragment[] = [
{
__typename: 'Position',
realisedPNL: '0',
openVolume: '6',
unrealisedPNL: '895000',
averageEntryPrice: '1129935',
updatedAt: '2022-07-28T15:09:34.441143Z',
market: {
id: 'c9f5acd348796011c075077e4d58d9b7f1689b7c1c8e030a5e886b83aa96923d',
__typename: 'Market',
},
},
{
__typename: 'Position',
realisedPNL: '100',
openVolume: '20',
unrealisedPNL: '895000',
averageEntryPrice: '8509338',
updatedAt: '2022-07-28T15:09:34.441143Z',
market: {
id: '0604e8c918655474525e1a95367902266ade70d318c2c908f0cca6e3d11dcb13',
__typename: 'Market',
},
},
{
realisedPNL: '0',
openVolume: '1',
unrealisedPNL: '-22519',
averageEntryPrice: '84400088',
updatedAt: '2022-07-28T14:53:54.725477Z',
market: {
id: '5a4b0b9e9c0629f0315ec56fcb7bd444b0c6e4da5ec7677719d502626658a376',
__typename: 'Market',
},
__typename: 'Position',
},
];
const defaultResult: PositionsQuery = {
party: {
__typename: 'Party',
id: Cypress.env('VEGA_PUBLIC_KEY'),
positionsConnection: {
__typename: 'PositionConnection',
edges: nodes.map((node) => {
return {
__typename: 'PositionEdge',
node,
};
}),
},
},
};
return merge(defaultResult, override);
};
export const emptyPositions = (): PositionsQuery => {
return {
party: {
id: Cypress.env('VEGA_PUBLIC_KEY'),
positionsConnection: { edges: null, __typename: 'PositionConnection' },
__typename: 'Party',
},
};
};
export const generateMargins = (): MarginsQuery => {
return {
party: {
id: Cypress.env('VEGA_PUBLIC_KEY'),
marginsConnection: {
edges: [
{
node: {
__typename: 'MarginLevels',
maintenanceLevel: '0',
searchLevel: '0',
initialLevel: '0',
collateralReleaseLevel: '0',
market: {
__typename: 'Market',
id: 'c9f5acd348796011c075077e4d58d9b7f1689b7c1c8e030a5e886b83aa96923d',
},
asset: {
__typename: 'Asset',
id: 'tDAI-id',
},
},
},
{
node: {
__typename: 'MarginLevels',
maintenanceLevel: '0',
searchLevel: '0',
initialLevel: '0',
collateralReleaseLevel: '0',
market: {
__typename: 'Market',
id: '0604e8c918655474525e1a95367902266ade70d318c2c908f0cca6e3d11dcb13',
},
asset: {
__typename: 'Asset',
id: 'tDAI-id',
},
},
__typename: 'MarginEdge',
},
{
node: {
__typename: 'MarginLevels',
maintenanceLevel: '0',
searchLevel: '0',
initialLevel: '0',
collateralReleaseLevel: '0',
market: {
__typename: 'Market',
id: '5a4b0b9e9c0629f0315ec56fcb7bd444b0c6e4da5ec7677719d502626658a376',
},
asset: {
__typename: 'Asset',
id: 'tEURO-id',
},
},
__typename: 'MarginEdge',
},
],
__typename: 'MarginConnection',
},
__typename: 'Party',
},
};
};
+3 -2
View File
@@ -1,12 +1,13 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"strict": true,
"jsx": "react-jsx",
"sourceMap": false,
"allowSyntheticDefaultImports": true,
"outDir": "../../dist/out-tsc",
"allowJs": true,
"types": ["cypress", "node", "cypress-real-events"]
"types": ["cypress", "node", "cypress-real-events", "cypress-grep"]
},
"include": ["src/**/*.ts", "src/**/*.js"]
"include": ["src/**/*.ts", "src/**/*.js", "./declaration.d.ts"]
}
+3 -3
View File
@@ -20,8 +20,8 @@ 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_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_WALLET_URL=http://localhost:1789
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_VEGA_NETWORKS={"MAINNET":"https://alpha.console.vega.xyz"}
NX_VEGA_EXPLORER_URL=https://explorer.fairground.wtf
-1
View File
@@ -1,4 +1,3 @@
# App configuration variables
NX_VEGA_URL=http://localhost:3028/query
NX_VEGA_ENV=LOCAL
NX_VEGA_REST=http://localhost:3029
+2 -3
View File
@@ -2,8 +2,7 @@
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/devnet-network.json
NX_VEGA_URL=https://api.n04.d.vega.xyz/graphql
NX_VEGA_ENV=DEVNET
NX_VEGA_REST=https://api.n04.d.vega.xyz
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_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_VEGA_EXPLORER_URL=https://dev.explorer.vega.xyz
+1 -2
View File
@@ -1,8 +1,7 @@
# App configuration variables
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/mainnet-network.json
NX_VEGA_URL=https://api.token.vega.xyz/query
NX_VEGA_URL=https://api.vega.xyz/query
NX_VEGA_ENV=MAINNET
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
+7
View File
@@ -0,0 +1,7 @@
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/sandbox-network.json
NX_VEGA_URL=https://api.sandbox.vega.xyz/graphql
NX_VEGA_ENV=SANDBOX
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET3":"https://stagnet3.token.vega.xyz","STAGNET1":"https://stagnet1.token.vega.xyz","TESTNET":"https://token.fairground.wtf","MAINNET":"https://token.vega.xyz"}'
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/sandbox-network.json
NX_VEGA_EXPLORER_URL=https://sandbox.explorer.vega.xyz
NX_VEGA_DOCS_URL=https://docs.vega.xyz/docs/testnet
+10
View File
@@ -0,0 +1,10 @@
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet1-network.json
NX_VEGA_ENV=STAGNET1
NX_VEGA_EXPLORER_URL=https://stagnet1.explorer.vega.xyz
NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\",\"STAGNET3\":\"https://stagnet3.console.vega.xyz\"}
NX_VEGA_TOKEN_URL=https://stagnet1.token.vega.xyz
NX_VEGA_URL=https://api.n00.stagnet1.vega.xyz/graphql
NX_VEGA_WALLET_URL=http://localhost:1789
+3 -4
View File
@@ -2,7 +2,6 @@
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet3-network.json
NX_VEGA_URL=https://api.n01.stagnet3.vega.xyz/graphql
NX_VEGA_ENV=STAGNET3
NX_VEGA_REST=https://api.n01.stagnet3.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
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_VEGA_EXPLORER_URL=https://stagnet3.explorer.vega.xyz
+3 -4
View File
@@ -1,9 +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://api.n12.testnet.vega.xyz/graphql
NX_VEGA_ENV=TESTNET
NX_VEGA_REST=https://api.n11.testnet.vega.xyz
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_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
NX_VEGA_EXPLORER_URL=https://explorer.fairground.wtf
+7
View File
@@ -77,6 +77,13 @@
"nx build console-lite"
]
}
},
"build-spec": {
"executor": "@nrwl/workspace:run-commands",
"outputs": [],
"options": {
"command": "yarn tsc --project ./apps/console-lite/tsconfig.spec.json"
}
}
},
"tags": []
+3
View File
@@ -1,4 +1,5 @@
import '@testing-library/jest-dom';
import 'jest-canvas-mock';
import { defaultFallbackInView } from 'react-intersection-observer';
import ResizeObserver from 'resize-observer-polyfill';
@@ -38,3 +39,5 @@ Object.defineProperty(window, 'matchMedia', {
dispatchEvent: jest.fn(),
})),
});
jest.setTimeout(30000);
+1 -5
View File
@@ -40,11 +40,7 @@ function App() {
<div className="max-h-full min-h-full dark:bg-lite-black dark:text-neutral-200 bg-white text-neutral-800 grid grid-rows-[min-content,1fr]">
<Header />
<Main />
<VegaConnectDialog
connectors={Connectors}
dialogOpen={vegaWalletDialog.connect}
setDialogOpen={vegaWalletDialog.setConnect}
/>
<VegaConnectDialog connectors={Connectors} />
<VegaManageDialog
dialogOpen={vegaWalletDialog.manage}
setDialogOpen={vegaWalletDialog.setManage}
@@ -0,0 +1,112 @@
import React, {
forwardRef,
useCallback,
useContext,
useMemo,
useRef,
} from 'react';
import classNames from 'classnames';
import type { AgGridReact } from 'ag-grid-react';
import { AgGridDynamic as AgGrid } from '@vegaprotocol/ui-toolkit';
import { ThemeContext, useScreenDimensions } from '@vegaprotocol/react-helpers';
import type {
GridOptions,
GetRowIdParams,
TabToNextCellParams,
CellKeyDownEvent,
FullWidthCellKeyDownEvent,
IGetRowsParams,
IDatasource,
} from 'ag-grid-community';
import { NO_DATA_MESSAGE } from '../../constants';
import * as constants from '../simple-market-list/constants';
export interface GetRowsParams<T>
extends Omit<IGetRowsParams, 'successCallback'> {
successCallback(rowsThisBlock: T[], lastRow?: number): void;
}
export interface Datasource<T> extends IDatasource {
getRows(params: GetRowsParams<T>): void;
}
interface Props<T> extends GridOptions {
rowData?: T[];
datasource?: Datasource<T>;
handleRowClicked?: (event: { data: T }) => void;
components?: Record<string, unknown>;
classNamesParam?: string | string[];
}
const ConsoleLiteGrid = <T extends { id?: string }>(
{ handleRowClicked, getRowId, classNamesParam, ...props }: Props<T>,
ref?: React.Ref<AgGridReact>
) => {
const { isMobile, screenSize } = useScreenDimensions();
const gridRef = useRef<AgGridReact | null>(null);
const theme = useContext(ThemeContext);
const handleOnGridReady = useCallback(() => {
(
(ref as React.RefObject<AgGridReact>) || gridRef
).current?.api?.sizeColumnsToFit();
}, [gridRef, ref]);
const onTabToNextCell = useCallback((params: TabToNextCellParams) => {
const {
api,
previousCellPosition: { rowIndex },
} = params;
const rowCount = api.getDisplayedRowCount();
if (rowCount <= rowIndex + 1) {
return null;
}
return { ...params.previousCellPosition, rowIndex: rowIndex + 1 };
}, []);
const getRowIdLocal = useCallback(({ data }: GetRowIdParams) => data.id, []);
const onCellKeyDown = useCallback(
(
params: (CellKeyDownEvent | FullWidthCellKeyDownEvent) & {
event: KeyboardEvent;
}
) => {
const { event: { key = '' } = {}, data } = params;
if (key === 'Enter') {
handleRowClicked?.({ data });
}
},
[handleRowClicked]
);
const shouldSuppressHorizontalScroll = useMemo(() => {
return !isMobile && constants.LARGE_SCREENS.includes(screenSize);
}, [isMobile, screenSize]);
return (
<AgGrid
className={classNames(classNamesParam)}
rowHeight={60}
customThemeParams={
theme === 'dark'
? constants.agGridDarkVariables
: constants.agGridLightVariables
}
onGridReady={handleOnGridReady}
onRowClicked={handleRowClicked}
rowClass={isMobile ? 'mobile' : ''}
rowClassRules={constants.ROW_CLASS_RULES}
ref={ref || gridRef}
overlayNoRowsTemplate={NO_DATA_MESSAGE}
suppressContextMenu
getRowId={getRowId || getRowIdLocal}
suppressMovableColumns
suppressRowTransform
onCellKeyDown={onCellKeyDown}
tabToNextCell={onTabToNextCell}
suppressHorizontalScroll={shouldSuppressHorizontalScroll}
{...props}
/>
);
};
const ConsoleLiteGridForwarder = forwardRef(ConsoleLiteGrid) as <T>(
p: Props<T> & { ref?: React.Ref<AgGridReact> }
) => React.ReactElement;
export default ConsoleLiteGridForwarder;
@@ -0,0 +1 @@
export { default as ConsoleLiteGrid } from './console-lite-grid';
@@ -1,65 +0,0 @@
/* tslint:disable */
/* eslint-disable */
// @generated
// This file was automatically generated and should not be edited.
import { AccountType } from "@vegaprotocol/types";
// ====================================================
// GraphQL query operation: PartyBalanceQuery
// ====================================================
export interface PartyBalanceQuery_party_accounts_asset {
__typename: "Asset";
/**
* The ID of the asset
*/
id: string;
/**
* The symbol of the asset (e.g: GBP)
*/
symbol: string;
/**
* The full name of the asset (e.g: Great British Pound)
*/
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
*/
decimals: number;
}
export interface PartyBalanceQuery_party_accounts {
__typename: "Account";
/**
* Account type (General, Margin, etc)
*/
type: AccountType;
/**
* Balance as string - current account balance (approx. as balances can be updated several times per second)
*/
balance: string;
/**
* Asset, the 'currency'
*/
asset: PartyBalanceQuery_party_accounts_asset;
}
export interface PartyBalanceQuery_party {
__typename: "Party";
/**
* Collateral accounts relating to a party
*/
accounts: PartyBalanceQuery_party_accounts[] | null;
}
export interface PartyBalanceQuery {
/**
* An entity that is trading on the Vega network
*/
party: PartyBalanceQuery_party | null;
}
export interface PartyBalanceQueryVariables {
partyId: string;
}
@@ -8,7 +8,7 @@ export type PartyBalanceQueryQueryVariables = Types.Exact<{
}>;
export type PartyBalanceQueryQuery = { __typename?: 'Query', party?: { __typename?: 'Party', accounts?: Array<{ __typename?: 'Account', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number } }> | null } | null };
export type PartyBalanceQueryQuery = { __typename?: 'Query', party?: { __typename?: 'Party', accounts?: Array<{ __typename?: 'AccountBalance', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number } }> | null } | null };
export const PartyBalanceQueryDocument = gql`
@@ -1,23 +1,24 @@
import React from 'react';
import { render } from '@testing-library/react';
import type {
PartyBalanceQuery_party_accounts,
PartyBalanceQuery_party_accounts_asset,
} from './__generated__/PartyBalanceQuery';
AccountFragment,
DealTicketMarketFragment,
} from '@vegaprotocol/deal-ticket';
import { DealTicketBalance } from './deal-ticket-balance';
import { AccountType } from '@vegaprotocol/types';
const tDAI: PartyBalanceQuery_party_accounts_asset = {
__typename: 'Asset',
id: '1',
symbol: 'tDAI',
name: 'TDAI',
decimals: 2,
};
const accounts: PartyBalanceQuery_party_accounts[] = [
const tDAI: DealTicketMarketFragment['tradableInstrument']['instrument']['product']['settlementAsset'] =
{
__typename: 'Account',
__typename: 'Asset',
id: '1',
symbol: 'tDAI',
name: 'TDAI',
decimals: 2,
};
const accounts: AccountFragment[] = [
{
__typename: 'AccountBalance',
type: AccountType.ACCOUNT_TYPE_GENERAL,
balance: '1000000',
asset: tDAI,
@@ -1,14 +1,15 @@
import * as React from 'react';
import classNames from 'classnames';
import type { DealTicketQuery_market_tradableInstrument_instrument_product_settlementAsset } from '@vegaprotocol/deal-ticket';
import type { PartyBalanceQuery_party_accounts } from './__generated__/PartyBalanceQuery';
import { useSettlementAccount } from '../../hooks/use-settlement-account';
import { addDecimalsFormatNumber, t } from '@vegaprotocol/react-helpers';
import { AccountType } from '@vegaprotocol/types';
import type {
AccountFragment,
DealTicketMarketFragment,
} from '@vegaprotocol/deal-ticket';
import { useSettlementAccount } from '@vegaprotocol/deal-ticket';
interface DealTicketBalanceProps {
settlementAsset: DealTicketQuery_market_tradableInstrument_instrument_product_settlementAsset;
accounts: PartyBalanceQuery_party_accounts[];
settlementAsset: DealTicketMarketFragment['tradableInstrument']['instrument']['product']['settlementAsset'];
accounts: AccountFragment[];
isWalletConnected: boolean;
className?: string;
}
@@ -26,7 +27,7 @@ export const DealTicketBalance = ({
accounts,
AccountType.ACCOUNT_TYPE_GENERAL
);
const formatedNumber =
const formattedNumber =
settlementAccount?.balance &&
settlementAccount.asset.decimals &&
addDecimalsFormatNumber(
@@ -37,7 +38,7 @@ export const DealTicketBalance = ({
const balance = (
<p className="text-blue text-lg font-semibold">
{settlementAccount
? t(`${formatedNumber}`)
? t(`${formattedNumber}`)
: `No ${settlementAssetSymbol} left to trade`}
</p>
);
@@ -1,9 +1,8 @@
import * as React from 'react';
import { useParams } from 'react-router-dom';
import { gql, useQuery } from '@apollo/client';
import {
DealTicketManager,
DealTicketContainer as Container,
usePartyBalanceQuery,
} from '@vegaprotocol/deal-ticket';
import { Loader } from '@vegaprotocol/ui-toolkit';
import { t } from '@vegaprotocol/react-helpers';
@@ -11,47 +10,30 @@ 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 { pubKey } = useVegaWallet();
const { data: partyData, loading } = useQuery<PartyBalanceQuery>(
PARTY_BALANCE_QUERY,
{
variables: { partyId: keypair?.pub },
skip: !keypair?.pub,
}
);
const { data: partyData, loading } = usePartyBalanceQuery({
variables: { partyId: pubKey || '' },
skip: !pubKey,
});
const loader = <Loader />;
const container = marketId ? (
<Container marketId={marketId}>
{(data) => {
if (!data.market) {
return null as unknown as JSX.Element;
}
const balance = (
<DealTicketBalance
className="mb-4"
@@ -59,14 +41,14 @@ export const DealTicketContainer = () => {
data.market.tradableInstrument.instrument.product?.settlementAsset
}
accounts={partyData?.party?.accounts || []}
isWalletConnected={!!keypair?.pub}
isWalletConnected={!!pubKey}
/>
);
return (
<DealTicketManager market={data.market}>
{loading ? loader : balance}
<DealTicketSteps market={data.market} partyData={partyData} />
<DealTicketSteps market={data.market} />
</DealTicketManager>
);
}}
@@ -78,7 +60,7 @@ export const DealTicketContainer = () => {
return (
<section className="flex p-4 md:p-6">
<section className="w-full md:w-1/2 md:min-w-[500px]">
{keypair ? container : <ConnectWallet />}
{pubKey ? container : <ConnectWallet />}
</section>
<Baubles />
</section>
@@ -1,5 +1,4 @@
import React from 'react';
import { DealTicketEstimates } from './deal-ticket-estimates';
import { DealTicketEstimates } from '@vegaprotocol/deal-ticket';
import { DealTicketSizeInput } from './deal-ticket-size-input';
interface DealTicketSizeProps {
@@ -1,11 +1,19 @@
import React, { useCallback, useState } from 'react';
import { t } from '@vegaprotocol/react-helpers';
import * as constants from './constants';
import { TrafficLight } from '../traffic-light';
import { Dialog, Icon, Intent, Tooltip } from '@vegaprotocol/ui-toolkit';
import {
Dialog,
Icon,
Intent,
Tooltip,
TrafficLight,
} from '@vegaprotocol/ui-toolkit';
import { InputSetter } from '../../components/input-setter';
import { IconNames } from '@blueprintjs/icons';
import { DataTitle, ValueTooltipRow } from './deal-ticket-estimates';
import {
DataTitle,
EST_SLIPPAGE,
ValueTooltipRow,
} from '@vegaprotocol/deal-ticket';
interface DealTicketSlippageProps {
step?: number;
@@ -40,12 +48,12 @@ export const DealTicketSlippage = ({
const formLabel = (
<label className="flex items-center mb-1">
<span className="mr-1">{t('Adjust slippage tolerance')}</span>
<Tooltip align="center" description={constants.EST_SLIPPAGE}>
<Tooltip align="center" description={EST_SLIPPAGE}>
<div className="cursor-help" tabIndex={-1}>
<Icon
name={IconNames.ISSUE}
className="block rotate-180"
ariaLabel={constants.EST_SLIPPAGE}
ariaLabel={EST_SLIPPAGE}
/>
</div>
</Tooltip>
@@ -83,7 +91,7 @@ export const DealTicketSlippage = ({
<DataTitle>{t('Est. Price Impact / Slippage')}</DataTitle>
<div className="flex">
<div className="mr-1">
<ValueTooltipRow description={constants.EST_SLIPPAGE}>
<ValueTooltipRow description={EST_SLIPPAGE}>
<TrafficLight value={value} q1={1} q2={5}>
{value}%
</TrafficLight>
@@ -1,50 +1,51 @@
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { useForm, Controller } from 'react-hook-form';
import { Stepper } from '../stepper';
import type { DealTicketQuery_market } from '@vegaprotocol/deal-ticket';
import { InputError } from '@vegaprotocol/ui-toolkit';
import { BigNumber } from 'bignumber.js';
import { MarketSelector } from '@vegaprotocol/deal-ticket';
import type { Order } from '@vegaprotocol/orders';
import { useVegaWallet, VegaTxStatus } from '@vegaprotocol/wallet';
import type { DealTicketMarketFragment } from '@vegaprotocol/deal-ticket';
import {
t,
addDecimalsFormatNumber,
toDecimal,
removeDecimal,
} from '@vegaprotocol/react-helpers';
useOrderCloseOut,
useOrderMargin,
usePartyBalanceQuery,
useMaximumPositionSize,
useCalculateSlippage,
} from '@vegaprotocol/deal-ticket';
import {
getDefaultOrder,
useOrderValidation,
validateSize,
} from '@vegaprotocol/deal-ticket';
import { InputError } from '@vegaprotocol/ui-toolkit';
import { BigNumber } from 'bignumber.js';
import { MarketSelector } from '@vegaprotocol/deal-ticket';
import type { OrderSubmissionBody } from '@vegaprotocol/wallet';
import { useVegaWallet } from '@vegaprotocol/wallet';
import { VegaTxStatus } from '@vegaprotocol/wallet';
import {
t,
toDecimal,
removeDecimal,
addDecimalsFormatNumber,
} from '@vegaprotocol/react-helpers';
import {
useOrderSubmit,
getOrderDialogTitle,
getOrderDialogIntent,
getOrderDialogIcon,
OrderFeedback,
validateSize,
} from '@vegaprotocol/orders';
import { DealTicketSize } from './deal-ticket-size';
import MarketNameRenderer from '../simple-market-list/simple-market-renderer';
import SideSelector, { SIDE_NAMES } from './side-selector';
import ReviewTrade from './review-trade';
import type { PartyBalanceQuery } from './__generated__/PartyBalanceQuery';
import useOrderCloseOut from '../../hooks/use-order-closeout';
import useOrderMargin from '../../hooks/use-order-margin';
import useMaximumPositionSize from '../../hooks/use-maximum-position-size';
import useCalculateSlippage from '../../hooks/use-calculate-slippage';
import { Side, OrderType } from '@vegaprotocol/types';
import { Schema } from '@vegaprotocol/types';
import { DealTicketSlippage } from './deal-ticket-slippage';
interface DealTicketMarketProps {
market: DealTicketQuery_market;
partyData?: PartyBalanceQuery;
market: DealTicketMarketFragment;
}
export const DealTicketSteps = ({
market,
partyData,
}: DealTicketMarketProps) => {
export const DealTicketSteps = ({ market }: DealTicketMarketProps) => {
const navigate = useNavigate();
const setMarket = useCallback(
(marketId: string) => {
@@ -59,35 +60,36 @@ export const DealTicketSteps = ({
watch,
setValue,
formState: { errors },
} = useForm<Order>({
} = useForm<OrderSubmissionBody['orderSubmission']>({
mode: 'onChange',
defaultValues: getDefaultOrder(market),
});
const emptyString = ' - ';
const step = toDecimal(market.positionDecimalPlaces);
const orderType = watch('type');
const orderTimeInForce = watch('timeInForce');
const orderSide = watch('side');
const orderSize = watch('size');
const order = watch();
const { message: invalidText, isDisabled } = useOrderValidation({
market,
orderType,
orderTimeInForce,
orderType: order.type,
orderTimeInForce: order.timeInForce,
fieldErrors: errors,
});
const { submit, transaction, finalizedOrder, Dialog } = useOrderSubmit();
const { keypair } = useVegaWallet();
const { pubKey } = useVegaWallet();
const estMargin = useOrderMargin({
order,
market,
partyId: keypair?.pub || '',
partyId: pubKey || '',
});
const { data: partyBalance } = usePartyBalanceQuery({
variables: { partyId: pubKey || '' },
skip: !pubKey,
});
const maxTrade = useMaximumPositionSize({
partyId: keypair?.pub || '',
accounts: partyData?.party?.accounts || [],
partyId: pubKey || '',
accounts: partyBalance?.party?.accounts || [],
marketId: market.id,
settlementAssetId:
market.tradableInstrument.instrument.product.settlementAsset.id,
@@ -95,7 +97,11 @@ export const DealTicketSteps = ({
order,
});
const estCloseOut = useOrderCloseOut({ order, market, partyData });
const estCloseOut = useOrderCloseOut({
order,
market,
partyData: partyBalance,
});
const slippage = useCalculateSlippage({ marketId: market.id, order });
const [slippageValue, setSlippageValue] = useState(
slippage ? parseFloat(slippage) : 0
@@ -112,7 +118,7 @@ export const DealTicketSteps = ({
const price = useMemo(() => {
if (slippage && market?.depth?.lastTrade?.price) {
const isLong = order.side === Side.SIDE_BUY;
const isLong = order.side === Schema.Side.SIDE_BUY;
const multiplier = new BigNumber(1)[isLong ? 'plus' : 'minus'](
parseFloat(slippage) / 100
);
@@ -128,26 +134,26 @@ export const DealTicketSteps = ({
const notionalSize = useMemo(() => {
if (price) {
const size = new BigNumber(price).multipliedBy(orderSize).toNumber();
const size = new BigNumber(price).multipliedBy(order.size).toNumber();
return addDecimalsFormatNumber(size, market.decimalPlaces);
}
return null;
}, [market.decimalPlaces, orderSize, price]);
}, [market.decimalPlaces, order.size, price]);
const fees = useMemo(() => {
if (estMargin?.fees && notionalSize) {
const percentage = new BigNumber(estMargin?.fees)
if (estMargin?.totalFees && notionalSize) {
const percentage = new BigNumber(estMargin?.totalFees)
.dividedBy(notionalSize)
.multipliedBy(100)
.decimalPlaces(2)
.toString();
return `${estMargin.fees} (${percentage}%)`;
return `${estMargin.totalFees} (${percentage}%)`;
}
return null;
}, [estMargin?.fees, notionalSize]);
}, [estMargin?.totalFees, notionalSize]);
const max = useMemo(() => {
return new BigNumber(maxTrade)
@@ -155,6 +161,10 @@ export const DealTicketSteps = ({
.toNumber();
}, [market.positionDecimalPlaces, maxTrade]);
useEffect(() => {
setSlippageValue(slippage ? parseFloat(slippage) : 0);
}, [slippage]);
const onSizeChange = useCallback(
(value: number) => {
const newVal = new BigNumber(value)
@@ -172,7 +182,7 @@ export const DealTicketSteps = ({
(value: number) => {
if (market?.depth?.lastTrade?.price) {
if (value) {
const isLong = order.side === Side.SIDE_BUY;
const isLong = order.side === Schema.Side.SIDE_BUY;
const multiplier = new BigNumber(1)[isLong ? 'plus' : 'minus'](
value / 100
);
@@ -183,11 +193,11 @@ export const DealTicketSteps = ({
setValue('price', bestAskPrice);
if (orderType === OrderType.TYPE_MARKET) {
setValue('type', OrderType.TYPE_LIMIT);
if (order.type === Schema.OrderType.TYPE_MARKET) {
setValue('type', Schema.OrderType.TYPE_LIMIT);
}
} else {
setValue('type', OrderType.TYPE_MARKET);
setValue('type', Schema.OrderType.TYPE_MARKET);
setValue('price', market?.depth?.lastTrade?.price);
}
}
@@ -197,13 +207,14 @@ export const DealTicketSteps = ({
market.decimalPlaces,
market?.depth?.lastTrade?.price,
order.side,
orderType,
order.type,
setSlippageValue,
setValue,
]
);
const onSubmit = useCallback(
(order: Order) => {
(order: OrderSubmissionBody['orderSubmission']) => {
if (transactionStatus !== 'pending') {
submit({
...order,
@@ -244,7 +255,7 @@ export const DealTicketSteps = ({
)}
/>
),
value: SIDE_NAMES[orderSide] || '',
value: SIDE_NAMES[order.side] || '',
},
{
label: t('Choose Position Size'),
@@ -256,7 +267,7 @@ export const DealTicketSteps = ({
min={step}
max={max}
onSizeChange={onSizeChange}
size={new BigNumber(orderSize).toNumber()}
size={new BigNumber(order.size).toNumber()}
name="size"
price={formattedPrice || emptyString}
positionDecimalPlaces={market.positionDecimalPlaces}
@@ -265,7 +276,7 @@ export const DealTicketSteps = ({
.symbol
}
notionalSize={notionalSize || emptyString}
estCloseOut={estCloseOut}
estCloseOut={estCloseOut || emptyString}
fees={fees || emptyString}
estMargin={estMargin?.margin || emptyString}
/>
@@ -275,9 +286,9 @@ export const DealTicketSteps = ({
/>
</>
) : (
'loading...'
t('Loading...')
),
value: orderSize,
value: order.size,
},
{
label: t('Review Trade'),
@@ -295,7 +306,7 @@ export const DealTicketSteps = ({
isDisabled={isDisabled}
transactionStatus={transactionStatus}
order={order}
estCloseOut={estCloseOut}
estCloseOut={estCloseOut || emptyString}
estMargin={estMargin?.margin || emptyString}
price={formattedPrice || emptyString}
quoteName={
@@ -310,9 +321,15 @@ export const DealTicketSteps = ({
title={getOrderDialogTitle(finalizedOrder?.status)}
intent={getOrderDialogIntent(finalizedOrder?.status)}
icon={getOrderDialogIcon(finalizedOrder?.status)}
>
<OrderFeedback transaction={transaction} order={finalizedOrder} />
</Dialog>
content={{
Complete: (
<OrderFeedback
transaction={transaction}
order={finalizedOrder}
/>
),
}}
/>
</div>
),
disabled: true,
@@ -4,19 +4,18 @@ import {
KeyValueTable,
KeyValueTableRow,
} from '@vegaprotocol/ui-toolkit';
import * as React from 'react';
import classNames from 'classnames';
import type { DealTicketQuery_market } from '@vegaprotocol/deal-ticket';
import type { Order } from '@vegaprotocol/orders';
import type { DealTicketMarketFragment } from '@vegaprotocol/deal-ticket';
import { DealTicketEstimates } from '@vegaprotocol/deal-ticket';
import type { OrderSubmissionBody } from '@vegaprotocol/wallet';
import { SIDE_NAMES } from './side-selector';
import SimpleMarketExpires from '../simple-market-list/simple-market-expires';
import { gql, useQuery } from '@apollo/client';
import type {
MarketTags,
MarketTagsVariables,
} from './__generated__/MarketTags';
import { DealTicketEstimates } from './deal-ticket-estimates';
import { Side } from '@vegaprotocol/types';
import { Schema } from '@vegaprotocol/types';
import { MarketExpires } from '@vegaprotocol/market-info';
export const MARKET_TAGS_QUERY = gql`
query MarketTags($marketId: ID!) {
@@ -33,10 +32,10 @@ export const MARKET_TAGS_QUERY = gql`
`;
interface Props {
market: DealTicketQuery_market;
market: DealTicketMarketFragment;
isDisabled: boolean;
transactionStatus?: string;
order: Order;
order: OrderSubmissionBody['orderSubmission'];
estCloseOut: string;
estMargin: string;
quoteName: string;
@@ -73,9 +72,10 @@ export default ({
<div
className={classNames(
{
'buyButton dark:buyButtonDark': order.side === Side.SIDE_BUY,
'buyButton dark:buyButtonDark':
order.side === Schema.Side.SIDE_BUY,
'sellButton dark:sellButtonDark':
order.side === Side.SIDE_SELL,
order.side === Schema.Side.SIDE_SELL,
},
'px-2 py-1 inline text-ui-small'
)}
@@ -86,7 +86,7 @@ export default ({
<div>
{tagsData?.market?.tradableInstrument.instrument.metadata
.tags && (
<SimpleMarketExpires
<MarketExpires
tags={
tagsData?.market.tradableInstrument.instrument.metadata.tags
}
@@ -2,16 +2,16 @@ import React from 'react';
import classNames from 'classnames';
import { FormGroup } from '@vegaprotocol/ui-toolkit';
import { t } from '@vegaprotocol/react-helpers';
import { Side } from '@vegaprotocol/types';
import { Schema } from '@vegaprotocol/types';
interface SideSelectorProps {
value: Side;
onSelect: (side: Side) => void;
value: Schema.Side;
onSelect: (side: Schema.Side) => void;
}
export const SIDE_NAMES: Record<Side, string> = {
[Side.SIDE_BUY]: t('Long'),
[Side.SIDE_SELL]: t('Short'),
export const SIDE_NAMES: Record<Schema.Side, string> = {
[Schema.Side.SIDE_BUY]: t('Long'),
[Schema.Side.SIDE_SELL]: t('Short'),
};
export default ({ value, onSelect }: SideSelectorProps) => {
@@ -31,9 +31,9 @@ export default ({ value, onSelect }: SideSelectorProps) => {
className={classNames(
'px-8 py-2',
'buyButton hover:buyButton dark:buyButtonDark dark:hover:buyButtonDark',
{ selected: value === Side.SIDE_BUY }
{ selected: value === Schema.Side.SIDE_BUY }
)}
onClick={() => onSelect(Side.SIDE_BUY)}
onClick={() => onSelect(Schema.Side.SIDE_BUY)}
>
{t('Long')}
</button>
@@ -43,9 +43,9 @@ export default ({ value, onSelect }: SideSelectorProps) => {
className={classNames(
'px-8 py-2',
'sellButton hover:sellButton dark:sellButtonDark dark:hover:sellButtonDark',
{ selected: value === Side.SIDE_SELL }
{ selected: value === Schema.Side.SIDE_SELL }
)}
onClick={() => onSelect(Side.SIDE_SELL)}
onClick={() => onSelect(Schema.Side.SIDE_SELL)}
>
{t('Short')}
</button>
@@ -1,4 +1,4 @@
query Deposits {
query DepositAssets {
assetsConnection {
edges {
node {
@@ -6,14 +6,14 @@
import { AssetStatus } from "@vegaprotocol/types";
// ====================================================
// GraphQL query operation: Deposits
// GraphQL query operation: DepositAssets
// ====================================================
export interface Deposits_assetsConnection_edges_node_source_BuiltinAsset {
export interface DepositAssets_assetsConnection_edges_node_source_BuiltinAsset {
__typename: "BuiltinAsset";
}
export interface Deposits_assetsConnection_edges_node_source_ERC20 {
export interface DepositAssets_assetsConnection_edges_node_source_ERC20 {
__typename: "ERC20";
/**
* The address of the ERC20 contract
@@ -21,9 +21,9 @@ export interface Deposits_assetsConnection_edges_node_source_ERC20 {
contractAddress: string;
}
export type Deposits_assetsConnection_edges_node_source = Deposits_assetsConnection_edges_node_source_BuiltinAsset | Deposits_assetsConnection_edges_node_source_ERC20;
export type DepositAssets_assetsConnection_edges_node_source = DepositAssets_assetsConnection_edges_node_source_BuiltinAsset | DepositAssets_assetsConnection_edges_node_source_ERC20;
export interface Deposits_assetsConnection_edges_node {
export interface DepositAssets_assetsConnection_edges_node {
__typename: "Asset";
/**
* The ID of the asset
@@ -48,25 +48,28 @@ export interface Deposits_assetsConnection_edges_node {
/**
* The origin source of the asset (e.g: an ERC20 asset)
*/
source: Deposits_assetsConnection_edges_node_source;
source: DepositAssets_assetsConnection_edges_node_source;
}
export interface Deposits_assetsConnection_edges {
export interface DepositAssets_assetsConnection_edges {
__typename: "AssetEdge";
node: Deposits_assetsConnection_edges_node;
/**
* The asset information
*/
node: DepositAssets_assetsConnection_edges_node;
}
export interface Deposits_assetsConnection {
export interface DepositAssets_assetsConnection {
__typename: "AssetsConnection";
/**
* The assets
*/
edges: (Deposits_assetsConnection_edges | null)[] | null;
edges: (DepositAssets_assetsConnection_edges | null)[] | null;
}
export interface Deposits {
export interface DepositAssets {
/**
* The list of all assets in use in the Vega network or the specified asset if ID is provided
*/
assetsConnection: Deposits_assetsConnection | null;
assetsConnection: DepositAssets_assetsConnection | null;
}
@@ -3,14 +3,14 @@ import { Schema as Types } from '@vegaprotocol/types';
import { gql } from '@apollo/client';
import * as Apollo from '@apollo/client';
const defaultOptions = {} as const;
export type DepositsQueryVariables = Types.Exact<{ [key: string]: never; }>;
export type DepositAssetsQueryVariables = Types.Exact<{ [key: string]: never; }>;
export type DepositsQuery = { __typename?: 'Query', assetsConnection?: { __typename?: 'AssetsConnection', edges?: Array<{ __typename?: 'AssetEdge', node: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, source: { __typename?: 'BuiltinAsset' } | { __typename?: 'ERC20', contractAddress: string } } } | null> | null } | null };
export type DepositAssetsQuery = { __typename?: 'Query', assetsConnection?: { __typename?: 'AssetsConnection', edges?: Array<{ __typename?: 'AssetEdge', node: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, source: { __typename?: 'BuiltinAsset' } | { __typename?: 'ERC20', contractAddress: string } } } | null> | null } | null };
export const DepositsDocument = gql`
query Deposits {
export const DepositAssetsDocument = gql`
query DepositAssets {
assetsConnection {
edges {
node {
@@ -30,28 +30,28 @@ export const DepositsDocument = gql`
`;
/**
* __useDepositsQuery__
* __useDepositAssetsQuery__
*
* To run a query within a React component, call `useDepositsQuery` and pass it any options that fit your needs.
* When your component renders, `useDepositsQuery` returns an object from Apollo Client that contains loading, error, and data properties
* To run a query within a React component, call `useDepositAssetsQuery` and pass it any options that fit your needs.
* When your component renders, `useDepositAssetsQuery` returns an object from Apollo Client that contains loading, error, and data properties
* you can use to render your UI.
*
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
*
* @example
* const { data, loading, error } = useDepositsQuery({
* const { data, loading, error } = useDepositAssetsQuery({
* variables: {
* },
* });
*/
export function useDepositsQuery(baseOptions?: Apollo.QueryHookOptions<DepositsQuery, DepositsQueryVariables>) {
export function useDepositAssetsQuery(baseOptions?: Apollo.QueryHookOptions<DepositAssetsQuery, DepositAssetsQueryVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useQuery<DepositsQuery, DepositsQueryVariables>(DepositsDocument, options);
return Apollo.useQuery<DepositAssetsQuery, DepositAssetsQueryVariables>(DepositAssetsDocument, options);
}
export function useDepositsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<DepositsQuery, DepositsQueryVariables>) {
export function useDepositAssetsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<DepositAssetsQuery, DepositAssetsQueryVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useLazyQuery<DepositsQuery, DepositsQueryVariables>(DepositsDocument, options);
return Apollo.useLazyQuery<DepositAssetsQuery, DepositAssetsQueryVariables>(DepositAssetsDocument, options);
}
export type DepositsQueryHookResult = ReturnType<typeof useDepositsQuery>;
export type DepositsLazyQueryHookResult = ReturnType<typeof useDepositsLazyQuery>;
export type DepositsQueryResult = Apollo.QueryResult<DepositsQuery, DepositsQueryVariables>;
export type DepositAssetsQueryHookResult = ReturnType<typeof useDepositAssetsQuery>;
export type DepositAssetsLazyQueryHookResult = ReturnType<typeof useDepositAssetsLazyQuery>;
export type DepositAssetsQueryResult = Apollo.QueryResult<DepositAssetsQuery, DepositAssetsQueryVariables>;
@@ -1,53 +1,32 @@
import { gql, useQuery } from '@apollo/client';
import { useMemo } from 'react';
import { DepositManager } from '@vegaprotocol/deposits';
import { getEnabledAssets, t } from '@vegaprotocol/react-helpers';
import { t } from '@vegaprotocol/react-helpers';
import { enabledAssetsProvider } from '@vegaprotocol/assets';
import { useDataProvider } from '@vegaprotocol/react-helpers';
import { Networks, useEnvironment } from '@vegaprotocol/environment';
import { AsyncRenderer, Splash } from '@vegaprotocol/ui-toolkit';
import { useVegaWallet } from '@vegaprotocol/wallet';
import { Web3Container } from '@vegaprotocol/web3';
import type { Deposits } from './__generated__/Deposits';
const DEPOSITS_QUERY = gql`
query Deposits {
assetsConnection {
edges {
node {
id
name
symbol
decimals
status
source {
... on ERC20 {
contractAddress
}
}
}
}
}
}
`;
/**
* Fetches data required for the Deposit page
*/
export const DepositContainer = () => {
const { VEGA_ENV } = useEnvironment();
const { keypair } = useVegaWallet();
const { data, loading, error } = useQuery<Deposits>(DEPOSITS_QUERY, {
variables: { partyId: keypair?.pub },
skip: !keypair?.pub,
const { pubKey } = useVegaWallet();
const variables = useMemo(() => ({ partyId: pubKey }), [pubKey]);
const { data, loading, error } = useDataProvider({
dataProvider: enabledAssetsProvider,
variables,
skip: !pubKey,
});
const assets = getEnabledAssets(data);
return (
<AsyncRenderer<Deposits> data={data} loading={loading} error={error}>
{assets.length ? (
<AsyncRenderer data={data} loading={loading} error={error}>
{data && data.length ? (
<Web3Container>
<DepositManager
assets={assets}
assets={data}
isFaucetable={VEGA_ENV !== Networks.MAINNET}
/>
</Web3Container>
@@ -1,32 +1,31 @@
import React, { useContext } from 'react';
import { ThemeSwitcher } from '@vegaprotocol/ui-toolkit';
import { useVegaWalletDialogStore } from '@vegaprotocol/wallet';
import Logo from './logo';
import { VegaWalletConnectButton } from '../vega-wallet-connect-button';
import LocalContext from '../../context/local-context';
const Header = () => {
const { updateVegaWalletDialog } = useVegaWalletDialogStore((store) => ({
updateVegaWalletDialog: store.updateVegaWalletDialog,
}));
const {
vegaWalletDialog: { setConnect, setManage },
vegaWalletDialog: { setManage },
theme,
toggleTheme,
} = useContext(LocalContext);
return (
<div
className="flex items-stretch pr-6 py-6 bg-black text-neutral-400"
className="dark flex items-stretch pr-6 py-6 bg-black text-neutral-400"
data-testid="header"
>
<Logo />
<div className="flex items-center gap-2 ml-auto relative z-10">
<VegaWalletConnectButton
setConnectDialog={setConnect}
setConnectDialog={updateVegaWalletDialog}
setManageDialog={setManage}
/>
<ThemeSwitcher
theme={theme}
onToggle={toggleTheme}
className="-my-4"
fixedBg="dark"
/>
<ThemeSwitcher theme={theme} onToggle={toggleTheme} className="-my-4" />
</div>
</div>
);
@@ -0,0 +1,103 @@
import classNames from 'classnames';
import React, { useEffect, useRef, useState } from 'react';
import { Link } from 'react-router-dom';
export interface Item {
name: string;
id: string;
url?: string;
isActive?: boolean;
color?: string;
cssClass?: string;
}
interface Props {
active?: string;
cssClass?: string[];
items: Item[];
'data-testid'?: string;
'aria-label'?: string;
}
const MenuItem = ({ id, name, url, isActive, cssClass }: Item): JSX.Element => {
if (!url) {
return <span data-testid={id}>{name}</span>;
}
return (
<Link
to={url}
aria-label={name}
className={classNames('pl-0 hover:opacity-75', cssClass, {
active: isActive,
})}
data-testid={id}
>
{name}
</Link>
);
};
const findActive = (active?: string, items?: Item[]) => {
if (!active && items?.length) {
return 0;
}
return items?.length
? items.findIndex((item) => item.id === active) || 0
: -1;
};
export const HorizontalMenu = ({
items,
active,
'data-testid': dataTestId,
'aria-label': ariaLabel,
}: Props) => {
const [activeNumber, setActiveNumber] = useState<number>(
findActive(active, items)
);
const slideContRef = useRef<HTMLUListElement | null>(null);
const [sliderStyles, setSliderStyles] = useState<Record<string, string>>({});
useEffect(() => {
setActiveNumber(findActive(active, items));
}, [active, items]);
useEffect(() => {
const contStyles = (
slideContRef.current as HTMLUListElement
).getBoundingClientRect();
const selectedStyles = (slideContRef.current as HTMLUListElement).children[
activeNumber
]?.getBoundingClientRect();
const styles: Record<string, string> = selectedStyles
? {
backgroundColor: items[activeNumber].color || '',
width: `${selectedStyles.width}px`,
left: `${selectedStyles.left - contStyles.left}px`,
}
: {};
setSliderStyles(styles);
}, [activeNumber, slideContRef, items]);
return items.length ? (
<ul
ref={slideContRef}
className="grid grid-flow-col auto-cols-min gap-4 relative pb-2 mb-2"
data-testid={dataTestId}
aria-label={ariaLabel}
>
{items.map((item, i) => (
<li key={item.id} className="md:mr-2 whitespace-nowrap">
<MenuItem {...item} isActive={i === activeNumber} />
</li>
))}
<li
className="absolute bottom-0 h-[2px] transition-left duration-300 dark:bg-white bg-black"
key="slider"
style={sliderStyles}
/>
</ul>
) : null;
};
export default HorizontalMenu;
@@ -0,0 +1,2 @@
export { default as HorizontalMenu } from './horizontal-menu';
export type { Item as HorizontalMenuItem } from './horizontal-menu';
@@ -0,0 +1,79 @@
import { useMemo, useRef, useCallback } from 'react';
import { useOutletContext } from 'react-router-dom';
import type { AgGridReact } from 'ag-grid-react';
import { PriceCell, useDataProvider } from '@vegaprotocol/react-helpers';
import type { AccountFields } from '@vegaprotocol/accounts';
import { aggregatedAccountsDataProvider, getId } from '@vegaprotocol/accounts';
import type { IGetRowsParams } from 'ag-grid-community';
import { AsyncRenderer } from '@vegaprotocol/ui-toolkit';
import {
AssetDetailsDialog,
useAssetDetailsDialogStore,
} from '@vegaprotocol/assets';
import { NO_DATA_MESSAGE } from '../../../constants';
import { ConsoleLiteGrid } from '../../console-lite-grid';
import { useAccountColumnDefinitions } from '.';
const AccountsManager = () => {
const { partyId = '' } = useOutletContext<{ partyId: string }>();
const { isOpen, symbol, setOpen } = useAssetDetailsDialogStore();
const gridRef = useRef<AgGridReact | null>(null);
const dataRef = useRef<AccountFields[] | null>(null);
const variables = useMemo(() => ({ partyId }), [partyId]);
const update = useCallback(
({ data }: { data: AccountFields[] | null }) => {
dataRef.current = data;
gridRef.current?.api?.refreshInfiniteCache();
return true;
},
[gridRef]
);
const { data, error, loading } = useDataProvider<AccountFields[], never>({
dataProvider: aggregatedAccountsDataProvider,
update,
variables,
});
if (!dataRef.current && data) {
dataRef.current = data;
}
const getRows = async ({
successCallback,
startRow,
endRow,
}: IGetRowsParams) => {
const rowsThisBlock = dataRef.current
? dataRef.current.slice(startRow, endRow)
: [];
const lastRow = dataRef.current?.length ?? -1;
successCallback(rowsThisBlock, lastRow);
};
const { columnDefs, defaultColDef } = useAccountColumnDefinitions();
return (
<>
<AsyncRenderer
loading={loading}
error={error}
data={data}
noDataMessage={NO_DATA_MESSAGE}
>
<ConsoleLiteGrid<AccountFields>
rowData={data?.length ? undefined : []}
rowModelType={data?.length ? 'infinite' : 'clientSide'}
ref={gridRef}
datasource={{ getRows }}
columnDefs={columnDefs}
defaultColDef={defaultColDef}
components={{ PriceCell }}
getRowId={({ data }) => getId(data)}
/>
</AsyncRenderer>
<AssetDetailsDialog
assetSymbol={symbol}
open={isOpen}
onChange={(open) => setOpen(open)}
/>
</>
);
};
export default AccountsManager;
@@ -0,0 +1,2 @@
export { default as AccountManager } from './accounts';
export { default as useAccountColumnDefinitions } from './use-column-definitions';
@@ -0,0 +1,80 @@
import React, { useMemo } from 'react';
import { addDecimalsFormatNumber, t } from '@vegaprotocol/react-helpers';
import type { AccountFields } from '@vegaprotocol/accounts';
import { useAssetDetailsDialogStore } from '@vegaprotocol/assets';
import type { ColDef, GroupCellRendererParams } from 'ag-grid-community';
import type { VegaValueFormatterParams } from '@vegaprotocol/ui-toolkit';
const useAccountColumnDefinitions = () => {
const { open } = useAssetDetailsDialogStore();
const columnDefs: ColDef[] = useMemo(() => {
return [
{
colId: 'account-asset',
headerName: t('Asset'),
field: 'asset.symbol',
headerClass: 'uppercase justify-start',
cellClass: 'uppercase flex h-full items-center md:pl-4',
cellRenderer: ({ value }: GroupCellRendererParams) =>
value && value.length > 0 ? (
<div className="md:pl-4 grid h-full items-center" title={value}>
<div className="truncate min-w-0">
<button
className="hover:underline"
onClick={() => {
open(value);
}}
>
{value}
</button>
</div>
</div>
) : (
''
),
},
{
colId: 'deposited',
headerName: t('Deposited'),
field: 'deposited',
cellRenderer: 'PriceCell',
valueFormatter: ({
value,
data,
}: VegaValueFormatterParams<AccountFields, 'deposited'>) => {
if (value && data) {
return addDecimalsFormatNumber(value, data.asset.decimals);
}
return '-';
},
},
{
colId: 'used',
headerName: t('Used'),
field: 'used',
cellRenderer: 'PriceCell',
valueFormatter: ({
value,
data,
}: VegaValueFormatterParams<AccountFields, 'used'>) => {
if (value && data) {
return addDecimalsFormatNumber(value, data.asset.decimals);
}
return '-';
},
},
];
}, [open]);
const defaultColDef = useMemo(() => {
return {
sortable: true,
unSortIcon: true,
headerClass: 'uppercase',
editable: false,
};
}, []);
return { columnDefs, defaultColDef };
};
export default useAccountColumnDefinitions;
@@ -0,0 +1,35 @@
import { t } from '@vegaprotocol/react-helpers';
export const PORTFOLIO_ASSETS = 'assets';
export const PORTFOLIO_POSITIONS = 'positions';
export const PORTFOLIO_ORDERS = 'orders';
export const PORTFOLIO_FILLS = 'fills';
export const PORTFOLIO_DEPOSITS = 'deposits';
export const PORTFOLIO_ITEMS = [
{
name: t('Assets'),
id: PORTFOLIO_ASSETS,
url: `/portfolio/${PORTFOLIO_ASSETS}`,
},
{
name: t('Positions'),
id: PORTFOLIO_POSITIONS,
url: `/portfolio/${PORTFOLIO_POSITIONS}`,
},
{
name: t('Orders'),
id: PORTFOLIO_ORDERS,
url: `/portfolio/${PORTFOLIO_ORDERS}`,
},
{
name: t('Fills'),
id: PORTFOLIO_FILLS,
url: `/portfolio/${PORTFOLIO_FILLS}`,
},
{
name: t('Deposits'),
id: PORTFOLIO_DEPOSITS,
url: `/portfolio/${PORTFOLIO_DEPOSITS}`,
},
];
@@ -0,0 +1,53 @@
import { useRef } from 'react';
import { useOutletContext } from 'react-router-dom';
import type { AgGridReact } from 'ag-grid-react';
import type { Trade } from '@vegaprotocol/fills';
import { useFillsList } from '@vegaprotocol/fills';
import type { BodyScrollEndEvent, BodyScrollEvent } from 'ag-grid-community';
import { AsyncRenderer } from '@vegaprotocol/ui-toolkit';
import { ConsoleLiteGrid } from '../../console-lite-grid';
import { NO_DATA_MESSAGE } from '../../../constants';
import useColumnDefinitions from './use-column-definitions';
const FillsManager = () => {
const { partyId } = useOutletContext<{ partyId: string }>();
const { columnDefs, defaultColDef } = useColumnDefinitions({ partyId });
const gridRef = useRef<AgGridReact | null>(null);
const scrolledToTop = useRef(true);
const { data, error, loading, addNewRows, getRows } = useFillsList({
partyId,
gridRef,
scrolledToTop,
});
const onBodyScrollEnd = (event: BodyScrollEndEvent) => {
if (event.top === 0) {
addNewRows();
}
};
const onBodyScroll = (event: BodyScrollEvent) => {
scrolledToTop.current = event.top <= 0;
};
return (
<AsyncRenderer
loading={loading}
error={error}
data={data?.length ? data : null}
noDataMessage={NO_DATA_MESSAGE}
>
<ConsoleLiteGrid<Trade>
ref={gridRef}
rowModelType="infinite"
datasource={{ getRows }}
onBodyScrollEnd={onBodyScrollEnd}
onBodyScroll={onBodyScroll}
columnDefs={columnDefs}
defaultColDef={defaultColDef}
/>
</AsyncRenderer>
);
};
export default FillsManager;
@@ -0,0 +1 @@
export { default as FillsManager } from './fills';
@@ -0,0 +1,190 @@
import { useMemo } from 'react';
import type { ColDef, ValueFormatterParams } from 'ag-grid-community';
import type { Trade } from '@vegaprotocol/fills';
import classNames from 'classnames';
import {
addDecimal,
addDecimalsFormatNumber,
formatNumber,
getDateTimeFormat,
negativeClassNames,
positiveClassNames,
t,
} from '@vegaprotocol/react-helpers';
import BigNumber from 'bignumber.js';
import { Schema } from '@vegaprotocol/types';
interface Props {
partyId: string;
}
const useColumnDefinitions = ({ partyId }: Props) => {
const columnDefs: ColDef[] = useMemo(() => {
return [
{
colId: 'market',
headerName: t('Market'),
field: 'market.tradableInstrument.instrument.name',
cellClass: '!flex h-full items-center !md:pl-4',
minWidth: 150,
},
{
colId: 'size',
headerName: t('Size'),
headerClass: 'uppercase',
field: 'size',
width: 100,
cellClass: ({ data }: { data: Trade }) => {
return classNames('!flex h-full items-center justify-center', {
[positiveClassNames]: data?.buyer.id === partyId,
[negativeClassNames]: data?.seller.id,
});
},
valueFormatter: ({ value, data }: ValueFormatterParams) => {
if (value && data?.market) {
let prefix;
if (data.buyer.id === partyId) {
prefix = '+';
} else if (data.seller.id) {
prefix = '-';
}
const size = addDecimalsFormatNumber(
value,
data.market.positionDecimalPlaces
);
return `${prefix}${size}`;
}
return '-';
},
},
{
colId: 'value',
headerName: t('Value'),
headerClass: 'uppercase text-center',
cellClass: '!flex h-full items-center',
field: 'price',
valueFormatter: ({ value, data }: ValueFormatterParams) => {
if (value && data?.market) {
const asset =
data.market.tradableInstrument.instrument.product.settlementAsset
.symbol;
const valueFormatted = addDecimalsFormatNumber(
value,
data.market.decimalPlaces
);
return `${valueFormatted} ${asset}`;
}
return '-';
},
type: 'rightAligned',
},
{
colId: 'filledvalue',
headerName: t('Filled value'),
headerClass: 'uppercase text-center',
cellClass: '!flex h-full items-center',
field: 'price',
valueFormatter: ({ value, data }: ValueFormatterParams) => {
if (value && data?.market) {
const asset =
data.market.tradableInstrument.instrument.product.settlementAsset
.symbol;
const size = new BigNumber(
addDecimal(data.size, data.market.positionDecimalPlaces)
);
const price = new BigNumber(
addDecimal(value, data.market.decimalPlaces)
);
const total = size.times(price).toString();
const valueFormatted = formatNumber(
total,
data?.market.decimalPlaces
);
return `${valueFormatted} ${asset}`;
}
return '-';
},
type: 'rightAligned',
},
{
colId: 'role',
headerName: t('Role'),
field: 'aggressor',
width: 100,
valueFormatter: ({ value, data }: ValueFormatterParams) => {
if (value && data) {
const taker = t('Taker');
const maker = t('Maker');
if (data?.buyer.id === partyId) {
if (value === Schema.Side.SIDE_BUY) {
return taker;
} else {
return maker;
}
} else if (data?.seller.id === partyId) {
if (value === Schema.Side.SIDE_SELL) {
return taker;
} else {
return maker;
}
}
}
return '-';
},
},
{
colId: 'fee',
headerName: t('Fee'),
headerClass: 'uppercase text-center',
cellClass: '!flex h-full items-center',
field: 'market.tradableInstrument.instrument.product',
valueFormatter: ({ value, data }: ValueFormatterParams) => {
if (value && data) {
const asset = value.settlementAsset;
let feesObj;
if (data.buyer.id === partyId) {
feesObj = data.buyerFee;
} else if (data?.seller.id === partyId) {
feesObj = data?.sellerFee;
} else {
return '-';
}
const fee = new BigNumber(feesObj.makerFee)
.plus(feesObj.infrastructureFee)
.plus(feesObj.liquidityFee);
const totalFees = addDecimalsFormatNumber(
fee.toString(),
asset.decimals
);
return `${totalFees} ${asset.symbol}`;
}
return '-';
},
type: 'rightAligned',
},
{
colId: 'date',
headerName: t('Date'),
field: 'createdAt',
valueFormatter: ({ value }: ValueFormatterParams) => {
return value ? getDateTimeFormat().format(new Date(value)) : '-';
},
},
];
}, [partyId]);
const defaultColDef = useMemo(() => {
return {
sortable: true,
unSortIcon: true,
headerClass: 'uppercase',
cellClass: '!flex h-full items-center',
};
}, []);
return { columnDefs, defaultColDef };
};
export default useColumnDefinitions;
@@ -1 +1,6 @@
export * from './portfolio';
export * from './accounts';
export * from './fills';
export * from './orders';
export * from './positions';
export * as constants from './constants';
@@ -0,0 +1 @@
export { default as OrdersManager } from './orders';
@@ -0,0 +1,107 @@
import { useRef, useState } from 'react';
import type { AgGridReact } from 'ag-grid-react';
import type { BodyScrollEndEvent, BodyScrollEvent } from 'ag-grid-community';
import { useOutletContext } from 'react-router-dom';
import type { Order } from '@vegaprotocol/orders';
import {
useOrderCancel,
useOrderListData,
useOrderEdit,
OrderFeedback,
getCancelDialogTitle,
getCancelDialogIntent,
getEditDialogTitle,
OrderEditDialog,
} from '@vegaprotocol/orders';
import { AsyncRenderer } from '@vegaprotocol/ui-toolkit';
import { ConsoleLiteGrid } from '../../console-lite-grid';
import { NO_DATA_MESSAGE } from '../../../constants';
import useColumnDefinitions from './use-column-definitions';
const OrdersManager = () => {
const { partyId } = useOutletContext<{ partyId: string }>();
const [editOrder, setEditOrder] = useState<Order | null>(null);
const orderCancel = useOrderCancel();
const orderEdit = useOrderEdit(editOrder);
const { columnDefs, defaultColDef } = useColumnDefinitions({
setEditOrder,
orderCancel,
});
const gridRef = useRef<AgGridReact | null>(null);
const scrolledToTop = useRef(true);
const { data, error, loading, addNewRows, getRows } = useOrderListData({
partyId,
gridRef,
scrolledToTop,
});
const onBodyScrollEnd = (event: BodyScrollEndEvent) => {
if (event.top === 0) {
addNewRows();
}
};
const onBodyScroll = (event: BodyScrollEvent) => {
scrolledToTop.current = event.top <= 0;
};
return (
<AsyncRenderer
loading={loading}
error={error}
data={data?.length ? data : null}
noDataMessage={NO_DATA_MESSAGE}
>
<ConsoleLiteGrid<Order>
ref={gridRef}
rowModelType={data?.length ? 'infinite' : 'clientSide'}
rowData={data?.length ? undefined : []}
datasource={{ getRows }}
onBodyScrollEnd={onBodyScrollEnd}
onBodyScroll={onBodyScroll}
columnDefs={columnDefs}
defaultColDef={defaultColDef}
/>
<orderCancel.Dialog
title={getCancelDialogTitle(orderCancel.cancelledOrder?.status)}
intent={getCancelDialogIntent(orderCancel.cancelledOrder?.status)}
content={{
Complete: (
<OrderFeedback
transaction={orderCancel.transaction}
order={orderCancel.cancelledOrder}
/>
),
}}
/>
<orderEdit.Dialog
title={getEditDialogTitle(orderEdit.updatedOrder?.status)}
content={{
Complete: (
<OrderFeedback
transaction={orderEdit.transaction}
order={orderEdit.updatedOrder}
/>
),
}}
/>
{editOrder && (
<OrderEditDialog
isOpen={Boolean(editOrder)}
onChange={(isOpen) => {
if (!isOpen) setEditOrder(null);
}}
order={editOrder}
onSubmit={(fields) => {
setEditOrder(null);
orderEdit.edit({ price: fields.limitPrice });
}}
/>
)}
</AsyncRenderer>
);
};
export default OrdersManager;
@@ -0,0 +1,278 @@
import { useMemo } from 'react';
import type {
ColDef,
ValueFormatterParams,
ICellRendererParams,
} from 'ag-grid-community';
import {
addDecimal,
getDateTimeFormat,
negativeClassNames,
positiveClassNames,
t,
} from '@vegaprotocol/react-helpers';
import type {
OrderFieldsFragment,
Order,
CancelOrderArgs,
} from '@vegaprotocol/orders';
import { isOrderActive } from '@vegaprotocol/orders';
import {
OrderRejectionReasonMapping,
OrderStatusMapping,
OrderTypeMapping,
Schema,
OrderTimeInForceMapping,
} from '@vegaprotocol/types';
import BigNumber from 'bignumber.js';
import { Button } from '@vegaprotocol/ui-toolkit';
type StatusKey = keyof typeof OrderStatusMapping;
type RejectReasonKey = keyof typeof OrderRejectionReasonMapping;
type OrderTimeKey = keyof typeof OrderTimeInForceMapping;
interface Props {
setEditOrder: (order: Order) => void;
orderCancel: {
cancel: (args: CancelOrderArgs) => void;
[key: string]: unknown;
};
}
const useColumnDefinitions = ({ setEditOrder, orderCancel }: Props) => {
const columnDefs: ColDef[] = useMemo(() => {
return [
{
colId: 'market',
headerName: t('Market'),
field: 'market.tradableInstrument.instrument.code',
headerClass: 'uppercase justify-start',
cellClass: '!flex h-full items-center !md:pl-4',
},
{
colId: 'size',
headerName: t('Size'),
field: 'size',
headerClass: 'uppercase',
cellClass: 'font-mono !flex h-full items-center',
width: 80,
cellClassRules: {
[positiveClassNames]: ({ data }: { data: OrderFieldsFragment }) =>
data?.side === Schema.Side.SIDE_BUY,
[negativeClassNames]: ({ data }: { data: OrderFieldsFragment }) =>
data?.side === Schema.Side.SIDE_SELL,
},
valueFormatter: ({ value, data }: ValueFormatterParams) => {
if (value && data && data.market) {
const prefix = data
? data.side === Schema.Side.SIDE_BUY
? '+'
: '-'
: '';
return (
prefix + addDecimal(value, data.market.positionDecimalPlaces)
);
}
return '-';
},
},
{
colId: 'type',
field: 'type',
width: 80,
valueFormatter: ({
value,
}: ValueFormatterParams & {
value?: OrderFieldsFragment['type'];
}) => OrderTypeMapping[value as Schema.OrderType],
},
{
colId: 'status',
field: 'status',
cellClass: 'text-center font-mono !flex h-full items-center',
valueFormatter: ({
value,
data,
}: ValueFormatterParams & {
value?: StatusKey;
}) => {
if (value && data && data.market) {
if (value === Schema.OrderStatus.STATUS_REJECTED) {
return `${OrderStatusMapping[value as StatusKey]}: ${
data.rejectionReason &&
OrderRejectionReasonMapping[
data.rejectionReason as RejectReasonKey
]
}`;
}
return OrderStatusMapping[value as StatusKey] as string;
}
return '-';
},
},
{
colId: 'filled',
headerName: t('Filled'),
headerClass: 'uppercase',
field: 'remaining',
cellClass: 'font-mono text-center !flex h-full items-center',
width: 80,
valueFormatter: ({
data,
value,
}: ValueFormatterParams & {
value?: OrderFieldsFragment['remaining'];
}) => {
if (value && data && data.market) {
const dps = data.market.positionDecimalPlaces;
const size = new BigNumber(data.size);
const remaining = new BigNumber(value);
const fills = size.minus(remaining);
return `${addDecimal(fills.toString(), dps)}/${addDecimal(
size.toString(),
dps
)}`;
}
return '-';
},
},
{
colId: 'price',
field: 'price',
type: 'rightAligned',
width: 125,
headerClass: 'uppercase text-right',
cellClass: 'font-mono text-right !flex h-full items-center',
valueFormatter: ({
value,
data,
}: ValueFormatterParams & {
value?: OrderFieldsFragment['price'];
}) => {
if (
value === undefined ||
!data ||
!data.market ||
data.type === Schema.OrderType.TYPE_MARKET
) {
return '-';
}
return addDecimal(value, data.market.decimalPlaces);
},
},
{
colId: 'timeInForce',
field: 'timeInForce',
minWidth: 120,
valueFormatter: ({
value,
data,
}: ValueFormatterParams & {
value?: OrderTimeKey;
}) => {
if (value && data?.market) {
if (
value === Schema.OrderTimeInForce.TIME_IN_FORCE_GTT &&
data.expiresAt
) {
const expiry = getDateTimeFormat().format(
new Date(data.expiresAt)
);
return `${
OrderTimeInForceMapping[value as OrderTimeKey]
}: ${expiry}`;
}
return OrderTimeInForceMapping[value as OrderTimeKey];
}
return '-';
},
},
{
colId: 'createdat',
field: 'createdAt',
valueFormatter: ({
value,
}: ValueFormatterParams & {
value?: OrderFieldsFragment['createdAt'];
}) => {
return value ? getDateTimeFormat().format(new Date(value)) : value;
},
},
{
colId: 'updated',
field: 'updatedAt',
cellClass: '!flex h-full items-center justify-center',
valueFormatter: ({
value,
}: ValueFormatterParams & {
value?: OrderFieldsFragment['updatedAt'];
}) => {
return value ? getDateTimeFormat().format(new Date(value)) : '-';
},
},
{
colId: 'edit',
field: 'edit',
width: 75,
cellRenderer: ({ data }: ICellRendererParams) => {
if (!data) return null;
if (isOrderActive(data.status)) {
return (
<Button
data-testid="edit"
onClick={() => {
setEditOrder(data);
}}
size="xs"
>
{t('Edit')}
</Button>
);
}
return null;
},
},
{
colId: 'cancel',
field: 'cancel',
minWidth: 130,
cellRenderer: ({ data }: ICellRendererParams) => {
if (!data) return null;
if (isOrderActive(data.status)) {
return (
<Button
size="xs"
data-testid="cancel"
onClick={() => {
if (data.market) {
orderCancel.cancel({
orderId: data.id,
marketId: data.market.id,
});
}
}}
>
Cancel
</Button>
);
}
return null;
},
},
];
}, [orderCancel, setEditOrder]);
const defaultColDef = useMemo(() => {
return {
sortable: true,
unSortIcon: true,
headerClass: 'uppercase',
cellClass: '!flex h-full items-center',
};
}, []);
return { columnDefs, defaultColDef };
};
export default useColumnDefinitions;
@@ -1,40 +1,27 @@
import * as React from 'react';
import { AccountsContainer } from '@vegaprotocol/accounts';
import { t } from '@vegaprotocol/react-helpers';
import React from 'react';
import { useVegaWallet } from '@vegaprotocol/wallet';
import { Tabs, Tab } from '@vegaprotocol/ui-toolkit';
import { OrderListContainer } from '@vegaprotocol/orders';
import { PositionsContainer } from '@vegaprotocol/positions';
import { FillsContainer } from '@vegaprotocol/fills';
import ConnectWallet from '../wallet-connector';
import { DepositContainer } from '../deposits';
import { useOutlet, useLocation } from 'react-router-dom';
import { HorizontalMenu } from '../horizontal-menu';
import * as constants from './constants';
export const Portfolio = () => {
const { keypair } = useVegaWallet();
if (!keypair) {
const { pubKey } = useVegaWallet();
const { pathname } = useLocation();
const module = pathname.split('/portfolio/')?.[1] ?? '';
const outlet = useOutlet({ partyId: pubKey || '' });
if (!pubKey) {
return (
<section className="xl:w-1/2">
<ConnectWallet />
</section>
);
}
return (
<Tabs>
<Tab id="assets" name={t('Assets')}>
<AccountsContainer />
</Tab>
<Tab id="positions" name={t('Positions')}>
<PositionsContainer />
</Tab>
<Tab id="orders" name={t('Orders')}>
<OrderListContainer />
</Tab>
<Tab id="fills" name={t('Fills')}>
<FillsContainer />
</Tab>
<Tab id="deposits" name={t('Deposits')}>
<DepositContainer />
</Tab>
</Tabs>
<div className="h-full p-4 md:p-6 grid grid-rows-[min-content_1fr]">
<HorizontalMenu active={module} items={constants.PORTFOLIO_ITEMS} />
{outlet}
</div>
);
};
@@ -0,0 +1 @@
export { default as PositionsManager } from './positions';
@@ -0,0 +1,58 @@
import { AsyncRenderer } from '@vegaprotocol/ui-toolkit';
import { useRef } from 'react';
import type { AgGridReact } from 'ag-grid-react';
import type { Position } from '@vegaprotocol/positions';
import { PriceFlashCell, t } from '@vegaprotocol/react-helpers';
import { AssetBalance } from '@vegaprotocol/accounts';
import { usePositionsData } from '@vegaprotocol/positions';
import { ConsoleLiteGrid } from '../../console-lite-grid';
import useColumnDefinitions from './use-column-definitions';
interface Props {
partyId: string;
assetSymbol: string;
}
const getRowId = ({ data }: { data: Position }) => data.marketId;
const PositionsAsset = ({ partyId, assetSymbol }: Props) => {
const gridRef = useRef<AgGridReact | null>(null);
const { data, error, loading, getRows } = usePositionsData(
partyId,
gridRef,
assetSymbol
);
const { columnDefs, defaultColDef } = useColumnDefinitions();
return (
<AsyncRenderer loading={loading} error={error} data={data}>
<div
data-testid={`positions-asset-${assetSymbol}`}
className="flex justify-between items-center px-4 pt-3 pb-1"
>
<h4>
{assetSymbol} {t('markets')}
</h4>
<div className="text-sm text-neutral-500 dark:text-neutral-300">
{assetSymbol} {t('balance')}:
<span data-testid="balance" className="pl-1 font-mono">
<AssetBalance partyId={partyId} assetSymbol={assetSymbol} />
</span>
</div>
</div>
<ConsoleLiteGrid<Position & { id: undefined }>
ref={gridRef}
domLayout="autoHeight"
classNamesParam="h-auto"
columnDefs={columnDefs}
defaultColDef={defaultColDef}
getRowId={getRowId}
rowModelType={data?.length ? 'infinite' : 'clientSide'}
rowData={data?.length ? undefined : []}
datasource={{ getRows }}
components={{ PriceFlashCell }}
/>
</AsyncRenderer>
);
};
export default PositionsAsset;
@@ -0,0 +1,28 @@
import { useOutletContext } from 'react-router-dom';
import { t } from '@vegaprotocol/react-helpers';
import { usePositionsAssets } from '@vegaprotocol/positions';
import { AsyncRenderer, Splash } from '@vegaprotocol/ui-toolkit';
import PositionsAsset from './positions-asset';
const Positions = () => {
const { partyId } = useOutletContext<{ partyId: string }>();
const { data, error, loading, assetSymbols } = usePositionsAssets(partyId);
return (
<AsyncRenderer loading={loading} error={error} data={data}>
{assetSymbols && assetSymbols.length > 0 && (
<div className="w-full, h-max">
{assetSymbols?.map((assetSymbol) => (
<PositionsAsset
key={assetSymbol}
partyId={partyId}
assetSymbol={assetSymbol}
/>
))}
</div>
)}
{assetSymbols?.length === 0 && <Splash>{t('No data to display')}</Splash>}
</AsyncRenderer>
);
};
export default Positions;
@@ -0,0 +1,278 @@
import { useMemo } from 'react';
import {
addDecimalsFormatNumber,
formatNumber,
getDateTimeFormat,
PriceFlashCell,
signedNumberCssClassRules,
t,
} from '@vegaprotocol/react-helpers';
import type { Position } from '@vegaprotocol/positions';
import { AmountCell } from '@vegaprotocol/positions';
import type {
CellRendererSelectorResult,
ICellRendererParams,
ValueGetterParams,
GroupCellRendererParams,
ColDef,
} from 'ag-grid-community';
import { MarketTradingMode } from '@vegaprotocol/types';
import type { VegaValueFormatterParams } from '@vegaprotocol/ui-toolkit';
import { Intent, ProgressBarCell } from '@vegaprotocol/ui-toolkit';
const EmptyCell = () => '';
const useColumnDefinitions = () => {
const columnDefs: ColDef[] = useMemo(() => {
return [
{
colId: 'market',
headerName: t('Market'),
headerClass: 'uppercase justify-start',
cellClass: '!flex h-full items-center !md:pl-4',
field: 'marketName',
cellRenderer: ({ value }: GroupCellRendererParams) => {
if (!value) {
return null;
}
const valueFormatted: [string, string?] = (() => {
// split market name into two parts, 'Part1 (Part2)' or 'Part1 - Part2'
const matches = value.match(/^(.*)(\((.*)\)| - (.*))\s*$/);
if (matches && matches[1] && matches[3]) {
return [matches[1].trim(), matches[3].trim()];
}
return [value];
})();
if (valueFormatted && valueFormatted[1]) {
return (
<div className="leading-tight">
<div>{valueFormatted[0]}</div>
<div>{valueFormatted[1]}</div>
</div>
);
}
return valueFormatted ? valueFormatted[0] : null;
},
},
{
colId: 'amount',
headerName: t('Amount'),
headerClass: 'uppercase',
cellClass: '!flex h-full items-center',
field: 'openVolume',
valueGetter: ({ node, data }: ValueGetterParams) => {
return node?.rowPinned ? data?.notional : data?.openVolume;
},
type: 'rightAligned',
cellRendererSelector: (
params: ICellRendererParams
): CellRendererSelectorResult => {
return {
component: params.node.rowPinned ? PriceFlashCell : AmountCell,
};
},
valueFormatter: ({
value,
data,
node,
}: VegaValueFormatterParams<Position, 'openVolume'>) => {
let ret;
if (value && data) {
ret = node?.rowPinned
? addDecimalsFormatNumber(value, data.decimals)
: data;
}
// FIXME this column needs refactoring
return ret as unknown as string;
},
},
{
colId: 'markprice',
headerName: t('Mark price'),
headerClass: 'uppercase',
cellClass: '!flex h-full items-center justify-center',
field: 'markPrice',
cellRendererSelector: (
params: ICellRendererParams
): CellRendererSelectorResult => {
return {
component: params.node.rowPinned ? EmptyCell : PriceFlashCell,
};
},
valueFormatter: ({
value,
data,
node,
}: VegaValueFormatterParams<Position, 'markPrice'>) => {
if (
data &&
value &&
node?.rowPinned &&
data.marketTradingMode ===
MarketTradingMode.TRADING_MODE_OPENING_AUCTION
) {
return addDecimalsFormatNumber(
value.toString(),
data.marketDecimalPlaces
);
}
return '-';
},
},
{
colId: 'entryprice',
headerName: t('Entry price'),
headerClass: 'uppercase',
cellClass: '!flex h-full items-center',
field: 'averageEntryPrice',
headerComponentParams: {
template:
'<div class="ag-cell-label-container" role="presentation">' +
` <span>${t('Liquidation price (est)')}</span>` +
' <span ref="eText" class="ag-header-cell-text"></span>' +
'</div>',
},
cellRenderer: ({ node, data }: GroupCellRendererParams) => {
const valueFormatted =
data && !node?.rowPinned
? (() => {
const min = BigInt(data.averageEntryPrice);
const max = BigInt(data.liquidationPrice);
const mid = BigInt(data.markPrice);
const range = max - min;
return {
low: addDecimalsFormatNumber(
min.toString(),
data.marketDecimalPlaces
),
high: addDecimalsFormatNumber(
max.toString(),
data.marketDecimalPlaces
),
value: range
? Number(((mid - min) * BigInt(100)) / range)
: 0,
intent: data.lowMarginLevel ? Intent.Warning : undefined,
};
})()
: undefined;
return node.rowPinned ? (
''
) : (
<ProgressBarCell valueFormatted={valueFormatted} />
);
},
},
{
colId: 'leverage',
headerName: t('Leverage'),
headerClass: 'uppercase',
cellClass: '!flex h-full items-center justify-center',
field: 'currentLeverage',
type: 'rightAligned',
cellRendererSelector: (
params: ICellRendererParams
): CellRendererSelectorResult => {
return {
component: params.node.rowPinned ? EmptyCell : PriceFlashCell,
};
},
valueFormatter: ({
value,
node,
}: VegaValueFormatterParams<Position, 'currentLeverage'>) =>
value === undefined ? '' : formatNumber(value.toString(), 1),
},
{
colId: 'marginallocated',
headerName: t('Margin allocated'),
headerClass: 'uppercase',
cellClass: '!flex h-full flex-col justify-center',
field: 'capitalUtilisation',
type: 'rightAligned',
cellRenderer: ({ value, node, data }: GroupCellRendererParams) => {
const valueFormatted =
data && value
? (() => {
return {
low: `${formatNumber(value, 2)}%`,
high: addDecimalsFormatNumber(
data.totalBalance,
data.decimals
),
value: Number(value),
};
})()
: undefined;
return node.rowPinned ? (
''
) : (
<ProgressBarCell valueFormatted={valueFormatted} />
);
},
},
{
colId: 'realisedpnl',
headerName: t('Realised PNL'),
headerClass: 'uppercase',
cellClass: '!flex h-full items-center',
field: 'realisedPNL',
type: 'rightAligned',
cellClassRules: signedNumberCssClassRules,
valueFormatter: ({
value,
data,
}: VegaValueFormatterParams<Position, 'realisedPNL'>) =>
value === undefined || data === undefined
? ''
: addDecimalsFormatNumber(value.toString(), data.decimals),
cellRenderer: 'PriceFlashCell',
headerTooltip: t('P&L excludes any fees paid.'),
},
{
colId: 'unrealisedpnl',
headerName: t('Unrealised PNL'),
headerClass: 'uppercase',
cellClass: '!flex h-full items-center',
field: 'unrealisedPNL',
type: 'rightAligned',
cellClassRules: signedNumberCssClassRules,
valueFormatter: ({
value,
data,
}: VegaValueFormatterParams<Position, 'unrealisedPNL'>) =>
value === undefined || data === undefined
? ''
: addDecimalsFormatNumber(value.toString(), data.decimals),
cellRenderer: 'PriceFlashCell',
},
{
colId: 'updated',
headerName: t('Updated'),
headerClass: 'uppercase',
cellClass: '!flex h-full items-center',
field: 'updatedAt',
type: 'rightAligned',
valueFormatter: ({
value,
}: VegaValueFormatterParams<Position, 'updatedAt'>) => {
if (!value) {
return '';
}
return getDateTimeFormat().format(new Date(value));
},
},
];
}, []);
const defaultColDef = useMemo(() => {
return {
sortable: true,
unSortIcon: true,
headerClass: 'uppercase',
cellClass: '!flex h-full items-center',
};
}, []);
return { columnDefs, defaultColDef };
};
export default useColumnDefinitions;
@@ -1,5 +0,0 @@
subscription CandleLive($marketId: ID!) {
candles(marketId: $marketId, interval: INTERVAL_I1H) {
close
}
}
@@ -1,39 +0,0 @@
fragment SimpleMarketDataFields on ObservableMarketData {
marketId
marketState
}
query SimpleMarkets($CandleSince: String!) {
markets {
id
state
tradableInstrument {
instrument {
name
code
metadata {
tags
}
product {
__typename
... on Future {
quoteName
settlementAsset {
symbol
}
}
}
}
}
candles(interval: INTERVAL_I1H, since: $CandleSince) {
open
close
}
}
}
subscription SimpleMarketDataSub($marketIds: [ID!]!) {
marketsData(marketIds: $marketIds) {
...SimpleMarketDataFields
}
}
@@ -1,33 +0,0 @@
/* tslint:disable */
/* eslint-disable */
// @generated
// This file was automatically generated and should not be edited.
import { MarketState } from "@vegaprotocol/types";
// ====================================================
// GraphQL subscription operation: SimpleMarketDataSub
// ====================================================
export interface SimpleMarketDataSub_marketsData {
__typename: "ObservableMarketData";
/**
* current state of the market
*/
marketState: MarketState;
/**
* market ID of the associated mark price
*/
marketId: string;
}
export interface SimpleMarketDataSub {
/**
* Subscribe to the mark price changes
*/
marketsData: SimpleMarketDataSub_marketsData[];
}
export interface SimpleMarketDataSubVariables {
marketIds: string[];
}
@@ -1,109 +0,0 @@
/* tslint:disable */
/* eslint-disable */
// @generated
// This file was automatically generated and should not be edited.
import { MarketState } from "@vegaprotocol/types";
// ====================================================
// GraphQL query operation: SimpleMarkets
// ====================================================
export interface SimpleMarkets_markets_tradableInstrument_instrument_metadata {
__typename: "InstrumentMetadata";
/**
* An arbitrary list of tags to associated to associate to the Instrument (string list)
*/
tags: string[] | null;
}
export interface SimpleMarkets_markets_tradableInstrument_instrument_product_settlementAsset {
__typename: "Asset";
/**
* The symbol of the asset (e.g: GBP)
*/
symbol: string;
}
export interface SimpleMarkets_markets_tradableInstrument_instrument_product {
__typename: "Future";
/**
* String representing the quote (e.g. BTCUSD -> USD is quote)
*/
quoteName: string;
/**
* The name of the asset (string)
*/
settlementAsset: SimpleMarkets_markets_tradableInstrument_instrument_product_settlementAsset;
}
export interface SimpleMarkets_markets_tradableInstrument_instrument {
__typename: "Instrument";
/**
* A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string)
*/
code: string;
/**
* Full and fairly descriptive name for the instrument
*/
name: string;
/**
* Metadata for this instrument
*/
metadata: SimpleMarkets_markets_tradableInstrument_instrument_metadata;
/**
* A reference to or instance of a fully specified product, including all required product parameters for that product (Product union)
*/
product: SimpleMarkets_markets_tradableInstrument_instrument_product;
}
export interface SimpleMarkets_markets_tradableInstrument {
__typename: "TradableInstrument";
/**
* An instance of, or reference to, a fully specified instrument.
*/
instrument: SimpleMarkets_markets_tradableInstrument_instrument;
}
export interface SimpleMarkets_markets_candles {
__typename: "Candle";
/**
* Open price (uint64)
*/
open: string;
/**
* Close price (uint64)
*/
close: string;
}
export interface SimpleMarkets_markets {
__typename: "Market";
/**
* Market ID
*/
id: string;
/**
* Current state of the market
*/
state: MarketState;
/**
* An instance of, or reference to, a tradable instrument.
*/
tradableInstrument: SimpleMarkets_markets_tradableInstrument;
/**
* Candles on a market, for the 'last' n candles, at 'interval' seconds as specified by parameters
*/
candles: (SimpleMarkets_markets_candles | null)[] | null;
}
export interface SimpleMarkets {
/**
* One or more instruments that are trading on the VEGA network
*/
markets: SimpleMarkets_markets[] | null;
}
export interface SimpleMarketsVariables {
CandleSince: string;
}
@@ -1,115 +0,0 @@
import { Schema as Types } from '@vegaprotocol/types';
import { gql } from '@apollo/client';
import * as Apollo from '@apollo/client';
const defaultOptions = {} as const;
export type SimpleMarketDataFieldsFragment = { __typename?: 'ObservableMarketData', marketId: string, marketState: Types.MarketState };
export type SimpleMarketsQueryVariables = Types.Exact<{
CandleSince: Types.Scalars['String'];
}>;
export type SimpleMarketsQuery = { __typename?: 'Query', markets?: Array<{ __typename?: 'Market', id: string, state: Types.MarketState, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array<string> | null }, product: { __typename: 'Future', quoteName: string, settlementAsset: { __typename?: 'Asset', symbol: string } } } }, candles?: Array<{ __typename?: 'Candle', open: string, close: string } | null> | null }> | null };
export type SimpleMarketDataSubSubscriptionVariables = Types.Exact<{
marketIds: Array<Types.Scalars['ID']> | Types.Scalars['ID'];
}>;
export type SimpleMarketDataSubSubscription = { __typename?: 'Subscription', marketsData: Array<{ __typename?: 'ObservableMarketData', marketId: string, marketState: Types.MarketState }> };
export const SimpleMarketDataFieldsFragmentDoc = gql`
fragment SimpleMarketDataFields on ObservableMarketData {
marketId
marketState
}
`;
export const SimpleMarketsDocument = gql`
query SimpleMarkets($CandleSince: String!) {
markets {
id
state
tradableInstrument {
instrument {
name
code
metadata {
tags
}
product {
__typename
... on Future {
quoteName
settlementAsset {
symbol
}
}
}
}
}
candles(interval: INTERVAL_I1H, since: $CandleSince) {
open
close
}
}
}
`;
/**
* __useSimpleMarketsQuery__
*
* To run a query within a React component, call `useSimpleMarketsQuery` and pass it any options that fit your needs.
* When your component renders, `useSimpleMarketsQuery` returns an object from Apollo Client that contains loading, error, and data properties
* you can use to render your UI.
*
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
*
* @example
* const { data, loading, error } = useSimpleMarketsQuery({
* variables: {
* CandleSince: // value for 'CandleSince'
* },
* });
*/
export function useSimpleMarketsQuery(baseOptions: Apollo.QueryHookOptions<SimpleMarketsQuery, SimpleMarketsQueryVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useQuery<SimpleMarketsQuery, SimpleMarketsQueryVariables>(SimpleMarketsDocument, options);
}
export function useSimpleMarketsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<SimpleMarketsQuery, SimpleMarketsQueryVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useLazyQuery<SimpleMarketsQuery, SimpleMarketsQueryVariables>(SimpleMarketsDocument, options);
}
export type SimpleMarketsQueryHookResult = ReturnType<typeof useSimpleMarketsQuery>;
export type SimpleMarketsLazyQueryHookResult = ReturnType<typeof useSimpleMarketsLazyQuery>;
export type SimpleMarketsQueryResult = Apollo.QueryResult<SimpleMarketsQuery, SimpleMarketsQueryVariables>;
export const SimpleMarketDataSubDocument = gql`
subscription SimpleMarketDataSub($marketIds: [ID!]!) {
marketsData(marketIds: $marketIds) {
...SimpleMarketDataFields
}
}
${SimpleMarketDataFieldsFragmentDoc}`;
/**
* __useSimpleMarketDataSubSubscription__
*
* To run a query within a React component, call `useSimpleMarketDataSubSubscription` and pass it any options that fit your needs.
* When your component renders, `useSimpleMarketDataSubSubscription` returns an object from Apollo Client that contains loading, error, and data properties
* you can use to render your UI.
*
* @param baseOptions options that will be passed into the subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
*
* @example
* const { data, loading, error } = useSimpleMarketDataSubSubscription({
* variables: {
* marketIds: // value for 'marketIds'
* },
* });
*/
export function useSimpleMarketDataSubSubscription(baseOptions: Apollo.SubscriptionHookOptions<SimpleMarketDataSubSubscription, SimpleMarketDataSubSubscriptionVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useSubscription<SimpleMarketDataSubSubscription, SimpleMarketDataSubSubscriptionVariables>(SimpleMarketDataSubDocument, options);
}
export type SimpleMarketDataSubSubscriptionHookResult = ReturnType<typeof useSimpleMarketDataSubSubscription>;
export type SimpleMarketDataSubSubscriptionResult = Apollo.SubscriptionResult<SimpleMarketDataSubSubscription>;
@@ -1,9 +1,9 @@
import { t } from '@vegaprotocol/react-helpers';
import { themelite as theme } from '@vegaprotocol/tailwindcss-config';
import { MarketState } from '@vegaprotocol/types';
import { IS_MARKET_TRADABLE } from '../../constants';
import type { SimpleMarkets_markets } from './__generated__/SimpleMarkets';
import colors from 'tailwindcss/colors';
import type { Market } from '@vegaprotocol/market-list';
import { IS_MARKET_TRADABLE } from '../../constants';
export const STATES_FILTER = [
{ value: 'all', text: t('All') },
@@ -192,8 +192,17 @@ export const agGridDarkVariables = `
`;
export const ROW_CLASS_RULES = {
'cursor-pointer': ({ data }: { data: SimpleMarkets_markets }) =>
'cursor-pointer': ({ data }: { data: Market }) =>
IS_MARKET_TRADABLE(data || {}),
};
export const LARGE_SCREENS = ['xl', 'xxl'];
export const ALL_PRODUCTS_ITEM = {
name: t('All Markets'),
id: 'allmarkets',
cssClass: 'text-pink',
color: theme.colors.pink,
};
export const AG_GRID_CONTAINER_STYLES = { width: '100%', height: '100%' };
@@ -1,92 +0,0 @@
import produce from 'immer';
import { gql } from '@apollo/client';
import { makeDataProvider } from '@vegaprotocol/react-helpers';
import type {
SimpleMarkets,
SimpleMarkets_markets,
} from './__generated__/SimpleMarkets';
import type {
SimpleMarketDataSub,
SimpleMarketDataSub_marketData,
} from './__generated__/SimpleMarketDataSub';
export const MARKETS_QUERY = gql`
query SimpleMarkets($CandleSince: String!) {
markets {
id
state
tradableInstrument {
instrument {
code
name
metadata {
tags
}
product {
__typename
... on Future {
quoteName
settlementAsset {
symbol
}
}
}
}
}
candles(interval: INTERVAL_I1H, since: $CandleSince) {
open
close
}
}
}
`;
const MARKET_DATA_SUB = gql`
subscription SimpleMarketDataSub($marketIds: [ID!]!) {
marketsData(marketIds: $marketIds) {
marketState
marketId
}
}
`;
export const CANDLE_SUB = gql`
subscription CandleLive($marketId: ID!) {
candles(marketId: $marketId, interval: INTERVAL_I1H) {
close
}
}
`;
const update = (
data: SimpleMarkets_markets[],
delta: SimpleMarketDataSub_marketData
) => {
return produce(data, (draft) => {
const index = draft.findIndex((m) => m.id === delta.market.id);
if (index !== -1) {
draft[index].state = delta.market.state;
}
// @TODO - else push new market to draft
});
};
const getData = (responseData: SimpleMarkets) => responseData.markets;
const getDelta = (
subscriptionData: SimpleMarketDataSub
): SimpleMarketDataSub_marketData => subscriptionData.marketData;
export const dataProvider = makeDataProvider<
SimpleMarkets,
SimpleMarkets_markets[],
SimpleMarketDataSub,
SimpleMarketDataSub_marketData
>({
query: MARKETS_QUERY,
subscriptionQuery: MARKET_DATA_SUB,
update,
getData,
getDelta,
});
export default dataProvider;
@@ -1,34 +0,0 @@
import React from 'react';
import { format, isValid, parseISO } from 'date-fns';
import { EXPIRE_DATE_FORMAT } from '../../constants';
const SimpleMarketExpires = ({
tags,
}: {
tags: ReadonlyArray<string> | null;
}) => {
if (tags) {
const dateFound = tags.reduce<Date | null>((agg, tag) => {
const parsed = parseISO(
(tag.match(/^settlement.*:/) &&
tag
.split(':')
.filter((item, i) => i)
.join(':')) as string
);
if (isValid(parsed)) {
agg = parsed;
}
return agg;
}, null);
return dateFound ? (
<div className="p-2 text-ui-small border border-pink text-pink inline-block">{`${format(
dateFound as Date,
EXPIRE_DATE_FORMAT
)}`}</div>
) : null;
}
return null;
};
export default SimpleMarketExpires;
@@ -4,21 +4,14 @@ import {
render,
screen,
waitFor,
cleanup,
getAllByRole,
fireEvent,
} from '@testing-library/react';
import { MockedProvider } from '@apollo/client/testing';
import type { MockedResponse } from '@apollo/client/testing';
import { BrowserRouter } from 'react-router-dom';
import { MarketState } from '@vegaprotocol/types';
import type { Market } from '@vegaprotocol/market-list';
import SimpleMarketList from './simple-market-list';
import { MARKETS_QUERY } from './data-provider';
import type {
SimpleMarkets_markets,
SimpleMarkets,
} from './__generated__/SimpleMarkets';
import type { SimpleMarketDataSub_marketData } from './__generated__/SimpleMarketDataSub';
const mockedNavigate = jest.fn();
@@ -28,20 +21,11 @@ jest.mock('react-router-dom', () => ({
useParams: () => ({}),
}));
jest.mock('date-fns', () => ({
subDays: () => new Date('2022-06-02T11:11:21.721Z'),
}));
jest.mock('./simple-market-percent-change', () => jest.fn());
let updateMock: ({
delta,
}: {
delta: SimpleMarketDataSub_marketData;
}) => boolean;
let mockData = [
let marketsMock = [
{
id: '1',
name: 'Market 1',
id: 'MARKET_A',
state: MarketState.STATE_ACTIVE,
tradableInstrument: {
instrument: {
@@ -57,8 +41,7 @@ let mockData = [
},
},
{
id: '2',
name: 'Market 2',
id: 'MARKET_B',
state: MarketState.STATE_ACTIVE,
tradableInstrument: {
instrument: {
@@ -73,20 +56,22 @@ let mockData = [
},
},
},
] as unknown as SimpleMarkets_markets[];
] as unknown as Market[];
const mockUseDataProvider = ({ update }: { update: () => boolean }) => {
updateMock = update;
return { data: mockData, loading: false, error: false };
const LIB = '@vegaprotocol/react-helpers';
const useDataProvider = () => {
return {
data: marketsMock,
loading: false,
error: false,
};
};
jest.mock('@vegaprotocol/react-helpers', () => ({
...jest.requireActual('@vegaprotocol/react-helpers'),
useDataProvider: jest.fn((args) => mockUseDataProvider(args)),
jest.mock(LIB, () => ({
...jest.requireActual(LIB),
useDataProvider: jest.fn(() => useDataProvider()),
}));
const mockIsTradable = jest.fn((_arg) => true);
jest.mock('../../constants', () => ({
...jest.requireActual('../../constants'),
IS_MARKET_TRADABLE: jest.fn((arg) => mockIsTradable(arg)),
@@ -95,25 +80,12 @@ jest.mock('../../constants', () => ({
describe('SimpleMarketList', () => {
afterEach(() => {
jest.clearAllMocks();
cleanup();
});
const mocks: MockedResponse<SimpleMarkets> = {
request: {
query: MARKETS_QUERY,
variables: {
CandleSince: '2022-06-02T11:11:21.721Z',
},
},
result: {
data: { markets: mockData },
},
};
it('should be properly rendered with some data', async () => {
await act(async () => {
render(
<MockedProvider mocks={[mocks]}>
<MockedProvider mocks={[]}>
<SimpleMarketList />
</MockedProvider>,
{ wrapper: BrowserRouter }
@@ -124,95 +96,49 @@ describe('SimpleMarketList', () => {
expect(
document.querySelector('.ag-center-cols-container')
).toBeInTheDocument();
});
await waitFor(() => {
const container = document.querySelector('.ag-center-cols-container');
expect(getAllByRole(container as HTMLDivElement, 'row')).toHaveLength(2);
});
});
it('update should return proper boolean value', async () => {
await act(async () => {
render(
<MockedProvider mocks={[mocks]}>
<SimpleMarketList />
</MockedProvider>,
{ wrapper: BrowserRouter }
);
await new Promise((resolve) => setTimeout(resolve, 0));
});
await waitFor(() => {
expect(
document.querySelector('.ag-center-cols-container')
).toBeInTheDocument();
});
await expect(
updateMock({
delta: {
__typename: 'MarketData',
market: {
__typename: 'Market',
id: '2',
state: MarketState.STATE_ACTIVE,
},
},
})
).toEqual(true);
await expect(
updateMock({
delta: {
__typename: 'MarketData',
market: {
__typename: 'Market',
id: '2',
state: MarketState.STATE_SUSPENDED,
},
},
})
).toEqual(false);
});
it('click on row should be properly handled', async () => {
await act(async () => {
render(
<MockedProvider mocks={[mocks]}>
<MockedProvider mocks={[]}>
<SimpleMarketList />
</MockedProvider>,
{ wrapper: BrowserRouter }
);
await new Promise((resolve) => setTimeout(resolve, 0));
});
await waitFor(() => {
expect(
document.querySelector('.ag-center-cols-container')
).toBeInTheDocument();
});
mockIsTradable.mockClear();
const container = document.querySelector('.ag-center-cols-container');
const firstRow = getAllByRole(container as HTMLDivElement, 'row')[0];
expect(firstRow).toHaveAttribute('row-id', '1');
fireEvent.click(firstRow);
expect(firstRow).toHaveAttribute('row-id', marketsMock[0].id);
await act(async () => {
fireEvent.click(firstRow);
});
await waitFor(() => {
expect(mockIsTradable).toHaveBeenCalledWith({
...mockData[0],
percentChange: '-',
});
expect(mockedNavigate).toHaveBeenCalledWith(`/trading/${mockData[0].id}`);
expect(mockIsTradable).toHaveBeenCalledWith(
expect.objectContaining({
id: marketsMock[0].id,
state: MarketState.STATE_ACTIVE,
})
);
expect(mockedNavigate).toHaveBeenCalledWith(
`/trading/${marketsMock[0].id}`
);
});
});
it('should be properly renderer as empty', async () => {
mockData = [];
marketsMock = [];
await act(async () => {
render(
<MockedProvider mocks={[mocks]}>
<MockedProvider mocks={[]}>
<SimpleMarketList />
</MockedProvider>,
{ wrapper: BrowserRouter }
);
await new Promise((resolve) => setTimeout(resolve, 0));
});
await waitFor(() => {
expect(screen.getByText('No data to display')).toBeInTheDocument();
@@ -1,40 +1,23 @@
import React, {
useCallback,
useContext,
useEffect,
useMemo,
useRef,
} from 'react';
import { useCallback, useEffect, useRef, useMemo } from 'react';
import { useNavigate, useParams } from 'react-router-dom';
import { subDays } from 'date-fns';
import type { AgGridReact } from 'ag-grid-react';
import { AgGridDynamic as AgGrid } from '@vegaprotocol/ui-toolkit';
import {
useDataProvider,
useScreenDimensions,
useDataProvider,
useYesterday,
} from '@vegaprotocol/react-helpers';
import { t } from '@vegaprotocol/react-helpers';
import { AsyncRenderer } from '@vegaprotocol/ui-toolkit';
import { ThemeContext } from '@vegaprotocol/react-helpers';
import type { MarketState } from '@vegaprotocol/types';
import useMarketsFilterData from '../../hooks/use-markets-filter-data';
import useColumnDefinitions from '../../hooks/use-column-definitions';
import dataProvider from './data-provider';
import * as constants from './constants';
import useMarketsFilterData from './use-markets-filter-data';
import useColumnDefinitions from './use-column-definitions';
import SimpleMarketToolbar from './simple-market-toolbar';
import type { SimpleMarkets_markets } from './__generated__/SimpleMarkets';
import type { SimpleMarketDataSub_marketData } from './__generated__/SimpleMarketDataSub';
import { IS_MARKET_TRADABLE } from '../../constants';
import type {
CellKeyDownEvent,
FullWidthCellKeyDownEvent,
} from 'ag-grid-community/dist/lib/events';
import type {
GetRowIdParams,
TabToNextCellParams,
} from 'ag-grid-community/dist/lib/entities/iCallbackParams';
import { ConsoleLiteGrid } from '../console-lite-grid';
import type { Market } from '@vegaprotocol/market-list';
import { Interval } from '@vegaprotocol/types';
import { marketsWithCandlesProvider } from '@vegaprotocol/market-list';
export type SimpleMarketsType = SimpleMarkets_markets & {
export type MarketWithPercentChange = Market & {
percentChange?: number | '-';
};
@@ -45,33 +28,25 @@ export type RouterParams = Partial<{
}>;
const SimpleMarketList = () => {
const { isMobile, screenSize } = useScreenDimensions();
const { isMobile } = useScreenDimensions();
const navigate = useNavigate();
const params = useParams<RouterParams>();
const theme = useContext(ThemeContext);
const statusesRef = useRef<Record<string, MarketState | ''>>({});
const gridRef = useRef<AgGridReact | null>(null);
const variables = useMemo(
() => ({
CandleSince: subDays(Date.now(), 1).toJSON(),
}),
[]
);
const update = useCallback(
({ delta }: { delta: SimpleMarketDataSub_marketData }) =>
statusesRef.current[delta.market.id] === delta.market.state,
[statusesRef]
);
const yesterday = useYesterday();
const variables = useMemo(() => {
return {
since: new Date(yesterday).toISOString(),
interval: Interval.INTERVAL_I1H,
};
}, [yesterday]);
const { data, error, loading } = useDataProvider({
dataProvider,
update,
dataProvider: marketsWithCandlesProvider,
variables,
noUpdate: true,
});
const localData: Array<SimpleMarketsType> = useMarketsFilterData(
data || [],
params
);
const localData = useMarketsFilterData(data, params);
const handleOnGridReady = useCallback(() => {
gridRef.current?.api?.sizeColumnsToFit();
@@ -92,10 +67,8 @@ const SimpleMarketList = () => {
const { columnDefs, defaultColDef } = useColumnDefinitions({ isMobile });
const getRowId = useCallback(({ data }: GetRowIdParams) => data.id, []);
const handleRowClicked = useCallback(
({ data }: { data: SimpleMarketsType }) => {
({ data }: { data: Market }) => {
if (IS_MARKET_TRADABLE(data)) {
navigate(`/trading/${data.id}`);
}
@@ -103,64 +76,17 @@ const SimpleMarketList = () => {
[navigate]
);
const onTabToNextCell = useCallback((params: TabToNextCellParams) => {
const {
api,
previousCellPosition: { rowIndex },
} = params;
const rowCount = api.getDisplayedRowCount();
if (rowCount <= rowIndex + 1) {
return null;
}
return { ...params.previousCellPosition, rowIndex: rowIndex + 1 };
}, []);
const onCellKeyDown = useCallback(
(
params: (CellKeyDownEvent | FullWidthCellKeyDownEvent) & {
event: KeyboardEvent;
}
) => {
const { event: { key = '' } = {}, data } = params;
if (key === 'Enter') {
handleRowClicked({ data });
}
},
[handleRowClicked]
);
const shouldSuppressHorizontalScroll = useMemo(() => {
return !isMobile && constants.LARGE_SCREENS.includes(screenSize);
}, [isMobile, screenSize]);
return (
<div className="h-full p-4 md:p-6 grid grid-rows-[min-content,1fr]">
<SimpleMarketToolbar data={data || []} />
<AsyncRenderer loading={loading} error={error} data={localData}>
<AgGrid
className="mb-32 min-h-[300px]"
defaultColDef={defaultColDef}
<ConsoleLiteGrid<MarketWithPercentChange>
classNamesParam="mb-32 min-h-[300px]"
columnDefs={columnDefs}
rowData={localData}
rowHeight={60}
customThemeParams={
theme === 'dark'
? constants.agGridDarkVariables
: constants.agGridLightVariables
}
onGridReady={handleOnGridReady}
onRowClicked={handleRowClicked}
rowClass={isMobile ? 'mobile' : ''}
rowClassRules={constants.ROW_CLASS_RULES}
ref={gridRef}
overlayNoRowsTemplate={t('No data to display')}
suppressContextMenu
getRowId={getRowId}
suppressMovableColumns
suppressRowTransform
onCellKeyDown={onCellKeyDown}
tabToNextCell={onTabToNextCell}
suppressHorizontalScroll={shouldSuppressHorizontalScroll}
defaultColDef={defaultColDef}
handleRowClicked={handleRowClicked}
getRowId={({ data }) => data.id}
/>
</AsyncRenderer>
</div>
@@ -2,10 +2,10 @@ import React from 'react';
import { render, screen } from '@testing-library/react';
import { MockedProvider } from '@apollo/react-testing';
import SimpleMarketPercentChange from './simple-market-percent-change';
import type { SimpleMarkets_markets_candles } from './__generated__/SimpleMarkets';
import type { Candle } from '@vegaprotocol/market-list';
describe('SimpleMarketPercentChange should parse proper change', () => {
let candles: (SimpleMarkets_markets_candles | null)[] | null;
let candles: (Candle | null)[] | null;
const setValue = () => undefined;
it('empty array', () => {
candles = [];
@@ -34,11 +34,7 @@ describe('SimpleMarketPercentChange should parse proper change', () => {
expect(screen.getByText('-')).toBeInTheDocument();
});
it('an appreciated one', () => {
candles = [
{ open: '50' } as SimpleMarkets_markets_candles,
{ close: '100' } as SimpleMarkets_markets_candles,
null,
];
candles = [{ open: '50' } as Candle, { close: '100' } as Candle, null];
render(
<MockedProvider>
<SimpleMarketPercentChange
@@ -54,11 +50,7 @@ describe('SimpleMarketPercentChange should parse proper change', () => {
);
});
it('a depreciated one', () => {
candles = [
{ open: '100' } as SimpleMarkets_markets_candles,
{ close: '50' } as SimpleMarkets_markets_candles,
null,
];
candles = [{ open: '100' } as Candle, { close: '50' } as Candle, null];
render(
<MockedProvider>
<SimpleMarketPercentChange
@@ -1,26 +1,20 @@
import React, { useEffect, useState } from 'react';
import { useEffect, useState } from 'react';
import classNames from 'classnames';
import { InView } from 'react-intersection-observer';
import { useSubscription } from '@apollo/client';
import type { SimpleMarkets_markets_candles } from './__generated__/SimpleMarkets';
import type {
CandleLive,
CandleLiveVariables,
} from './__generated__/CandleLive';
import { CANDLE_SUB } from './data-provider';
import { useDataProvider, useYesterday } from '@vegaprotocol/react-helpers';
import type { Candle } from '@vegaprotocol/market-list';
import { marketCandlesProvider } from '@vegaprotocol/market-list';
import { Interval } from '@vegaprotocol/types';
interface Props {
candles: (SimpleMarkets_markets_candles | null)[] | null;
candles: (Candle | null)[] | null;
marketId: string;
setValue: (arg: unknown) => void;
}
const EMPTY_VALUE = ' - ';
const getChange = (
candles: (SimpleMarkets_markets_candles | null)[] | null,
lastClose?: string
) => {
const getChange = (candles: (Candle | null)[] | null, lastClose?: string) => {
if (candles) {
const first = parseInt(candles.find((item) => item?.open)?.open || '-1');
const last =
@@ -74,11 +68,19 @@ const SimpleMarketPercentChangeWrapper = (props: Props) => {
};
const SimpleMarketPercentChange = ({ candles, marketId, setValue }: Props) => {
const { data: { candles: { close = undefined } = {} } = {} } =
useSubscription<CandleLive, CandleLiveVariables>(CANDLE_SUB, {
variables: { marketId },
});
const change = getChange(candles, close);
const yesterday = useYesterday();
const { data } = useDataProvider({
dataProvider: marketCandlesProvider,
variables: {
marketId,
interval: Interval.INTERVAL_I1D,
since: new Date(yesterday).toISOString(),
},
});
const close = data?.map((m) => m.close);
const change = getChange(candles, close?.[0]);
const colorClasses = getClassColor(change);
useEffect(() => {
const value = parseFloat(change);
@@ -1,36 +1,36 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import type { MarketNames_markets } from '@vegaprotocol/deal-ticket';
import { MarketState } from '@vegaprotocol/types';
import MarketNameRenderer from './simple-market-renderer';
import type { Market } from '@vegaprotocol/market-list';
describe('SimpleMarketRenderer', () => {
const market = {
id: 'marketId',
id: 'MARKET_A',
state: MarketState.STATE_ACTIVE,
tradableInstrument: {
instrument: {
code: 'Market code',
name: 'Market Name',
code: 'MARKET_A_CODE',
name: 'MARKET_A_NAME',
product: {
quoteName: 'Quote name',
quoteName: 'MARKET_A_QUOTE_NAME',
},
metadata: {
tags: null,
},
},
},
} as MarketNames_markets;
} as Market;
it('should properly render not mobile', () => {
render(<MarketNameRenderer market={market} isMobile={false} />);
expect(screen.getByText('Market Name')).toBeInTheDocument();
expect(screen.getByText('Quote name')).toBeInTheDocument();
expect(screen.getByText('MARKET_A_NAME')).toBeInTheDocument();
expect(screen.getByText('MARKET_A_QUOTE_NAME')).toBeInTheDocument();
});
it('should properly render mobile', () => {
render(<MarketNameRenderer market={market} isMobile={true} />);
expect(screen.getByText('Market code')).toBeInTheDocument();
expect(screen.getByText('Quote name')).toBeInTheDocument();
expect(screen.getByText('MARKET_A_CODE')).toBeInTheDocument();
expect(screen.getByText('MARKET_A_QUOTE_NAME')).toBeInTheDocument();
});
});
@@ -1,10 +1,9 @@
import React from 'react';
import classNames from 'classnames';
import type { MarketNames_markets } from '@vegaprotocol/deal-ticket';
import SimpleMarketExpires from './simple-market-expires';
import type { Market } from '@vegaprotocol/market-list';
import { MarketExpires } from '@vegaprotocol/market-info';
interface Props {
market: MarketNames_markets;
market: Market;
isMobile?: boolean;
}
@@ -20,7 +19,7 @@ const MarketNameRenderer = ({ market, isMobile }: Props) => {
{isMobile
? market.tradableInstrument.instrument.code
: market.tradableInstrument.instrument.name}{' '}
<SimpleMarketExpires
<MarketExpires
tags={market.tradableInstrument.instrument.metadata.tags}
/>
</div>
@@ -15,8 +15,8 @@ import {
} from '@testing-library/react';
import { MockedProvider } from '@apollo/react-testing';
import { MarketState } from '@vegaprotocol/types';
import type { Market } from '@vegaprotocol/market-list';
import SimpleMarketToolbar from './simple-market-toolbar';
import type { SimpleMarkets_markets } from './__generated__/SimpleMarkets';
import { markets as filterData } from './mocks/market-filters.json';
const mockedNavigate = jest.fn();
@@ -35,35 +35,23 @@ describe('SimpleMarketToolbar', () => {
const routes = useRoutes([
{
path: '/',
element: (
<SimpleMarketToolbar data={filterData as SimpleMarkets_markets[]} />
),
element: <SimpleMarketToolbar data={filterData as Market[]} />,
},
{
path: 'markets',
children: [
{
path: `:state`,
element: (
<SimpleMarketToolbar
data={filterData as SimpleMarkets_markets[]}
/>
),
element: <SimpleMarketToolbar data={filterData as Market[]} />,
children: [
{
path: `:product`,
element: (
<SimpleMarketToolbar
data={filterData as SimpleMarkets_markets[]}
/>
),
element: <SimpleMarketToolbar data={filterData as Market[]} />,
children: [
{
path: `:asset`,
element: (
<SimpleMarketToolbar
data={filterData as SimpleMarkets_markets[]}
/>
<SimpleMarketToolbar data={filterData as Market[]} />
),
},
],
@@ -71,9 +59,7 @@ describe('SimpleMarketToolbar', () => {
],
},
],
element: (
<SimpleMarketToolbar data={filterData as SimpleMarkets_markets[]} />
),
element: <SimpleMarketToolbar data={filterData as Market[]} />,
},
]);
const location = useLocation();
@@ -166,7 +152,7 @@ describe('SimpleMarketToolbar', () => {
}));
render(
<MockedProvider mocks={[]} addTypename={false}>
<SimpleMarketToolbar data={filterData as SimpleMarkets_markets[]} />
<SimpleMarketToolbar data={filterData as Market[]} />
</MockedProvider>,
{ wrapper: BrowserRouter }
);
@@ -187,7 +173,7 @@ describe('SimpleMarketToolbar', () => {
(useParams as jest.Mock).mockImplementation(() => ({}));
render(
<MockedProvider mocks={[]} addTypename={false}>
<SimpleMarketToolbar data={filterData as SimpleMarkets_markets[]} />
<SimpleMarketToolbar data={filterData as Market[]} />
</MockedProvider>,
{ wrapper: BrowserRouter }
);
@@ -211,7 +197,7 @@ describe('SimpleMarketToolbar', () => {
}));
render(
<MockedProvider mocks={[]} addTypename={false}>
<SimpleMarketToolbar data={filterData as SimpleMarkets_markets[]} />
<SimpleMarketToolbar data={filterData as Market[]} />
</MockedProvider>,
{ wrapper: BrowserRouter }
);

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