1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 01:39:44 +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 GitHub
parent c8b697687f
commit 7212dcf098
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 45 additions and 22 deletions

View File

@ -3209,6 +3209,9 @@
"twelveHrTitle": { "twelveHrTitle": {
"message": "12hr:" "message": "12hr:"
}, },
"txInsightsNotSupported": {
"message": "Transaction insights not supported for this contract at this time."
},
"typePassword": { "typePassword": {
"message": "Type your MetaMask password" "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')}> <Tab className="confirm-page-container-content__tab" name={t('data')}>
{dataComponent} {dataComponent}
</Tab> </Tab>
<Tab {dataHexComponent && (
className="confirm-page-container-content__tab" <Tab
name={t('dataHex')} className="confirm-page-container-content__tab"
> name={t('dataHex')}
{dataHexComponent} >
</Tab> {dataHexComponent}
</Tab>
)}
</Tabs> </Tabs>
); );
} }

View File

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

View File

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

View File

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

View File

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