Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix/payment requests & deeplinks #1751

Merged
merged 12 commits into from
Aug 6, 2020
5 changes: 3 additions & 2 deletions app/components/Views/Entry/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@ class Entry extends PureComponent {
}
const deeplink = params['+non_branch_link'] || uri || null;
if (deeplink) {
const existingUser = await AsyncStorage.getItem('@MetaMask:existingUser');
!existingUser ? DeeplinkManager.setDeeplink(deeplink) : DeeplinkManager.parse(deeplink);
const { KeyringController } = Engine.context;
const isUnlocked = KeyringController.isUnlocked();
isUnlocked ? DeeplinkManager.parse(deeplink) : DeeplinkManager.setDeeplink(deeplink);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we're checking if keyring is unlocked to store a deeplink or parse it right away

}
};

Expand Down
5 changes: 2 additions & 3 deletions app/components/Views/Send/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { colors } from '../../../styles/common';
import Engine from '../../../core/Engine';
import EditAmount from '../../Views/SendFlow/Amount';
import ConfirmSend from '../../Views/SendFlow/Confirm';
import { toBN, BNToHex, hexToBN, fromWei } from '../../../util/number';
import { toBN, BNToHex, hexToBN, fromWei, fromTokenMinimalUnit } from '../../../util/number';
import { toChecksumAddress } from 'ethereumjs-util';
import { strings } from '../../../../locales/i18n';
import { getTransactionOptionsTitle } from '../../UI/Navbar';
Expand Down Expand Up @@ -245,7 +245,6 @@ class Send extends PureComponent {
parameters = null
}) => {
const { addressBook, network, identities, selectedAddress } = this.props;

if (chain_id) {
this.handleNetworkSwitch(chain_id);
}
Expand Down Expand Up @@ -292,7 +291,7 @@ class Send extends PureComponent {
amount: BNToHex(tokenAmount)
}),
value: '0x0',
readableValue: parameters.uint256 || '0'
readableValue: fromTokenMinimalUnit(parameters.uint256, selectedAsset.decimals) || '0'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

now we have to handle token "atomic" units from deeplinks

};
newTxMeta.transactionToName = getTransactionToName({
addressBook,
Expand Down
3 changes: 1 addition & 2 deletions app/components/Views/SendFlow/Confirm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ class Confirm extends PureComponent {
contractBalances[address] ? contractBalances[address] : '0',
decimals
)} ${symbol}`;
[transactionTo, , amount] = decodeTransferData('transfer', data);
[transactionTo, amount] = decodeTransferData('transfer', data);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we were taking a parsed number from the hex format, now we take the hex number

const transferValue = renderFromTokenMinimalUnit(amount, decimals);
transactionValue = `${transferValue} ${symbol}`;
const exchangeRate = contractExchangeRates[address];
Expand Down Expand Up @@ -905,7 +905,6 @@ class Confirm extends PureComponent {
transactionConfirmed,
paymentChannelBalance
} = this.state;

return (
<SafeAreaView style={styles.wrapper} testID={'txn-confirm-screen'}>
<View style={styles.inputWrapper}>
Expand Down