Skip to content

Commit

Permalink
[ETCM-472] Simplify code
Browse files Browse the repository at this point in the history
- Simplify display "true :  Execution success" -> " Execution success"
- Remove converting function. In web3 library, TransactionReceipt.status
  is a boolean. ("0x0" -> false and "0x1" -> true).
  • Loading branch information
jb-lunatech committed Apr 8, 2021
1 parent a802b90 commit cbd1adf
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/components/blockchain/TransactionInfoTable.js
Expand Up @@ -3,14 +3,6 @@ import { Link } from 'react-router-dom';
import { Input } from 'antd';
import { bigNumber, decToHex } from '../../utils/format-utils';

const translateReceiptStatusCode = statusCode => {
switch(parseInt(statusCode, 16)) {
case 0: return "Execution failure";
case 1: return "Execution success";
default: return "???";
}
};

const TransactionInfoTable = ({tx, receipt}) => {
return (
<table className="pure-table pure-table-horizontal">
Expand Down Expand Up @@ -46,7 +38,7 @@ const TransactionInfoTable = ({tx, receipt}) => {
<tr>
<td>Status code</td>
<td>
<span> { receipt.status ? `${receipt.status} : ${translateReceiptStatusCode(receipt.status)}` : '???' } </span>
<span> { receipt.status ? "Execution success" : "Execution failed" } </span>
</td>
</tr>
}
Expand Down

0 comments on commit cbd1adf

Please sign in to comment.