Commit Graph

98 Commits

Author SHA1 Message Date
William O'Beirne 33f5ede22a Minor swap rates refactor (#1162)
* Refactor swaps:
* Remove references to bity fallback, it aint happening
* Consolidate sagas to single orchestrator function like other sagas
* Grab rates once, dont continuously poll

* tscheck

* Re-instate the auto-fetching behavior. This time, only notify the first time.

* Make CurrentRates responsible for redux actions. Fix up some typings.

* Remove commented code.

* Update snapshot.
2018-02-24 19:29:34 -06:00
William O'Beirne 31912c0f83 Gas Price Estimates API (#1050)
* Setup api / reducers / actions for gas.

* Implement gas price saga, fetch from component, and loading states. Blocked on CORS.

* Implement caching mechanism.

* Add tests for gas saga and reducer.

* More testing.

* Indicate that gas price is recommended when fetched from API.

* Hide track while loading.

* Fix tscheck.

* Check gas estimate before assuming its ok.

* Check for correct logical order of gas prices.

* Tscheck fixes.
2018-02-16 13:01:39 -06:00
William O'Beirne be61d804e0 Check Transaction page (Pt. 1 - The Basics) (#1099)
* Component layer and routing for transaction status.

* Initial start on redux for transactions.

* Initial crack at reducer / actions / saga for transactions.

* Finish off check transaction saga, reducer, component, and page.
2018-02-16 10:57:23 -06:00
HenryNguyen5 01fc5f1a89 Move Nodes/Networks to Redux (#961)
* Start splitting networks into their own reducers

* Split out nodes and networks into their own reducers

* Cleanup file structure

* Make selectors for new state

* Change custom network typing

* re-type repo

* Fix up components to use selectors, work on fixing sagas

* Provide consistency in naming, fix more sagas

* Get non web3 node switching working

* Split config rehydration off into a different file for store

* Inline auth for custom nodes

* Include typing for app state

* moar selectors

* Get web3 working + cleanup sagas

* Cleanup tsc errors

* Use forof loop instead of foreach for clearing pruning custom networks

* Add reducer tests for new redux state

* Export needed variables

* Add console error

* Remove old comment

* Work on saga tests

* Get passing existing saga tests

* Fix more tests

* Remove irrlevant tests

* add console error

* Get rest of tests passing

* Fix merge errors

* Remove random text

* Fix store saving

* Fix selector lib only grabbing from static nodes

* Fix custom node removal crashing app

* Infer selected network via node

* Prune custom networks properly on node removal

* Infer network name from chainid from selecting state

* Cleanup tsc errors

* Remove MEW nodes for main and testnet
2018-02-12 14:43:07 -06:00
aitrean df4b73721a Refresh balance button (#1027)
* Refresh balance button.

* Refresh balance button.

* Move refresh.svg

* Remove previous svg.

* Map action with saga.

* Fix travis build (on prettify).

* Move refresh button in-line with account balance

* Update styles
2018-02-08 01:22:32 -06:00
Daniel Ternyak e7f88a6a0a
Remove redux-promise-middleware (#1022)
* Use shapeshift for all swaps.

* Replace existing redux-promise-middleware based CCRequest action with saga based action.

* Remove module from package.json, store middleware, webpack_config.

* fix snapshot

* Add return typing

* Add test for saga
2018-02-07 17:59:55 -06:00
HenryNguyen5 2a4ad180d3 ENS Resolving (#942)
* Refactor BaseNode to be an interface INode

* Initial contract commit

* Remove redundant fallback ABI function

* First working iteration of Contract generator to be used in ENS branch

* Hide abi to clean up logging output

* Strip 0x prefix from output decode

* Handle unnamed output params

* Implement ability to supply output mappings to ABI functions

* Fix null case in outputMapping

* Add flow typing

* Add .call method to functions

* Partial commit for type refactor

* Temp contract type fix -- waiting for NPM modularization

* Remove empty files

* Cleanup contract

* Add call request to node interface

* Fix output mapping types

* Revert destructuring overboard

* Add sendCallRequest to rpcNode class and add typing

* Use enum for selecting ABI methods

* Add transaction capability to contracts

* Cleanup privaite/public members

* Remove broadcasting step from a contract transaction

* Cleanup uneeded types

* Refactor ens-base to typescript and add typings for ENS smart contracts

* Migrate ens-name-search to TS

* Add IResolveDomainRequest

* Fix rest of TSC errors

* Add definition file for bn.js

* Remove types-bn

* Fix some typings

* make isBN a static property

* progress commit -- swap out bignumber.js for bn.js

* Swap out bignumber for bn in vendor

* Change modn to number return

* Start to strip out units lib for a string manipulation based lib

* Convert codebase to only base units

* Get rid of useless component

* Handle only wei in values

* Use unit conversion in sidebar

* Automatically strip hex prefix, and  handle decimal edge case

* Handle base 16 wei in transactions

* Make a render callback component for dealing with unit conversion

* Switch contracts to use bn.js, and get transaction values from signedTx instead of state

* Get send transaction  working with bn.js

* Remove redundant hex stripping,  return base value of tokens

* Cleanup unit file

* Re-implement toFixed for strings

* Use formatNumber in codebase

* Cleanup code

* Undo package test changes

* Update snapshot and remove console logs

* Use TokenValue / Wei more consistently where applicable

* Add typing to deterministicWallets, fix confirmation modal, make UnitDisplay more flexible

* Split different ENS modes into their own components

* Fix Abi typedef

* Remove redundant moment type package

* Add Aux helper component

* Split out resolve components

* Make 'to' parameter optional

* Change import type

* Change typing to be base domain request

* Split handling of resolving into object handler

* Fix countdown component

* Adjust element spacing

* Implement reveal search functionality

* Add unit display for highest bidder

* Fill out forbidden/NYA modes

* ENS wallet component skeleton

* Clean up prop handling in UnitDisplay

* Change instanceof to typeof check, change boolean of displayBalance

* Add ENS wallet component

* Cleanup spacing

* Convert ConfModal for bidding in ENS

* Make ui component for placing bids

* Fix destructure in placeBid

* Pass through entire wallet

* Remove text center

* Display inline notification ENS isValid & add some ENS tests

* Add export of Aux

* Reformat with prettier

* progress...

* Add ENSUnlockLayout

* Add RevealBid component

* organize NameResolve components

* Merge ENS with transaction-refactor changes

* Fix address resolution

* Update styles

* convert ens name to lowercase before checking

* Add overflow-y:scroll to table

* update ens snapshots & tests

* cast 'undefined' state argument as any for testing

* clean up components

* Connect unitconverter to redux state

* remove unnecessary type assertion

* fix spinner size

* remove old bidmodal

* validate bidmask before opening modal

* progress...

* Update styles

* Add saga / actions for placing a bid

* Update types & clean up dead code

* Delete old test

* Dispatch PlaceBidRequested acitons

* Progress commit -- get ENS bidding ready for tx generation via sagas

* Seperate ENS action creators and types

* Add reducer & actions for ENS fields

* Add preliminary sagas for bid mask and bid value

* Fix ts errors

* Get bidding fields connected with some validation

* Clean up generate bid

* Hook up generate bid to redux state

* Get bid data generation working

* Add support for bidding on already open auctions

* Move bid generation states to redux, improve default field values

* Remove generate bid component

* Throttle bid generation

* Progress commit -- Bid Modal

* Hook bidmodal component up to bidding component

* Update template modal to handle custom confirm behavior

* Remove old redux bidding actions, add new one for downloaded bids

* Save downloaded bids to local storage

* Finish bidding modal

* Fix gas estimation bug

* Fix typing

* Remove bidding related functionality

* Get passing unit tests

* Make previous test more comprehensive

* Fix ts errors

* Remove commented code

* Fix invalid return

* Remove implementation of revealing bid

* Update snapshot

* Fix tests

* Delegate bidding to V3
2018-02-05 13:40:33 -06:00
Daniel Ternyak 84bae60c02
Refactor Generate Transaction (#960)
* Make generic modal

* Allow generic modals to be injected into send button component

* Refactor generate transaction, cleanup transaction sagas, simplify signing process

* Get passing unit tests

* Make previous test more comprehensive

* Fix ts errors
2018-01-29 16:58:07 -06:00
William O'Beirne d1a2c885a2 Performance Improvements (Pure components, debounced gas slider) (#899)
* PureComponent a ton of non-connected components.

* Debounce gas price slider. Keep gas price in state to reflect changes immediately.

* PureComponent balance sidebar and swap unconnected components.

* Import correct component.

* Move debouncing of gas slider to sagas via gasPriceInputIntent action.

* Remove console log.

* Remove leftover file from merge.
2018-01-29 13:13:46 -06:00
James Prado f9c1134a16 Equivalent Values Bugfixes (#870)
Update <EquivalentValues /> component
Now works on non-ethereum networks
Update dropdown with new <Select /> from react-select
Calculates total value for all coins & tokens
2018-01-21 22:21:48 -06:00
Daniel Ternyak ab5fa1a799
Support Non-Ethereum Networks (#849)
* Make UnlockHeader a PureComponent

* MVP

* actually disable wallet format if not determined to be valid format for wallet

* default to correct derivation in mnemonic modal

* cleanup

* fix tslint

* use enums for HD wallet getPath

* Add stricter typing

* Fix labels not updating on selector

* Ban hardware wallet support for custom network unsupported chainIds

* Fix type error

* Fix custom node dPath not being saved

* Fix mnemonic modal

* default path bugfixes

* add react-select

* misc fixes; rabbit holing hard.

* fix tslint

* revert identicon changes

* reload on network change :/

* actually reload on network change

* really really reload on network change

* tslint fixes

* Update styles

* set table width

* fix package versioning

* push broken sagas

* Fix saga test

* fix tslint

* address round of review

* move non-selectors out to utilty; adjust reload timer

* cleanup network util comments

* manage wallet disable at WalletDecrypt instead of in both WalletDecrypt and WalletButton

* Separate WalletDecrypt props into ownProps / StateProps

* disable payment requests on non-eth networks

* specialize connect; separate props

* remove unused state prop

* remove bad import

* create tests for networks

* Clarify Lite-Send error on non-ethereum networkS

* remove string option for network config name

* Create concept of always-on 'EXTRA_PATHS'; include SINGULAR_DTV legacy dPath in 'EXTRA_PATHS'

* fix multiple imports

* address PR comments
2018-01-20 14:06:28 -06:00
James Prado 6108d08693 Improved Gas Estimate UX (#830) 2018-01-15 03:59:59 -06:00
HenryNguyen5 67b2e6491c ENS Resolution for AddressField Component (#807)
* Refactor BaseNode to be an interface INode

* Initial contract commit

* Remove redundant fallback ABI function

* First working iteration of Contract generator to be used in ENS branch

* Hide abi to clean up logging output

* Strip 0x prefix from output decode

* Handle unnamed output params

* Implement ability to supply output mappings to ABI functions

* Fix null case in outputMapping

* Add flow typing

* Add .call method to functions

* Partial commit for type refactor

* Temp contract type fix -- waiting for NPM modularization

* Remove empty files

* Cleanup contract

* Add call request to node interface

* Fix output mapping types

* Revert destructuring overboard

* Add sendCallRequest to rpcNode class and add typing

* Use enum for selecting ABI methods

* Add transaction capability to contracts

* Cleanup privaite/public members

* Remove broadcasting step from a contract transaction

* Cleanup uneeded types

* Refactor ens-base to typescript and add typings for ENS smart contracts

* Migrate ens-name-search to TS

* Add IResolveDomainRequest

* Fix rest of TSC errors

* Add definition file for bn.js

* Remove types-bn

* Fix some typings

* make isBN a static property

* progress commit -- swap out bignumber.js for bn.js

* Swap out bignumber for bn in vendor

* Change modn to number return

* Start to strip out units lib for a string manipulation based lib

* Convert codebase to only base units

* Get rid of useless component

* Handle only wei in values

* Use unit conversion in sidebar

* Automatically strip hex prefix, and  handle decimal edge case

* Handle base 16 wei in transactions

* Make a render callback component for dealing with unit conversion

* Switch contracts to use bn.js, and get transaction values from signedTx instead of state

* Get send transaction  working with bn.js

* Remove redundant hex stripping,  return base value of tokens

* Cleanup unit file

* Re-implement toFixed for strings

* Use formatNumber in codebase

* Cleanup code

* Undo package test changes

* Update snapshot and remove console logs

* Use TokenValue / Wei more consistently where applicable

* Add typing to deterministicWallets, fix confirmation modal, make UnitDisplay more flexible

* Split different ENS modes into their own components

* Fix Abi typedef

* Remove redundant moment type package

* Add Aux helper component

* Split out resolve components

* Make 'to' parameter optional

* Change import type

* Change typing to be base domain request

* Split handling of resolving into object handler

* Fix countdown component

* Adjust element spacing

* Implement reveal search functionality

* Add unit display for highest bidder

* Fill out forbidden/NYA modes

* ENS wallet component skeleton

* Clean up prop handling in UnitDisplay

* Change instanceof to typeof check, change boolean of displayBalance

* Add ENS wallet component

* Cleanup spacing

* Convert ConfModal for bidding in ENS

* Make ui component for placing bids

* Fix destructure in placeBid

* Pass through entire wallet

* Remove text center

* Display inline notification ENS isValid & add some ENS tests

* Add export of Aux

* Reformat with prettier

* progress...

* Add ENSUnlockLayout

* Add RevealBid component

* organize NameResolve components

* Merge ENS with transaction-refactor changes

* Fix address resolution

* Update styles

* convert ens name to lowercase before checking

* Add overflow-y:scroll to table

* update ens snapshots & tests

* cast 'undefined' state argument as any for testing

* clean up components

* Connect unitconverter to redux state

* remove unnecessary type assertion

* fix spinner size

* remove old bidmodal

* validate bidmask before opening modal

* progress...

* Update styles

* Add saga / actions for placing a bid

* Update types & clean up dead code

* Delete old test

* Dispatch PlaceBidRequested acitons

* Progress commit -- get ENS bidding ready for tx generation via sagas

* Seperate ENS action creators and types

* Add reducer & actions for ENS fields

* Add preliminary sagas for bid mask and bid value

* Initial commit

* Add loading indicator

* Remove some bidding components

* Revert bidding files

* Remove more bidding code

* Remove rest of bidding code

* Fix ENS error message

* Revert value saga changes

* Remove error param from setting 'To' field

* Fix existing ENS test

* Cleanup address resolution, remove dead code

* Remove error messages from unimplemented ENS

* Fix last character being not set bug

* Remove error state from Meta

* Rename isGenesisAddress to isCreationAddress
2018-01-15 03:57:09 -06:00
Olajide Ogundipe Jr 303e44abb3 Onboarding Modal (#611)
* [WIP] Start port of V3 Modal

* allow lambda functions in React Components

* lint code

* add null case for modalRef

* fix action test

* reduce onboard slide boilerplate

* delete images and componentize OnboardSlide

* comment out info onboarding message

* fix merge conflict

* fix prettier error

* revert tslint file

* fix type in modal

* add translations to onboard modal

* add in images, fix stlyes
2018-01-11 12:13:14 -06:00
William O'Beirne 4f6e83acf4 Better Offline UX (#785)
* Check offline status immediately.

* If they start the page offline, show a less severe error message.

* Get rid of offline aware header. Disable wallet options when offline.

* Add online indicator to the header.

* Prevent some components from render, some requests from firing when offline.

* Allow for array of elements with typing.

* Dont show dollars in fee summary when offline.

* Fix up saga tests.

* Fix sidebar component offline styles.

* Remove force offline.

* Dont request rates if offline.

* Nonce in advanced, show even of online.

* Show invalid advanced props.

* Fix up offline poll tests.
2018-01-11 12:04:11 -06:00
aitrean af2e0b69e1 Web Worker Decrypt (#680)
1. Attempt an empty password every time a keystore is uploaded.
2. Delegate scrypt decryption (ie ethereumjs-wallet.fromV3) to its own web worker and interface with it through an async typescript function that gets handled in the wallet saga. This keeps the UI unblocked when scrypt takes a long time to decrypt.
3. Add logic to show a spinner x number of milliseconds after file upload so the user will understand when a wallet is being decrypted.
2018-01-11 00:44:13 -06:00
William O'Beirne 6e2b74c79a Use network unit everywhere, fix network redux state (#765)
* Use network unit in confirmation modal. Make sure network is set at init.

* Fix token display

* Ensure that when the node changes, the network also changes. Show network unit in unit dropdown.

* Type saga, fix tests.
2018-01-09 14:13:14 -06:00
William O'Beirne 6ec04f6731 Fix ENS Address Field (#724)
* Fixed borked tag.

* Fix saga tests.

* fix tscheck error
2018-01-08 01:12:16 -06:00
William O'Beirne edda9f71ea Improved Gas UX (Pt. 1 - Gas Slider on Send) (#728)
* Initial crack at simple only gas slider component.

* Work on advanced component. Refactor redux and components to specify gas limit vs price.

* Convert fee summary to a render cbesque thing.

* Rework responsive columns.

* Remove force offline button.

* Tweak styles.

* Fix tscheck issues, remove unneeded prop.

* Fix references to GasField

* Gas slider in lite send.

* Make gas slider network-aware for symbol and price calculation.
2018-01-07 10:43:06 -06:00
Eddie Wang 88532cdc3c Shapeshift Integration (#564)
* progress

* Normalize bity api response

* Filter api response

* Track swap information in component state

* Update dropdown onchange

* remove dead code

* Update Min Max Validation

* Update minmax err msg && fix onChangeOriginKind

* Add origin & destination to redux state

* Update types & Update tests

* Update types

* Update swap.spec.ts test

* Remove commented out code

* Remove hardcoded coin array

* Create types.ts for swap reducer

* Update swapinput type

* Update bityRates in localStorage & Replace all instances of ...Kind / ...Amount props

* Add shapeshift banner

* initial work for sagas

* Update Types

* Update swap reducer initial state

* Update Types & Store empty obj for bityRates / options

* Update more types

* added shapeshift file and rates comments

* action reducers and prop mapping to components

* add typings and swap icon

* more actions reducers and sagas

* debugging shapeshift service

* add Headers

* Fix content type

* add order reset saga and ui fixes

* remove console log and swap b/w Bity and Shapeshift

* working state for Shapeshift and Bity - tested with mainnet

* add icon component

* UI improvements and fix select bug

* fix timer bug

* add bity fallback options and toFixed floats

* tslint errors

* add arrow to dropdown and add support footer

* Add service provider

* fix minor $ bug and stop timer on order complete

* better load UX and dropdown UX

* fixed single test

* currRate prop bugs and reduce LS bloat

* takeEvery on timer saga and don't clear state.options to restartSwap reducer

* export tx sagas and fix minor type

* Add ShapeShift Rates functionality when selecting a ShapeShift pair.

* type fixes

* BugFix: Don't change displayed ShapeShift Rate Inputs on every dropdown change
Also contains some caching / performance improvements

* BugFix: Don't remote rate inputs when falsy amount

* fix type error

* Progress commit

* Implement saga logic

* Make address field factory component

* Shorten debounce time

* Make new actions / sagas  for handling single token lookup

* Implement working version of litesend

* Change saga into selector

* Add failing spec

* fix broken test

* add debounce to error message

* fix tests

* update snapshots

* test coverage

* move setState disabled property from debounce so we instantly can go to next step on valid amounts

* much deeper test coverage, fix debounce ux, and fix bity flashing at swap page load

* fix minor failing test

* seperate shapeshift erc20 token whitelist

* fix saveState store bug

* break orderTimeRemaining saga up and rewrite tests

* add new swap icon

* remove unused allowReadOnly prop

* change offlineaware to walletdecrypt for litesend

* fix LiteSend changewallet bug

* fix error message UX

* fix button styling to match develop

* fix liteSend test

* Fix LiteSend UX on unavl tokens, dropdown null value, and don't show decrypt in litesend after successful wallet decrypt.

* add litesend network check
2018-01-02 12:04:50 -06:00
William O'Beirne 6513acd03d Generate Mnemonic Wallet (#659)
* Initial work at splitting out generate into two flows.

* Finish mnemonic flow.

* Convert keystore to state-based component. Remove all redux generate stuff. Remove generate help section. Fix styles.

* Add back button, switch to routing instead of state for generate pages.

* PR feedback.

* Alertify warning at generate. Linkify alternatives. Fix some alert link styles.
2017-12-28 13:54:07 -06:00
HenryNguyen5 f39787152e Fix Miscellaneous Types (#635)
* Add repo wide prettier command to prepush

* Make config file explict, remove formatAll to prepush

* Fix react router typings

* Add more typings

* Fix event typings,  fix transition children
2017-12-19 16:46:34 -06:00
HenryNguyen5 da93fb1684 Prettier Reformat (#619)
* Add repo wide prettier command to prepush

* Make config file explict, remove formatAll to prepush
2017-12-18 17:29:26 -06:00
HenryNguyen5 08d4ccbdae Productionize Transaction Stack (#456)
* export conditional input and hoc

* Move typings and fields out of send transaction

* Move fields into their own component for decoupled handling, use conditional inputs to simplify disabled components

* Handle hex and non hex strings automatically in BN conversion

* Fix handling of strings and numbers for BN

* add web3 fixes & comments

* Display short balances on deterministic modals

* add more tests, fix rounding

* Add spacer to balance sidebar network name

* Fix tsc error

* Add offline render CB

* Make more render callbacks

* Transform NonceField into its self contained component

* Remove styling from nonce field

* Better network handling in nonce cb

* Move network nonce initialization to componentDidMount

* Remove unessesary conditional input

* Make nonce component return a BN

* Simplify Query render cb

* Add gas query and token query render cbs

* Re-write address field component, strip out ENS name functionality for now

* Add address and data as unit types

* Cleanup Address Field component

* Export gas query

* Re-write gas field component

* Cleanup gas estimation check

* Re-write Data field

* Transaction field skeleton

* Export transaction field actions

* Rename fields to map to ethtx fields

* Make reducers for fields

* Fix reducer module exports

* Export reducer

* Formatting fix

* Type return of GasQuery

* Add transaction field getter / setter component

* Make transaction fields more flexible

* Formatting fix

* Split transaction fields component into two

* Remove erroneous prop

* Fix field naming to follow ethereum transaction fields

* Merge valid prop into componeent

* Change address field to be redux based

* Convert nonce field to redux based

* Make component for passing in current transaction

* Re-write Gas component to use redux state

* Reduxify data field component

* seperate transaction fields redux state into field data and meta data

* Rename SetTransactionFields to be singular

* Make render callback components for getting/setting meta fields

* Add non-zero option prop for token balance render cb

* re-write unit dropdown component to be redux based

* Make ether the first option

* Fix tsc error on tokenquery

* Handle query string default values in unit drop down

* Add thunks to package

* Add helper function for encoding transfer data

* Handle co-dependencies between fields via thunks, seperate value fields into ether and token based

* Fix wrong typing

* Add token metafield as export

* Start scaffolding out amount field component

* Make render cbs for conditional selection of value and balance

* Make render callbacks nullable

* Progress commit -- get dynaming swapping between tokens and ether working

* Get gas estimation working between ether and tokens

* Remove nonce from breaking gas estimation

* Add better validation for amount field

* Add 500ms debounce to gas saga

* Self contain custom message component

* Add web3 awareness to wallet render cb

* Add render cb for checking if  wallet is unlocked

* Cleanup inline typing

* export available params

* Add render cb to render component when a query string exists

* Add boolean callback param that check that the transaction is filled by user

* Remove uneeded typings from send transaction

* Fix misnomer

* Self contain generate transaction button

* Compartmentalize more send transaction components

* Add query string warning, custom message and generate tx button to fields

* Cleanup send tx component with new components

* export render callbacks

* saga transaction scaffolding

* make gas saga fully declarative

* transaction lib renaming

* Seperate gasprice into its own generator

* Make action creators for tx sign actions

* Clean up signing saga, introduce reducer for signing, make HW wallet libs compatible with new tx format, fix some typing with ethereumjs-tx

* Add TransactionComparison component

* Add pushTx

* Progress commit --  Streamline web3 and local signing / broadcasting flows. Need to still implement reducers for broadcasting and notifications

* Get local transaction broadcasting working

* re-write confirmation modal to be redux based

* Fix spacing and import

* Move confirmation modal to be attached to send button, create send button

* Properly handle broadcasting for conf modal

* Handle gas cost > balance for send everything

* Add signing status as its own component (#454)

* Fix ledger errors not showing on notifs

* Make dedicated actions for swapping from tokens to ether and ether to tokens

* Split actionTypes file

* Cleanup comments

* Cleanup comments

* Fix various tsc errors

* Lay down infrastructure for saving configurations per-wallet.

* Add pending and rejected states properly to token values.

* Add custom token form improvements.

* Fix metamask transaction errors

* Fix send entire balance estimation

* Fix add token form from never being enabled.

* Initial pass at account tab with send and view wallet tabs.

* Fix inactive tab.

* Hide private key, toggling

* Progress commit -- Replacing render callbacks with selectors, put  validation logic in sagas

* Moved the restore keystore functionality to view wallet info, and put it in a modal / util file.

* Fix navigation link active

* Force read only wallets to info tab.

* Remove commented code

* Saga-ify send everything

* Scan for new tokens, track saved tokens, only request tracked tokens on initial load.

* Add custom token to current wallets tracked tokens.

* Rework remove token icon.

* Adjust button margin

* Remove the rest of the needless render callbacks for selectors, sagaify nonce

* Bug fix send transaction

* remove unused redux-thunk

* Move fields to general components

* Clean up saga structure

* Refactor broadcast tx

* Implement better validation logic, get contract deploy working

* PR feedback.

* Convert tokenbalances component to connected redux component.

* Addressed feedback from Henry.

* Progress commit -- Implement Interact logic, needs manual testing

* Get rid of commented code

* move exports after declarations

* add tests, rough draft

* Get contract method calls working

* Bugfix contracts

* Cleanup hex prefixing

* Reset transaction state on wallet change

* Get rid of old send transaction component

* Disable sign transaction button when network request is underway

* Flatten send button tree, make nonce human readable in confirmation modal

* Add ghetto cost breakdown component, fix token field validation

* Create Generic SubTab and use in Send

* MVP of mnemonics with sub-tabs in Create Wallet view.

* Do dynamic revalidation

* move exports after declarations

* add forgotten signing tests

* update token spec

* update currentValue spec

* update validationHelpers spec

* Address TODO - use injected history to push navigation state instead of hardcoding window.location

* Use SubTabs in Contracts

* Fix revertPath prop for AcceptOrRedirectModal

* Use subtabs in SignAndVerifyMessage

* Routing for subtabs

* Fix routes, adjust sizing.

* Remove unused import

* Request nonce in base 10

* Add offline override to unit display

* Make cost breakdown less buggy

* Add non standard transaction warning

* Fix amount validity

* Cleanup datafield validity

* Display notif on gas estimation failure

* Add post-signing verification against fields, clean up gas price

* Fix tsc errors

* Code cleanup

* add exports to functions

* add specs for sendEverything and reset sagas

* delete duplicate files

* make tslint happy

* Merge develop

* Fix develop regressions

* Delegate nonce pulling  to wallet being set

* Clarify non standard transaction

* Make address a buffer to avoid leading 0's bug

* Clarify validation helper comment

* Increase debounce time, add console error

* Better validation for non-standard transactions

* Add verification skipping for broadcasting txs

* Fix state and wallet resetting for contract tabs

* Fix some spec files, remove contract.spec

* Remove broadcasting specs from wallet

* Close DeterministicWalletModal on confirm

* Revert "Close DeterministicWalletModal on confirm"

This reverts commit 16c860e854ca29e9de754164d8be5e24f722cbad.

* Reset hardware wallet state on unlocking. Dont render walletdecrypt content when its hidden.

* Fix client side broadcast checking

* Add more state resetters in error scenarios

* Fix gas estimation

* Add validation for value transactions to contract creation

* Add transaction comparaision differentiation depending on wallet type

* Fix token row display balance showing twice

* Properly handle failed transactions

* Handle bad error messages

* fix broken tests

* fix broken test

* Progress commit -- Implement generic subtab types

* Remove react router v3

* Remove unused routes

* Clean up Tabbing code, add onTabChange handler

* Fix tests

* Add nav fix

* revert opinionated sub-tab implementation

* additional reverts

* Add decimal validation

* Make gas price single source of truth, dont save any transaction state other than gas price

* Get rid of old wallet.spec reducer tests

* Add decimal validation when re-validating gasCost

* remove utilities view

* Remove cost breakdown

* Remove local gas estimation warning

* Create getShownTokenBalances selector; use in UnitDropDown and Equivalent Values

* Convert reducers to switch case

* Clean tsc errors

* Fix failing test

* fix tscheck error

* Add number validation to gas field

* Fix misaligned input dropdown

* Revert "Fix misaligned input dropdown"

This reverts commit a40a4c0e8d52471dea01e6727f741a737b798695.

* Set window timeout long enough for node switch to be persisted to state

* Transaction Refactor Style Fixes (#615)

* Fix unit dropdown alignment by rendering it in AmountField, and fixing a missed bootstrap case.

* Fix modal amount and gas text.

* Fix misaligned dropdown

* Update conditions for NavLink is-active class
2017-12-18 15:23:31 -06:00
James Prado 72e30643a9 Normalize Swap Reducer (#443) 2017-12-11 09:44:53 -08:00
William O'Beirne 6cb0ebff5b Fix EquivalentValue crash on invalid tokens (#511) 2017-12-01 14:40:27 -06:00
William O'Beirne b638b746de Custom Nodes - Final Touches (#501)
* Add warning about matching nodes, only allow one url:port combination of nodes.

* Fix up alert styling.

* Custom network form.

* Add custom network to redux store. Setup infrastructure for removal and display.

* Persist custom networks to LS, show them in display.

* Force chain id, make typing happy.

* Display custom networks in network dropdown.

* Fix form validation, purge unused custom networks.
2017-12-01 10:09:51 -06:00
Eddie Wang 980366694c RPC Error Handling (#384)
* create ensureOkResponse and check against RPC responses

* Merge with develop branch

* added single unit test

* main nodes added

* getBalance method

* remove console.log

* minor conflict fix - readd polyfill to integration test

* added two more method tests

* seperate rpcnode from extended classes

* fixes etherscan

* added all tests

* revert files with only formatting changes

* remove console.logs - still need to update snapshot before tests will pass

* updated snapshot due to RpcNode fixes for Infura and Etherscan nodes

* added RpcNodeTest config so we don't rely on constants in code

* undo formatting changes

* Multiple fixes to error handling tokens.

* Fixed TSC errors

* Minor styling edit - change async func to promise

* changed shape of tokenBalances

* change balance type back to stricter TokenValue type

* remove package.json change and include test for error state.

* minor change removing unneeded line of code

* added longer timeout for api

* update snapshot
2017-11-29 23:35:17 -06:00
skubakdj 6c09e7160a Saga Testing (#415)
* add exports to config saga, refactor

* add config saga tests

* add exports to necessary files

* add remaining saga test & snapshots

* update orders saga spec to use Infinity constant

* update dWallet saga spec snapshot

* refactor config saga slightly

* update config saga spec

* update config saga snapshot

* update rates saga spec

* remove unused vars from config saga spec
2017-11-29 22:07:16 -06:00
William O'Beirne 5b07395ee4 Throw on CryptoCompare API error (#486)
* Throw properly on API error.
2017-11-29 13:45:38 -06:00
William O'Beirne 1221a73a46 Better Offline Detection / Handling (#478)
* Change navigator.onLine to actually pinging the network. Refactor notifications to take Infinity instead of 'infinity'

* Stop polling when forced offline.

* Show spinners if unit display balance is null, show offline text if were actually offline.

* Fix issue with typescript and connected union-prop components.

* Only ping the node when navigator.onLine changes.
2017-11-28 18:17:26 -06:00
William O'Beirne c0cd668c64 Custom Nodes (#322)
* Layed out components for custom nodes.

* Outline of custom nodes. Still missing various features and error handling.

* Persist custom nodes to local storage.

* Make custom nodes removable.

* Add latest block functions, call it when switching nodes.

* Initialize correct node, move node utils into utils file.

* Fix names

* Send headers along with rpc requests.

* Remove custom network options for now.

* PR feedback.

* One last log.

* Fix tests.

* Headers in batch too.

* Switch to node when you add it.

* Reduce hackery.

* Clean up linter and tsc.

* Fix latest block hex conversion.

* Unit tests.

* Fix missing property.

* Fix Modal title typing.
2017-11-18 14:33:53 -06:00
William O'Beirne 1510533ec7 Equivalent values for all tokens (ETH + ERC20s) (#420)
* Fetch all token rates at once. Add option for displaying all token values.

* Ensure spinner always shows before equivalent values are ready.

* Fix up test.
2017-11-18 14:15:02 -06:00
skubakdj c31490c8b4 Redux Reducer Tests (#390)
* set return type in resetWallet action creator

* update config reducer test

* update generateWallet reducer test

* update swap reducer test

* update wallet reducer test

* create customTokens reducer test

* create deterministicWallets reducer test

* create ens reducer test

* create notifications reducer test

* add crypto compare success/fail actions

* add rates reducer test

* remove unnecessary comments

* remove more comments

* remove duplicate import

* update wallet reducer test to use BN

* update dWallet reducer test to use BN

* update wallet reducer tests

* update rates reducer tests
2017-11-17 13:12:27 -08:00
William O'Beirne 8bc1a348c7 Equivalent Values for Tokens (#366)
* Add select with tokens.

* Reformat state shape to allow multiple currency rates. Show those rates when selected.

* Add loader
2017-11-14 23:51:09 -06:00
James Prado 0d5d0cea9a Wallet Loading States & Spinner Update (#334)
* Add disclaimer modal to footer

* Remove duplicate code & unnecessary styles

* Fix formatting noise

* remove un-used css style

* Fix tslint error & add media query for modals

* Nest Media Query

* Replace '???' with Spinner & update spinner

* Add loading states for wallet balances

* Update wallet test

* Remove excess data passed to wallet balance reducer & Fix wallet balance types

* Merge 'develop' into 'loading-indicator'

* Add 'light' prop to Spinner

* Only show spinners when fetching data

* Remove format diff

* Apply naming conventions

* Remove network name when offline
2017-11-14 21:44:55 -06:00
HenryNguyen5 8fe664c171 Replace bignumber.js with bn.js (#319)
* Add definition file for bn.js

* Remove types-bn

* make isBN a static property

* progress commit -- swap out bignumber.js for bn.js

* Swap out bignumber for bn in vendor

* Change modn to number return

* Start to strip out units lib for a string manipulation based lib

* Convert codebase to only base units

* Get rid of useless component

* Handle only wei in values

* Use unit conversion in sidebar

* Automatically strip hex prefix, and  handle decimal edge case

* Handle base 16 wei in transactions

* Make a render callback component for dealing with unit conversion

* Switch contracts to use bn.js, and get transaction values from signedTx instead of state

* Get send transaction  working with bn.js

* Remove redundant hex stripping,  return base value of tokens

* Cleanup unit file

* Re-implement toFixed for strings

* Use formatNumber in codebase

* Cleanup code

* Undo package test changes

* Update snapshot and remove console logs

* Use TokenValue / Wei more consistently where applicable

* Add typing to deterministicWallets, fix confirmation modal, make UnitDisplay more flexible

* Clean up prop handling in UnitDisplay

* Change instanceof to typeof check, change boolean of displayBalance

* Fix tsc errors

* Fix token row displaying wrong decimals

* Fix deterministic modal token display

* Handle hex and non hex strings automatically in BN conversion

* Fix handling of strings and numbers for BN

* add web3 fixes & comments

* Display short balances on deterministic modals

* add more tests, fix rounding

* Add spacer to balance sidebar network name

* Fix tsc error
2017-11-12 11:45:52 -08:00
skubakdj c9c147db52 Wallet Decrypt - Web3 (MetaMask / Mist) (#303)
* add support for web3, disabled, and hidden in node dropdown header

* add web3 node config actions

* add web3 wallet actions

* add web3 node support

* add web3 wallet & web3 wallet ui selection

* add web3 wallet & config sagas

* add web3 transaction support to SendTransaction tab

* add web3 node check & reset to redux store

* remove comments from Web3.tsx

* update comment

* correct spacing display issue in Web3 component

* convert getTransactionCount response to string

* disable web3 wallets in offline mode

* implement sendCallRequest method on Web3 node

* remove unused vars

* make typescript happy

* convert wallet constants to enum & apply to wallet action files

* update wallet reducer to use TypeKeys enum

* remove unnecessary console log

* remove unnecessary await

* make token balance math more readable

* use NewTabLink in Web3.tsx, allow NewTabLink to accept className

* move web3.ts to non-deterministic folder

* update imports & method names, implement message signing

* add web3 wallet export

* use bufferToHex
2017-11-09 19:30:20 -08:00
HenryNguyen5 3bea632a9a EthereumJS-Wallet (Part 2) (#310)
* Progress commit -- ethereumjs-wallet typings

* Add hdkey module + better wallet typing

* Add provider-engine typings

* Add jsdoc descriptions for hdkey constructor methods

* Fix missing return type

* Fix another missing return

* Make provider engine options optional

* Add priv/pubkey members to wallet instance

* Turn into SFC + Use ethereumjs-lib

* Use proper interface naming for V3Wallet

* Switch to ethereumjs-wallet

* Switch to ethereumjs-wallet and refactor using NewTabLink

* Use proper interface naming for V3Wallet

* Use proper interface naming for PublicKeyOnlyWallet

* Fix broken test, re-add scryptsy to make this PR pass

* Fix definition module for thirdparty wallets

* Decrease n-factor to 1024, checksum address of keystore

* Update typedef for react-dom from 15 to 16

* Lock react-dom, set typescript to 2.5.2
2017-11-07 10:42:53 -08:00
James Prado 2075a416ae Animate transaction notifications & fix styles (#305)
* Add disclaimer modal to footer

* Remove duplicate code & unnecessary styles

* Fix formatting noise

* remove un-used css style

* Fix tslint error & add media query for modals

* Nest Media Query

* Add react-transition-group

* Animate notifications with react-transition-group

* Identify issue with notifications getting overridden

* Update RTG (react-transition-group) to v2 & identify keys as animation issue

* Add unique id on successful transactions for unique keys

* update classNames, remove unused import

* Revert removing lodash

* Remove unnecessary test util

* Remove formatting noise

* Remove all formatting noise

* Update CSS & Change notification unique id

* Add unique id for each notification
2017-11-06 22:20:19 -08:00
HenryNguyen5 b94bede473 Add "No Unused Params and Locals" Linting Rule (#297)
Add "No Unused Params and Locals" Linting Rule
2017-10-18 19:29:49 -07:00
HenryNguyen5 efccac79ad Contracts UI (#277)
* Refactor BaseNode to be an interface INode

* Initial contract commit

* Remove redundant fallback ABI function

* First working iteration of Contract generator to be used in ENS branch

* Hide abi to clean up logging output

* Strip 0x prefix from output decode

* Handle unnamed output params

* Implement ability to supply output mappings to ABI functions

* Fix null case in outputMapping

* Add flow typing

* Add .call method to functions

* Partial commit for type refactor

* Temp contract type fix -- waiting for NPM modularization

* Misc. Optimizations to tsconfig + webpack

* Convert Contracts to TS

* Remove nested prop passing from contracts, get rid of contract reducers / sagas / redux state

* Add disclaimer modal to footer

* Remove duplicate code & unnecessary styles

* Add contracts to nav

* Wrap Contracts in App

* Add ether/hex validation override for contract creation calls

* First iteration of working deploy contract

* Delete routing file that shouldnt exist

* Revert "Misc. Optimizations to tsconfig + webpack"

This reverts commit 70cba3a07f4255153a9e277b3c41032a4b661c94.

* Cleanup HOC code

* Fix formatting noise

* remove un-used css style

* Remove deterministic contract address computation

* Remove empty files

* Cleanup contract

* Add call request to node interface

* Fix output mapping types

* Revert destructuring overboard

* Add sendCallRequest to rpcNode class and add typing

* Use enum for selecting ABI methods

* Fix tslint error & add media query for modals

* Nest Media Query

* Fix contracts to include new router fixes

* Add transaction capability to contracts

* Get ABI parsing + contract calls almost fully integrated using dynamic contract parser lib

* Refactor contract deploy to have a reusable HOC for contract interact

* Move modal and tx comparasion up file tree

* Include ABI  outputs in display

* Cleanup privaite/public members

* Remove broadcasting step from a contract transaction

* Update TX contract components to inter-op with interact and deploy

* Finish contracts-interact functionality

* Add transaction capability to contracts

* Cleanup privaite/public members

* Remove broadcasting step from a contract transaction

* Apply James's CSS fix

* Cleanup uneeded types

* Remove unecessary class

* Add UI side validation and helper utils, addresess PR comments

* Fix spacing + remove unused imports /  types

* Fix spacing + remove unused imports /  types

* Address PR comments

* Actually address PR comments

* Actually address PR comments
2017-10-16 21:01:28 -07:00
Daniel Ternyak b493a0c968 Offline Send (#276)
* offline-send mvp

* cleanup unneeded imports

* - create pollOfflineStatus action, action creator, interface

* expand UnlockHeader when collapse-button is clicked, instead of div

* kick-off pollOfflineStatus upon SendTransaction mount.

* Create sagas for polling offline status

* remove comment

* - create CONFIG_FORCE_OFFLINE action, action creator, interface

* Adjust OfflineToggle terms to "Force Online/Offline", and understand when forced offline and when really offline.

* - Assume offline in SendTransaction when either offline or forcedOffline

* - handle forceOffline action in reducer
- adjust state type / provide default state for forceOffline in config reducer

* adjust test to pass with different key name

* fix incorrect import

* - allow size to be specified in offline toggle

* - Decode and display nonce in confirmation modal

* - set default nonces when forced offline and have online connectivity based on transaction count
- pass nonce to generateCompleteTransaction
- refactor componentDidUpdate

* Allow optional nonce to be passed to generateCompleteTransaction

* - create stripHexPrefix function

* - cleanup sagas

* move getParam into helper util

* update address on component update

* - show spinner while transaction is being signed
- reset state when wallet instance changes (new wallet instantiated via UnlockHeader)

* center-align offline message

* Adjust force offline/online button text

* - validate nonces when offline
- only estimate gas when online
- don't show send tx button when offline

* - break generateCompleteTransactionFromRawTransaction into multiple functions.
- support offline generation in generateCompleteTransaction (and generateCompleteTransactionFromRawTransaction). Balance checking is now only done when not offline to support offline generation.

* Create Help component (to be used as a tooltip)

* Disable hardware wallets when offline.

* Hide Send Entire Balance when balance is falsy

* Show help icon in nonce field.

* - show helper instructions on how to broadcast when user is offline after generating a tx
- hardcoded gas limits when offline
- refactors

* create isPositiveInteger helper function

* fix nonce validation

* really fix nonce validation (specifically the input highlighting)

* remove stray // @flow's

* remove offline tab nav

* remove unused action arg

* address PR comments
2017-10-10 22:04:49 -07:00
James Prado 4858f96520 Logout Prompt Modal on Navigation from Send (#275)
* Add disclaimer modal to footer

* Remove duplicate code & unnecessary styles

* Fix formatting noise

* remove un-used css style

* Fix tslint error & add media query for modals

* Nest Media Query

* Add NavigationPrompt component

* Fix types

* Fix types

* Extend History Types

* break out logic into setupUnblock method
2017-10-10 16:08:55 -07:00
Daniel Ternyak a06298afa1 Refresh on Network Change (#261)
* configure gitignore

* create CONFIG_NODE_CHANGE_INTENT action, action creator, and type

* pass changeNodeIntent intstead of changeNode to Header

* create saga for handling node changes that will refresh only when network changes
2017-10-03 21:37:06 -07:00
Daniel Ternyak af84a589c5 Redux promise middleware (v2) (#233)
* add redux-promise-middleware to package.json and update package-lock.json

* intergrate redux-promise-middleware and simplify rates by replacing saga with promise

* fix unrelated breaking test

* -improve user messaging when network request fails. \n Clean up rates actions and reducers

* Address tslint errors
2017-09-25 20:41:11 -07:00
HenryNguyen5 5d4b36d453 Migrate to Typescript (#224)
* Refactor babel/types

* Refactor entry point

* Refactor actions

* Refactor api

* Full project refactor -- Broad type fixing sweep

* - completely fix merge conflicts
- handle various type errors

* Add tslint to package.json

* Dependency cleanup

* Fix module resolution

* Work on type definitions for untyped libs

* progress commit

* Add more definition typing

* various type additions

* Add unit types

* Fix sagaiterator  + unit types

* various types added

* additional type additions

* Fix typing on Sagas

* remove flowfixmes; swap translate for translateRaw

* Get rid of contracts - awaiting Henry's contract PR

* Remove contracts from routing

* Fix most of actions/reducers

* refactor actions directory structure

* fix reducer action type imports

* Fix most of type errors pre-actions refactor

* fix action creator imports in containers

* Refactor more

* Refactor index of actions

* fix action imports; use module level index export

* package-lock.json updated

* Use action types in props

* Type up action creators

* Fix most of connect errors

* Typefixing progress

* More types

* Fix run-time errors

* Caching improvements for webpack

* Remove path resolve from webpack

* Update non-breaking packages to latest version

* Fix token typing

* Remove unused color code

* Fix wallet decrypt dispatch

* Set redux-form related props/functions to ANY, since we're stripping it out later on

* Revert BigNumber.js package changes

* Extend window to custom object for Perf

* Format Navigation

* Typecase keystore errors as any (since we shouldnt touch this)

* Push wallet context fix

* - find/replace value->payload in swap
- properly type swap state properties
- extract inline reducer into reducer function

* - type local storage retrieved items as generic

* - bind all RPCClient methods with fat arrow

* - reformat

* Change to enums for constants

* Change state into any

* Fix swap errors

* ensure that seconds are passed into state as integers

* Fix rest of errors

* use parseInt explicitly instead of type coercion

* Fix derivation-checker, remove flow command, add tslint command, add tslint-react, tell travis to use tslint instead of flow.

* Whoops, remove those tests.

* Remove unsupported (yet) config option.

* Fix precommit to target ts and tsx files.

* Fix some errors, ignore some silly rules.

* Revert jest to v19, use ts-jest and make all tests typescript. Fixes all but one.

* Get rid of saga tests

* Fix tslint errors
2017-09-24 19:06:28 -07:00
skubakdj c88e96d603 Wallet Decrypt - Mnemonic (#180)
* add 'bip39' package

* add mnemonic decrypt, wallet wrapper

* add mnemonic path config

* add mnemonic support to deterministic components

* add mnemonic support

* accomodate for ledger ETH path

* remove comments

* update comments regarding path length

* rename modal open handler

* make several props optional

* add basic tests for mnemonic decrypt

* make flow happy, add user error notifications

* convert dpaths to js file, update references

* add ledger path to test

* Trezor DPath Fix (#196)

* Match v3 more closely.

* Require wallet index on deterministic wallets, update trezor to send index.

* remove redundent stripAndLower function and rename existing stripHex to stripHexPrefixAndLower
2017-09-15 12:29:38 -07:00
Daniel Ternyak f3b85b2aae Alerting and UX Improvements. (#185)
* Remove unused imports.

* Create and use .toPrecision forwarding method for `Unit`

* Error handling when unlocking trezor devices.

* Use translateRaw to fulfill string req;

*  - Refactor rates actions and action creators to use standard network request state pattern (REQUESTED / SUCCE
 - Only Request Rates once AccountInfo Component has mounted, instead of upon saga instantiation (uneeded overhead). This allows also us to issue subsequent fiat rates requests to update the "equivalent values" should the users session persist.
 - Show '???' as account balance when balance is null
 - Wallet initial state with balance as null instead of 0. We don't actually know what the balance is, and we shouldn't have 0 as a default as this may confuse users and doesn't accurately reflect their balance.

* - Display 'No rates were loaded.' in EquivalentValues when rates are null, instead of nothing.
- Remove unneeded imports.

* Remove unneeded imports and reformat.

* Fix error messaging (show error message instead of error Object)

* remove console.log

* inform flow how silly it is being

* fix wallet test to reflect balance being null by default

* figure out way to have flow understand that rates will not be undefined

* open external links in new tab

* handle case where balance is null in equivalanet values
2017-09-12 15:15:23 -07:00
HenryNguyen5 481e6e89b6 Refactor Wallet Base Class to Wallet Interface and Implement (#184) 2017-09-11 19:26:16 -05:00