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

Portal Ledger Support, Lazy-loading token balances/allowances #351

Merged
merged 47 commits into from
Jan 30, 2018

Conversation

fabioberger
Copy link
Contributor

@fabioberger fabioberger commented Jan 30, 2018

This PR:

  • Adds Ledger support to Portal 🥇
  • Adds lazy-loading of token balances/allowances, making Portal loading times faster and reducing internal state dependencies.
  • Removes the bulky loading animation and replaces it with a simple circular spinner (it doesn't show for too long now 💃 )
  • Add Rinkeby and Ropsten support to Portal
  • Fetches a reasonable default gasPrice for transactions from EthGasStation
  • Fixed a bug so Portal properly detects when users reject a transaction request on Metamask, Parity Signer and Ledger
  • Changes dev domain to 0xproject.localhost since .dev is owned by Google and chrome complains about missing certs.
  • Fix bug where negative amounts would cause our input fields to break
  • Fix setState on unmounted component race conditions across the entire website

screen shot 2018-01-30 at 20 23 09

screen shot 2018-01-30 at 20 25 07

…port

* feature/addSubproviders:
  Standardize deps
  Inline function
  Introduce a const
  Make private
  Add version matcher script
  Use same versions of dependencies everywhere
  Add missing await
  Move declaration into proper conditional block
  Fix Party element so that an identicon's height is that which was passed in
…port

* feature/addSubproviders:
  remove unneeded reset
  Use rejectedWith
  Add missing calls to configure
  remove unneeded type assertions
  remove unused type
  Simplify interface to signPersonalMessageAsync
  Fix unit test
  Fix ethereumjs-tx declaration and import
  Use assert.isHexString
  Add type defs for ledgerco and ethereumjs-tx
  Make test only run unit tests since cannot run integration tests on CI
  Improve README
  Fix version and remove the UMD build
  Fix tslint error
…port

* feature/addSubproviders:
  Make sure we don't pass empty maker into getOrderHashHex
  Make sure we always pass in the correct networkId even if no injectedWeb3 found
…port

* feature/addSubproviders:
  remove console.log
  Update README.md
  Fix unit test
  Add missing params
  Debug CircleCi failure
  Update yarn.lock
  Inline network module
  Add todo
  Stop supporting different file extensions in abi-gen
  Refactor networkId out of web3Wrapper
  Update connect types in preperation for publishing
  Add link to random id generator
  Remove `prebuild` command and add `test:circleci`
  Fix CI command
  Address feedback
  Refactor web3Wrapper to a separate package
* development: (437 commits)
  Publish
  Update yarn.lock
  Update the CHANGELOG
  Fix the bug making it impossible to specify the custom ZRX address
  Fix fill/cancel order by looking for NoError instead of empty blockchainErr given the BlockchainErrs type refactor
  Add a comment about a yarn bug
  Add our mainnet and kovan nodes as backups for Portal requests
  Fix bug hiding the user info from topBar
  Add dev-utils package to top level README
  Prettier newline
  Prettier
  Allow Token symbols to be alphanumeric
  Update CHANGELOG, rebase on development
  Should not -> cannot
  Reject negative amounts in isValidBaseUnitAmount
  Re-add changelog for 0x.js
  Fix prettier
  Update yarn.lock
  Move tests to a separate folder
  Change file layout
  ...

# Conflicts:
#	packages/website/README.md
* development:
  Publish
  Add PR number
  Add config file specifically in prettier command and fix files
  Fix prettier
  Fix prettier
  Add shouldAddPersonalMessagePrefix param to signOrderHashAsync instead of trying to infer whether to add it or not from the nodeVersion
  Publish
  Move @0xproject/types to dependencies
  Updated web3-typescript-typings changelog
  Fixed getTransactionReceipt not returning null
  Run prettier
  Update changelog
  Add Rinkeby addresses to artifacts
  Fix bad merge on package.json
  Respond to GH comments and add /info endpoint
  Change package name to @0xproject/testnet-faucets
  Implement testnet faucets for any testnet available via infura
  Rename to testnet-faucets
  Add to the Pull Request Template
  Create an ISSUE TEMPLATE
…r append it for Ledger. This fixes signing when Ledger is used and the backing node is not Parity
…own flag rather then using a cancellablePromise since there was little to be gained from this alternative
* development:
  Prettierignore package.json
  Enable solidity syntax highlighting
@LogvinovLeon
Copy link
Contributor

Can we use .local?

"update_contracts": "for i in ${npm_package_config_artifacts}; do copyfiles -u 4 ../contracts/build/contracts/$i.json ../website/contracts; done;",
"deploy_staging": "npm run build; aws s3 sync ./public/. s3://staging-0xproject --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers",
"deploy_live": "npm run build; aws s3 sync ./public/. s3://0xproject.com --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers"
"update_contracts":
Copy link
Contributor

Choose a reason for hiding this comment

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

Please undo those changes

@@ -121,6 +123,9 @@ export class Blockchain {
constructor(dispatcher: Dispatcher, isSalePage: boolean = false) {
this._dispatcher = dispatcher;
this._userAddress = '';
this._defaultGasPrice = new BigNumber(30000000000);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use ZeroEx.toBaseUnitAmount? It's unclear if that's 3 Gwei or 0.3 Gwei or 30 GWei

Copy link
Contributor Author

@fabioberger fabioberger Jan 30, 2018

Choose a reason for hiding this comment

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

toBaseUnitAmount goes from unit amount to baseUnit, i.e Ether to Wei. If we go from gwei to wei, it's also weird because the assumption is we are passing in the unit amount, not some other intermediary unit. I'll use a named constant to make this more readable.

Something like:

30 * GWEI_IN_WEI

@@ -121,6 +123,9 @@ export class Blockchain {
constructor(dispatcher: Dispatcher, isSalePage: boolean = false) {
this._dispatcher = dispatcher;
this._userAddress = '';
this._defaultGasPrice = new BigNumber(30000000000);
// tslint:disable-next-line:no-floating-promises
this._updateDefaultGasPriceAsync();
Copy link
Contributor

Choose a reason for hiding this comment

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

FireAndForget?

@@ -184,6 +202,8 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps,
const selectAddressBalance = this.state.addressBalances[selectedRowIndex];
this.props.dispatcher.updateUserAddress(selectedAddress);
this.props.blockchain.updateWeb3WrapperPrevUserAddress(selectedAddress);
// tslint:disable-next-line:no-floating-promises
this.props.blockchain.fetchTokenInformationAsync();
Copy link
Contributor

Choose a reason for hiding this comment

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

FireAndForget?

@LogvinovLeon
Copy link
Contributor

image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants