Commit Graph

41 Commits

Author SHA1 Message Date
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
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
Daniel Ternyak 3660260efb Fix Typescript Refactor (#229)
* Remove console logs.

* Fix undefined error by binding method.

* Show 0's in input field.

* Remove various unused imports.
2017-09-24 20:29:49 -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
William O'Beirne e80d0a68a9 All v3 Nodes & Networks (#202)
* Add all v3s nodes, create node libs for etherscan and infura.

* Add all network configs for alternatives.

* Color and animate nav border on network selection.

* Address PR comments.

* Persist network selection to local storage.

* Modifiy TransactionSucceeded to link to network-specific explorer.

* - Reload on Node Change to reset state. Should be refactored in the future so that we are not forcing clients to reload.
2017-09-19 17:47:08 -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
William O'Beirne 8854d42fd9 Sidebar refactor / style update (#173)
* Convert bootstrap to sass instead of checked in and less

* Darken body, adjust header.

* First pass at tab styles, each tab will need a lot of individual love tho.

* Update footer to main site content, improve responsiveness.

* Missing key added.

* Fix dropdowns.

* Convert GenerateWallet HTML over, still needs styling.

* Send form.

* Current rates styled.

* CurrencySwap form styles.

* SwapInfoHeader styled.

* Finish up swap restyling, minor usability improvements for mobile.

* Fix up notifications / alert customizations

* Import v3 variables.

* Fix notification spacing.

* Align input height base with buttons.

* Revert height base, add additional bootstrap overrides.

* Grid overrides.

* Move overrides to their own folder. Adjust naming.

* Fix inconsistencies.

* Style generate wallet pt 1.

* Style generate wallet pt 2

* Style generate wallet pt 3

* Fix swap

* Added some missing overries, fixed the fallout.

* Remove header text, indicate alpha version.

* Fix radio / checkbox weights.

* Bind => arrow

* Convert simpledropdown to proper form select, instead of weirdly implemented nonfuncitoning dropdown.

* Fix token balances buttons, footr icons.

* Break out files, style up account info.

* Style up token balances.

* Equivalent values styling.

* Sidebar promos.

* Fix up delete button and add custom form.

* Even spacing.

* Unlog

* Convert Big types to Ether types

* Fix test to expect Ether instead of Big
2017-09-08 14:26:51 -05:00
Daniel Ternyak 38dd22953a Ether Unit Types and Send UX Improvements (#174)
* remove 'transate' property and ng-scopes

* use bigs (surprised flow did not catch this)

* fix dropdown not expanding -- switch to simpledropdown

* Don't use generics for no real reason

*    Create Ether, Wei, and GWei types, and annotate.

    Also contains refactors and UX improvements

    1. clear previously generated rawTX/signedTx when changes to transaction inputs are made.

    2. reset generated rawTx/signedTx while new generateTx is loading

* add toString helper method and use in place of .amount.toString()

* support optional base in toString helper method and use

* incorporate PR suggestions (destructure, resolve via callback)
2017-09-08 14:01:31 -05:00
HenryNguyen5 e07eedb3ad Refactor BaseNode to be an interface INode (#167) 2017-09-05 11:32:14 -05:00
Bryan Fillmer b666d0e143 Address flow issues in sagas (#162) 2017-09-04 11:30:31 -05:00
Bryan Fillmer 2616129409 Create a basic saga pattern to handle potential network errors. (#144)
* First pass at handling API failure.

* Bity saga logic upgrade.

* Reusable response.ok logic. Small optimization to array join.

* Flow fixes.

* Streamlined some error handling, moved types.
2017-08-31 09:30:46 -07:00
Daniel Ternyak efee709d0f Swap Part 5 (#150)
* refactor notificationMessage

* MVP Bitcoin QR

* refactor currentrates and add loading state

* fix text space

* translate hardcoded text

* only show QR code when attempting to swap Bitcoin as the origin kind

* remove commented import

* add flow typings

* Don't show a notification of a stringified element
2017-08-31 08:56:49 -07:00
Daniel Ternyak a4ec6f6139 Finalize send (broadcast signedTx, loading indicators, error handling, form validation) (#141)
* hide buttons during send loading state

* fix transaction succeeded not clickable; provide error in action

* move BroadcastStatusTransaction into 'libs/transaction'

* use more succint Array.prototype.find

* rename resetState -> resetTransaction

* refactor and component componentDidUpdate logic

* rename disabled -> generateDisabled; comment componentDidUpdate

* add size to Spinner, use in ConfirmationModal; disable instead of hide buttons in Modal

* fix flow not understanding that an object wouldn't be null in this case anyway. silly flow

* various refactors; send entire balance working
2017-08-30 21:00:31 -07:00
William O'Beirne f5b6a49463 Translation updates (#120)
* Updated all translations, moved into their own folders.

* Switch translations to use Markdown component.

* Remove markup tests, since were using a module now.

* Fix flow errors, render react elements instead of dangerouslysetinnerhtml.

* Make translate a connected component, so it updates with Redux.

* Fix flow errors

* First pass at returning raw when needed for placeholder.

* Added aria test.

* Fixed flow errors and linter warnings.

* Move settimeout to saga.

* Change reload to 250 ms from 1500 ms
2017-08-28 13:05:38 -05:00
William O'Beirne 1d235cf67a Trezor Unlock + Deterministic Wallet Groundwork (#137)
* Basic reducer / action / saga setup, rendering wallets.

* Better address rows, with values.

* Styling + back and next buttons.

* Formatting, dpath changing.

* Derived -> Deterministic

* Set wallet on confirm.

* Flesh out Trezor wallet, add transaction signing.

* Custom dpath, better handling of canceled switches and over-rendering / prop calling.

* Token empty string value.

* Move DPaths to config file.

* Clarifying comments.
2017-08-28 12:43:57 -05:00
skubakdj f42837de68 Keystore & Private Key Wallet Decrypts (#116)
* wire up keystore decrypt & build UI

* add support for encrypted private keys

* add check for key length

* rename keystore wallet file

* rename encrypted priv key wallet file

* add support for presale, v1, & v2 JSON keystores

* clean up TODO messages, add class files

* add v3 references

* add flow type

* fix event bug

* update privkey validators to accept whole privkey

* refactor pkey/pass validation to function

* move pass req detection to function, remove unnecessary state

* add tests for decrypt & keystore libs
2017-08-20 22:28:47 +02:00
skubakdj 187d2e16ad Fix flow errors (#110)
* simplify getAddress method

* refactor to handle async wallet getAddress

* fix bug on BaseWallet

* remove unnecessary catch
2017-08-09 07:01:34 -05:00
William O'Beirne 7541d6f486 Estimate gas (WIP) (#102)
* relayout rpc code, start contract helper

* Dont ask for estimate if theres no value

* Split out conversion of ether to wei hex into lib function.

* big.js -> bignumber.js
2017-08-07 22:45:08 -05:00
Daniel Ternyak a66337ac0a Swap Part 4 (#101)
### Re-implements:
* min/max validators on initial currency swap selection
* polling of order status
* timer that persists across refreshes via localStorage (computed based on `createdTime` and `validFor` amount)
* swap persists across refreshes once order is created.
* various type refactors

### New additions:
* *SimpleButton* (can be PRd separately on request)
* clear loading state after order create (via SimpleButton and font-awesome)
* buffers for non-BTC swaps (bity does not actually accept 0.01 BTC worth of ETH as they claim they do in their JSON response, so a magic number of 10% is added to the minimum).
2017-07-31 18:14:30 -05:00
William O'Beirne e3505fd958 Contracts Tab Scaffolding (#70)
* Empty component, routes setup.

* Shared components for all Contracts inputs. Dont do anything yet.

* Check in reducer work so far. Still WIP.

* Header styling

* Check in input work so far, splitting to new branch.

* Strip down contracts inputs. Split out into form and explorer

* Contract selector

* Constantized config actions to use in contract saga.

* Interact explorer UI, no functionality

* Convert to constants, hook up errors

* Deploy and style cleanup.

* Remove unnecessary class.

* Fix flow errors with css modules

* Attempt at fixing all newly introduced flow errors in the contracts branch.

* Removed unused validator.

* Remove action constants, fix flow specificity in reducers

* Fix unit tests

* Move network contracts out of redux / sagas, and read directly from state with a selector in mapStateToProps.

* Fix initialState -> INITIAL_STATE rename

* foreach push -> concat
2017-07-27 19:31:59 -05:00
William O'Beirne 1aad9d1c21 Standardize Redux Actions / Reducers (#95)
* Convert Swap to consistent style

* Generate wallet reducer cleanup.

* Confirm empty action in swap reducer

* Union types. Fix gen wallet collision

* Fix not using all actions in reducer. Added reducer state for is fetching from bity. Added todo to make that a loader.

* Readme instructions.

* Remove common action constants.

* Bring all actions and reducers inline with readme instructions.

* Readme fixes

* address comments
2017-07-27 12:05:09 -05:00
Daniel Ternyak 37008e9fe9 Complete Generate/Create Wallet Flow (#38)
* GenerateWallet: Download real UTC file.

* Paper wallet (#45)

* Working paper wallet (#52)

* Reset Generate Wallet state when component will unmount
2017-07-16 16:02:13 -05:00
crptm 780f3ba94f balance fetching (#41)
* balance fetching

* fix tests

* bump deps

* validate custom token form

* equiv values

* fix rates saga naming

* address review comments
2017-07-13 16:02:39 -05:00
Daniel Ternyak cdcbd7a56b Sagas: Adjust bity saga to allow for cancelled polling, and stop polling when part 2 of swap ends. 2017-07-08 22:51:14 -05:00
crptm ecb11133dd move bity getRates to saga (#35)
* move bity getRates to saga

* typo

* bity polling
2017-07-07 21:00:09 -05:00
crptm 9a65a49d0b invalid pkey message 2017-07-04 16:19:04 +04:00
Daniel Ternyak 06ae70988a merge develop into 'swap_part_3' 2017-07-03 22:21:19 -05:00
crptm bead2b30ad fix merge errors 2017-07-04 06:22:16 +04:00
crptm 40f2c4466a merge develop 2017-07-04 06:18:16 +04:00
crptm 85759d73b4 type dropdown, config actions 2017-07-04 05:25:01 +04:00
Daniel Ternyak 7846b2125a merge develop info 'donation_addresses' 2017-07-03 19:24:22 -05:00
Daniel Ternyak 164e6a07bb fix additional hardcoded address issues 2017-07-03 19:20:47 -05:00
crptm 65234a26c0 fix flow sagas errors 2017-07-04 03:59:27 +04:00
Daniel Ternyak 7cf3d26bbe Merge feat/send-page 2017-07-02 00:49:06 -05:00
crptm 63e7eb89e4 unlock wip 2017-06-30 03:03:11 +04:00
crptm 1fb4a004ac send wip 2017-06-27 02:27:55 +04:00
crptm 51f2c8596e address review comments 2017-06-23 01:16:21 +04:00
crptm d0becf7746 notifications 2017-06-22 03:31:59 +04:00