Bugfix: do not try to decode method selector on contract creation txs fix #96

This commit is contained in:
Willian Mitsuda 2021-10-18 19:04:43 -03:00
parent 22da8082d8
commit 719ce4bd35
2 changed files with 7 additions and 5 deletions

View File

@ -76,7 +76,7 @@ const TransactionItem: React.FC<TransactionItemProps> = ({
<TransactionLink txHash={tx.hash} /> <TransactionLink txHash={tx.hash} />
</span> </span>
</div> </div>
<MethodName data={tx.data} /> {tx.to !== null ? <MethodName data={tx.data} /> : <span></span>}
<span> <span>
<BlockLink blockTag={tx.blockNumber} /> <BlockLink blockTag={tx.blockNumber} />
</span> </span>

View File

@ -72,7 +72,7 @@ const Details: React.FC<DetailsProps> = ({
} }
}, [txData]); }, [txData]);
const fourBytes = rawInputTo4Bytes(txData.data); const fourBytes = txData.to !== null ? rawInputTo4Bytes(txData.data) : "0x";
const fourBytesEntry = use4Bytes(fourBytes); const fourBytesEntry = use4Bytes(fourBytes);
const fourBytesTxDesc = useMemo(() => { const fourBytesTxDesc = useMemo(() => {
if (!txData || !fourBytesEntry?.signature) { if (!txData || !fourBytesEntry?.signature) {
@ -202,9 +202,11 @@ const Details: React.FC<DetailsProps> = ({
</div> </div>
)} )}
</InfoRow> </InfoRow>
<InfoRow title="Transaction Action"> {txData.to && (
<MethodName data={txData.data} /> <InfoRow title="Transaction Action">
</InfoRow> <MethodName data={txData.data} />
</InfoRow>
)}
{txData.tokenTransfers.length > 0 && ( {txData.tokenTransfers.length > 0 && (
<InfoRow title={`Tokens Transferred (${txData.tokenTransfers.length})`}> <InfoRow title={`Tokens Transferred (${txData.tokenTransfers.length})`}>
<div> <div>