Commit Graph

142 Commits

Author SHA1 Message Date
botond
69b19e4b7b
feat(#507): Node Discovery
* feat: add network-switcher lib

* feat: add env variables for some deployed app urls

* feat: add network processing to environment hoook

* refactor: network handling

* refactor: remove dialog from provider and add env setter

* feat: add network switcher dialog to the trading app

* refactor: add network redirect to dialog connect callback

* fix: lint

* feat: add network configuration files to static app

* feat: update environments to use config file instead of static node url

* refactor: split out network switcher utils

* refactor: split up environment hook

* fix: jsonify env variable for possible networks

* fix: add formatter file

* feat: add network loader component

* feat: add network loader to the trading app

* fix: assign correct global state to network swicther

* feat: add status modal

* feat: add network-switcher lib

* feat: add env variables for some deployed app urls

* feat: add network processing to environment hoook

* refactor: network handling

* refactor: remove dialog from provider and add env setter

* feat: add network switcher dialog to the trading app

* refactor: add network redirect to dialog connect callback

* fix: lint

* fix: jsonify env variable for possible networks

* fix: add formatter file

* fix: assign correct global state to network swicther

* fix: failing tests from UI changes

* feat: add environment validation

* feat: add runtime validation for network configs

* fix: readd node urls to envs to avoid breaking the apps for now

* chore: rename network swicther lib to environmnet

* fix: lint

* feat: add tests for config hook

* feat: add environment hook tests

* fix: lint

* fix: lint

* feat: add environment hook tests

* feat: add storage tests

* fix: formet

* feat: improve loading states

* fix: format

* fix: use router instead of window location

* fix: rearrange network loader props and components

* fix: remove FC type

* fix: env validation

* fix: untangle returns in network loader

* fix: add teardown for env and localstorage

* fix: add custom to env networks

* fix: lint

* fix: format

* fix: lint

* fix: remove env provider from simple trading app

* fix: remove failing promise hacks

* fix: some leftover format files

* fix: remove network switcher from tsconf

* fix: move Networks to libs/environment

* fix: add defaults for ether env vars

* feat: add tests for default ether env vars

* fix: remove chain id env var from web3 container

* fix: remove chain id from the environment

* fix: format

* fix: lint token

* fix: lint env

* fix: add comment to callout hack

* fix: lint token again

* fix: remove skip

* fix: move addresses to token app

* fix: improve schema validation errors and fix token app

* fix: lint

* fix: format

* fix: format

* fix: add network loaders to apps

* fix: format

* fix: remove logs

* fix: cypress process errors

* fix: change network loader hierarchy in token

* fix: remove stray console.log

* fix: revert test changes in simple trading app

* fix: prefix env vars with NX

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

* fix: improve schema validation errors and fix token app

* fix: format

* fix: disable lint rules for catch block any types

* fix: format again

* fix: remove redundant process.platform injections

* fix: format

Co-authored-by: Joe <joe@vega.xyz>
Co-authored-by: Matthew Russell <mattrussell36@gmail.com>
Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com>
2022-06-21 16:20:53 -07:00
Matthew Russell
835f86d024
Fix/Trading grid layout fixes (#583)
* fix: move MarketList wait back

* fix: dont wait for MarketList query

* fix: move assertion to actual test body so other tests can run

* fix: ensure page rendered before checking url after redirect

* fix: grid layout

* fix: withdrawals test by giving explicit dates to mocked withdrawals so they are ordered correctly
2022-06-20 16:52:25 -07:00
Sam Keen
374faa0b74
fix(#586): theme switcher not working for all panels 2022-06-17 10:26:45 -07:00
m.ray
675716089a
feat: #155 trading full market details (#549)
* feat: [#155] move grid tab to ui-toolkit and add info component in the tabbed ticket

* feat: [#155] add accordion component + storybook

* feat: [#155] styling updates, unit tests and export ui-toolkit

* feat: [#155] generate deal ticket query and info-market.tsx updates

* feat: [#155] move grid tab to ui-toolkit and add info component in the tabbed ticket

* feat: [#155] add accordion component + storybook

* feat: [#155] styling updates, unit tests and export ui-toolkit

* feat: [#155] generate deal ticket query and info-market.tsx updates

* fix: [#155] styling updates to mimic figma

* fix: [#155] fix trading-e2e generate deal ticket query

* feat: [#155] remove open field, add omits configurable

* fix: [#155] row component in info market

* feat: market info/accordion styling tweaks

* fix: [#155] add risk models and fix readme

* fix: [#155] update  generate deal ticket query to fix test

* fix: [#155] fix cypress test data

Co-authored-by: PeteWilliams <me@petewilliams.info>
2022-06-17 15:56:42 +01:00
Dexter Edwards
bcaab22891
Feat/dockerize frontends (#388)
* feat: unhardcode contract addresses

* fix: linting and tests

* feat: switch contract usage in token app to use unhardcoded addresses

* chore: remove other usage of hard coded contract addresses

* feat: convert contracts to classes, update claim contract to fix circular dependency

* feat: add hard coded contract addresses to contracts page

* fix: misc tidy up

* chore: rename ethers big num conversion func

* fix: remove pending transactions modal

* chore: add single toBigNum function that can accept number string or EthersBignNumber

* chore: delete unused tranche helpers and decimals functions from smart contracts lib

* feat: add faucetable token class

* fix: reset tx state after early exit from approve tx

* feat: re add transaction modal using zustand store

* fix: loader colors for eth wallet

* fix: pass ethereum config to gurantee existence before tx execution

* add docker image for building explorer

* add arg

* env file changes

* add docker file to build env file

* add requirement for env file in explorer

* fix env file syntax

* containers functional

* default to testnet

* make env flag logic consistent in all places

* pre populate env file

* ensure working for all projects

* address PR comment

* generalising env for token

* invert config dependency from ui toolkit

* fix: merge issues

* docs: running containers documentation

* style: lint

* fix: env varibales not being added properly

* chore: fix merge issues

* chore: fix docker file to support new exectutors

* chore: set address on all contracts as a property

* feat: pull token from contract rather than relying on env var

* chore: fix typing

* chore: remove duplicated prop

* chore: don't use chainId

* style: lint

* style: lint

* Merge branch 'master' into feat/dockerize-frontends

* Merge remote-tracking branch 'origin/master' into feat/dockerize-frontends

* test: revert changes to explorer e2e file

* fix: creating client without base causing token to error

* test: fix tests erroring in before hook due to file not being found

* chore: remove node env from configurable flags

Co-authored-by: Matthew Russell <mattrussell36@gmail.com>
2022-06-13 15:39:17 +01:00
Matthew Russell
ff8990c257
Fix/411 asset dropdown style (#535)
* fix: arrow missing from select box

* fix: select box styles on firefox
2022-06-10 16:12:51 -07:00
Matthew Russell
9941c9bfaa
Fix/trading app tests (#539)
* fix: deposits tests, also convert to basic cypress

* add new home tests which test redirect to trading page and markets page

* chore: replace portfolio page feature with raw cypress

* chore: replace market page feature with raw cypress tests

* chore: replace home page tests with global.ts for wallet connections

* chore: add raw cypress withdrawals tests with mocks

* fix: complete withdrawals prompt and add assertion for it

* chore: remove unnecessary cypress envs now that we are mocking assets

* chore: ignore lint errors temporarily

* chore: add mock for deposit page query, add wait for mocked queries to resolve

* fix: order of waiting for withdraw page query

* fix: validate vega wallet connection

* chore: remove rest of page objects and convert trading page feature to regular cypress

* fix: assertion on transaction dialog after withdrawal

* chore: split withdraw and withdrawals pages into separate files

* chore: split trading tests into own files, connect wallet once for deal ticket

* feat: convert home page tests to raw cypress
2022-06-10 12:00:02 -07:00
Dexter Edwards
9266ff4bd8
Feat/smart contracts update (#536)
* feat: add new bridge contract logic

* chore: remove unused contract from provider

* chore: remove minimum as no longer exists

* feat: use new withdrawals contract, but allow for old contract for token

* feat: power contracts selection by a flag

* style: lint

* Update libs/smart-contracts/src/contracts/collateral-bridge-new.ts

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

* chore: rename env var as per feedback

* chore: consistent varaible names as per PR comments

* chore: add back in checks for minimum as per PR comments

* style: formatting

Co-authored-by: Matthew Russell <mattrussell36@gmail.com>
2022-06-10 11:36:38 +01:00
botond
ecda46caa5
Feat/6 Network Switcher (#502)
* feat: add network-switcher lib

* feat: add env variables for some deployed app urls

* feat: add network processing to environment hoook

* refactor: network handling

* refactor: remove dialog from provider and add env setter

* feat: add network switcher dialog to the trading app

* refactor: add network redirect to dialog connect callback

* fix: lint

* fix: jsonify env variable for possible networks

* fix: add formatter file

* fix: assign correct global state to network swicther

* feat: add network-switcher lib

* feat: add env variables for some deployed app urls

* feat: add network processing to environment hoook

* refactor: network handling

* refactor: remove dialog from provider and add env setter

* feat: add network switcher dialog to the trading app

* refactor: add network redirect to dialog connect callback

* fix: lint

* fix: jsonify env variable for possible networks

* fix: add formatter file

* fix: assign correct global state to network swicther

* fix: failing tests from UI changes

* fix: lint

* fix: lint

Co-authored-by: Joe <joe@vega.xyz>
Co-authored-by: Dexter <dexter.edwards93@gmail.com>
2022-06-10 10:15:38 +01:00
Matthew Russell
be3b416176
Fix/Default market and tabs navigation (#518)
* fix: dont use localstorage for navigation, remove query params for tabs

* chore: lint

* fix: revert to using url rather than data test id

* chore: lint

* chore: remove arrow down ref from markets page object
2022-06-08 09:47:31 +01:00
Matthew Russell
6b14221de3 fix: make scroll bars auto in trade header 2022-06-07 16:06:40 -07:00
Matthew Russell
e463bbe238
feat(#495): get smart contracts addresses from network params
* feat: unhardcode contract addresses

* fix: linting and tests

* feat: switch contract usage in token app to use unhardcoded addresses

* chore: remove other usage of hard coded contract addresses

* feat: convert contracts to classes, update claim contract to fix circular dependency

* feat: add hard coded contract addresses to contracts page

* fix: misc tidy up

* chore: rename ethers big num conversion func

* fix: remove pending transactions modal

* chore: add single toBigNum function that can accept number string or EthersBignNumber

* chore: delete unused tranche helpers and decimals functions from smart contracts lib

* feat: add faucetable token class

* fix: reset tx state after early exit from approve tx

* feat: re add transaction modal using zustand store

* fix: loader colors for eth wallet

* fix: pass ethereum config to gurantee existence before tx execution

* chore: lint smart contracts lib

* chore: fix web3container to use children and not render prop

* chore: lint

* fix: use background to mock ethereum wallet to avoid mocking globally for every test

* chore: move web3 mock to common steps and call from withdrawals feature tests
2022-06-07 15:08:40 -07:00
botond
d4420d6038
Feat/248: portfolio layout (#476)
* feat: add base portfolio layout

* feat: add positions, order list and withdrawals to portfolio page

* feat: add account container to portfolio page plus wallet management improvments

* fix: remove duplication from portfolio page containers

* fix: format and lint

* fix: remove buggy wallet dialog from portfolio page

* fix: deposit e2e test navigation

* fix: temporarily go straight to withdrawal pages

* fix: formatting

* fix: add formatting

Co-authored-by: Joe <joe@vega.xyz>
2022-06-07 10:26:45 +01:00
m.ray
a65c52d7d4
feat: trading page market summary & select markets modal opening from market title & fix: positions table realised PnL (#505)
* feat: [#456] select markets modal opening from market title

* feat: add a global zustand store for managing connect dialogs and landing dialog

* feat: add tests

* feat: [#456] make arrow configurable

* feat: [#456] make arrow configurable

* feat: [#456] trading tab active only on portfolio

* chore: update tranches

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix: [#445] shallow routing from index (#484)

* fix: [#445] shallow routing from index

* fix: [#445] use link to redirect to market - an attempt to fix reload

* fix: [#445] remove stretched link from last link - it makes all the other links unusable

* fix: [#445] fix lint on select market list - remove stretched link

* fix: [#456] put everything in landing folder to avoid conflicts

* fix: remove condition for cypress for auto connecting

* feat: [#456] add global store and fix href routing

* feat: [#456] add global store and fix href routing

* feat: [#456] add one more test

* feat: [#154] pull market data summary

* feat: [#154] move header above the trade grid child sections

* feat: [#154] flex oerflow and styling updates for market summary

* feat: [#154] fix styling

* fix: [154] fix cyp tests and styling

* fix: [#154] fix markets navigation cypress step

* fix: [#154] fix for navigate to markets link

* fix: failing tests from market change

* fix: [#154] set nav items based on market id and show last viewed market on landing

* fix: [#412] invalid decimal place on realised PnL field

* fix: [#154] remove redundant curly braces

* fix: [#154] show hyphen on volume if market data is undefined

Co-authored-by: Matthew Russell <mattrussell36@gmail.com>
Co-authored-by: dexturr <dexturr@users.noreply.github.com>
Co-authored-by: Joe <joe@vega.xyz>
2022-06-06 17:19:56 +01:00
Matthew Russell
25b67009a6
feat: add a global zustand store for managing dialogs (#494)
* feat: add a global zustand store for managing connect dialogs and landing dialog

* feat: add tests

* fix: remove condition for cypress for auto connecting

* chore: fix assertion in tests for vega wallet text

* fix: add mock for landing dialog markets query

Co-authored-by: madalinaraicu <madalina@vegaprotocol.io>
2022-06-01 15:21:36 +01:00
botond
3a27172e04
feat(#175): ui-toolkit links (#453)
* feat: add enviromnemt provider to the ui-toolkit

* chore: replace etherscan links

* chore: wrap trading app into environment provider

* chore: move env provider to react-helpers and wrap every app

* chore: remove more env variables from libs and replace them with the env hook

* fix: lint

* fix: update readme with correct formatting command

* fix: warnings for web3 hook

* fix: wrap warning in conditional, print message only when env keys are missing

* fix: incorrect condition on deposit manager fauceting param

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

* fix: cleanup token app ethereum config

* chore: add better error handling to the useEnvironment hook

* fix: lint

* fix: formatting

* fix: more lint

* fix: throw error if required env variables are missing

* fix: remove default eth chain id

* fix: add back etherscan testid to withdrawals links

* fix: imports

* fix: try using babel jest for smart contracts test transpilation

* fix: uniform ts syntax

* chore: set resolveJsonModule in base tsconfig

* fix: add missing data-ids for etherscan links

Co-authored-by: Matthew Russell <mattrussell36@gmail.com>
2022-05-31 17:30:02 -07:00
m.ray
97b4ffb399
fix: [#445] shallow routing from index (#484)
* fix: [#445] shallow routing from index

* fix: [#445] use link to redirect to market - an attempt to fix reload

* fix: [#445] remove stretched link from last link - it makes all the other links unusable

* fix: [#445] fix lint on select market list - remove stretched link
2022-05-30 17:57:14 +01:00
Joe Tsang
66c18a2b1b
Test/425 withdrawals (#457)
* chore: improve assertions for deposits

* test: validation test passing

* test: withdrawal tests passing

* fix: test failures in CI

* fix: lint

* chore: add env variables

* fix: failing tests due to wallet service not running

* ci: pass automatic cnsent

* ci: init wallet in other directory

* ci: pass home string everywhere

* ci: config is already imported

* fix: failing deposit and nightly run

* ci: port over changes from pr run

* fix: failing network param tests

* fix: assertion

* fix: assertion one last time

Co-authored-by: Dexter <dexter.edwards93@gmail.com>
2022-05-27 10:23:07 +01:00
m.ray
9ab6337e42
Feat/305 add console v2 first view screen (#424)
* [#305] add initial landing dialog on markets page and fix some typos

* [#305] market-list utils and generate schema

* [#305] initial styling of the landing dialog and add arrows

* [#305] routing to markets and add hover and market list tests

* [#305] fix z-index on dialog overlay

* [#305] default market shoulde be oldest market that is currently trading in continuous mode

* [#305] refactor market-list library

* [#305] add arrow unit tests

* Update libs/market-list/src/lib/components/landing/landing-dialog.tsx

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

* Update libs/market-list/src/lib/components/landing/select-market-list.tsx

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

* Update libs/market-list/src/lib/components/landing/select-market-list.tsx

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

* test: fix failing tests from homepage change

* [#305] sort by id after sorting by date

* test: increase timeout for failing tests in CI

* [#305] destructuring all over the place and some code tweaks, arrows and percentage changes

* [#305] update sparkline to show colour

* [#305] fix order of market list

* [#305] stretchedLink class plus a-tag href for navigation - accessibility updates

* [#305] use href only and remove log

* [#305] use bignumber.js for price calculations

* [#305] change to bg-white/50 on dark mode overlay as asked from UX

* [#305] change to bg-white/50 on dark mode overlay as asked from UX

* [#305] toLocaleString fix

* [#305] toLocaleString fix

* [#305] add price-change-cell and use formatNumber

* [#305] add extra test for select market list

* Update apps/trading/specs/index.spec.tsx

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

* [#305] use memo, sort by date and id lodash

Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com>
Co-authored-by: Joe <joe@vega.xyz>
2022-05-23 13:21:54 +01:00
botond
a6a21bed46
Feat/427: Serve explicit environments (#433)
* feat: add env specific serve commands where appropriate for apps

* fix: typo in command call

* feat: add custom executor for serving apps

* chore: clean up project files and use the custom executor

* chore: patch readmes

* chore: split out logs into their own function

* fix: prevent overriding env when no flag passed in

* fix: add tsc to postinstall to take care of compiling the custom executors

* fix: remove the custom serve executor from trading
2022-05-23 10:56:11 +01:00
botond
66c8d195a2
Fix/429: app zindex (#438)
* fix: app zindex

* fix: remove redundant z-index from toggle buttons
2022-05-23 10:54:57 +01:00
Sam Keen
34502a7c7f
frontend-monorepo-436 Env var files 'devent' typo (#437) 2022-05-23 09:51:19 +01:00
Matthew Russell
d8bf887245
chore(#315): Convert token to use wallet lib
* delete token version of vega wallet serivce

* update use-user-vote to use new wallet service

* remove typo

* add further types for transaction submissions, add assets to withdraw page query

* update api client package to get generated types, adjust render logic of withdrawals page

* fix withdrawals list rendering

* update determine id function to not use nodejs buffer

* update service api client so it accepts new tx types

* remove stray logs and formatting

* make filtering erc20 assets the responsibility of the withdraw/deposit lib and not the app

* remove sha3 dep and use js-sha3 and ethers to determine ids

* use hook for fetching withdrawals form lib, add type policy to ensure withdrawal state is updated correctly

* fix: markets page feature
2022-05-17 09:04:41 -04:00
Dexter Edwards
107171d46a
renaming test files (#351)
* renaming test files

* add eslint plugin jest

* enable linting rule and additional rules

* fix a metric ton of linting errors

* fix lint errors

* remove export
2022-05-12 13:32:14 +01:00
Ditmir-Vega
6bccfaf8ab
Task/252 Eth wallet connection and deposit form validation tests (#309)
* add feature/scenarios for deposits

* add file for auction orders tests

* update feature file for deposits

* update feature tests for deposit

* add feature/scenarios for deposits

* add file for auction orders tests

* update feature file for deposits

* update feature tests for deposit

* add test for wallet not connected

* fix lint warning

* add mock ethereum provider to allow connecting ethereum wallet

* add basic test for required validation errors

* add  aria for input errors for a11y and test targeting, expand submit form helper

* use mnemonic for private key generation, update tests to not submit and just assert validation message updates

* add chain id to cypress config

* update scenario

* remove feature file

* lint fix

* Update apps/trading-e2e/cypress.json

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

* use mnemonic from github secret, update cypress.json env vars to match

* fix typo in test name and mnemonic env var

* update env variables

* update eth wallet mnemonic env

* Update libs/cypress/src/lib/eip1193-bridge.ts

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

* remove unused reference to chainId

* update casing

* chainId reference from cypress.json

* Update apps/trading-e2e/cypress.json

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

* Update apps/trading-e2e/src/support/step_definitions/deposits.step.ts

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

* ignore a known failing step in the test due to wallet connected having approved status

* update testid

* update tests for deposits

* tidy up comments in custom cypress commands

* add comment about eager connect when running in cypress

* update deposits tests

Co-authored-by: Matthew Russell <mattrussell36@gmail.com>
Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com>
2022-05-10 20:37:09 +01:00
Bartłomiej Głownia
19a9e9adb0
Fix global types imports in generated files (#386) 2022-05-09 13:14:59 +02:00
Dexter Edwards
9e82935658
Chore/more docs (#331)
* chore renable prettier md files

* remove duplicated information, add instructions on running formatting

* add more docs for other apps a libraries

* correct numbering

* Missing applications

* correction for serving

* more docs
2022-05-03 16:32:31 +01:00
Matthew Russell
1d8de701c9
Use types from web3-react library
export connectors to avoid needless data manipulation, use built in types from web3-react (#310)
2022-05-02 13:16:57 -04:00
Matthew Russell
3af4e354cd
Mock accounts for trading page (#311)
* move accounts and positions into own feature, add mock for accounts

* use length for expected number of columns

* combine trading feature tests into single trading-page.feature

* add orders scenario for trading page

* fix typo

* move related test cases for orders together
2022-04-29 14:24:15 +01:00
Matthew Russell
8ebb2ee81c
Allow any type of asset fields for the isERC20Asset type guard (#322) 2022-04-27 10:35:30 -07:00
Matthew Russell
29cd7dd2e4
Feat/104 withdraws (#263)
* add withdraw page

* add create page and withdraws lib with basic components

* add create withdrawal functionality, add withdrawal dialog

* re arrange pages so we have a pending page with a list of withdrawals and a withdraw page with the form

* handle withdrawal completion

* add withdraw dialog so withdraw is completed in one flow

* rename and arrange prop getter function to avoid use of any

* tidy up and make eth transaction and vega transaction hooks follow similar patterns

* make complete withdraw hook fetch approval, combine hooks for full flow

* delete unused file

* add accounts to query to get use max withdraw button

* use ag grid fro withdrawals list

* format amount in grid

* ensure party has id field for cache

* update to use t i18n function

* change complete status to better match values of WithdrawalStatus

* add asset lib file for type guard

* share queries for withdraws lib

* move web3 related hooks to the web3 lib and make web3 lib buildable

* add unit test for use-complete-withdraw

* add test for use-withdraw

* add e2e scenarios for withdrawals

* don render custom no withdrawals message and use ag grid prop

* make withdraw form take ethereum account as prop

* add test config, update withdraw form to handle min/max amounts, add unit test for withdraw form

* fix rendering 0 if not pending withdrawals

* use controlled component for select box

* tidy up async parts of tests, add test for withdraw-manager

* update withdraw dialog to use map for different tx states

* add fallback etherscan link, add test for withdraw-dialog.spec.tsx

* rename erc20 query in token app, change page structure to /withdraw and /withdrawals

* change linked vegawallet-service-api-client to newly published version

* ignore not implemented withdrawals e2e tests

* make vega tx pending and requested states the same, for now, until tx confirmation work is done

* Add some unit tests for determine-ids and remove0x

Neither are critical, but both are libs expected to be shared between
projects so some unit tests will hopefully ensure projects all have the
same expectations about how the functions act.

- Add 1 determine-ids test
- Add a few remove-0x tests
- Update determine-ids to use remove-0x
- Add a comment describing why i18n is what it is

* modify cache with client only field for tracking foreign chain progress

* move withdrawals-list to lib, add useWithdrawals hook

* add container component for withdrawals page

* add unit tests for withdrawals-table

* add some tests for use-withdrawals hook

* revert changes to generated files in other libs and apps

* update withdrawals scenarios

* resolve pr comments

* update page containers to use render prop rather than children

* delete unused files

* remove transaction dialog story

Co-authored-by: Ditmir-Vega <ditmir@vega.xyz>
Co-authored-by: Edd <edd@vega.xyz>
2022-04-26 19:51:39 -07:00
Bartłomiej Głownia
d0ec016adc
Feature/151 orderbook (#266)
* [#151] Add orderbook

* [#151] Add orderbook components

* [#151] Add market-depth data provider

* [#151] Add orderbook manager

* [#151] handle market depth updates in orderbook manager

* [#151] Fix PageQueryContainer usage of AsyncRenderer

* [#151] Move data handling logig out from orderbook manager

* [#151] Use mocked data, fix data issues

* [#151] Add compact order book data unit tests

* [#151] Add updateData unit tests

* [#151] Add updateCompactedData unit tests

* [#151] update cummulative vol on update, move data ref handling from effect to manager

* [#151] Update cummulative vol on update, fixes

* [#151] Optimieze orderbook ag-grid render

* [#151] Replace ag-grid with orderbook component

* [#151] Use react memo to optimize orderbook rendering

* [#151] Fix cummulative vol computation on compacted data update

* [#151] Add resolution controls

* [#151] Fix cumulative spelling mistake

* [#151] Use number instead of string for cumulative values

* [#151] Expose restart callback in useDataProvider hook

* [#151] Update empty cumulative values

* [#151] Add horizontal line under header in orderbook

* [#151] reuse orderbook data in market-depth chart

* [#151] restart market depth provider on sequenceNumber gap

* [#151] use throttle in orderbook and depth-chart

* [#151] Add comments, refactor data functions

* [#151] Add comments, refactor data functions

* [#151] move orderbook and depth-chart libs to market-depth
2022-04-26 17:26:28 +02:00
John Walley
ba19b5acca
Candle/depth chart switcher (#284) 2022-04-25 10:34:07 -07:00
Matthew Russell
899277e6d4
Fixes for workflows (#291)
* change to setting envars rather than passing in via CLI

* update nx to latest patch version

* add env files for token-e2e, fix lint and ts errors

* move generate functions to mocs for trading e2e to avoid violating boundary rules

* add jsx compiler option for trading-e2e

* downgrade nextjs

* add testing-library to types declaration where required
2022-04-22 17:51:18 -07:00
Sam Keen
9591687a80
Feat/224 move token app into monorepo (#229)
* moved TFE into monorepo with some remaining errors

* moved TFE into monorepo with some remaining errors - further files

* add tailwind config, use etherscan link from toolkit, use web3 from lib

* make app compatible with react router 6

* remove vega keys from app state and use from state from lib

* comment out crowdin script injection

* convert all buttons to use ui toolkit buttons

* remove blueprint inputs and selects and replace with ui-toolkit

* remove css resets

* tidy button styles in wallet replace splash-screen with version from ui-toolkit

* various style fixes

* tidy up proposal list

* add valid key to route children

* Set custom port and config for token e2e tests

* added env title e2e test

* started some styling fixes - nav and home route

* Added 'h-auto' to button height regex check

* Added 'h-auto' to regex check to allow desired TFE button height

* Removed scss and used tailwind for heading component

* Woff files not woof :)

* Proper nav h1 font size

* Wallet card headings

* Vega wallet button styles

* Set project to use static hosted alpha font (cors being fixed separately)

* Eth wallet button styles (unfinished)

* Home route styles

* Staking route styles and title calculation

* Rewards route styles

* Vega wallet container button style

* Eth wallet disconnect button

* Connect dialog title colour and spacing

* Splash screen layout

* Fixed a bunch of linting errors

* Used 'Object.entries' instead of 'Array.from' to create iterable from object in 'use-search-params'

* Removed use of 'any' from 'use-search-params'

* Better simplification of 'use-search-params'

* Removed package.json duplication errors, set most up-to-date version from duplicate options

* Elvis for possible undefined in 'use-add-asset-to-wallet'

* Removed redundant files

* Removed old todo

* Removed package.json redundant packages

* Added dark class for dialog h1 text colour (required as the current scss gives a wrong default for this element)

* update useAddAsset to use new provider

* Ensure Jest has required methods

* tidy up package.json

* remove ts-ignores and use casts for dynamic grid imports

* remove unused code from token-e2e

* update to latest types from react 17

* Removed vegag wallet not running component as it should be handled by wallet lib

* fix typing of contract addresses

* type cast network string to Network enum in reduce

* remove comment, issue 270 created instead

* default associated wallet amounts to zero

* update comment

* delete unused staking-overview component, add note about withTranslation types to comment

* re add proposal dates

* enable source maps for build

* add rest of env files for networks

* remove crowdin script tags from index.html

* add testing-library/jest-dom to types in test tsconfig

* setup i18n for tests so that translations are used, proposal change table test

* delete unused translation files and config

* set sentry release to use commit ref

* delete dex liquidity pages

* remove unused useVegaLPStaking hook

* use found id so no non null assertion needed

* remove mocked graphql provider

* remove commented out breadcrumb component

* add comment and link to issue for syntax highlighter changes

* fix any types in token-input, add link to ui-toolkit input changes

* dont default allowance to zero as it affects rendering logic

* fix spacing between callouts on associate page

* adjust spacing between callout for association callout

* fix alignment of ethereum splash screen

* use ethereum connect dialog state for connect dialog

* add infura provider as default

* change from infura provider to JsonRpcProvider

* remove unused Ethereum config

* add custom webpack config to inject sentry plugin

* delete commented out code for pending stake

* add comment linking input elements issue for eth-address-input

* move useEagerConnect to libs/wallet, add logic for connecting state so token app can load after connection has succeeded or failed

* remove unused storage files, update web3 connector to render children if not actively connected

Co-authored-by: Matthew Russell <mattrussell36@gmail.com>
2022-04-20 12:37:44 -07:00
Matthew Russell
04872522d6
Task/229 Stub api in trading e2e (#211)
* add fixture for markets query

* stub graphql requests

* re-add assertion for tx hash, stub command/sync requests

* refactor to get tests to run with trading page mocked queries

* add test wallet credentials

* split up markets page from trading page

* add portfolio page feature, add market page scenarios

* move hasOperationName helper to support/index

* fix home-page.feature

* fix missing feature step

* Minor changes to BDD steps

* Use in object syntax to get better type safety on hasOperationName helper function

* remove bypass placing orders env var and usage in tests

* use UI_Trading_Test wallet publick key in command/sync mock

* move public key to cypress env

* replace fixtures with generator functions

* colocate query generators with queries

* add custom commands, add index files

* fix dodgy merge, remove duplicate market page feature

* make tsconfig for cypress lib match

* update tsconfig for explorer e2e so commands using merge work

* revert trading step to js

Co-authored-by: Joe <joe@vega.xyz>
2022-04-12 12:04:26 +01:00
John Walley
f721a21d0f
Feat/129 pennant chart (#214)
* initial commit for adding chartt lib with pennant chart

* add pennant package, fix dynamic import of chart

* use updated pennant library

* Create separate chart and depth-chart libs

* Remove leftover generated files

* Use more targeted queries and subscriptions

* Fix jestConfig value for depth-chart

* Add jest-canvas-mock

* Refactor updateDepthUpdate function

* Add updateDpethUpdate test

* Add jest-canvas-mock to chart tests

* Avoid using any type in test

* Use correct casing for gql queries and subscriptions

* Make ButtonRadio generic in option value type

* Add padding and margin to chart container

* Remove unused subscriptions and methods from data source

* Use correct React imports

Co-authored-by: Matthew Russell <mattrussell36@gmail.com>
2022-04-08 10:49:45 -07:00
Matthew Russell
98c1fc82f7
Feat/152 Trade list MVP (#217)
* add trades lib with data provider

* add trades table and cell color logic

* ensure we only show last 50 rows

* add test for table columns and formatting

* update trades table to get cells using col-id

* fix linting

* use default function param for fetchpolicy
2022-04-07 06:41:57 -07:00
Matthew Russell
f244cd07d4
Feat/103 deposits (#143)
* add web3 provider using web3-react package

* add env setup, add guard for incorrect chain id

* add lib for web3-provider

* make wallet and ethereum connect dialogs look more consistent

* add setup tests file for jest-dom

* remove chain id config and just use appChainId prop, add disconnect button to invalid chainId state

* switch handling of connect dialog state to the consuming app

* rename web3-provider package to just web3

* envs for each environment so we can specify chainId

* make web3container enforce connection before rendering childen

* add web3 provider using web3-react package

* make web3container enforce connection before rendering childen

* add container for getting network params

* Move ethereum config query to web3 container

* add basic deposit form elements

* add queries required for deposits, add asset default

* add bridge contract and deposit transaction

* break txhash

* restrict etherscan link props, use etherscan link in transaction dialogs

* use smart-contracts-sdk

* split hooks and components into different files, fix find deposit logic, add styles and progress for tx dialogs

* fix text colors for dark mode

* improve tx dialogs, rename deposit query

* position use buttons, fix select validation

* fix type errors after not being in strict mode, add allowance checking

* add deposit-limits component, fix types now that strict mode is enabled

* make contract hooks have a single instance

* split out dialogs into separate files, fix icon alignment

* improve error types for use transaction hook, add number save min and max for the amount input

* add validation for ethereum and vega addresses

* add unit test for deposit form component

* add icons and shared dialog styles so it better matches order transaction dialog

* fix underline class, reset finalized deposit

* fix type imports, use i18n function, regen types

* only pass contract address to token contract hook

* add vega env, refactor so retrieving asset contract address logic isn't duplicated

* add faucet functionality, combine dialogs into single transaction-dialog

* combine rendering logic into single func of transaction dialog, rever contract hooks to just useMemo

* use to field rather than connected key

* fix props and imports in deposit form test

* share faucetable condition, pass it to token contract

* pass contracts in as params to hooks to avoid multiple contract instances

* refetch balance in wallet after deposit, add comments

* use hook state for tracking deposit via partyid, add test for use ethereum transaction hook

* add deposits lib

* add last smart contract sdk package

* fix asset import in test

* tidy up ts-ignores

* pass arg for faucetable token contract

* add provider url to env vars and use in place of infura id, also update web3-connector to only allow the chain permitted by the app

* add type guard for erc20 assets

* fix intent shadow helper function, use arrow function for isEthereumError

* update etherscan link to use env vars for url base

* rename deposit related hooks to indicate read vs write calls

* move ethereum error class and helpers to react-helpers

* add use-ethereum-read-contract hook to contain fetch logic

* remove unused import

* move validation to lib, add hex check for vega public key

* use map for transaction modal states, pass confirmed prop to transaction dialog for deposits

* remove unused import for classnames
2022-04-06 10:34:51 -07:00
Bartłomiej Głownia
6cbc701384
[#168] Use static resources from static.vega.xyz (#205) 2022-04-06 11:36:36 +01:00
Matthew Russell
018e5fe139
Task/33 add sentry to trading (#189)
* add sentry setup, add VEGA_ENV to env files

* rename custom error page

* capture exception for eager connect

* add link to setup docs in comment

* add browser tracing plugin

* define sentry auth token once

* enable sourcemaps on build

* use correct sentry config property
2022-04-04 12:45:40 -07:00
Joe Tsang
205f4124f1
Test/deal ticket tests (#161)
* scaffold dealticket package, remove trading views from react-helpers

* add deal ticket component, add intent utils, expand dialog and form group styles

* add splash component, show market not found message if market doesnt exist

* tidy up error handling

* add handleError method for vega tx hook

* add better testname for provider test, flesh out tests a bit more for deal ticket

* Add unit tests for useVegaTransaction and useOrderSubmit hooks

* add wrapper component for order dialog styles

* add vega styled loader to ui toolkit and use in order dialog

* add title prop to order dialog

* split limit and market tickets into own files

* add button radio component

* revert dialog styles

* move splash component to ui-toolkit, add story

* convert intent to enum

* Make button always type=button unless type prop is passed

* inline filter logic for tif selector

* add date-fns, add datetime to helpers

* add order types to wallet package, make price undefined if order type is market

* use enums in deal ticket logic

* tidy up order state by moving submit and transaction hooks out of deal ticket

* add comment for dialog styles

* remove decimal from price input

* add types package, delete old generated types from trading project

* rename types package to graphql

* update generate command to point to correct locations

* fix use order submit test

* BDD and navigation tests passing

* Remove commented steps

* Steps up to placing order

* Date picker and date-fns update

* Vega connector wallet tests

* Passing up to request sent, updated date picker

* Tests for sell orders and errors

* Update market feature

* Fix failing tests

* Update wallet login

* Readded tx hash assertion and remaining tests

* Add CI wallet import

* Update .github/workflows/cypress.yml

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

* Resolved PR comments

* Fix yaml error

* Attempt to fix failing tests in CI

* Run Cypress in Chrome

* Add reload if public key error displayed

* Fix wallet name

* Add force click and waits

* Increase timeout for deal ticket page

* Removed network list from yaml and using input error id

* Increase timeout to 8 seconds

* Re add deleted test id

Co-authored-by: Matthew Russell <mattrussell36@gmail.com>
Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com>
2022-04-04 16:11:27 +01:00
Matthew Russell
15551b65e5
Feat/83 switching vega key (#156)
* add manage dialog to wallet lib, add it to trading app

* add test for wallet button

* add tests for manage dialog

* move tooltip to ui-toolkit, add copy with tooltip component for manage dialog

* add better labelling

* add tooltip story

* add story for copy-with-tooltip

* add tests for tooltip and copy-with-tooltip

* move useFakeTimers call to beforeAll

* adjust design of manage dialog

* fix linting issues
2022-03-31 10:16:30 -07:00
sam-keen
b6df83ede8 Resolved merge conflicts with master, reduced warnings 2022-03-31 14:20:36 +01:00
Matthew Russell
4899d1bce8
Task/Mark translations (#174)
* add dummy i18n translate function to market text that will need translation in future

* add i18n function to aria-labels
2022-03-30 18:08:25 -07:00
sam-keen
80902e3c30 Added custom module for classes that aren't in Tailwind - allows us to use contextual alternates for Alpha Lyrae 2022-03-30 16:56:48 +01:00
Bartłomiej Głownia
7af0efa8d8 Enable @typescript-eslint/consistent-type-imports eslint rule 2022-03-30 13:05:41 +02:00
Matthew Russell
d3d28947ea tidy up deal ticket query and market page query 2022-03-29 16:19:23 -07:00
Matthew Russell
edce1c7869 rename graphql dir to types 2022-03-29 16:03:27 -07:00
Matthew Russell
3f62c79f8d colocate querys with libs 2022-03-29 15:52:51 -07:00