Skip to content

Commit

Permalink
Merge pull request #778 from hubiinetwork/feature/1.2.2
Browse files Browse the repository at this point in the history
1.2.2
  • Loading branch information
katat committed Aug 29, 2019
2 parents 876861b + 3817676 commit 966929d
Show file tree
Hide file tree
Showing 16 changed files with 1,087 additions and 808 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hubii-core",
"version": "1.2.1",
"version": "1.2.2",
"author": {
"name": "hubii",
"email": "info@hubii.com",
Expand Down Expand Up @@ -318,7 +318,7 @@
"minimist": "1.2.0",
"moment": "2.22.2",
"nahmii-ethereum-address": "^2.0.1",
"nahmii-sdk": "3.0.4",
"nahmii-sdk": "3.0.5",
"prop-types": "15.6.1",
"qrcode.react": "0.8.0",
"react": "16.6.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class ImportWalletPrivateKeyForm extends React.Component {
validator: this.validatePrivateKey,
},
],
})(<ModalFormInput disabled={loading} />)}
})(<ModalFormInput type="password" disabled={loading} />)}
</ModalFormItem>
<ModalFormItem
label={
Expand Down
2 changes: 1 addition & 1 deletion src/containers/DerivationPathContainer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export class DerivationPathContainer extends React.Component { // eslint-disable
let balance = 'Loading...';
if (assetsState) {
const asset = assetsState.toJSON().find((ast) => ast.currency === '0x0000000000000000000000000000000000000000');
balance = parseFloat(utils.formatEther(asset.balance));
balance = utils.formatEther(asset ? asset.balance : 0);
}
processedAddresses.push({
key: i,
Expand Down
35 changes: 14 additions & 21 deletions src/containers/NahmiiDeposit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { push } from 'react-router-redux';
import { fromJS } from 'immutable';
import { shell } from 'electron';
import { Row, Icon } from 'antd';
import { getAbsolutePath, assetImageFallback } from 'utils/electron';
Expand Down Expand Up @@ -101,20 +102,6 @@ export class NahmiiDeposit extends React.Component { // eslint-disable-line reac
this.generateTransferingStatus = this.generateTransferingStatus.bind(this);
}

componentDidUpdate(prevProps) {
const { depositStatus, goWalletDetails, currentWalletWithInfo } = this.props;
const prevFinalDepositStage =
prevProps.depositStatus.get('depositingEth')
|| prevProps.depositStatus.get('completingTokenDeposit');
if
(
prevFinalDepositStage
&& !depositStatus.get('depositingEth')
&& !depositStatus.get('completingTokenDeposit')
&& !depositStatus.get('error')
) goWalletDetails(currentWalletWithInfo.get('address'));
}

onFocusNumberInput(input) {
if (this.state[input] === '0') {
this.setState({ [input]: '' });
Expand All @@ -131,6 +118,13 @@ export class NahmiiDeposit extends React.Component { // eslint-disable-line reac
this.setState({ gasLimit: gasLimit.toNumber(), gasPriceGwei });
}

getDepositStatusForWalletCurrency() {
const { assetToDeposit } = this.state;
const { depositStatus, currentWalletWithInfo } = this.props;
const depositStatusForWalletCurrency = depositStatus.getIn([currentWalletWithInfo.get('address'), assetToDeposit.symbol]);
return depositStatusForWalletCurrency || fromJS({});
}

handleAssetChange(newSymbol) {
const { currentWalletWithInfo, supportedAssets } = this.props;
const baseLayerAssets = currentWalletWithInfo.getIn(['balances', 'baseLayer', 'assets']).toJS();
Expand Down Expand Up @@ -179,14 +173,15 @@ export class NahmiiDeposit extends React.Component { // eslint-disable-line reac
this.setState({ amountToDepositInput: value });
}

generateTransferingStatus(depositStatus, ledgerNanoSInfo, trezorInfo) {
generateTransferingStatus(ledgerNanoSInfo, trezorInfo) {
const { currentWalletWithInfo, currentNetwork, intl } = this.props;
const { formatMessage } = intl;
const depositStatusForWalletCurrency = this.getDepositStatusForWalletCurrency();
const confOnDevice = ledgerNanoSInfo.get('confTxOnDevice') || trezorInfo.get('confTxOnDevice');
let ratio;
if (depositStatus.get('depositingEth')) ratio = '1/1';
if (depositStatus.get('approvingTokenDeposit')) ratio = '1/2';
if (depositStatus.get('completingTokenDeposit')) ratio = '2/2';
if (depositStatusForWalletCurrency.get('depositing')) ratio = '1/1';
if (depositStatusForWalletCurrency.get('approvingTokenDeposit')) ratio = '1/2';
if (depositStatusForWalletCurrency.get('completingTokenDeposit')) ratio = '2/2';
if (!ratio) return null;
const transferingText =
`${formatMessage({ id: 'waiting_for_deposit_to_be' }, { ratio })} ${confOnDevice ? formatMessage({ id: 'signed' }) : `${formatMessage({ id: 'mined' })}...`}`;
Expand Down Expand Up @@ -227,7 +222,6 @@ export class NahmiiDeposit extends React.Component { // eslint-disable-line reac
gasStatistics,
intl,
supportedAssets,
depositStatus,
ledgerNanoSInfo,
trezorInfo,
} = this.props;
Expand Down Expand Up @@ -317,7 +311,7 @@ export class NahmiiDeposit extends React.Component { // eslint-disable-line reac
baseLayerBalAfterAmt.isNegative() ||
baseLayerEthBalanceAfterAmount.isNegative() ||
!walletReady(walletType, ledgerNanoSInfo, trezorInfo);
const TransferingStatus = this.generateTransferingStatus(depositStatus, ledgerNanoSInfo, trezorInfo);
const TransferingStatus = this.generateTransferingStatus(ledgerNanoSInfo, trezorInfo);
return (
<ScrollableContentWrapper>
<div style={{ display: 'flex', flex: '1', flexWrap: 'wrap', marginTop: '0.5rem' }}>
Expand Down Expand Up @@ -533,7 +527,6 @@ NahmiiDeposit.propTypes = {
currentNetwork: PropTypes.object.isRequired,
nahmiiDeposit: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
goWalletDetails: PropTypes.func.isRequired,
gasStatistics: PropTypes.object.isRequired,
};

Expand Down
Loading

0 comments on commit 966929d

Please sign in to comment.