diff options
-rw-r--r-- | app/scripts/controllers/transactions/index.js | 24 | ||||
-rw-r--r-- | development/sentry-publish.js | 38 | ||||
-rw-r--r-- | test/integration/lib/send-new-ui.js | 2 | ||||
-rw-r--r-- | ui/app/components/qr-code.js | 2 | ||||
-rw-r--r-- | ui/app/components/send/to-autocomplete/to-autocomplete.js | 3 | ||||
-rw-r--r-- | ui/app/components/sender-to-recipient/sender-to-recipient.component.js | 17 |
6 files changed, 63 insertions, 23 deletions
diff --git a/app/scripts/controllers/transactions/index.js b/app/scripts/controllers/transactions/index.js index ebd49f882..1d566522c 100644 --- a/app/scripts/controllers/transactions/index.js +++ b/app/scripts/controllers/transactions/index.js @@ -362,7 +362,29 @@ class TransactionController extends EventEmitter { this.txStateManager.setTxStatusSubmitted(txId) } - confirmTransaction (txId) { + /** + Sets the status of the transaction to confirmed + and sets the status of nonce duplicates as dropped + if the txParams have data it will fetch the txReceipt + @param txId {number} - the tx's Id + @returns {Promise<void>} + */ + + async confirmTransaction (txId) { + // get the txReceipt before marking the transaction confirmed + // to ensure the receipt is gotten before the ui revives the tx + const txMeta = this.txStateManager.getTx(txId) + if (txMeta.txParams.data) { + try { + const txReceipt = await this.query.getTransactionReceipt() + txMeta.txReceipt = txReceipt + this.txStateManager.updateTx(txMeta, 'transactions#confirmTransaction - add txReceipt') + + } catch (err) { + log.error(err) + } + } + this.txStateManager.setTxStatusConfirmed(txId) this._markNonceDuplicatesDropped(txId) } diff --git a/development/sentry-publish.js b/development/sentry-publish.js index 7a6d55115..e14f3f176 100644 --- a/development/sentry-publish.js +++ b/development/sentry-publish.js @@ -14,21 +14,27 @@ async function start () { const versionAlreadyExists = await checkIfVersionExists() // abort if versions exists if (versionAlreadyExists) { - console.log(`Version "${VERSION}" already exists on Sentry, aborting sourcemap upload.`) - return + console.log(`Version "${VERSION}" already exists on Sentry, skipping version creation`) + } else { + // create sentry release + console.log(`creating Sentry release for "${VERSION}"...`) + await exec(`sentry-cli releases --org 'metamask' --project 'metamask' new ${VERSION}`) + console.log(`removing any existing files from Sentry release "${VERSION}"...`) + await exec(`sentry-cli releases --org 'metamask' --project 'metamask' files ${VERSION} delete --all`) } - // create sentry release - console.log(`creating Sentry release for "${VERSION}"...`) - await exec(`sentry-cli releases --org 'metamask' --project 'metamask' new ${VERSION}`) - console.log(`removing any existing files from Sentry release "${VERSION}"...`) - await exec(`sentry-cli releases --org 'metamask' --project 'metamask' files ${VERSION} delete --all`) - // upload sentry source and sourcemaps - console.log(`uploading source files Sentry release "${VERSION}"...`) - await exec(`for FILEPATH in ./dist/chrome/*.js; do [ -e $FILEPATH ] || continue; export FILE=\`basename $FILEPATH\` && echo uploading $FILE && sentry-cli releases --org 'metamask' --project 'metamask' files ${VERSION} upload $FILEPATH metamask/$FILE; done;`) - console.log(`uploading sourcemaps Sentry release "${VERSION}"...`) - await exec(`sentry-cli releases --org 'metamask' --project 'metamask' files ${VERSION} upload-sourcemaps ./dist/sourcemaps/ --url-prefix 'sourcemaps'`) - console.log('all done!') + // check if version has artifacts or not + const versionHasArtifacts = versionAlreadyExists && await checkIfVersionHasArtifacts() + if (!versionHasArtifacts) { + // upload sentry source and sourcemaps + console.log(`uploading source files Sentry release "${VERSION}"...`) + await exec(`for FILEPATH in ./dist/chrome/*.js; do [ -e $FILEPATH ] || continue; export FILE=\`basename $FILEPATH\` && echo uploading $FILE && sentry-cli releases --org 'metamask' --project 'metamask' files ${VERSION} upload $FILEPATH metamask/$FILE; done;`) + console.log(`uploading sourcemaps Sentry release "${VERSION}"...`) + await exec(`sentry-cli releases --org 'metamask' --project 'metamask' files ${VERSION} upload-sourcemaps ./dist/sourcemaps/ --url-prefix 'sourcemaps'`) + console.log('all done!') + } else { + console.log(`Version "${VERSION}" already has artifacts on Sentry, skipping sourcemap upload`) + } } async function checkIfAuthWorks () { @@ -45,6 +51,12 @@ async function checkIfVersionExists () { return versionAlreadyExists } +async function checkIfVersionHasArtifacts () { + const artifacts = await exec(`sentry-cli releases --org 'metamask' --project 'metamask' files ${VERSION} list`) + // When there's no artifacts, we get a response from the shell like this ['', ''] + return artifacts[0] && artifacts[0].length > 0 +} + async function doesNotFail (asyncFn) { try { await asyncFn() diff --git a/test/integration/lib/send-new-ui.js b/test/integration/lib/send-new-ui.js index 7f3c114e4..ac1cc2e14 100644 --- a/test/integration/lib/send-new-ui.js +++ b/test/integration/lib/send-new-ui.js @@ -94,7 +94,7 @@ async function runSendFlowTest (assert, done) { sendToDropdownList.children()[2].click() const sendToAccountAddress = sendToFieldInput.val() - assert.equal(sendToAccountAddress, '0x2f8d4a878cfa04a6e60d46362f5644deab66572d', 'send to dropdown selects the correct address') + assert.equal(sendToAccountAddress, '0x2f8D4a878cFA04A6E60D46362f5644DeAb66572D', 'send to dropdown selects the correct address') const sendAmountField = await queryAsync($, '.send-v2__form-row:eq(2)') sendAmountField.find('.currency-display')[0].click() diff --git a/ui/app/components/qr-code.js b/ui/app/components/qr-code.js index 3b2c62f49..d3242ddf5 100644 --- a/ui/app/components/qr-code.js +++ b/ui/app/components/qr-code.js @@ -26,7 +26,7 @@ function QrCodeView () { QrCodeView.prototype.render = function () { const props = this.props const { message, data } = props.Qr - const address = `${isHexPrefixed(data) ? 'ethereum:' : ''}${data}` + const address = `${isHexPrefixed(data) ? 'ethereum:' : ''}${checksumAddress(data)}` const qrImage = qrCode(4, 'M') qrImage.addData(address) qrImage.make() diff --git a/ui/app/components/send/to-autocomplete/to-autocomplete.js b/ui/app/components/send/to-autocomplete/to-autocomplete.js index 49ebf49d9..39d15dfa7 100644 --- a/ui/app/components/send/to-autocomplete/to-autocomplete.js +++ b/ui/app/components/send/to-autocomplete/to-autocomplete.js @@ -5,6 +5,7 @@ const inherits = require('util').inherits const AccountListItem = require('../account-list-item/account-list-item.component').default const connect = require('react-redux').connect const Tooltip = require('../../tooltip') +const checksumAddress = require('../../../util').checksumAddress ToAutoComplete.contextTypes = { t: PropTypes.func, @@ -48,7 +49,7 @@ ToAutoComplete.prototype.renderDropdown = function () { account, className: 'account-list-item__dropdown', handleClick: () => { - onChange(account.address) + onChange(checksumAddress(account.address)) closeDropdown() }, icon: this.getListItemIcon(account.address, to), diff --git a/ui/app/components/sender-to-recipient/sender-to-recipient.component.js b/ui/app/components/sender-to-recipient/sender-to-recipient.component.js index 61f77224d..e71bd7406 100644 --- a/ui/app/components/sender-to-recipient/sender-to-recipient.component.js +++ b/ui/app/components/sender-to-recipient/sender-to-recipient.component.js @@ -5,6 +5,7 @@ import Identicon from '../identicon' import Tooltip from '../tooltip-v2' import copyToClipboard from 'copy-to-clipboard' import { DEFAULT_VARIANT, CARDS_VARIANT } from './sender-to-recipient.constants' +import { checksumAddress } from '../../util' const variantHash = { [DEFAULT_VARIANT]: 'sender-to-recipient--default', @@ -40,7 +41,7 @@ export default class SenderToRecipient extends PureComponent { return !this.props.addressOnly && ( <div className="sender-to-recipient__sender-icon"> <Identicon - address={this.props.senderAddress} + address={checksumAddress(this.props.senderAddress)} diameter={24} /> </div> @@ -50,6 +51,7 @@ export default class SenderToRecipient extends PureComponent { renderSenderAddress () { const { t } = this.context const { senderName, senderAddress, addressOnly } = this.props + const checksummedSenderAddress = checksumAddress(senderAddress) return ( <Tooltip @@ -60,7 +62,7 @@ export default class SenderToRecipient extends PureComponent { onHidden={() => this.setState({ senderAddressCopied: false })} > <div className="sender-to-recipient__name"> - { addressOnly ? `${t('from')}: ${senderAddress}` : senderName } + { addressOnly ? `${t('from')}: ${checksummedSenderAddress}` : senderName } </div> </Tooltip> ) @@ -68,11 +70,12 @@ export default class SenderToRecipient extends PureComponent { renderRecipientIdenticon () { const { recipientAddress, assetImage } = this.props + const checksummedRecipientAddress = checksumAddress(recipientAddress) return !this.props.addressOnly && ( <div className="sender-to-recipient__sender-icon"> <Identicon - address={recipientAddress} + address={checksummedRecipientAddress} diameter={24} image={assetImage} /> @@ -83,13 +86,14 @@ export default class SenderToRecipient extends PureComponent { renderRecipientWithAddress () { const { t } = this.context const { recipientName, recipientAddress, addressOnly } = this.props + const checksummedRecipientAddress = checksumAddress(recipientAddress) return ( <div className="sender-to-recipient__party sender-to-recipient__party--recipient sender-to-recipient__party--recipient-with-address" onClick={() => { this.setState({ recipientAddressCopied: true }) - copyToClipboard(recipientAddress) + copyToClipboard(checksummedRecipientAddress) }} > { this.renderRecipientIdenticon() } @@ -103,7 +107,7 @@ export default class SenderToRecipient extends PureComponent { <div className="sender-to-recipient__name"> { addressOnly - ? `${t('to')}: ${recipientAddress}` + ? `${t('to')}: ${checksummedRecipientAddress}` : (recipientName || this.context.t('newContract')) } </div> @@ -147,6 +151,7 @@ export default class SenderToRecipient extends PureComponent { render () { const { senderAddress, recipientAddress, variant } = this.props + const checksummedSenderAddress = checksumAddress(senderAddress) return ( <div className={classnames(variantHash[variant])}> @@ -154,7 +159,7 @@ export default class SenderToRecipient extends PureComponent { className={classnames('sender-to-recipient__party sender-to-recipient__party--sender')} onClick={() => { this.setState({ senderAddressCopied: true }) - copyToClipboard(senderAddress) + copyToClipboard(checksummedSenderAddress) }} > { this.renderSenderIdenticon() } |