Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

Network check 2 #1546

Merged
merged 5 commits into from
Oct 27, 2020
Merged

Network check 2 #1546

merged 5 commits into from
Oct 27, 2020

Conversation

W3stside
Copy link
Contributor

#1543 was broken somehow in backend so retrying here...

Closes #283

Deals with incorrect network using CONFIG list's default accepted networks and uses toast.error pointing users to a our repo's wiki about networks.

THE URL IN THE TOAST ERROR NEEDS TO POINT ELSEWHERE!! Right now it is pointing to THIS repo.

Thoughts on toast approach?

W3stside and others added 3 commits October 20, 2020 18:03
Update src/hooks/useNetworkCheck.tsx

Co-authored-by: Velenir <Velenir@users.noreply.github.com>
@ghost
Copy link

ghost commented Oct 22, 2020

Travis automatic deployment:

Copy link
Contributor

@anxolin anxolin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! I like it!

Only comment, can you try setting closeButton: false and closeOnClick: false

@W3stside W3stside changed the base branch from develop to release/v1.6.0 October 26, 2020 17:16
@W3stside W3stside requested a review from anxolin October 26, 2020 17:32
@W3stside
Copy link
Contributor Author

@anxolin @Velenir thoughts on the URL in the toast pointing to this repo's wiki?

@anxolin
Copy link
Contributor

anxolin commented Oct 27, 2020

I think is good! 👌

Copy link
Contributor

@anxolin anxolin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great

@Velenir
Copy link
Contributor

Velenir commented Oct 27, 2020

@anxolin @Velenir thoughts on the URL in the toast pointing to this repo's wiki?

Good thoughts 👍

@W3stside W3stside merged commit d3b700e into release/v1.6.0 Oct 27, 2020
@W3stside W3stside deleted the network-check-2 branch October 27, 2020 12:01
Velenir added a commit that referenced this pull request Nov 3, 2020
* Refactoring: moving OrdeBookWidget component to its own folder

* Refactoring: splitting component into smaller files

* Refactoring: commenting useEffectHooks and ordering them

* Refactoring: renamed component from OrderBookWidget to OrderBookChart

* Adjusting y axis on one sided markets

* Leaving it up to amCharts to decide how to space the grids

* 1295/linear orderbook styling (#1299)

* remove dead CSS

* consistency changes

1. text: BT/QT (/)
2. Volume (BT) Y-axis
3. Price(BT/QT) X-axis

* styling

* make upper scrollbar opacity lower

* adapt chartFuntions

* adapt dataProcessing

* adapt zoomFunctions

* adapt OrderBookChart

* adapt OrderBookWidget

* move stories to components

* rename folder

* fix name

* lint fixes

* xDAI price estimate prod URL

* 1336/tooltip date orders (#1507)

* add dates to OrdersWidget in Trade

* expireDateLocal > expireDateFormatted

* 1.5.1

* updated README to add compatible networks and URLs to wiki (#1537)

* move toast to custom wrapped container (#1539)

1. encapsulates custom styles and moves out of global

* Modal (prev. modali) Storybook stories (#1508)

* export ModalOptions and ModalProps

* Modal stories

* use action and make modal smaller

* rename css variable to generic + variable defaults

* wrapped datetimepicker in global styles (#1542)

1. removed redundant global.ts styles

* [Smart Quote] COMPLETE (#1492)

* Add token priorities

* Add priority and new market types

* Add market util

* Add test for getMarket util

* Improve tests

* Add change in implementation (forgot to commit)

* Load priority for tokens

* User automatic market selection

* Add token priorities and smart quote selection util (#1474)

* Add token priorities

* Add priority and new market types

* Add market util

* Add test for getMarket util

* Improve tests

* Add change in implementation (forgot to commit)

* Smart quote load priority (#1478)

* Add token priorities

* Add priority and new market types

* Add market util

* Add test for getMarket util

* Improve tests

* Add change in implementation (forgot to commit)

* Load priority for tokens

* Memoize and add debug

* Calculate the received tokens using the right price

* Fix typo

* Use cannonical market in tx confirmation

* Simplify prices in order row

* Refactor price calculation into smartPrice component

* Add title to smart price

* Remove title from swap token

* [Smart Quote]  User automatic market selection (#1479)

* Add token priorities

* Add priority and new market types

* Add market util

* Add test for getMarket util

* Improve tests

* Add change in implementation (forgot to commit)

* Load priority for tokens

* User automatic market selection

* Memoize and add debug

* Calculate the received tokens using the right price

* Fix typo

* Use cannonical market in tx confirmation

* Create new price fraction and memoize

* Smart quote market selection widget (#1531)

* Add token priorities

* Add priority and new market types

* Add market util

* Add test for getMarket util

* Improve tests

* Add change in implementation (forgot to commit)

* Load priority for tokens

* User automatic market selection

* Memoize and add debug

* Calculate the received tokens using the right price

* Fix typo

* Use cannonical market in tx confirmation

* Fix var name

* Use setter function for hook

* Show buy sell fills (#1530)

* Show side and price units

* Allow to invert price

* Memoize info

* Do not use anchor for market

* Remove unused var

* [Smart Quote]: Add useBestAsk hook to PriceSuggestionsWidget (#1533)

* useBestAsk hook

* PriceSuggestions: add useBestAsk hook

* [Smart Quote] TradesRow data rearrangement - swap Limit/Fill price and Sell/Bought column split (#1535)

* TradesWidget: move rows around

1. Date is moved right of Order ID
2. Sold/Bought split into 2 columns

* change labels and fix filter

* remove Pair title & css changes

* Trades split limit fill price (#1536)

* add/calc surplus to TradeRow

* make data fit

* surplus bold/green/text change

* fix style issue as table sizes grow

1. orders widget is larger to fit more data

* OrdersWidget: rearrange data presentation (#1541)

1. split total/filled

* remove wasPriorityAdjusted

Co-authored-by: David <david.sato64@gmail.com>

* Network check 2 (#1546)

* deal with incorrect network

* PR changes, thank you to the legend @Velenir

* rel noopener

Update src/hooks/useNetworkCheck.tsx

Co-authored-by: Velenir <Velenir@users.noreply.github.com>

* block toast click close or button

Co-authored-by: Velenir <Velenir@users.noreply.github.com>

* travis yml: sticky node v12 (#1556)

* wxDAI priority list (#1555)

* [Smart Quote] Fix broken **limitPrice** amount (#1554)

* PriceSuggestion: check adjusted market and use correct price

1. pass original token pair to price estimation logic
2. invert price when adjusted market detected

* tradewidget - pricesuggestion

1. pass original tokens as props
2. comment on props for ease

* add autoWidth prop to self adjust (#1560)

* Update orderbookSamples.ts (#1439)

* Update orderbookSamples.ts

Added some new examples, deleted old examples that didn't break the orderbook in the past.

* travis yml: sticky node v12

Co-authored-by: Velenir <Velenir@users.noreply.github.com>
Co-authored-by: David Sato <david.sato64@gmail.com>

* 1545 - Show percentage filled & fix incorrect market order in orders (#1562)

* calculate filled amount percentage

1. change surplus min to 0.01%

* show proper market in orderrow

* logic cleanup for TS

* memo getMarket

* fix filled percentage css

* connect wallet width auto

* [Price Impact]: Base (#1509)

* remove amount shown in Fill Price

* create PriceImpact component

* PriceSuggestionsWidget/Child

1. remove Best Ask comp + calc
2. export Wrapper
3. remove dead props

* add priceimpact to tradewidget

* THRESHOLD constant values

* const: doesnt need threshold vals

1. move to priceimpact

* memoise colourClass and use BigNumber thresholds

* fix stories/build

* format price impact

* fixed tooltip style

* edited calculation, changed smart format limit, dont show on ZERO

* change of red colour

* [Price Impact] Warnings in PriceSuggestions (#1544)

* small util for checking truthiness

* move PriceImpact into PriceSuggestionsWidget

* move unrelated files into more related FS

* rename isTruthy util fn and use in PriceSUggestions

* styling

1.added button-warning red
2. label no background
3. added midImpact class

* utils: decouple some of the impact level determining logic

1. add midPrice and high price impact thres
2. warning logic fix

* saving warning label change

* address PR comments

1. use standard FormMessage
2. dont show warning on using suggested price
3. change tooltip text

* put in useBestAsk hook

* added placeholder slippage of 0.5%

1. protects against Deep Market warning showing too frequently
2. added some comments for clarity

* addressed PR comments:

1. remove TODO useBestAsk comment
2. simplify priceImpactSmart logic thanks @anxolin
3. use switch cases
4. fix formatSmart broken small amount
5. use enum in priceimpact/utils
6. isStrNumTruthy > isNonZeroNumber rename

* [Price Impact] Confirmation Modal Warnings (#1550)

* add priceimpact to tradewidget

* [Price Impact] Warnings in PriceSuggestions (#1544)

* small util for checking truthiness

* move PriceImpact into PriceSuggestionsWidget

* move unrelated files into more related FS

* rename isTruthy util fn and use in PriceSUggestions

* styling

1.added button-warning red
2. label no background
3. added midImpact class

* utils: decouple some of the impact level determining logic

1. add midPrice and high price impact thres
2. warning logic fix

* saving warning label change

* address PR comments

1. use standard FormMessage
2. dont show warning on using suggested price
3. change tooltip text

* put in useBestAsk hook

* added placeholder slippage of 0.5%

1. protects against Deep Market warning showing too frequently
2. added some comments for clarity

* addressed PR comments:

1. remove TODO useBestAsk comment
2. simplify priceImpactSmart logic thanks @anxolin
3. use switch cases
4. fix formatSmart broken small amount
5. use enum in priceimpact/utils
6. isStrNumTruthy > isNonZeroNumber rename

* move unrelated files into more related FS

* saving warning label change

* moved logic to usePriceImpact hook

* move types to type subfolder

* add usePRiceImpact hook

* added price impact warnings to TxMessage

* errors as constants

* changed warning message type to object

* removed error title

* usePriceImpact compact logic

* utils:

1. made warnings into constants
2. reworked some of the warning label logic

* PriceImpact %: show 0 when 0 or negative

* remove logDebug

* add PriceImpact into conf modal

* small change

1. extrapolate SimplePriceImpact to reuse
2. new type
3. warnings all have icon

* use fontawesome over system font

* enum doesnt need assigned numbers

* exhaustive cases for switch/case no default

* [Price Impact] Fix broken warnings on adjusted market (#1557)

* commented/cleaned up utils

* Impact: use absolute pair & quote price

* fix warning in confirmation modal

* flip base for quote in low vol calc (#1559)

* Tx approval timeout (#1547)

Tx approval timeout

* Fix TS issue

Co-authored-by: Leandro Boscariol <leandro.boscariol@gnosis.io>
Co-authored-by: David <david.sato64@gmail.com>
Co-authored-by: Anxo Rodriguez <anxolin@gmail.com>
Co-authored-by: Rafanator <rafael.suarez333@gmail.com>
@W3stside W3stside mentioned this pull request Nov 9, 2020
anxolin added a commit that referenced this pull request Jan 11, 2021
* Refactoring: moving OrdeBookWidget component to its own folder

* Refactoring: splitting component into smaller files

* Refactoring: commenting useEffectHooks and ordering them

* Refactoring: renamed component from OrderBookWidget to OrderBookChart

* Adjusting y axis on one sided markets

* Leaving it up to amCharts to decide how to space the grids

* 1295/linear orderbook styling (#1299)

* remove dead CSS

* consistency changes

1. text: BT/QT (/)
2. Volume (BT) Y-axis
3. Price(BT/QT) X-axis

* styling

* make upper scrollbar opacity lower

* adapt chartFuntions

* adapt dataProcessing

* adapt zoomFunctions

* adapt OrderBookChart

* adapt OrderBookWidget

* move stories to components

* rename folder

* fix name

* lint fixes

* xDAI price estimate prod URL

* 1336/tooltip date orders (#1507)

* add dates to OrdersWidget in Trade

* expireDateLocal > expireDateFormatted

* 1.5.1

* updated README to add compatible networks and URLs to wiki (#1537)

* move toast to custom wrapped container (#1539)

1. encapsulates custom styles and moves out of global

* Modal (prev. modali) Storybook stories (#1508)

* export ModalOptions and ModalProps

* Modal stories

* use action and make modal smaller

* rename css variable to generic + variable defaults

* wrapped datetimepicker in global styles (#1542)

1. removed redundant global.ts styles

* [Smart Quote] COMPLETE (#1492)

* Add token priorities

* Add priority and new market types

* Add market util

* Add test for getMarket util

* Improve tests

* Add change in implementation (forgot to commit)

* Load priority for tokens

* User automatic market selection

* Add token priorities and smart quote selection util (#1474)

* Add token priorities

* Add priority and new market types

* Add market util

* Add test for getMarket util

* Improve tests

* Add change in implementation (forgot to commit)

* Smart quote load priority (#1478)

* Add token priorities

* Add priority and new market types

* Add market util

* Add test for getMarket util

* Improve tests

* Add change in implementation (forgot to commit)

* Load priority for tokens

* Memoize and add debug

* Calculate the received tokens using the right price

* Fix typo

* Use cannonical market in tx confirmation

* Simplify prices in order row

* Refactor price calculation into smartPrice component

* Add title to smart price

* Remove title from swap token

* [Smart Quote]  User automatic market selection (#1479)

* Add token priorities

* Add priority and new market types

* Add market util

* Add test for getMarket util

* Improve tests

* Add change in implementation (forgot to commit)

* Load priority for tokens

* User automatic market selection

* Memoize and add debug

* Calculate the received tokens using the right price

* Fix typo

* Use cannonical market in tx confirmation

* Create new price fraction and memoize

* Smart quote market selection widget (#1531)

* Add token priorities

* Add priority and new market types

* Add market util

* Add test for getMarket util

* Improve tests

* Add change in implementation (forgot to commit)

* Load priority for tokens

* User automatic market selection

* Memoize and add debug

* Calculate the received tokens using the right price

* Fix typo

* Use cannonical market in tx confirmation

* Fix var name

* Use setter function for hook

* Show buy sell fills (#1530)

* Show side and price units

* Allow to invert price

* Memoize info

* Do not use anchor for market

* Remove unused var

* [Smart Quote]: Add useBestAsk hook to PriceSuggestionsWidget (#1533)

* useBestAsk hook

* PriceSuggestions: add useBestAsk hook

* [Smart Quote] TradesRow data rearrangement - swap Limit/Fill price and Sell/Bought column split (#1535)

* TradesWidget: move rows around

1. Date is moved right of Order ID
2. Sold/Bought split into 2 columns

* change labels and fix filter

* remove Pair title & css changes

* Trades split limit fill price (#1536)

* add/calc surplus to TradeRow

* make data fit

* surplus bold/green/text change

* fix style issue as table sizes grow

1. orders widget is larger to fit more data

* OrdersWidget: rearrange data presentation (#1541)

1. split total/filled

* remove wasPriorityAdjusted

Co-authored-by: David <david.sato64@gmail.com>

* Network check 2 (#1546)

* deal with incorrect network

* PR changes, thank you to the legend @Velenir

* rel noopener

Update src/hooks/useNetworkCheck.tsx

Co-authored-by: Velenir <Velenir@users.noreply.github.com>

* block toast click close or button

Co-authored-by: Velenir <Velenir@users.noreply.github.com>

* travis yml: sticky node v12 (#1556)

* wxDAI priority list (#1555)

* [Smart Quote] Fix broken **limitPrice** amount (#1554)

* PriceSuggestion: check adjusted market and use correct price

1. pass original token pair to price estimation logic
2. invert price when adjusted market detected

* tradewidget - pricesuggestion

1. pass original tokens as props
2. comment on props for ease

* add autoWidth prop to self adjust (#1560)

* Update orderbookSamples.ts (#1439)

* Update orderbookSamples.ts

Added some new examples, deleted old examples that didn't break the orderbook in the past.

* travis yml: sticky node v12

Co-authored-by: Velenir <Velenir@users.noreply.github.com>
Co-authored-by: David Sato <david.sato64@gmail.com>

* 1545 - Show percentage filled & fix incorrect market order in orders (#1562)

* calculate filled amount percentage

1. change surplus min to 0.01%

* show proper market in orderrow

* logic cleanup for TS

* memo getMarket

* fix filled percentage css

* connect wallet width auto

* [Price Impact]: Base (#1509)

* remove amount shown in Fill Price

* create PriceImpact component

* PriceSuggestionsWidget/Child

1. remove Best Ask comp + calc
2. export Wrapper
3. remove dead props

* add priceimpact to tradewidget

* THRESHOLD constant values

* const: doesnt need threshold vals

1. move to priceimpact

* memoise colourClass and use BigNumber thresholds

* fix stories/build

* format price impact

* fixed tooltip style

* edited calculation, changed smart format limit, dont show on ZERO

* change of red colour

* [Price Impact] Warnings in PriceSuggestions (#1544)

* small util for checking truthiness

* move PriceImpact into PriceSuggestionsWidget

* move unrelated files into more related FS

* rename isTruthy util fn and use in PriceSUggestions

* styling

1.added button-warning red
2. label no background
3. added midImpact class

* utils: decouple some of the impact level determining logic

1. add midPrice and high price impact thres
2. warning logic fix

* saving warning label change

* address PR comments

1. use standard FormMessage
2. dont show warning on using suggested price
3. change tooltip text

* put in useBestAsk hook

* added placeholder slippage of 0.5%

1. protects against Deep Market warning showing too frequently
2. added some comments for clarity

* addressed PR comments:

1. remove TODO useBestAsk comment
2. simplify priceImpactSmart logic thanks @anxolin
3. use switch cases
4. fix formatSmart broken small amount
5. use enum in priceimpact/utils
6. isStrNumTruthy > isNonZeroNumber rename

* [Price Impact] Confirmation Modal Warnings (#1550)

* add priceimpact to tradewidget

* [Price Impact] Warnings in PriceSuggestions (#1544)

* small util for checking truthiness

* move PriceImpact into PriceSuggestionsWidget

* move unrelated files into more related FS

* rename isTruthy util fn and use in PriceSUggestions

* styling

1.added button-warning red
2. label no background
3. added midImpact class

* utils: decouple some of the impact level determining logic

1. add midPrice and high price impact thres
2. warning logic fix

* saving warning label change

* address PR comments

1. use standard FormMessage
2. dont show warning on using suggested price
3. change tooltip text

* put in useBestAsk hook

* added placeholder slippage of 0.5%

1. protects against Deep Market warning showing too frequently
2. added some comments for clarity

* addressed PR comments:

1. remove TODO useBestAsk comment
2. simplify priceImpactSmart logic thanks @anxolin
3. use switch cases
4. fix formatSmart broken small amount
5. use enum in priceimpact/utils
6. isStrNumTruthy > isNonZeroNumber rename

* move unrelated files into more related FS

* saving warning label change

* moved logic to usePriceImpact hook

* move types to type subfolder

* add usePRiceImpact hook

* added price impact warnings to TxMessage

* errors as constants

* changed warning message type to object

* removed error title

* usePriceImpact compact logic

* utils:

1. made warnings into constants
2. reworked some of the warning label logic

* PriceImpact %: show 0 when 0 or negative

* remove logDebug

* add PriceImpact into conf modal

* small change

1. extrapolate SimplePriceImpact to reuse
2. new type
3. warnings all have icon

* use fontawesome over system font

* enum doesnt need assigned numbers

* exhaustive cases for switch/case no default

* [Price Impact] Fix broken warnings on adjusted market (#1557)

* commented/cleaned up utils

* Impact: use absolute pair & quote price

* fix warning in confirmation modal

* flip base for quote in low vol calc (#1559)

* Tx approval timeout (#1547)

Tx approval timeout

* Fix TS issue

Co-authored-by: Leandro Boscariol <leandro.boscariol@gnosis.io>
Co-authored-by: David <david.sato64@gmail.com>
Co-authored-by: Anxo Rodriguez <anxolin@gmail.com>
Co-authored-by: Rafanator <rafael.suarez333@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The app breaks when you are not in the right network
3 participants