1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-26 12:29:06 +01:00

Tx insights fixes (#12988)

* Ensure that function representation on hex and data tabs are consistent

* Don't show redundant hex tab when deploying contract

* Show standard pointer cursor on error messages in tx-decoder component

* Don't show activity log for incoming transactions

* Update localization

* Fix error message
This commit is contained in:
Dan J Miller 2021-12-07 11:42:34 -03:30 committed by Dan Miller
parent 5554ca5e09
commit f56c25f584
6 changed files with 45 additions and 22 deletions

View File

@ -3143,6 +3143,9 @@
"twelveHrTitle": {
"message": "12hr:"
},
"txInsightsNotSupported": {
"message": "Transaction insights not supported for this contract at this time."
},
"typePassword": {
"message": "Type your MetaMask password"
},

View File

@ -68,12 +68,14 @@ export default class ConfirmPageContainerContent extends Component {
<Tab className="confirm-page-container-content__tab" name={t('data')}>
{dataComponent}
</Tab>
<Tab
className="confirm-page-container-content__tab"
name={t('dataHex')}
>
{dataHexComponent}
</Tab>
{dataHexComponent && (
<Tab
className="confirm-page-container-content__tab"
name={t('dataHex')}
>
{dataHexComponent}
</Tab>
)}
</Tabs>
);
}

View File

@ -37,7 +37,9 @@
}
}
&-error {
cursor: auto;
}
.tx-insight-content {
&__tree-component {

View File

@ -79,7 +79,11 @@ export default function TransactionDecoding({ to = '', inputData: data = '' }) {
} catch (error) {
setLoading(false);
setError(true);
setErrorMessage(error?.message);
if (error?.message.match('400')) {
setErrorMessage(t('txInsightsNotSupported'));
} else {
setErrorMessage(error?.message);
}
}
})();
}, [t, from, to, network, data]);

View File

@ -252,15 +252,18 @@ export default class TransactionListItemDetails extends PureComponent {
primaryCurrency={primaryCurrency}
className="transaction-list-item-details__transaction-breakdown"
/>
<Disclosure title="Activity log" size="small">
<TransactionActivityLog
transactionGroup={transactionGroup}
className="transaction-list-item-details__transaction-activity-log"
onCancel={this.handleCancel}
onRetry={this.handleRetry}
isEarliestNonce={isEarliestNonce}
/>
</Disclosure>
{transactionGroup.initialTransaction.type !==
TRANSACTION_TYPES.INCOMING && (
<Disclosure title={t('activityLog')} size="small">
<TransactionActivityLog
transactionGroup={transactionGroup}
className="transaction-list-item-details__transaction-activity-log"
onCancel={this.handleCancel}
onRetry={this.handleRetry}
isEarliestNonce={isEarliestNonce}
/>
</Disclosure>
)}
{transactionGroup.initialTransaction?.txParams?.data ? (
<Disclosure title="Transaction data" size="small">
<TransactionDecoding

View File

@ -638,19 +638,28 @@ export default class ConfirmTransactionBase extends Component {
renderData(functionType) {
const { t } = this.context;
const { txData: { txParams } = {}, hideData, dataComponent } = this.props;
const {
txData: { txParams } = {},
methodData: { params } = {},
hideData,
dataComponent,
} = this.props;
if (hideData) {
return null;
}
const functionParams = params?.length
? `(${params.map(({ type }) => type).join(', ')})`
: '';
return (
dataComponent || (
<div className="confirm-page-container-content__data">
<div className="confirm-page-container-content__data-box-label">
{`${t('functionType')}:`}
<span className="confirm-page-container-content__function-type">
{functionType}
{`${functionType} ${functionParams}`}
</span>
</div>
<Disclosure>
@ -670,12 +679,12 @@ export default class ConfirmTransactionBase extends Component {
dataHexComponent,
} = this.props;
if (hideData) {
if (hideData || !txParams.to) {
return null;
}
const functionParams = params
? `(${params.map(({ type }) => type).join(', ')}`
const functionParams = params?.length
? `(${params.map(({ type }) => type).join(', ')})`
: '';
return (