mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-22 17:33:23 +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:
parent
c8b697687f
commit
7212dcf098
@ -3209,6 +3209,9 @@
|
||||
"twelveHrTitle": {
|
||||
"message": "12hr:"
|
||||
},
|
||||
"txInsightsNotSupported": {
|
||||
"message": "Transaction insights not supported for this contract at this time."
|
||||
},
|
||||
"typePassword": {
|
||||
"message": "Type your MetaMask password"
|
||||
},
|
||||
|
@ -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>
|
||||
);
|
||||
}
|
||||
|
@ -37,7 +37,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
&-error {
|
||||
cursor: auto;
|
||||
}
|
||||
|
||||
.tx-insight-content {
|
||||
&__tree-component {
|
||||
|
@ -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]);
|
||||
|
@ -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
|
||||
|
@ -635,19 +635,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>
|
||||
@ -667,12 +676,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 (
|
||||
|
Loading…
Reference in New Issue
Block a user