Commit Graph

1292 Commits

Author SHA1 Message Date
Moody Salem
095beae0c2
Refactor ExchangePage into Swap and Send pages (#774)
* Part 1, separate swap and send, move duplicate code into separate files

* Move some more constants out of the swap/send

* Support defaults from URL parameters

* Implement query string parsing via a redux action

* Finish merging the changes

* Fix the slippage warnings

* Clean up some other files

* More refactoring

* Move the price bar out of the component

* Move advanced details and some computations into utilities

* Make same improvements to send

* Approval hook

* Swap page functional with swap callback hook

* Swap/send page functional with swap callback hook

* Fix lint

* Move styleds.ts

* Fix integration test

* Fix error state in swap and move some things around

* Move send callback out of send page

* Make send behave more like current behavior

* Differentiate swap w/o send on send page from swap w/o send on swap page

* Remove userAdvanced which was always false

* Remove the price bar which is not used in the new UI

* Delete the file

* Fix null in the send dialog and move another component out of send

* Move the swap modal header out to another file

* Include change after merge

* Add recipient to swap message

* Keep input token selected if user has no balance and clicks send with swap

* Move the modal footer out of send component

* Remove the hard coded estimated time

* Fix the label/action for swap/sends

* Share the swap modal footer between swap and send

* Fix integration test

* remove margin from popper to suppress warnings

fix missing ENS name recipient link

default deadline to 15 minutes

* ensure useApproveCallback returns accurate data

* clean up callbacks

* extra space

* Re-apply ignored changes from v2 branch ExchangePage file

Co-authored-by: Noah Zinsmeister <noahwz@gmail.com>
2020-05-16 16:55:22 -05:00
Moody Salem
51e929bd1e
Clear all transactions (#778) 2020-05-16 16:23:46 -04:00
Ian Lapham
af892c1fec
copy updates (#779) 2020-05-16 14:50:03 -04:00
Moody Salem
1380f865a9
Place tooltips better on smaller screens 2020-05-16 10:44:26 -04:00
Moody Salem
487b5ceccc
Don't allow the transaction status icon shrink 2020-05-15 15:55:38 -04:00
Ian Lapham
6c9eeb4691
fixes from bug hunting (#773)
* fix small bugs , token icons

* remove mainnet

* style changes

* fix nav pointer issues on desktop

* more style changes

* remove mainnet
2020-05-15 15:17:19 -04:00
Moody Salem
a34dc73c38
Don't always redirect for links 2020-05-15 10:12:43 -04:00
Moody Salem
07fee04526
Lint error 2020-05-14 23:15:57 -04:00
Moody Salem
5a9b7a382e
Fix bug with balance listeners not being reattached 2020-05-14 23:15:28 -04:00
Noah Zinsmeister
7bffea0692
update swr hooks when block number changes (#771)
* key per-block SWR data with block number

* fix + tweak copy and decrease sig figs for lp fee

* don't use blocknumber as a key

instead mutate when it changes

* fix totalsupply + user liquidity sync issues

* fix v1 trade checker logic

* rough fix allowing removal of user added tokens

probably needs a more comprehensive overhaul...

* refactor SWR block updates to custom hook

* typo

* fix import error

* fix footer css to work cross-broswer

* disallow \ to be typing into amount inputs

add test case for this

add value assertions to all input integration tests

* fix import error

* remove console.log

* clean up address input a bit

trim whitespace from pasted addresses

* fix input maxing

remove spurious max output logic
2020-05-14 17:12:59 -04:00
Moody Salem
b1ffab1890
Refactors (#772)
* Bunch of refactoring

* Add an integration test that gets as far as swapping

* Drop the nonce code that isn't doing anything right now

* Undo one of the accidental changes to the reducer
2020-05-14 15:56:40 -04:00
Moody Salem
60582de4d6
Use the new v2 GA ID 2020-05-14 14:13:16 -04:00
Moody Salem
4ef3746a09
Add GA instrumentation to v2 (#769) 2020-05-14 13:18:08 -04:00
Moody Salem
d2462af821
Address flashy first loading behavior 2020-05-14 12:57:19 -04:00
Moody Salem
5405648a54
Improve the transaction render style (#767) 2020-05-14 10:32:48 -04:00
Noah Zinsmeister
4ba7dd9535
fix invariant bug due to dummy ETH (#766)
* fix invariant bug due to dummy ETH

* fix lint issue
2020-05-13 20:25:07 -04:00
Moody Salem
0733cdd63c
Fix trade routing to not throw 2020-05-13 19:57:12 -04:00
Noah Zinsmeister
8a61b4e4ad
support browsers which use old match API (safari) (#765) 2020-05-13 19:22:36 -04:00
Noah Zinsmeister
e0cbee79a6
fix bug for single-hop fees (#764)
fix incorrect feeTimesInputFormatted logic
2020-05-13 18:43:17 -04:00
Noah Zinsmeister
141e605c17
v2 slippage fix (#763)
* appropriately discount for multi-hop fee slippage

* fix comment

* make calculation more explicit with a ternary
2020-05-13 17:58:22 -04:00
Moody Salem
3a426fa36b
Fix token balance fetching in the position card 2020-05-13 16:55:14 -04:00
Moody Salem
52d40949a6
Missed a spot 2020-05-13 16:45:08 -04:00
Moody Salem
685bb1745a
Improve rendering of failed transactions 2020-05-13 16:42:47 -04:00
Moody Salem
9006acb4c5
Balances rewrite (#761)
* Create the wallet store

* Get the updater completed

* Code complete

* Fix token balance bug

* Fix another bug in the hooks

* Final bug fix, blockNumber can be undefined

* Formalize the fact that block number can be undefined

* Woops add package

* Add more info to errors

* Replace balances in the v1 methods with the new ones

* Only return a balance value if it's present

* Address comments

* Trigger updateVersion before anything else
2020-05-13 16:36:45 -04:00
Moody Salem
1e1a049990
Add more unit tests to utils 2020-05-13 14:24:03 -04:00
Ian Lapham
3a2566b4e7
Changes to useReserves, escapreRegex moved to utils, code cleanup (#762)
* bug fixes on non-existent vs no reserves, fix scanning on pair search, small ui tweaks

* remove unused vars

* remove mainnet in injected connector

* code cleanup for pr

* update pair value check
2020-05-13 14:16:52 -04:00
Moody Salem
c9db5fb276
Change slippage calculation in trade page as discussed (#756)
* Change slippage calculation in trade page as discussed

* Revert test change

* Fix the missing import
2020-05-13 13:59:54 -04:00
Moody Salem
1cbf67872b
Remove pair that is no longer used from the exchange page 2020-05-13 13:37:06 -04:00
Moody Salem
38947fe760
Remove trade errors about insufficient liquidity that only show up if there's a route (best trade will not return a trade if there is insufficient liquidity) 2020-05-13 13:24:55 -04:00
Moody Salem
31f72a541b
Clean up transaction modal behavior with new store 2020-05-13 12:58:20 -04:00
Moody Salem
287f64cf5c
Fix a redux error from passing a BigNumber to the store 2020-05-13 10:59:51 -04:00
Moody Salem
822f9e5fe2
Connect integration tests (#757)
* Connect a testing wallet

* Replace with a funded address

* Fix the balance checking and adding logging
2020-05-13 08:29:54 -04:00
Moody Salem
6781fce58e
Fix linting error again! 2020-05-12 18:17:26 -04:00
Moody Salem
4398fef38f
Use yarn cache plugin to speed up GitHub test actions 2020-05-12 18:14:39 -04:00
Moody Salem
ef65943659
Rewrite tx store (#754)
* Rewrite the transaction store

* Working state

* Fix lint errors

* Just always call getSigner
2020-05-12 18:11:10 -04:00
Moody Salem
19a53cd999
Rewrite localstorage context (#749)
* Rewrite the local storage context into a redux store for user data

* Separate out the mega methods

* Fix infinite loop

* Missing dependency

* Missing dependency, rename version field
2020-05-12 14:46:58 -04:00
Noah Zinsmeister
b28ad2865d
add v1 slippage checks (only for mainnet) (#746)
* add v1 slippage checks (only for mainnet)

* Add v1 trade notification UI

* Design tweaks

* add minimum delta

* remove dark theme toggle from menu

* only render view on etherscan if an address exists

* fix weird spacing on logged-in header

* lint error

* remove mainnet

Co-authored-by: Callil Capuozzo <callil.capuozzo@gmail.com>
2020-05-12 12:20:05 -04:00
Ian Lapham
0d4108937f
Ui changes (#747)
* copy changes

* remove unused input on toggle

* comparison fix
2020-05-12 11:48:42 -04:00
Moody Salem
6da8e2c84d
Introduce redux for one of the state stores (#742)
* Introduce redux for one of the state stores

* Remove unused state

* Clean up hooks

* Add types for react-redux and fix error from any type on useSelector

* Strongly type the web3 provider

* Make the popup content into a POJO

* Lint errors

* Clean up method call

* Fix lint error

* Fix lint error

* Lint
2020-05-11 18:23:01 -04:00
Moody Salem
ea015d16f2
Stop reloading fonts when light mode/dark mode switch 2020-05-11 17:02:10 -04:00
Noah Zinsmeister
d40d81ca6a
noah changes (#739)
* remove duplicated prettier from dependencies

* use swr for allowances

* slight improvements to error cascading

* fetch totalsupply with SWR

fetch pairs with SWR (except persistent pairs, will be refactored later)

* fix lint error

* stop using pair context, instead store per-user pairs in local storage

* add more pairs to the default list

remove unnecessary isWETH

fix lint error

* add more bases to trade consideration

* fix lint warnings

* get SWR data on same schedule

* don't pass value if it's 0

fix WETH equality checks

* clean up fixed/significant formatting

* fix slippage calculation bug in swap

add slippage to remove

* fix token logos

* show fewer sig figs

* lint error

* remove unused signer

* add calculateSlippageAmount safety check and tests

* fix useAllBalances type

stop spuriously sorting token amounts of different tokens

use slightly better comparisons for slippage calculations

* improve priceSlippage comparison logic

* useReserves -> usePair

* use checksum for DAI logo address
2020-05-11 16:39:05 -04:00
Callil Capuozzo
dba6abadf5
UI/UX tweaks (#740)
* Prepare for V2 testing

* Bug fixes and tweaks

* Add form link

* Design tweaks

* higher quality favicon

* Favicon... again.

* Start dark mode

* Add dark toggle

* New dark theme unicorn

* fix connect wallet ui

* Titles for fields && small UI/UX tweaks

* Fix ts linter errors

* UI/UX tweaks

* rebass and change color names

* v1/v2 toggle and color tweaks

* Small header tweaks

* fix account input mobile padding

* remove unused imports

* Fix header link

* Theme toggle for mobile & fix

* no acount? hide maxes

* Use system theme unless toggled

* Remove unused styles

* Fix missing hooks dependencies

* Fix linting errors

* improve system dark mode listener

* add listener

* fix hook dependency

Co-authored-by: Ian Lapham <ianlapham@gmail.com>
Co-authored-by: Noah Zinsmeister <noahwz@gmail.com>
2020-05-11 15:12:38 -04:00
Moody Salem
4131268b8e
Icons (#744)
* Manifest icons

* Add touch icons
2020-05-11 14:02:49 -04:00
Moody Salem
c365a5ec33
Add some integration tests (#743) 2020-05-11 09:03:44 -04:00
Moody Salem
ee92df1554
Handle insufficient reserves/input errors without crashing 2020-05-09 12:41:21 -04:00
Moody Salem
f1ccd7a166
Fix horizontal scrolling on small screens & add some small padding 2020-05-09 10:55:41 -04:00
Ian Lapham
7c43023860
fix DOM warnings (#741)
* fix DOM warnings

* Update index.tsx

Co-authored-by: Noah Zinsmeister <noahwz@gmail.com>
2020-05-08 23:58:40 -04:00
Moody Salem
843d5e790a
Done with linter errors! 2020-05-08 18:32:36 -04:00
Ian Lapham
40a7cea6f6
Bug fixes, UI tweaks (#738)
* linking bug fixes, search UI tweaks

* search style tweaks

* organize imports
2020-05-08 17:22:19 -04:00
Moody Salem
e023a02037
Use eslint/prettier for typescript files (#737)
* Use eslint/prettier for typescript files

* Fix more linting errors

* Turn linting errors off so CI passes
2020-05-08 16:15:45 -04:00